/* TIITrust · Material Action Runtime (public sandbox)
   Dark technical tone — navy / cyan. No CDN fonts. */

:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel-2: #0f1726;
  --line: #243356;
  --line-strong: #2f4268;
  --text: #e8eef9;
  --muted: #8b9bb8;
  --cyan: #3dd6ff;
  --cyan-dim: rgba(61, 214, 255, 0.15);
  --cyan-border: rgba(61, 214, 255, 0.35);
  --green: #3dff9a;
  --green-dim: rgba(61, 255, 154, 0.14);
  --green-border: rgba(61, 255, 154, 0.35);
  --red: #ff5d6c;
  --red-dim: rgba(255, 93, 108, 0.14);
  --red-border: rgba(255, 93, 108, 0.35);
  --amber: #ffc857;
  --focus: #3dd6ff;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, "Noto Sans Thai", "Helvetica Neue", sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--cyan);
  color: #062033;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.brand .sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  border: 1px solid var(--cyan-border);
  background: var(--cyan-dim);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

.badge.warn {
  color: var(--amber);
  border-color: rgba(255, 200, 87, 0.4);
  background: rgba(255, 200, 87, 0.12);
}

/* Stepper */
.pipeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.step {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 6px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.step.active {
  color: var(--cyan);
  border-color: var(--cyan-border);
  background: var(--cyan-dim);
}

.step.done {
  color: var(--green);
}

.step .num {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.85;
  margin-bottom: 2px;
}

.step .label {
  letter-spacing: 0.06em;
}

.arrow {
  color: var(--line);
  font-family: var(--mono);
  font-size: 14px;
  user-select: none;
}

/* Stage panel */
.stage {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  padding: 26px 28px;
  min-height: 420px;
  box-shadow: var(--shadow);
  /* Keep content in normal flow — no absolute / zero-height traps */
  overflow: visible;
}

.screen {
  display: none;
  animation: fadeIn 0.22s ease;
}

.screen.is-on {
  display: block;
}

.screen[hidden] {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0.55; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  html { scroll-behavior: auto; }
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.screen h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.screen .lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.wide {
  grid-column: 1 / -1;
}

.field label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.45;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

.field input:invalid:not(:placeholder-shown),
.field textarea:invalid:not(:placeholder-shown) {
  border-color: var(--red-border);
}

/* Sample fill bar */
.samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
}

.samples .tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 4px;
}

/* Buttons */
.btn {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:disabled:hover {
  border-color: var(--line);
  color: var(--text);
}

.btn-primary {
  background: var(--cyan-dim);
  border-color: var(--cyan-border);
  color: var(--cyan);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: rgba(61, 214, 255, 0.25);
  color: #b8f0ff;
}

.btn-danger {
  border-color: var(--red-border);
  color: var(--red);
}

.btn-danger:hover:not(:disabled) {
  background: var(--red-dim);
}

.btn-ghost {
  border-style: dashed;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.nav-row .left,
.nav-row .right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Outcome */
.outcome {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.outcome.ok {
  background: var(--green-dim);
  border-color: var(--green-border);
}

.outcome.bad {
  background: var(--red-dim);
  border-color: var(--red-border);
}

.pill {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.outcome.ok .pill {
  background: var(--green);
  color: #062416;
}

.outcome.bad .pill {
  background: var(--red);
  color: #2a060a;
}

.msg {
  font-size: 14px;
  color: #d7e2f5;
}

.msg strong {
  font-weight: 700;
}

.msg .en {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
}

.card .k {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.card .v {
  font-size: 14px;
  font-weight: 500;
}

.card .v.mono {
  font-family: var(--mono);
  font-size: 13px;
  color: #c9d7ef;
  word-break: break-all;
}

/* Rules checklist */
.rules-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
}

.rules-panel h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.rules-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.rules-list li.pass {
  background: var(--green-dim);
  border-color: rgba(61, 255, 154, 0.2);
}

.rules-list li.fail {
  background: var(--red-dim);
  border-color: rgba(255, 93, 108, 0.25);
}

.rule-status {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.rules-list li.pass .rule-status {
  background: var(--green);
  color: #062416;
}

.rules-list li.fail .rule-status {
  background: var(--red);
  color: #2a060a;
}

.rule-body .rid {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  margin-bottom: 2px;
}

.rule-body .rdesc {
  color: #c9d7ef;
  font-size: 13px;
}

.rule-body .rdetail {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

/* Summary of input on outcome */
.case-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Footer */
.site-footer {
  margin-top: 18px;
  padding: 14px 4px 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.site-footer .disclaimer {
  color: var(--amber);
  margin-bottom: 6px;
}

.site-footer a {
  color: var(--cyan);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  .shell {
    padding: 16px 14px 32px;
  }

  .stage {
    padding: 18px 16px;
    min-height: 0;
  }

  .form-grid,
  .meta-grid,
  .case-summary {
    grid-template-columns: 1fr;
  }

  .pipeline {
    gap: 4px;
  }

  .step {
    font-size: 10px;
    padding: 6px 4px;
  }

  .screen h2 {
    font-size: 17px;
  }

  .nav-row {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-row .left,
  .nav-row .right {
    justify-content: stretch;
  }

  .nav-row .btn {
    flex: 1;
    text-align: center;
  }
}
/* TII shield logo (brand mark) */
.brand {
  align-items: center;
}

.brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: none;
}
