:root {
  color-scheme: light;
  --ink: #17253c;
  --muted: #65748b;
  --accent: #285fe8;
  --line: #d5dde9;
  --soft-line: #e4eaf2;
  --surface: #f6f8fb;
  --blue-surface: #edf2ff;
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 13px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: fixed; z-index: 5; left: 12px; top: 12px; transform: translateY(-200%); background: white; padding: 8px; }
.skip:focus { transform: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 200px; background: white; display: flex; flex-direction: column; padding: 28px 16px 24px; gap: 48px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; background: var(--accent); color: white; border-radius: 8px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar nav a { height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border-radius: 7px; color: var(--muted); font-weight: 550; }
.sidebar nav a:hover { background: var(--surface); }
.sidebar nav a[aria-current=page] { background: var(--blue-surface); color: var(--accent); font-weight: 700; }
.nav-icon { width: 19px; text-align: center; font-size: 18px; line-height: 1; }
.grid::before { content: "⊞"; }
.list::before { content: "▤"; }
.pulse::before { content: "⌁"; }
.bell::before { content: "♧"; }
.sidebar-footer { margin-top: auto; padding: 14px; color: var(--muted); background: var(--surface); border-radius: 7px; font-size: 12px; line-height: 1.6; }
.workspace { margin-left: 200px; min-width: 0; }
.topbar { height: 64px; border-bottom: 1px solid var(--soft-line); background: white; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.topbar strong { color: var(--ink); font-weight: 600; }
.divider { padding: 0 10px; color: #a5b2c5; }
main { padding: 25px 32px 26px; }
.heading { margin-bottom: 26px; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: -.04em; line-height: 1.45; }
.heading p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric { min-height: 86px; display: flex; gap: 8px; align-items: center; justify-content: space-between; background: white; padding: 14px 18px; border: 1px solid var(--soft-line); border-radius: 8px; }
.metric:hover, .metric-total { border-color: #bacbff; }
.metric strong { font-size: 13px; font-weight: 650; }
.metric b { font-size: 26px; font-variant-numeric: tabular-nums; }
small { color: var(--muted); font-size: 11px; }
.metric small { display: block; margin-top: 5px; }
.metric-O, .valid { color: #087052; }
.metric-V { color: var(--accent); }
.metric-X { color: #647187; }
.metric-unset { color: #95600c; }
.toolbar, .filters, .actions, .upload-card, .preview-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { justify-content: space-between; margin-bottom: 16px; }
.filters { min-width: 0; }
.button, button, input:not([type=hidden],[type=checkbox]), select, textarea { background: white; border: 1px solid var(--line); border-radius: 6px; }
.button, button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.button:hover, button:hover { background: #eef3fa; }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover, button.primary:hover { background: #194cc9; }
button.danger { background: #ab2735; border-color: #ab2735; color: white; }
input:not([type=hidden],[type=checkbox]), select, textarea { min-height: 38px; padding: 0 11px; min-width: 0; }
textarea { padding: 8px 11px; resize: vertical; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; vertical-align: middle; }
.search { display: flex; align-items: center; position: relative; }
.search span { position: absolute; left: 11px; font-size: 20px; color: var(--muted); }
.search input { width: 246px; padding-left: 32px !important; }
.table-card { border: 1px solid var(--soft-line); border-radius: 8px; overflow: hidden; background: white; }
.table-scroll { container-type: inline-size; overflow: auto; max-height: 550px; }
table { width: 100%; min-width: 975px; border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 1; height: 40px; background: #f0f3f8; color: #4f607b; font-weight: 650; }
th, td { padding: 0 10px; text-align: left; }
tbody th, tbody td { height: 42px; border-bottom: 1px solid #e9eef5; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: #f7f9fc; }
tbody tr:hover, tbody tr.selected-row { background: var(--blue-surface); }
tbody small { display: block; font-size: 10px; line-height: 1.4; }
.text-cell { max-width: 125px; overflow: hidden; text-overflow: ellipsis; }
.watch, .edit-link { color: var(--accent); font-weight: 650; }
.edit-link:hover, .table-footer a:hover { text-decoration: underline; }
.badge { min-width: 26px; display: inline-block; text-align: center; padding: 3px 5px; border-radius: 4px; font-weight: 750; }
.badge-O { background: #e2f2ec; color: #087052; }
.badge-V { background: #e9efff; color: #2359d9; }
.badge-X { background: #edf0f4; color: #5a677b; }
.badge-unset { background: #fff2d6; color: #8b5b0c; }
.empty-row td { height: 200px; padding: 0; color: var(--muted); }
.empty-state { width: 100cqw; padding: 16px; text-align: center; white-space: normal; }
.empty-row strong { display: block; margin-bottom: 7px; font-size: 14px; color: var(--ink); }
.empty-row a { color: var(--accent); text-decoration: underline; }
.table-footer { display: flex; min-height: 48px; align-items: center; justify-content: space-between; padding: 8px 16px; color: var(--muted); }
.table-footer nav { display: flex; gap: 14px; }
.table-hint { margin: 14px 0 20px; color: var(--muted); font-size: 12px; }
.info, .message { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 7px; line-height: 1.65; }
.info { background: #eaf0f9; color: #4c6384; font-size: 12px; }
.info > span { font-size: 18px; }
.message { margin-bottom: 16px; }
.error { background: #fff0f0; color: #952638; }
.success { background: #e7f5ed; color: #13644b; }
.empty-card, .upload-card { background: white; border: 1px solid var(--soft-line); border-radius: 8px; padding: 24px; }
.empty-card h2, .preview h2 { font-size: 17px; margin-bottom: 6px; }
.empty-card p, .preview p { color: var(--muted); margin-bottom: 14px; }
.upload-card { align-items: end; }
.upload-card label { display: grid; gap: 6px; max-width: 100%; font-weight: 600; }
.upload-card input { padding: 7px; }
.preview { margin-top: 24px; }
.preview-actions { margin-top: 16px; }
.invalid, .delete-link { color: #a52b3c; }
.import-table { min-width: 1180px; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(496px, 100%); height: 100dvh; max-height: none; max-width: none; margin: 0; padding: 0; border: none; background: white; color: var(--ink); box-shadow: -8px 0 28px #17253c23; }
.drawer[open] { display: flex; flex-direction: column; }
.drawer::backdrop { background: #17253c2b; }
.drawer-heading, .drawer-footer { display: flex; align-items: center; padding: 16px 24px; gap: 8px; background: white; }
.drawer-heading { justify-content: space-between; border-bottom: 1px solid var(--soft-line); }
.drawer-heading h2 { font-size: 21px; letter-spacing: -.035em; }
.drawer-heading p { margin-top: 4px; color: var(--muted); }
.close { font-size: 25px; line-height: 1; color: var(--muted); padding: 4px 8px; }
.drawer-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.drawer-body { overflow: auto; flex: 1; padding: 16px 24px; }
.drawer-footer { border-top: 1px solid var(--soft-line); justify-content: flex-end; }
.drawer-footer small { margin-right: auto; }
.delete-link { margin-right: 4px; padding: 8px 0; text-decoration: underline; }
.rule-fields { border: 0; padding: 0; min-width: 0; margin: 0 0 14px; }
.rule-fields + .rule-fields { border-top: 1px solid var(--soft-line); padding-top: 10px; }
.rule-fields > legend { padding: 0; margin-bottom: 5px; font-weight: 700; }
.rule-fields:first-child:last-child > legend, .rule-fields:first-child:last-child .remove-rule { display: none; }
.remove-rule { float: right; margin-bottom: 8px; min-height: 28px; color: #a52b3c; font-size: 11px; }
.form-grid { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 12px; }
.form-grid label, .price-group { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 650; }
.form-grid label small { display: inline; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; font-weight: 400; }
.form-grid .full { grid-column: 1 / -1; }
.price-summary { background: var(--blue-surface); color: var(--accent); border-radius: 6px; min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; }
.price-summary strong { font-size: 16px; }
.confirm-dialog { inset: 0; margin: auto; width: min(420px, calc(100% - 32px)); height: auto; border-radius: 8px; }
@media (max-width: 1200px) { .metric { padding: 10px; } .metric small { font-size: 10px; } }
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; padding: 13px 16px; gap: 10px; border-bottom: 1px solid var(--soft-line); }
  .sidebar nav { flex-direction: row; gap: 3px; overflow-x: auto; }
  .sidebar nav a { flex: 0 0 auto; padding: 0 8px; gap: 5px; height: 38px; font-size: 12px; }
  .sidebar-footer { display: none; }
  .workspace { margin: 0; }
  .topbar { height: 42px; padding: 0 16px; }
  main { padding: 18px 16px; }
}
@media (max-width: 580px) {
  .market { display: none; }
  .nav-icon { display: none; }
  h1 { font-size: 24px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 60px; }
  .metric-total { grid-column: span 2; }
  .metric b { font-size: 22px; }
  .filters, .search, .search input { width: 100%; }
  .toolbar { gap: 12px; }
  .drawer-heading, .drawer-body, .drawer-footer { padding-left: 15px; padding-right: 15px; }
}
.choice-field { border: 0; min-width: 0; margin: 0; padding: 0; }
.choice-field legend { font-size: 12px; font-weight: 650; padding: 0; margin-bottom: 5px; }
.choice-field small { display: block; margin-top: 5px; }
.segments { display: flex; gap: 3px; padding: 3px; border-radius: 6px; background: #f0f3f8; }
.segments label { flex: 1; min-width: 0; position: relative; text-align: center; cursor: pointer; }
.segments input[type=radio] { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; cursor: pointer; }
.segments span { border: 1px solid transparent; border-radius: 4px; padding: 6px 2px; color: var(--muted); font-weight: 500; }
.segments input:checked + span { border-color: #bacbff; background: white; color: var(--accent); font-weight: 700; }
.segments input[value=O]:checked + span { color: #087052; border-color: #bce2d4; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(100%, 400px); background: white; padding: 28px; border: 1px solid var(--soft-line); border-radius: 8px; }
.login-card h1 { margin: 22px 0 14px; }
.login-card form, .login-card label { display: grid; gap: 8px; }
.login-card form { gap: 16px; }
