:root {
  --navy: #111f73;
  --navy-dark: #0c1758;
  --ink: #171c2b;
  --muted: #697184;
  --bg: #f6f5f2;
  --surface: #fff;
  --line: #e2e4e9;
  --gold: #e2c35d;
  --red: #dc3f4b;
  --orange: #f39a13;
  --green: #24965d;
  --blue: #2f74d0;
}
* { box-sizing: border-box; }
html { color: var(--ink); background: var(--bg); font-family: "Noto Sans KR", "Malgun Gothic", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:active { transform: scale(.96); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(47,116,208,.25); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.admin-login { display: grid; min-height: 100vh; place-items: center; padding: 40px 20px; background: var(--navy); color: #fff; }
.login-inner { width: min(452px, 100%); text-align: center; }
.login-inner > img { width: 150px; height: 70px; object-fit: contain; }
.login-inner h1 { margin: 0 0 28px; font-size: 19px; font-weight: 600; letter-spacing: 0; }
.login-form { display: grid; gap: 20px; }
.login-form input { width: 100%; height: 66px; padding: 0 22px; border: 1px solid #d7d9e0; border-radius: 8px; background: #fff; color: var(--ink); font-size: 18px; }
.login-submit { height: 56px; border: 1px solid var(--gold); border-radius: 6px; background: var(--gold); color: #111; font-weight: 800; }
.login-links { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.login-links button { min-height: 44px; border: 0; background: transparent; color: #fff; font-weight: 700; }
.login-mode { margin-top: 24px; color: rgba(255,255,255,.56); font-size: 12px; }

.admin-app { min-height: 100vh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 240px; flex-direction: column; background: var(--navy); color: #fff; }
.admin-brand { height: 102px; margin: 0 28px; padding-top: 22px; border-bottom: 1px solid rgba(255,255,255,.55); }
.admin-brand img { display: block; width: 76px; height: 35px; object-fit: contain; object-position: left center; }
.admin-brand span { display: block; margin-top: 3px; font-size: 10px; color: rgba(255,255,255,.78); }
.admin-nav { flex: 1; padding: 20px 16px; overflow-y: auto; }
.admin-nav button { position: relative; width: 100%; min-height: 48px; padding: 0 24px; border: 0; border-radius: 6px; background: transparent; color: rgba(255,255,255,.78); text-align: left; font-size: 14px; font-weight: 600; }
.admin-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav button.is-active { background: rgba(255,255,255,.09); color: #fff; }
.admin-nav button.is-active::before { content: ""; position: absolute; inset: 0 auto 0 -5px; width: 4px; background: var(--gold); }
.nav-divider { margin: 20px 8px 8px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.42); font-size: 11px; }
.sidebar-footer { margin: 0 28px 24px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.5); }
.sidebar-footer > a, .sidebar-footer > button { display: inline-flex; min-height: 40px; align-items: center; border: 0; background: transparent; color: rgba(255,255,255,.8); font-size: 12px; text-decoration: none; }
.sidebar-footer > button { float: right; }
.sidebar-footer > div { clear: both; display: grid; gap: 3px; padding-top: 12px; font-size: 12px; }
.sidebar-footer span { color: rgba(255,255,255,.55); }
.admin-workspace { min-height: 100vh; margin-left: 240px; }
.admin-topbar { position: sticky; top: 0; z-index: 10; display: flex; height: 72px; align-items: center; justify-content: space-between; padding: 0 40px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); }
.admin-topbar h2 { margin: 0; font-size: 21px; }
.admin-topbar > div { display: flex; align-items: center; gap: 28px; color: var(--muted); font-size: 12px; }
.admin-chip { min-width: 72px; padding: 9px 15px; border-radius: 999px; background: #f2f2f4; color: var(--ink); text-align: center; }
.sidebar-toggle { display: none; width: 44px; height: 44px; border: 0; background: transparent; }
.sidebar-toggle span, .sidebar-toggle span::before, .sidebar-toggle span::after { display: block; width: 22px; height: 2px; background: var(--ink); content: ""; }
.sidebar-toggle span::before { transform: translateY(-7px); }
.sidebar-toggle span::after { transform: translateY(5px); }
.admin-content { padding: 38px 40px 64px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: 32px; line-height: 1.25; text-wrap: balance; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(2, 160px) auto; gap: 14px; margin-bottom: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 6px 18px rgba(15,25,64,.05); }
.toolbar input, .toolbar select { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.btn { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; }
.btn-primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.btn-danger { border-color: #f4d4d7; background: #fff6f7; color: #b52f3b; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 20px; margin-bottom: 28px; }
.summary-item { min-height: 126px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 20px rgba(15,25,64,.07); }
.summary-item span { color: var(--muted); font-size: 13px; }
.summary-item strong { display: block; margin-top: 12px; font-size: 30px; font-variant-numeric: tabular-nums; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 22px; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 22px rgba(15,25,64,.06); }
.panel + .panel { margin-top: 22px; }
.panel-header { display: flex; min-height: 60px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 18px; }
.panel-body { padding: 18px 22px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th, .data-table td { height: 52px; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; white-space: nowrap; }
.data-table th { height: 42px; background: #f5f5f7; color: var(--muted); font-size: 12px; }
.data-table tr[data-select-id] { cursor: pointer; }
.data-table tbody tr:hover, .data-table tbody tr.is-selected { background: #faf7ec; }
.status { display: inline-flex; min-width: 74px; min-height: 28px; align-items: center; justify-content: center; padding: 0 12px; border-radius: 999px; background: #edf0f5; color: #526073; font-size: 11px; font-weight: 800; }
.status.blue { background: #e5f0ff; color: #2f74d0; }
.status.green { background: #e3f5eb; color: #218455; }
.status.orange { background: #fff0d5; color: #d98300; }
.status.red { background: #fde6e8; color: #c9323f; }
.status.gray { background: #eceef2; color: #677083; }
.task-list { display: grid; gap: 0; }
.task-item { display: flex; min-height: 58px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 13px; }
.task-item:last-child { border-bottom: 0; }
.task-item span::before { display: inline-block; width: 8px; height: 8px; margin-right: 12px; border-radius: 50%; background: var(--blue); content: ""; }
.task-item:nth-child(2) span::before { background: var(--red); }
.task-item:nth-child(3) span::before { background: var(--orange); }
.task-item:nth-child(4) span::before { background: var(--gold); }
.split-view { display: grid; grid-template-columns: minmax(480px, 1.25fr) minmax(320px, .75fr); gap: 20px; }
.detail-empty { display: grid; min-height: 420px; place-items: center; color: var(--muted); text-align: center; }
.detail-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { margin: 0 0 12px; font-size: 14px; }
.detail-section p { margin: 0; color: #40495a; font-size: 13px; line-height: 1.75; white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 12px; font-size: 13px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 600; }
.detail-actions { display: grid; grid-template-columns: 140px 1fr; gap: 10px; margin-top: 16px; }
.admin-field { display: grid; gap: 8px; margin-bottom: 16px; }
.admin-field label { font-size: 13px; font-weight: 700; }
.admin-field input, .admin-field select, .admin-field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.admin-field textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.delivery-options { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: #f7f8fb; }
.delivery-options legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.delivery-options label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; cursor: pointer; }
.delivery-options input { width: 18px; height: 18px; accent-color: var(--navy); }
.delivery-options input:disabled + span { color: #8b92a0; }
.empty-row { padding: 48px 12px !important; color: var(--muted); text-align: center !important; }
.admin-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 72px rgba(0,0,0,.3); }
.admin-dialog::backdrop { background: rgba(5,10,38,.66); }
.dialog-shell > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.dialog-shell > header h2 { margin: 0; font-size: 21px; }
.dialog-shell > header button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 28px; }
[data-dialog-body] { max-height: calc(100dvh - 130px); overflow-y: auto; padding: 22px 24px 26px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.admin-toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: 340px; padding: 15px 18px; border-radius: 6px; background: var(--navy); color: #fff; box-shadow: 0 14px 36px rgba(0,0,0,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition-property: opacity, transform; transition-duration: 180ms; }
.admin-toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 180ms ease-out; }
  .sidebar-open .admin-sidebar { transform: translateX(0); }
  .admin-workspace { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .admin-topbar { padding: 0 20px; }
  .admin-content { padding: 28px 20px 52px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid, .split-view { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .admin-topbar > div time { display: none; }
  .admin-content { padding-left: 14px; padding-right: 14px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading h1 { font-size: 27px; }
  .toolbar { grid-template-columns: 1fr; }
  .summary-grid { gap: 12px; }
  .summary-item { min-height: 104px; padding: 16px; }
  .summary-item strong { font-size: 25px; }
  .panel-header, .panel-body { padding-left: 16px; padding-right: 16px; }
  .split-view { display: block; }
  .split-view .panel + .panel { margin-top: 16px; }
  .detail-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
