:root {
  --ink: #1b1c1a;
  --ink-2: #5c5e59;
  --ink-3: #8b8d87;
  --paper: #ffffff;
  --ground: #f4f4f1;
  --rule: #e3e3de;
  --rule-strong: #cfcfc8;
  --pass: #1d6b4f;
  --fail: #b3261e;
  --fail-wash: #fdf0ee;
  --diff-wash: #fff3cf;
  --diff-ink: #6b4e00;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: Inter, -apple-system, "Segoe UI", system-ui, "Noto Sans Lao", "Lao Sangam MN", "Phetsarath OT", sans-serif;

  /* Transition variables, tuned for a review tool: quicker than the demo
     defaults, and entering content eases out. */
  --tabs-dur: 200ms;
  --tabs-ease: var(--ease-out);
  --tabs-text-muted: var(--ink-2);
  --tabs-text-active: var(--ink);
  --tabs-bar-bg: #e9e9e4;
  --tabs-pill-bg: var(--paper);
  --shimmer-dur: 1600ms;
  --shimmer-base: var(--ink-3);
  --shimmer-highlight: var(--ink);
  --shimmer-band: 400%;
  --shimmer-ease: linear;
  --pulse-dur: 1000ms;
  --pulse-count: infinite;
  --pulse-min: 0.5;
  --reveal-dur: 240ms;
  --reveal-blur: 2px;
  --reveal-ease: var(--ease-out);
  --shake-distance: 6px;
  --shake-overshoot: 4px;
  --shake-dur-a: 80ms;
  --shake-dur-b: 60ms;
  --shake-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --revert-hold: 4000ms;
  --revert-dur: 280ms;
  --stagger-dur: 420ms;
  --stagger-distance: 10px;
  --stagger-stagger: 40ms;
  --stagger-blur: 3px;
  --stagger-ease: var(--ease-out);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; }
h1, h2, p { margin: 0; font-weight: inherit; font-size: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.button {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.button:active { transform: scale(0.97); }
.button--primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.button[aria-disabled="true"] {
  border-color: var(--rule);
  background: var(--ground);
  color: var(--ink-3);
  cursor: not-allowed;
  transform: none;
}
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--ground); }
  .button--primary:hover { background: #33352f; }
  .button[aria-disabled="true"]:hover { background: var(--ground); }
}

/* Empty view */
.empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 24px;
}
.t-input-wrap { width: min(520px, 100%); }
.drop {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 56px 32px;
  border: 1px dashed var(--rule-strong);
  border-radius: 14px;
  background: var(--paper);
  text-align: center;
}
.drop.is-over { border-color: var(--ink); }
.drop.is-error { border-color: var(--fail); }
.drop h1 { font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.drop .t-stagger-line--2 { margin-top: 6px; color: var(--ink-2); text-wrap: pretty; }
.t-error-msg { min-height: 21px; margin-top: 10px; color: var(--fail); text-align: center; }

/* Review view */
.review {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 12px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.report { min-width: 0; }
.report h1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report p { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.actions { display: flex; align-items: center; gap: 10px; flex: none; }
.verdict { font-size: 13px; color: var(--pass); }
.verdict.is-bad { color: var(--fail); }

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  overflow-x: auto;
}
.t-tab { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500; }
.t-tab[data-diff]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c48a00;
}
.form-name { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.form-name b { color: var(--ink); font-weight: 600; }

.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  min-height: 0;
  padding: 0 20px 20px;
}
.sheet {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
}
.t-skel-skeleton {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 20px;
  pointer-events: none;
}
.t-skel-skeleton span { display: block; height: 12px; border-radius: 4px; background: var(--rule); }
.t-skel-skeleton span:nth-child(3n) { width: 72%; }
.t-skel-skeleton span:nth-child(3n + 1) { width: 88%; }
.t-skel-skeleton span:nth-child(3n + 2) { width: 64%; }
.t-skel-content { overflow: auto; visibility: hidden; }
.t-skel.is-revealed .t-skel-content { visibility: visible; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.6; }
thead { position: sticky; top: 0; z-index: 1; }
th {
  padding: 8px 10px;
  background: #fafaf8;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  color: var(--ink-2);
  font-weight: 500;
  text-align: center;
  vertical-align: middle;
}
td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
td.number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.zero { color: var(--ink-3); }
tr.strong td { font-weight: 600; }
td.differs { background: var(--diff-wash); color: var(--diff-ink); }

tr.is-selected td { background: var(--ground); }
.line {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .line:hover { text-decoration: underline; text-underline-offset: 3px; }
}

.source {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  font-size: 13px;
}
.source-code { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.source-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
details.panel summary { font-size: 13px; font-weight: 600; cursor: pointer; }
details.panel summary span { color: var(--ink-2); font-weight: 400; }
details.panel[open] summary { margin-bottom: 8px; }

.rail { display: grid; align-content: start; gap: 12px; min-height: 0; overflow: auto; }
.panel {
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
}
.panel h2 { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.panel h2 span { color: var(--ink-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.panel.is-bad { border-color: #eec4bf; background: var(--fail-wash); }
.check { padding: 7px 0; border-top: 1px solid var(--rule); font-size: 13px; }
.check:first-of-type { border-top: 0; }
.check b { display: block; font-weight: 500; }
.check b::before { content: "✓"; margin-right: 6px; color: var(--pass); }
.check.is-bad b { color: var(--fail); }
.check.is-bad b::before { content: "✕"; color: var(--fail); }
.check small { display: block; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.note { padding: 7px 0; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; text-wrap: pretty; }
.note:first-of-type { border-top: 0; }
.note.is-diff { color: var(--diff-ink); }

@media (max-width: 960px) {
  .review { height: auto; min-height: 100vh; }
  .work { grid-template-columns: minmax(0, 1fr); }
  .sheet { height: 70vh; }
  .bar { flex-wrap: wrap; }
}
