@font-face {
  font-family: Inter;
  src: url('./fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Pretendard;
  src: url('./fonts/PretendardVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0d9488;
  --background: #f8fafc;
  --surface: #fff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px #0f172a08, 0 4px 16px #0f172a06;
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root:lang(ko) { font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--background); }
a { color: var(--primary); text-underline-offset: .18em; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: clamp(1.8rem, 2.4vw, 2.5rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.22rem; letter-spacing: -.018em; }
h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; max-width: 100%; }
button, input, select, textarea, .button {
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; min-height: 40px; padding: 7px 12px; transition: background 160ms, border-color 160ms, box-shadow 160ms;
}
button, .button { font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button:hover:not(:disabled), .button:hover { background: var(--primary-light); border-color: #c7d2fe; }
.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.primary:hover:not(:disabled) { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover); }
:focus-visible { outline: 3px solid #818cf8; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .52; }
textarea { display: block; width: 100%; min-height: 13rem; font-family: ui-monospace, monospace; }
input[type=checkbox] { min-height: 0; accent-color: var(--primary); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; min-height: 100vh; background: var(--surface); border-right: 1px solid var(--border); padding: 24px 16px; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); font-size: 1.25rem; font-weight: 750; letter-spacing: -.035em; }
.brand-mark { display: grid; place-items: center; color: #fff; background: var(--primary); width: 34px; height: 34px; border-radius: 10px; }
.workspace { margin: 28px 0 16px; padding: 12px; background: var(--background); border: 1px solid var(--border); border-radius: 10px; }
.workspace strong, .workspace small { display: block; }
small, .muted { color: var(--muted); }
.section-nav { display: grid; gap: 4px; }
.section-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: var(--muted); border-radius: 8px; text-decoration: none; font-weight: 600; }
.section-nav a:hover, .section-nav a[aria-current] { background: var(--primary-light); color: var(--primary-hover); }
.menu-toggle { display: none; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 64px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.context { font-weight: 650; }
.language, .actions, form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.language a[aria-current] { font-weight: 750; text-decoration-thickness: 2px; }
.content { max-width: 1480px; margin: 0 auto; padding: 24px clamp(12px, 3vw, 40px) 40px; }
.page-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: start; margin-bottom: 20px; }
.page-heading p { max-width: 62ch; margin-bottom: 0; }
.demo-pill, .badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 4px 8px; border-radius: 999px; background: var(--primary-light); color: var(--primary-hover); font-size: .82rem; font-weight: 650; }
.panel { scroll-margin-top: 12px; margin-bottom: 16px; padding: clamp(14px, 2.4vw, 24px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; align-items: center; }
.panel-head h2 { margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric, .subcard { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
.metric strong { display: block; margin: 4px 0 6px; font-size: clamp(1.15rem, 2.15vw, 1.75rem); overflow-wrap: anywhere; }
.metric small { display: block; }
.metric strong, .money, .report-table { font-variant-numeric: tabular-nums; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.subcard p:last-child, .panel p:last-child { margin-bottom: 0; }
.chart-row, .mini-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 12px; margin: 9px 0; }
.chart-track { grid-column: 1 / -1; display: block; width: 100%; height: 7px; border-radius: 8px; background: #e9edf5; overflow: hidden; }
.chart-fill { display: block; background: var(--primary); border-radius: inherit; height: 100%; }
.chart-fill.teal { background: var(--secondary); }
.dashboard-recent { list-style: none; padding: 0; margin: 0; }
.dropzone { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 22px 12px; border: 1px dashed #a5b4fc; border-radius: 12px; background: var(--primary-light); margin: 12px 0; }
.dropzone.is-dragging { outline: 2px solid var(--primary); background: #e0e7ff; }
.dropzone input { background: var(--surface); width: min(100%, 370px); }
.dropzone .icon { color: var(--primary); width: 26px; height: 26px; }
.upload-form { display: block; }
.file-list, .queue-list { list-style: none; padding: 0; margin: 8px 0 12px; }
.queue-list button { justify-content: space-between; width: 100%; text-align: left; margin-bottom: 5px; overflow-wrap: anywhere; }
.queue-list button[aria-pressed=true] { border-color: #a5b4fc; background: var(--primary-light); }
.badge[data-status=failed] { background: #fef2f2; color: #991b1b; }
.badge[data-status=approved], .badge[data-status=posted] { background: #ecfdf3; color: #166534; }
.badge[data-status=review], .badge[data-status=edited] { background: #fff7ed; color: #92400e; }
.review-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 14px; align-items: start; }
.preview { border-radius: 12px; border: 1px solid var(--border); background: var(--background); padding: 12px; min-width: 0; }
.preview img, .preview iframe { display: block; width: 100%; max-height: 360px; object-fit: contain; border: 0; margin-top: 10px; }
.preview iframe { height: 350px; }
fieldset { min-width: 0; border: 1px solid var(--border); border-radius: 10px; }
#document-fields:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap: 8px; margin-bottom: 10px; }
#document-fields label { display: grid; gap: 3px; min-width: 0; }
#document-fields input { width: 100%; min-width: 0; }
details, .filters { margin: 10px 0; }
#status, #ledger-status, #export-status { white-space: pre-wrap; overflow-wrap: anywhere; }
#status:not(:empty) { padding: 10px; border-radius: 8px; background: #fff7ed; color: #78350f; }
#status[data-tone=success] { background: #ecfdf3; color: #166534; }
.table-wrap { overflow: auto; max-width: 100%; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { background: var(--background); color: #475569; font-size: .84rem; white-space: nowrap; }
td:nth-child(3), #transactions-section th:nth-child(3) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td small { display: block; }
td input[list], td select { min-width: 115px; }
td input[list] { font-size: .86rem; border-radius: 18px; background: var(--primary-light); color: var(--primary-hover); }
td button { min-height: 34px; padding: 4px 8px; margin: 2px; font-size: .86rem; }
.report-table td { white-space: nowrap; }
.assistant-panel { background: linear-gradient(145deg,#eef2ff 0,var(--surface) 64%); }
.assistant-panel ul { padding-left: 20px; }
.assistant-panel li { margin: 7px 0; }
#profit-totals li, #annual-totals li, #candidates li { padding: 8px 0; border-bottom: 1px solid var(--border); }
#report-charts { margin-bottom: 14px; }
dialog { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-width: min(520px,95vw); }
dialog::backdrop { background: #0f172a60; }
dialog label { display: grid; gap: 4px; }
@media (max-width: 1080px) {
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 830px) {
  .shell { display: block; }
  .sidebar { position: static; min-height: 0; padding: 12px; border: 0; border-bottom: 1px solid var(--border); }
  .workspace { display: none; }
  .menu-toggle { display: inline-flex; margin-top: 8px; }
  .section-nav { display: none; flex-wrap: wrap; margin-top: 10px; }
  .section-nav.is-expanded { display: flex; }
  .section-nav a { padding: 5px 7px; font-size: .84rem; }
  .section-nav .icon { width: 16px; height: 16px; }
  .topbar { min-height: 48px; padding: 8px 12px; }
}
@media (max-width: 600px) {
  .dashboard-grid, .review-grid { grid-template-columns: minmax(0,1fr); }
  .content { padding-top: 16px; }
  .metric { padding: 10px; }
  .filters label, #document-list { width: 100%; }
  .filters label { display: grid; gap: 4px; }
  .language { gap: 8px; font-size: .84rem; }
}
