:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  color: #171714;
  background: #f3f2ed;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f2ed; }
button, input, select { font: inherit; }
button { min-height: 48px; border: 1px solid #d8d6cc; border-radius: 12px; padding: 0 16px; color: #171714; background: #fff; cursor: pointer; font-weight: 750; }
button:hover { border-color: #171714; }
button:disabled { opacity: .45; cursor: wait; }
button.primary { color: #fff; background: #171714; border-color: #171714; }
button.danger { color: #9d2f29; border-color: #dfb4ae; background: #fff2f0; }
button.danger.solid { color: #fff; border-color: #9d2f29; background: #9d2f29; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px; color: #fff; background: #0b0b0a; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #fff5; border-radius: 50%; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand small, .sidebar-foot small { margin-top: 3px; color: #99988f; font-size: 10px; letter-spacing: .14em; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; min-height: 48px; border-radius: 12px; padding: 0 16px; font-weight: 750; text-decoration: none; width: 100%; justify-content: flex-start; border-color: transparent; color: #aaa99f; background: transparent; text-align: left; }
.nav-item:hover, .nav-item.active { color: #111; background: #f5f2e7; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid #ffffff18; }
.sidebar-foot strong, .sidebar-foot small { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace { min-width: 0; padding: clamp(20px, 3vw, 46px); padding-bottom: max(36px, env(safe-area-inset-bottom)); }
.topbar, .section-toolbar, .panel-heading, .detail-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(30px, 4vw, 50px); line-height: 1; letter-spacing: -.045em; }
h2 { margin-bottom: 4px; font-size: clamp(21px, 2.5vw, 30px); letter-spacing: -.035em; }
.eyebrow { margin-bottom: 8px; color: #77756b; font-size: 11px; font-weight: 900; letter-spacing: .18em; }
.muted, small { color: #7a786f; }
.sync-panel, .button-row, .search-form { display: flex; align-items: center; gap: 9px; }
.icon-button { width: 48px; padding: 0; font-size: 24px; }
.badge, .state-pill { display: inline-flex; align-items: center; min-height: 32px; border-radius: 999px; padding: 0 12px; font-size: 12px; font-weight: 850; }
.badge.waiting { background: #eee9d8; }
.badge.online { color: #12633a; background: #dff3e6; }
.badge.offline { color: #9d2f29; background: #f9dfdc; }
.badge.browser { color: #315a91; background: #e1ecfa; }
.runtime-settings { min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 12px; }
.dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #777; }
.dot.online { background: #35c875; box-shadow: 0 0 0 4px #35c87522; }
.dot.warning { background: #e8932f; }
.offline-banner { margin-top: 22px; border: 1px solid #e0b5af; border-radius: 14px; padding: 12px 14px; color: #8e2b25; background: #fff2f0; }
.offline-banner button { float: right; min-height: 34px; color: inherit; background: transparent; }
.toast { position: fixed; z-index: 50; right: 26px; bottom: 26px; max-width: min(420px, calc(100vw - 40px)); border-radius: 12px; padding: 14px 18px; color: #fff; background: #171714; box-shadow: 0 12px 40px #0004; }
.toast.error { background: #982f29; }
.view { display: none; margin-top: 34px; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric, .panel, .kds-column, .menu-row, .order-list, .detail-panel { border: 1px solid #dedcd2; border-radius: 18px; background: #fff; box-shadow: 0 8px 28px #27230e0a; }
.metric { min-height: 156px; padding: 22px; }
.metric span, .metric small, .metric strong { display: block; }
.metric span { font-size: 13px; font-weight: 750; }
.metric strong { margin: 18px 0 12px; font-size: 38px; line-height: 1; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 16px; margin-top: 16px; }
.panel { padding: clamp(18px, 2.4vw, 28px); }
.compact-list, .status-stack { display: grid; gap: 9px; margin-top: 18px; }
.compact-row, .status-row, .history-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 64px; border: 0; border-radius: 12px; padding: 11px 13px; background: #f6f5ef; text-align: left; }
.compact-row span:first-child, .status-row span:nth-child(2), .history-row span { min-width: 0; }
.compact-row strong, .compact-row small, .status-row strong, .status-row small, .history-row strong, .history-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state-pill.waiting { background: #eee9d8; }
.state-pill.accepted { color: #315a91; background: #e1ecfa; }
.state-pill.cooking { color: #925513; background: #fae9d6; }
.state-pill.ready { color: #12633a; background: #dff3e6; }
.inline-state { margin: 16px 0 10px; border-radius: 10px; padding: 10px 13px; background: #f6f5ef; color: #65635b; font-size: 13px; }
.kiosk-viewport { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; background: #111; }
#kiosk-frame { position: absolute; top: 50%; left: 50%; border: 0; border-radius: 0; background: #fff; transform: translate(-50%, -50%) rotate(90deg); transform-origin: center; }
.kds-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; margin-top: 20px; overflow-x: auto; }
.kds-column { min-height: 500px; padding: 14px; background: #ebeae4; box-shadow: none; }
.kds-column > header { display: flex; justify-content: space-between; align-items: center; padding: 4px 3px 13px; }
.kds-column h3 { margin: 0; }
.kds-column header span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; font-weight: 900; }
.fullscreen-overlay { position: fixed; z-index: 100; inset: 0; overflow: hidden; background: #0b0b0a; }
.fullscreen-overlay[hidden] { display: none !important; }
.fullscreen-overlay iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #fff; }
.kiosk-overlay #kiosk-frame { inset: auto; top: 50%; left: 50%; }
.overlay-actions { position: fixed; z-index: 102; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); display: flex; gap: 8px; }
.overlay-action, .overlay-close { min-height: 48px; border-color: #ffffff40; color: #fff; background: #111d; box-shadow: 0 8px 28px #0005; backdrop-filter: blur(10px); }
.overlay-action, .overlay-close { width: 52px; padding: 0; border-radius: 999px; font-size: 30px; line-height: 1; }
.overlay-close { position: fixed; z-index: 102; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); }
.overlay-actions .overlay-close { position: static; }
.overlay-state { position: fixed; z-index: 101; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); border-radius: 999px; padding: 10px 14px; color: #fff; background: #111d; box-shadow: 0 8px 28px #0005; backdrop-filter: blur(10px); font-size: 13px; }
body.overlay-open { overflow: hidden; }
.ticket-stack { display: grid; gap: 10px; }
.ticket-card { border-radius: 14px; padding: 15px; background: #fff; }
.ticket-head { display: flex; justify-content: space-between; gap: 10px; }
.ticket-head strong { font-size: 18px; }
.ticket-head time, .ticket-meta { color: #7a786f; font-size: 12px; }
.ticket-card ul { display: grid; gap: 5px; margin: 14px 0; padding: 0; list-style: none; }
.ticket-card li { display: flex; justify-content: space-between; gap: 10px; }
.ticket-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.ticket-actions button { min-height: 42px; padding: 0 8px; font-size: 12px; background: #171714; color: #fff; }
.ticket-actions .secondary { grid-column: 1 / -1; color: #171714; background: #fff; }
.section-toolbar { min-height: 64px; }
.search, select { min-height: 48px; border: 1px solid #d8d6cc; border-radius: 12px; padding: 0 14px; color: #171714; background: #fff; }
.search { width: min(340px, 100%); }
.menu-list { display: grid; gap: 10px; margin-top: 20px; }
.availability-tabs { display: inline-grid; grid-template-columns: repeat(2, minmax(100px, 1fr)); gap: 4px; margin-top: 18px; border: 1px solid #dedcd2; border-radius: 12px; padding: 4px; background: #f3f1ec; }
.availability-tabs button { border: 0; border-radius: 8px; background: transparent; color: #77756b; }
.availability-tabs button.active { background: #171714; color: #fff; }
.option-group-list { display: grid; gap: 12px; margin-top: 20px; }
.menu-list[hidden],
.option-group-list[hidden] { display: none !important; }
.option-group-card { overflow: hidden; border: 1px solid #dedcd2; border-radius: 16px; background: #fff; box-shadow: 0 8px 28px #27230e0a; }
.option-group-card > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid #eceae2; }
.option-group-card > header strong, .option-group-card > header small { display: block; }
.option-group-card > header small { margin-top: 4px; color: #77756b; }
.requirement-toggle.required { color: #fff; border-color: #171714; background: #171714; }
.requirement-toggle.optional { color: #5f5d55; border-color: #cfcdc3; background: #fff; }
.option-rows { display: grid; }
.option-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; }
.option-row + .option-row { border-top: 1px solid #eceae2; }
.option-row.soldout { background: #f3f1ec; }
.option-row span strong, .option-row span small { display: block; }
.option-row span small { margin-top: 4px; color: #77756b; }
.menu-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; }
.menu-row.soldout { background: #f3f1ec; }
.menu-image { display: grid; place-items: center; width: 58px; height: 58px; overflow: hidden; border-radius: 12px; background: #171714; color: #fff; font-weight: 900; }
.menu-image img { width: 100%; height: 100%; object-fit: cover; }
.menu-copy strong, .menu-copy span { display: block; }
.menu-copy span { margin-top: 5px; color: #77756b; font-size: 12px; }
.availability.stop { color: #9d2f29; border-color: #e0b5af; background: #fff2f0; }
.availability.resume { color: #12633a; border-color: #b8ddc5; background: #e9f7ee; }
.split-panel { display: grid; grid-template-columns: minmax(310px, .85fr) minmax(380px, 1.15fr); gap: 14px; margin-top: 20px; }
.order-list { max-height: 70vh; overflow: auto; padding: 8px; }
.order-row { display: flex; justify-content: space-between; gap: 14px; width: 100%; border: 0; border-radius: 10px; text-align: left; }
.order-row + .order-row { margin-top: 4px; }
.order-row.selected { background: #e9e5d8; }
.order-row span:last-child { text-align: right; }
.order-row strong, .order-row small, .order-row b { display: block; }
.order-row small { max-width: 250px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.detail-panel { min-height: 430px; padding: 24px; }
.detail-panel dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-panel dl div { border-radius: 10px; padding: 12px; background: #f6f5ef; }
.detail-panel dt { color: #77756b; font-size: 11px; }
.detail-panel dd { margin: 5px 0 0; font-weight: 800; }
.detail-lines, .timeline { padding: 0; list-style: none; }
.detail-lines li, .timeline li { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #eceae2; padding: 11px 0; }
.detail-lines small { display: block; margin-top: 3px; }
.reversal-control { margin-top: 24px; border-top: 2px solid #ece8dc; padding-top: 22px; }
.receipt-reprint-control { margin-top: 24px; border-top: 2px solid #ece8dc; padding-top: 22px; }
.receipt-reprint-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.receipt-reprint-heading h3 { margin: 2px 0 0; }
.receipt-reprint-control .muted { margin-bottom: 0; }
.reversal-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.reason-field { display: grid; gap: 8px; margin: 16px 0 12px; font-weight: 800; }
.reason-field textarea { width: 100%; resize: vertical; border: 1px solid #d8d6cc; border-radius: 12px; padding: 12px; color: #171714; background: #fff; font: inherit; }
.reversal-final { margin-top: 12px; border: 1px solid #dfb4ae; border-radius: 14px; padding: 16px; background: #fff2f0; }
.reversal-final button { margin: 8px 8px 0 0; }
.disabled-reason { margin: 9px 0 0; color: #9d2f29; font-size: 12px; }
.reversal-result { display: grid; gap: 4px; margin: 12px 0; border-radius: 10px; padding: 11px 13px; background: #f6f5ef; }
.reversal-result.succeeded { color: #12633a; background: #e9f7ee; }
.reversal-result.failed { color: #9d2f29; background: #fff2f0; }
.recovery-panel { margin-top: 16px; }
.recovery-panel h3 { margin-top: 24px; }
.error-log { display: grid; gap: 8px; margin-top: 18px; }
.error-log > div { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; border-top: 1px solid #eceae2; padding: 10px 0; }
.empty-state { color: #858279; text-align: center; padding: 28px; }
.ordering-warning { margin: 18px 0 0; border: 1px solid #e6c58f; border-radius: 12px; padding: 14px 16px; color: #805018; background: #fff6df; font-weight: 750; }
.channel-control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.channel-control-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 220px; }
.channel-control-copy { min-width: 0; }
.channel-control-copy h2 { margin-bottom: 10px; }
.channel-control-copy .muted { max-width: 440px; }
.channel-status { display: inline-flex; margin-top: 14px; border-radius: 999px; padding: 8px 12px; color: #12633a; background: #e9f7ee; font-size: 13px; }
.channel-status.paused { color: #9d2f29; background: #fff2f0; }
.channel-toggle { position: relative; flex: 0 0 auto; width: 76px; min-height: 42px; border: 0; border-radius: 999px; padding: 4px; background: #bbb9b0; }
.channel-toggle span { display: block; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px #0003; transition: transform .18s ease; }
.channel-toggle[aria-checked="true"] { background: #171714; }
.channel-toggle[aria-checked="true"] span { transform: translateX(34px); }
.channel-toggle:focus-visible { outline: 3px solid #315a91; outline-offset: 3px; }
.ordering-note { margin-top: 16px; }
.ordering-note p:last-child { margin-bottom: 0; }
.benefit-locked { margin-top: 20px; text-align: center; }
.benefit-locked p { margin: 8px 0 0; }
.benefit-search { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; }
.benefit-search h3, .benefit-search p { margin-bottom: 4px; }
.benefit-layout { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(520px, 1.3fr); gap: 16px; margin-top: 16px; }
.benefit-layout > .panel { min-height: 520px; }
.benefit-member-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.benefit-balance { min-width: 116px; border-radius: 12px; padding: 16px; color: #fff; background: #171714; text-align: right; }
.benefit-balance strong, .benefit-balance span { display: block; }
.benefit-balance strong { font-size: 34px; line-height: 1; }
.benefit-balance span { margin-top: 6px; font-size: 12px; }
.benefit-summary { display: flex; gap: 8px; margin: 18px 0; }
.benefit-summary span { flex: 1; border-radius: 10px; padding: 12px; background: #f6f5ef; }
.benefit-summary strong { float: right; }
.benefit-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.benefit-action { display: grid; align-content: start; gap: 12px; border: 1px solid #e2e0d7; border-radius: 14px; padding: 16px; }
.benefit-action h3 { margin-bottom: 2px; }
.benefit-action label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
.benefit-action input, .benefit-action select, .benefit-action textarea { width: 100%; min-height: 46px; border: 1px solid #d8d6cc; border-radius: 10px; padding: 10px 12px; color: #171714; background: #fff; font: inherit; }
.benefit-action textarea { resize: vertical; }
.benefit-held-coupons { margin-top: 22px; }
.benefit-held-coupons .history-row + .history-row { margin-top: 7px; }
.benefit-audit-panel { margin-top: 16px; }
.benefit-audit-row small { max-width: 720px; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .channel-control-grid { grid-template-columns: 1fr; }
  .benefit-layout { grid-template-columns: 1fr; }
  .kds-board { grid-template-columns: repeat(4, 270px); }
}

@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; top: auto; bottom: 0; width: 100%; height: auto; padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .brand, .sidebar-foot { display: none; }
  nav { grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .nav-item { min-width: 0; min-height: 48px; padding: 0 5px; font-size: 11px; text-align: center; }
  .workspace { padding: 20px 14px 126px; }
  .topbar, .section-toolbar { align-items: flex-start; flex-direction: column; }
  .sync-panel, .search-form { width: 100%; flex-wrap: wrap; }
  .search-form .search { flex: 1 1 100%; }
  .split-panel { grid-template-columns: 1fr; }
  .order-list { max-height: 44vh; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 128px; padding: 16px; }
  .metric strong { font-size: 30px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .menu-row { grid-template-columns: 48px minmax(0, 1fr); }
  .menu-image { width: 48px; height: 48px; }
  .availability { grid-column: 1 / -1; width: 100%; }
  .availability-tabs { display: grid; width: 100%; }
  .option-row { align-items: stretch; flex-direction: column; }
  .option-row .availability { width: 100%; }
  .detail-panel dl { grid-template-columns: 1fr; }
  .error-log > div { grid-template-columns: 1fr; }
  .channel-control-card { min-height: 190px; padding: 20px; }
  .benefit-search { align-items: stretch; flex-direction: column; }
  .benefit-action-grid { grid-template-columns: 1fr; }
  .channel-toggle { width: 68px; }
  .channel-toggle[aria-checked="true"] span { transform: translateX(26px); }
}

.language-select { min-width: 112px; }

.credential-dialog { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 0; color: #171714; background: #fff; box-shadow: 0 28px 90px #0006; }
.credential-dialog::backdrop { background: #0b0b0acc; backdrop-filter: blur(4px); }
.credential-dialog form { display: grid; gap: 16px; padding: 28px; }
.credential-dialog h2, .credential-dialog p { margin-bottom: 0; }
.credential-dialog label { display: grid; gap: 8px; font-weight: 800; }
.credential-dialog input { width: 100%; min-height: 48px; border: 1px solid #d8d6cc; border-radius: 12px; padding: 0 14px; color: #171714; background: #fff; }
.credential-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.credential-error { margin: 0; color: #9d2f29; font-size: 13px; font-weight: 750; }

@media (max-width: 520px) {
  .credential-dialog form { padding: 22px 18px; }
  .credential-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
