:root {
  --ink: #102236;
  --ink-2: #1d344b;
  --muted: #718093;
  --line: #dfe7ed;
  --soft: #f4f7f9;
  --paper: #ffffff;
  --mint: #c9f2df;
  --lilac: #e9e0ff;
  --sand: #ffe5b9;
  --cyan: #c7eff3;
  --accent: #e15d42;
  --shadow: 0 18px 50px rgba(16, 34, 54, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: #f5f8fa; }
button, input, select { font: inherit; }
button, label { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #8fd9df; outline-offset: 2px; }

.app-shell { min-height: 100vh; background: radial-gradient(circle at 80% -10%, rgba(199,239,243,.7), transparent 34rem), #f5f8fa; }
.topbar { height: 76px; max-width: 1440px; margin: 0 auto; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--ink); color: white; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.topbar-note { color: var(--muted); font-size: 12px; font-weight: 650; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #41b982; box-shadow: 0 0 0 4px rgba(65,185,130,.12); }

.page-wrap { max-width: 1440px; margin: 0 auto; padding: 28px 34px 80px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 34px; align-items: stretch; padding: 38px 0 58px; }
.hero-copy { padding: 38px 16px 32px 18px; }
.eyebrow { margin: 0 0 12px; color: #8a98a7; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 22px; font-size: clamp(48px, 6.3vw, 88px); line-height: .96; letter-spacing: -.07em; font-weight: 820; }
h1 em { color: var(--accent); font-style: normal; }
.hero-lede { max-width: 550px; margin-bottom: 26px; color: #526478; font-size: 17px; line-height: 1.6; }
.trust-row { display: flex; flex-wrap: wrap; gap: 9px; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.trust-row span { padding: 8px 11px; border: 1px solid #d8e3e8; border-radius: 999px; background: rgba(255,255,255,.55); }

.upload-card { min-height: 350px; padding: 38px; border: 1px solid rgba(16,34,54,.08); border-radius: 26px; background: linear-gradient(145deg, #fff, #edf8f7); box-shadow: var(--shadow); text-align: center; }
.upload-card.dragging { border-color: #50b6bf; background: #e5fbf6; transform: translateY(-2px); }
.upload-kicker { color: #78a5a4; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.upload-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 22px auto 16px; border-radius: 20px; background: var(--ink); color: var(--mint); font-size: 31px; line-height: 1; }
.upload-card h2 { margin-bottom: 9px; font-size: 25px; letter-spacing: -.04em; }
.upload-card p { max-width: 360px; margin: 0 auto 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.upload-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.upload-button { display: inline-flex !important; }
#workbookInput { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-hint { margin-top: 15px; color: #9aa7b1; font-size: 11px; }
.load-status { min-height: 17px; margin-top: 13px; color: #5f7e80; font-size: 12px; font-weight: 700; }
.load-status.error { color: #b33e33; }

.button { min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 800; letter-spacing: .01em; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--ink); color: #fff; box-shadow: 0 7px 16px rgba(16,34,54,.16); }
.button-primary:hover { background: #274866; }
.button-quiet { border-color: var(--line); background: #fff; color: var(--ink-2); }
.button-quiet:hover { border-color: #afc2cc; background: #f9fbfc; }

.workspace { padding-top: 8px; }
.workspace-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.workspace-heading h2 { margin-bottom: 6px; font-size: 29px; letter-spacing: -.05em; }
.muted { color: var(--muted); font-size: 13px; }
.heading-actions, .action-row { display: flex; flex-wrap: wrap; gap: 9px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 17px; }
.stat-card { min-height: 135px; padding: 21px 22px; border-radius: 17px; }
.stat-ink { color: #fff; background: var(--ink); }
.stat-lilac { background: var(--lilac); }
.stat-mint { background: var(--mint); }
.stat-sand { background: var(--sand); }
.stat-label { display: block; margin-bottom: 16px; opacity: .72; font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.stat-card strong { display: block; font-size: 34px; line-height: 1; letter-spacing: -.06em; }
.stat-card small { display: block; margin-top: 8px; opacity: .66; font-size: 11px; font-weight: 700; }

.quality-strip { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 17px; padding: 12px 15px; border: 1px solid #d4e7e8; border-radius: 12px; background: #eefafa; color: #437175; font-size: 12px; line-height: 1.45; }
.quality-icon { display: grid; place-items: center; flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%; background: #bfe9e6; color: #246468; font-size: 12px; font-weight: 850; }

.controls-card, .table-card { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: 0 8px 26px rgba(16,34,54,.04); }
.controls-card { margin-bottom: 17px; padding: 18px 18px 14px; }
.control-row { display: grid; grid-template-columns: minmax(260px, 1.7fr) minmax(160px, .85fr) minmax(90px, .46fr); gap: 12px; }
.filter-row { grid-template-columns: minmax(220px, 1.7fr) minmax(220px, 1.7fr) repeat(4, minmax(125px, .75fr)); margin-top: 12px; }
.field label { display: block; margin: 0 0 7px; color: #68798a; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
input, select { width: 100%; height: 40px; border: 1px solid #d8e2e8; border-radius: 9px; background: #fff; color: var(--ink); font-size: 13px; }
input { padding: 0 12px; }
select { padding: 0 10px; }
.search-wrap { position: relative; }
.search-wrap > span { position: absolute; left: 12px; top: 8px; color: #8aa1af; font-size: 21px; line-height: 1; }
.search-wrap input { padding-left: 34px; }
.control-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf1f3; }
.result-summary { color: #718291; font-size: 12px; font-weight: 650; }

.table-card { overflow: hidden; }
.table-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 22px 17px; }
.table-header h2 { margin: 0; font-size: 22px; letter-spacing: -.045em; }
.table-note { max-width: 360px; color: #8896a2; font-size: 12px; text-align: right; }
.table-scroll { overflow-x: auto; border-top: 1px solid #edf1f3; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 14px; background: #f7f9fa; color: #738493; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { max-width: 310px; padding: 13px 14px; border-top: 1px solid #edf1f3; color: #30485e; vertical-align: top; line-height: 1.4; }
tbody tr:hover { background: #fbfdfd; }
td.primary-cell { color: var(--ink); font-weight: 800; }
td .subline { display: block; margin-top: 3px; color: #8a99a6; font-size: 11px; font-weight: 500; }
.badge { display: inline-block; padding: 5px 8px; border-radius: 999px; background: #eef2f5; color: #5f7180; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.regular { background: #e2f5e9; color: #3f7658; }
.badge.reappear { background: #fff0d6; color: #95601c; }
.paper-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 4px 7px; border-radius: 6px; background: #f0f4f6; color: #4a6376; font-size: 10px; }
.empty-table { padding: 56px 20px; text-align: center; }
.empty-icon { margin-bottom: 9px; color: #9eb1bd; font-size: 30px; }
.empty-table h3 { margin-bottom: 5px; font-size: 17px; }
.empty-table p { margin: 0; color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 17px; padding: 15px; border-top: 1px solid #edf1f3; color: #788996; font-size: 12px; font-weight: 700; }
.pagination .button { min-height: 34px; }

.how-card { display: grid; grid-template-columns: .7fr 1.3fr; gap: 45px; margin-top: 70px; padding: 34px; border-radius: 20px; background: var(--ink); color: #fff; }
.how-card h2 { max-width: 330px; margin-bottom: 0; font-size: 29px; line-height: 1.04; letter-spacing: -.055em; }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.how-steps > div { padding-left: 17px; border-left: 1px solid rgba(255,255,255,.22); }
.how-steps span { display: block; margin-bottom: 32px; color: var(--mint); font-size: 11px; font-weight: 850; }
.how-steps strong { font-size: 17px; }
.how-steps p { margin: 7px 0 0; color: #a9b8c5; font-size: 12px; line-height: 1.5; }
.footer { max-width: 1440px; margin: 0 auto; padding: 18px 34px 26px; display: flex; justify-content: space-between; gap: 15px; color: #8998a6; font-size: 11px; }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero-copy { padding: 22px 8px 8px; }
  .upload-card { max-width: 640px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .control-row, .filter-row { grid-template-columns: repeat(2, 1fr); }
  .field-search, .field-wide { grid-column: 1 / -1; }
  .how-card { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 620px) {
  .topbar, .page-wrap, .footer { padding-left: 17px; padding-right: 17px; }
  .topbar { height: 68px; }
  .topbar-note { display: none; }
  .hero-grid { padding-top: 15px; padding-bottom: 35px; }
  h1 { font-size: 52px; }
  .hero-lede { font-size: 15px; }
  .upload-card { padding: 28px 19px; border-radius: 19px; }
  .upload-actions { flex-direction: column; }
  .upload-actions .button { width: 100%; }
  .workspace-heading, .control-footer, .table-header, .footer { align-items: flex-start; flex-direction: column; }
  .heading-actions, .action-row { width: 100%; }
  .heading-actions .button, .action-row .button { flex: 1; }
  .control-row, .filter-row { grid-template-columns: 1fr; }
  .field-search, .field-wide { grid-column: auto; }
  .table-note { max-width: none; text-align: left; }
  .how-card { padding: 25px 20px; }
  .how-steps { grid-template-columns: 1fr; gap: 18px; }
  .how-steps span { margin-bottom: 10px; }
}

@media print {
  body, .app-shell { background: #fff; }
  .topbar, .hero-grid, .how-card, .footer, .controls-card, .heading-actions, .pagination { display: none !important; }
  .page-wrap { padding: 0; }
  .workspace { display: block !important; }
  .workspace-heading { margin-bottom: 14px; }
  .table-card { border: 0; box-shadow: none; }
  .table-header { padding: 0 0 12px; }
  .table-scroll { overflow: visible; }
  table { font-size: 10px; }
  th, td { padding: 6px; }
}
