:root {
  --ink: #171b24;
  --ink-soft: #5b6470;
  --paper: #eef0ef;
  --panel: #ffffff;
  --line: #dadedd;
  --line-soft: #e6e8e7;

  --ember: #c7401c;
  --ember-dark: #9c2f13;
  --ember-tint: #fbe7e0;

  --amber: #de9a2e;
  --amber-tint: #faefda;

  --ok: #2e7d5b;
  --ok-tint: #e2f0e9;
  --warn: #b3730f;
  --warn-tint: #faf0da;

  --radius-sm: 4px;
  --radius: 6px;
  --font: "PretendardVariable", "Pretendard", -apple-system, BlinkMacSystemFont,
          "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-feature-settings: "tnum" 1, "case" 1;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ================= Shell layout ================= */
.shell {
  display: flex;
  min-height: 100%;
}

/* ---------- Side console nav ---------- */
.side-nav {
  width: 246px;
  flex-shrink: 0;
  background: var(--ink);
  color: #d9dce2;
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 34px;
}
.side-nav-brand .mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ember);
}
.side-nav-brand .mark svg { width: 22px; height: 22px; }
.side-nav-title {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.side-nav-title strong {
  font-size: 14.5px;
  font-weight: 700;
  color: #f4f5f7;
}
.side-nav-title span {
  font-size: 11.5px;
  color: #98a0ad;
}

.stage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}
.stage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  color: #7d8794;
  font-size: 13px;
  font-weight: 500;
}
.stage-item .stage-num {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #5b6472;
  width: 20px;
}
.stage-item.is-active {
  color: #f4f5f7;
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--ember);
}
.stage-item.is-active .stage-num { color: var(--ember); }
.stage-item.is-done {
  color: #b7bec8;
}
.stage-item.is-done .stage-num { color: var(--amber); }

.side-nav-foot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  margin-top: 5px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(46, 125, 91, 0.18);
}
.side-nav-foot p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: #8b93a0;
}

/* ---------- Main column ---------- */
.main-col {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 36px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0 0 3px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.badge-outline {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.content {
  flex-grow: 1;
  max-width: 880px;
  width: 100%;
  padding: 32px 36px 80px;
}

/* ================= Panels ================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 30px;
  margin-bottom: 22px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.panel-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ember);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.panel h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
}
.panel-desc {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 13.5px;
  max-width: 62ch;
}
.btn-reset {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.btn-reset:hover {
  border-color: var(--ember);
  color: var(--ember-dark);
}

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 44px 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--ember);
  background: var(--ember-tint);
}
.dropzone-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ember);
}
.dropzone-icon svg { width: 24px; height: 24px; }
.dropzone-text { font-weight: 600; font-size: 13.5px; }
.dropzone-sub { font-size: 11.5px; color: var(--ink-soft); }

.upload-status {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.upload-status.status-ok { background: var(--ok-tint); color: var(--ok); }
.upload-status.status-error { background: var(--ember-tint); color: var(--ember-dark); }
.upload-status.status-loading { background: #eef0f3; color: var(--ink-soft); }

/* ---------- File summary list ---------- */
.file-summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.file-summary-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.file-summary-item--error {
  border-color: #e3b6a8;
  background: var(--ember-tint);
}
.file-summary-name {
  font-size: 13px;
  font-weight: 600;
}
.file-summary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge--info { background: #e4e9f0; color: #3a4f68; }
.badge--warn { background: var(--warn-tint); color: var(--warn); }

/* ================= Summary cards ================= */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 28px;
}
.summary-card {
  background: var(--panel);
  padding: 16px 18px;
}
.summary-card .num {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.summary-card .label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}

/* ================= Category match / Diagnostics ================= */
.category-block,
.diagnostics-block {
  margin-bottom: 26px;
}
.category-block h3,
.diagnostics-block h3 {
  font-size: 13.5px;
  margin: 0 0 4px;
  font-weight: 700;
}
.col-list-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

#category-match-table table,
#diagnostics-table table,
#year-preview-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#category-match-table th,
#category-match-table td,
#diagnostics-table th,
#diagnostics-table td,
#year-preview-table th,
#year-preview-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
#category-match-table th,
#diagnostics-table th,
#year-preview-table th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: none;
  font-variant-numeric: normal;
}
#category-match-table td:last-child { width: 130px; }
#diagnostics-table tr.diag-warn td:nth-child(1),
#diagnostics-table tr.diag-warn td:nth-child(2) {
  color: var(--warn);
  font-weight: 700;
}

.mini-bar {
  width: 100%;
  height: 6px;
  background: #e5e7e6;
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar-fill { height: 100%; }
.mini-bar-fill.bar--ok { background: var(--ok); }
.mini-bar-fill.bar--warn { background: var(--amber); }
.mini-bar-fill.bar--low { background: var(--ember); }

.year-preview h3 {
  font-size: 13.5px;
  margin: 0 0 10px;
  font-weight: 700;
}

/* ================= Tabs ================= */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 4px;
  margin-right: 20px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active {
  color: var(--ember-dark);
  border-bottom-color: var(--ember);
}
.tab-panel { min-height: 200px; }

.placeholder-box {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.placeholder-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9aa1ab;
}

/* ================= Footer ================= */
.app-footer {
  text-align: center;
  padding: 20px 36px 32px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.app-footer .dot { margin: 0 6px; color: var(--line); }

/* ================= Responsive ================= */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side-nav {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    gap: 16px;
  }
  .side-nav-brand { margin-bottom: 0; }
  .stage-list {
    flex-direction: row;
    overflow-x: auto;
    flex-grow: 1;
  }
  .stage-item {
    flex-shrink: 0;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
  }
  .stage-item.is-active { border-bottom-color: var(--ember); }
  .side-nav-foot { display: none; }
  .topbar { padding: 18px 20px; flex-wrap: wrap; }
  .content { padding: 24px 20px 60px; }
  .panel { padding: 20px; }
}
