/* ── 리셋 & 기본 ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --c-bg:       #0f1117;
  --c-surface:  #1a1d27;
  --c-border:   #2a2d3a;
  --c-text:     #e8e8f0;
  --c-muted:    #6b7080;
  --c-primary:  #4f8ef7;
  --c-success:  #34c77b;
  --c-danger:   #e05252;
  --c-warning:  #f0a030;
  --c-day:      #f0a030;
  --c-night:    #7b68ee;
  --c-free:     #34c77b;
  --c-occupied: #e05252;
  --radius:     10px;
  --radius-sm:  6px;
}
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif;
             background: var(--c-bg); color: var(--c-text); font-size: 15px; }
a { color: inherit; text-decoration: none; }

/* ── 공통 컴포넌트 ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem 1.1rem; border: none; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer; transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--c-primary); color: #fff; }
.btn-secondary{ background: #444860; color: #fff; }
.btn-outline  { background: transparent; border: 1.5px solid var(--c-border); color: var(--c-text); }
.btn-danger   { background: var(--c-danger); color: #fff; }
.btn-warning  { background: var(--c-warning); color: #000; }
.btn-success  { background: var(--c-success); color: #000; }
.btn-sm       { padding: .3rem .7rem; font-size: .8rem; }
.btn-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-lg       { padding: .75rem 1.8rem; font-size: 1.05rem; }
.btn-block    { width: 100%; margin-top: .75rem; }

.card { background: var(--c-surface); border: 1px solid var(--c-border);
        border-radius: var(--radius); padding: 1.2rem; }
.form-group  { display: flex; flex-direction: column; gap: .35rem; }
.form-row    { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-label  { font-size: .82rem; color: var(--c-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.form-input, .form-select {
  background: var(--c-bg); border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm); color: var(--c-text);
  padding: .55rem .8rem; font-size: .95rem; width: 100%;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--c-primary);
}
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: .75rem; }
.mt-2 { margin-top: .5rem; } .mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: .5rem; }
.text-muted  { color: var(--c-muted); }
.text-center { text-align: center; }

.flash-container { padding: .5rem 1rem; }
.flash { background: var(--c-warning); color: #000; padding: .6rem 1rem;
         border-radius: var(--radius-sm); margin-bottom: .4rem; font-weight: 600; }

.badge { display: inline-block; padding: .2rem .55rem; border-radius: 20px;
         font-size: .78rem; font-weight: 700; }
.badge-active   { background: #1e4d31; color: var(--c-success); }
.badge-inactive { background: #3d1e1e; color: var(--c-danger); }

/* ── TopBar ──────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  padding: .6rem 1.2rem; position: sticky; top: 0; z-index: 100;
  overflow: hidden;
}
.topbar-left  { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.topbar-right {
  display: flex; align-items: center; gap: .5rem;
  overflow-x: auto; flex-shrink: 1; min-width: 0;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;   /* 스크롤바 겹침 방지 */
  scrollbar-width: none; /* Firefox */
}
.topbar-right::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.shop-name    { font-weight: 800; font-size: 1.05rem; letter-spacing: .05em;
               color: var(--c-text); text-decoration: none; cursor: pointer; }
.shop-name:hover { opacity: .75; }
.user-name    { color: var(--c-muted); font-size: .88rem; margin-right: .4rem; }

/* ── Shift Badge ─────────────────────────────────────── */
.shift-badge { display: inline-block; font-size: 1.1rem; line-height: 1; }
.shift-d { color: var(--c-day); }
.shift-n { color: #c8c0ff; }

.main-content { padding: 1.2rem; max-width: 1400px; margin: 0 auto; }

/* ── 로그인 ──────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box  { background: var(--c-surface); border: 1px solid var(--c-border);
              border-radius: var(--radius); padding: 2rem; width: 320px; }
.login-logo { text-align: center; font-size: 1.6rem; font-weight: 800;
              color: var(--c-primary); margin-bottom: 1.5rem; letter-spacing: .1em; }
.pin-input  { width: 100%; text-align: center; font-size: 2rem; letter-spacing: .5em;
              padding: .5rem; margin-bottom: 1rem; }
.numpad     { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.numpad-btn { background: var(--c-bg); border: 1px solid var(--c-border);
              border-radius: var(--radius-sm); padding: .85rem;
              font-size: 1.2rem; font-weight: 600; cursor: pointer; color: var(--c-text); }
.numpad-btn:hover { background: var(--c-border); }

/* ── 교대 선택 ───────────────────────────────────────── */
.shift-select-page { max-width: 480px; margin: 0 auto; }
.shift-select-page h2 { margin-bottom: 1rem; font-size: 1.4rem; }
.shift-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0;
             border-bottom: 1px solid var(--c-border); }
.shift-row:last-child { border-bottom: none; }
.shift-type-btns { display: flex; gap: 1rem; }
.shift-type-card {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--c-border); border-radius: var(--radius);
  padding: 1.4rem; font-size: 1.3rem; font-weight: 700; cursor: pointer;
  transition: all .15s; background: var(--c-bg); color: var(--c-text);
}
button.shift-type-card.shift-d:hover { border-color: var(--c-day) !important; color: var(--c-day); background: #5a3e0a; box-shadow: 0 0 10px var(--c-day); }
button.shift-type-card.shift-n:hover { border-color: #a090ff      !important; color: #d0c8ff;       background: #3a2e80; box-shadow: 0 0 10px #7b68ee; }
button.shift-type-card.shift-d:active { background: #6b4a0f; }
button.shift-type-card.shift-n:active { background: #4a3a99; }

/* ── 테이블 뷰 ───────────────────────────────────────── */
.tables-page {}
.tables-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.tables-toolbar h2 { font-size: 1.3rem; }

/* Day / Night 토글 */
.shift-toggle-wrap { display: flex; align-items: center; gap: .6rem; }
.shift-toggle-label { font-size: .85rem; font-weight: 700; color: var(--c-muted); transition: color .2s; }
.shift-toggle-label.active.day   { color: var(--c-day); }
.shift-toggle-label.active.night { color: #a090ff; }
.shift-toggle {
  position: relative; width: 52px; height: 28px;
  background: #2a2060; border-radius: 14px; cursor: pointer;
  border: 2px solid #7b68ee; transition: background .25s, border-color .25s;
}
.shift-toggle:has(.shift-toggle-knob:not(.night)) {
  background: #5a3e0a; border-color: var(--c-day);
}
.shift-toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-day); transition: transform .25s, background .25s;
}
.shift-toggle-knob.night {
  transform: translateX(24px); background: #a090ff;
}
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}
.table-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--c-surface); border: 2px solid var(--c-border);
  border-radius: var(--radius); padding: 1.2rem .8rem;
  min-height: 110px; cursor: pointer; transition: transform .1s, border-color .15s;
}
.table-card:hover { transform: scale(1.03); }
.table-card.free     { border-color: var(--c-free); }
.table-card.occupied { border-color: var(--c-occupied); background: #2a1a1a; }
.table-number  { font-size: 1.4rem; font-weight: 800; }
.table-amount  { font-size: 1rem; color: var(--c-danger); font-weight: 700; margin-top: .3rem; }
.table-status  { font-size: .82rem; color: var(--c-success); margin-top: .3rem; }
.rate-bar { margin-top: 1.2rem; text-align: right; color: var(--c-muted); font-size: .85rem; }

/* ── 주문 화면 ───────────────────────────────────────── */
.order-page { display: flex; gap: 1rem; height: calc(100vh - 60px); overflow: hidden; }
.menu-panel  { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.order-panel { width: 320px; display: flex; flex-direction: column;
               background: var(--c-surface); border-left: 1px solid var(--c-border); }

.cat-tabs { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem;
            background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.cat-tab  { background: var(--c-bg); border: 1px solid var(--c-border);
            border-radius: var(--radius-sm); padding: .4rem .85rem;
            font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--c-text); }
.cat-tab.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.sub-tab  { margin-left: .5rem; font-size: .8rem; opacity: .8; }

.menu-items-area { flex: 1; overflow-y: auto; padding: .75rem; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: .6rem; }
.menu-btn  {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  background: var(--c-bg); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); padding: .75rem; cursor: pointer;
  transition: border-color .12s, background .12s; min-height: 72px; text-align: left;
}
.menu-btn:hover { border-color: var(--c-primary); background: #1a2035; }
.menu-name    { font-size: .75rem; color: var(--c-muted); line-height: 1.2; margin-top: .1rem; }
.menu-name-km { font-size: .92rem; font-weight: 600; color: var(--c-text); line-height: 1.3; }
.menu-price   { font-size: .9rem; color: var(--c-primary); font-weight: 700; margin-top: .4rem; }

.order-header { display: flex; justify-content: space-between; align-items: center;
                padding: .8rem 1rem; border-bottom: 1px solid var(--c-border); }
.order-title  { font-size: 1.2rem; font-weight: 800; }
.order-id     { color: var(--c-muted); font-size: .85rem; }

.order-items  { flex: 1; overflow-y: auto; padding: .6rem .8rem; }
.oi-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem 0; border-bottom: 1px solid var(--c-border); font-size: .9rem;
}
.oi-name-wrap { flex: 1; display: flex; flex-direction: column; }
.oi-name      { font-size: .85rem; }
.oi-name-km   { font-size: .75rem; color: var(--c-muted); line-height: 1.2; }
.oi-controls { display: flex; align-items: center; gap: .3rem; }
.oi-controls button { background: var(--c-border); border: none; color: var(--c-text);
                       width: 26px; height: 26px; border-radius: 4px; cursor: pointer;
                       font-size: 1rem; font-weight: 700; }
.oi-qty   { min-width: 20px; text-align: center; font-weight: 700; }
.oi-price { min-width: 55px; text-align: right; font-weight: 700; color: var(--c-primary); }
.oi-del   { background: none; border: none; color: var(--c-danger); cursor: pointer;
             font-size: 1rem; padding: 0 .2rem; }

.order-footer { padding: .8rem 1rem; border-top: 1px solid var(--c-border); }
.order-total  { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.1rem; }
.order-total-khr { text-align: right; color: var(--c-muted); font-size: .85rem; margin-top: .2rem; }
.order-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.order-actions .btn { flex: 1; }

/* ── 결제 화면 ───────────────────────────────────────── */
.payment-page { max-width: 540px; margin: 0 auto; }
.payment-page h2 { margin-bottom: 1rem; }
.payment-summary { background: var(--c-surface); border: 1px solid var(--c-border);
                   border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.pay-item-row { display: flex; justify-content: space-between; padding: .3rem 0;
                font-size: .9rem; border-bottom: 1px solid var(--c-border); }
.pay-total-row { display: flex; justify-content: space-between;
                 font-size: 1.15rem; font-weight: 800; margin-top: .6rem; }
.pay-total-khr { text-align: right; color: var(--c-muted); font-size: .9rem; margin-top: .2rem; }
.rate-note     { font-size: .78rem; margin-left: .5rem; }

.qr-section { background: var(--c-surface); border: 1px solid var(--c-border);
               border-radius: var(--radius); padding: 1rem;
               display: flex; flex-direction: column; align-items: center; gap: .7rem;
               margin-bottom: 1rem; }
.qr-amount-input { max-width: 160px; text-align: center; }
.qr-display { text-align: center; }
.qr-img     { max-width: 180px; border-radius: 8px; background: #fff; padding: 6px; }
.qr-label   { font-size: 1.1rem; font-weight: 700; color: var(--c-primary); }

.payment-form { background: var(--c-surface); border: 1px solid var(--c-border);
                border-radius: var(--radius); padding: 1rem; }
.payment-row  { display: flex; gap: .5rem; align-items: center; margin-bottom: .6rem; flex-wrap: wrap; }
.pay-method   { flex: 2; min-width: 0; }
.pay-sub      { flex: 2; min-width: 0; }   /* ② QR/Card 서브 선택: 동일 크기 */
.pay-currency { flex: 1; min-width: 0; }
.pay-amount   { flex: 2; min-width: 0; }
.payment-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.payment-actions .btn { flex: 1; min-width: 80px; }
.pay-print-btn { font-size: .88rem; }

/* ── 관리자 ──────────────────────────────────────────── */
.admin-page {}
.admin-nav { display: flex; gap: .4rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.admin-nav-link { padding: .45rem 1rem; border-radius: var(--radius-sm);
                  border: 1px solid var(--c-border); font-size: .88rem; font-weight: 600; }
.admin-nav-link.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.admin-nav-link:hover  { border-color: var(--c-primary); }

.stat-cards { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-card  { flex: 1; min-width: 160px; background: var(--c-surface);
               border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.2rem; }
.stat-label { font-size: .78rem; color: var(--c-muted); text-transform: uppercase;
              letter-spacing: .05em; margin-bottom: .4rem; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--c-primary); }
.stat-sub   { font-size: .85rem; color: var(--c-muted); margin-top: .2rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: var(--c-surface); padding: .65rem .8rem;
                  text-align: left; font-size: .78rem; color: var(--c-muted);
                  text-transform: uppercase; letter-spacing: .04em;
                  border-bottom: 2px solid var(--c-border); }
.data-table td { padding: .6rem .8rem; border-bottom: 1px solid var(--c-border); }
.data-table tr:hover td { background: #1e2030; }
.row-inactive td { opacity: .45; }

.report-filter { margin-bottom: 1rem; }
.filter-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-form .form-group { min-width: 150px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .report-grid { grid-template-columns: 1fr; } }

.menu-admin-toolbar { display: flex; justify-content: space-between;
                      align-items: center; margin-bottom: 1rem; }
.orders-toolbar { display: flex; justify-content: space-between;
                  align-items: flex-end; margin-bottom: .75rem; flex-wrap: wrap; gap: .75rem; }
.orders-toolbar h2 { font-size: 1.3rem; }
.orders-legend { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.rate-history { border-top: 1px solid var(--c-border); padding-top: .5rem; }
.rate-row { display: flex; gap: 1rem; font-size: .85rem; padding: .25rem 0; }

/* 배달 채널 */
.delivery-channel-btns { display: flex; gap: .75rem; }
.channel-label input[type=radio] { display: none; }
.channel-card { display: block; padding: .7rem 1.4rem; border: 2px solid var(--c-border);
                border-radius: var(--radius); font-weight: 700; cursor: pointer; }
.channel-label input:checked + .channel-card { border-color: var(--c-primary);
                                                color: var(--c-primary); background: #0d1e3d; }
.delivery-new-page { max-width: 440px; margin: 0 auto; }
.delivery-new-page h2 { margin-bottom: 1rem; }
.delivery-new-page .card { padding: 1.5rem; }

/* ── 배달 목록 ───────────────────────────────────────── */
.delivery-list-page { max-width: 720px; margin: 0 auto; }
.delivery-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }
.delivery-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); padding: .9rem 1.1rem;
  transition: border-color .15s;
}
.delivery-row:hover { border-color: var(--c-primary); }
.delivery-open  { border-left: 4px solid var(--c-success); }
.delivery-closed{ border-left: 4px solid var(--c-muted); opacity: .75; }
.delivery-row-left  { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.delivery-row-center{ flex: 0 0 60px; text-align: center; }
.delivery-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; min-width: 110px; }
.delivery-id   { font-weight: 700; color: var(--c-muted); font-size: .85rem; }
.delivery-company { font-weight: 800; font-size: .95rem; padding: .2rem .55rem;
                    border-radius: 4px; }
.company-grab  { background: #1a3a2a; color: #3cba6b; }
.company-egets { background: #1a2a3a; color: #3c8aba; }
.company-co    { background: #2a2a1a; color: #baba3c; }
.fee-note      { font-weight: 400; font-size: .75rem; opacity: .8; }
.delivery-ref  { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delivery-amount { font-weight: 700; font-size: 1rem; color: var(--c-text); }
.delivery-time   { font-size: .8rem; }
.status-pill { padding: .2rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.status-pill.status-open   { background: #0d2a1a; color: var(--c-success); }
.status-pill.status-closed { background: #222; color: var(--c-muted); }
.delivery-summary { display: flex; gap: 1.5rem; font-size: .9rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--c-muted); }
.empty-icon  { font-size: 2.5rem; margin-bottom: .5rem; }
.empty-text  { font-size: 1rem; }

/* ── Users/PIN 관리 ──────────────────────────────────── */
.role-legend { display: flex; align-items: center; gap: .5rem; font-size: .85rem; flex-wrap: wrap; }
.role-badge { padding: .2rem .55rem; border-radius: 4px; font-size: .78rem; font-weight: 700; }
.role-crew    { background: #1a2a3a; color: #5ba8e0; }
.role-cashier { background: #1a3a2a; color: #5be090; }
.role-admin   { background: #3a1a1a; color: #e05252; }
.row-inactive td { opacity: .5; }
.action-cell  { display: flex; gap: .4rem; }
.status-dot   { font-size: .9rem; }
.status-dot.status-open   { color: var(--c-success); }
.status-dot.status-closed { color: var(--c-muted); }
.form-error { color: var(--c-danger); font-size: .85rem; margin-top: .25rem; }

/* ── 모달 ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.modal-box {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.5rem; width: min(420px, 92vw);
  max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin-bottom: .25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }

/* ── 출력 버튼 ───────────────────────────────────────── */
.print-actions {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; border-top: 1px solid var(--c-border);
}
.print-status { font-size: .82rem; transition: color .2s; }
.print-status.printing { color: var(--c-muted); }
.print-status.ok  { color: var(--c-success); }
.print-status.err { color: var(--c-danger); }

/* ── 결제 완료 화면 ──────────────────────────────────── */
.payment-done-page {
  max-width: 420px; margin: 0 auto; padding: 1.5rem 1rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.done-header { text-align: center; }
.done-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--c-success); color: #000;
  font-size: 2rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .75rem;
}
.done-header h2 { font-size: 1.5rem; }
.done-sub { color: var(--c-muted); margin-top: .25rem; }
.done-summary { display: flex; flex-direction: column; gap: .4rem; }
.divider { border-top: 1px solid var(--c-border); margin: .4rem 0; }
.done-actions {
  display: flex; gap: .75rem; justify-content: center;
}
.done-actions .btn-lg { flex: 1; max-width: 180px; }

/* ── 캐셔 대시보드 ───────────────────────────────────── */
.cashier-dash {}

/* Header */
.cdash-header { display: flex; align-items: flex-end; gap: 1.2rem;
                flex-wrap: wrap; margin-bottom: 1.4rem; }
.cdash-header h2 { font-size: 1.3rem; white-space: nowrap; margin-bottom: 0; }
.cdash-form  { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.cdash-date  { max-width: 150px; }
.cdash-float { max-width: 120px; }
.cdash-calc-btn    { align-self: flex-end; white-space: nowrap; }
.cdash-saved-note  { align-self: flex-end; font-size: .8rem; color: var(--c-success);
                     background: #0d2a1a; padding: .25rem .7rem; border-radius: 20px;
                     white-space: nowrap; }
.cdash-exp-manual  { border-left: 3px solid var(--c-warning); padding-left: .6rem; }
.exp-manual-badge  { background: #3a2a00; color: var(--c-warning); font-size: .72rem;
                     padding: .1rem .4rem; border-radius: 4px; margin-left: .3rem;
                     vertical-align: middle; font-weight: 700; }
.exp-db-badge      { background: #0d2a1a; color: var(--c-success); font-size: .72rem;
                     padding: .1rem .4rem; border-radius: 4px; margin-left: .3rem;
                     vertical-align: middle; font-weight: 700; }

/* Rows */
.cdash-row { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Row 1 – Ideal / Diff / Actual */
.cdash-cmp { flex: 1; min-width: 180px; text-align: center; padding: 1.5rem 1rem; }
.cmp-label   { font-size: .75rem; color: var(--c-muted); text-transform: uppercase;
               letter-spacing: .07em; margin-bottom: .25rem; font-weight: 700; }
.cmp-formula { font-size: .78rem; color: var(--c-muted); margin-bottom: .6rem; }
.cmp-value   { font-size: 2rem; font-weight: 800; color: var(--c-primary); line-height: 1.1; }
.cmp-sub     { font-size: .82rem; color: var(--c-muted); margin-top: .3rem; }
.cmp-match   { font-size: 1.6rem; }
.cmp-diff-wrap { border: 2px solid var(--c-border); }
.cmp-danger  { color: var(--c-danger) !important; }
.cmp-success { color: var(--c-success) !important; }

/* Row 2 – Summary cards */
.cdash-sum { flex: 1; min-width: 130px; padding: 1.1rem 1.2rem; }
.sum-label  { font-size: .75rem; color: var(--c-muted); text-transform: uppercase;
              letter-spacing: .05em; margin-bottom: .4rem; font-weight: 700; }
.sum-value  { font-size: 1.6rem; font-weight: 800; color: var(--c-primary); }
.sum-sub    { font-size: .82rem; color: var(--c-muted); margin-top: .2rem; }

/* Row 3 – Breakdown tables */
.cdash-break-card { flex: 1; min-width: 280px; }
.cdash-sec-title  { font-size: .95rem; font-weight: 700;
                    margin-bottom: .75rem; color: var(--c-text); }
.ta-r { text-align: right; }
.cdash-subtotal td { background: #1e2133; font-weight: 600; }

/* ── Head Count 패널 ─────────────────────────────────── */
.hc-panel   { display: flex; flex-direction: column; align-items: center;
              justify-content: center; height: 100%; gap: 1.2rem;
              background: var(--c-surface); }

/* Compact 변형 — 한 줄 배치, 메뉴 영역을 가리지 않도록 최소 높이 */
.hc-panel-compact { height: auto; flex-direction: column;
                    gap: .3rem; padding: .55rem .7rem; align-items: stretch; }
.hc-panel-compact .hc-row { display: flex; align-items: center;
                            gap: .7rem; flex-wrap: wrap; justify-content: center; }
.hc-panel-compact .hc-item { display: flex; align-items: center; gap: .4rem; }
.hc-panel-compact .hc-item-eth { flex-wrap: wrap; }
.hc-panel-compact .hc-label { font-size: .85rem; color: var(--c-muted);
                              font-weight: 600; }
.hc-panel-compact .hc-divider { width: 1px; height: 22px;
                                background: var(--c-border); }
.hc-btn-sm  { width: 30px; height: 30px; border-radius: 50%;
              background: var(--c-border); border: none; color: var(--c-text);
              font-size: 1.1rem; font-weight: 700; cursor: pointer;
              line-height: 1; padding: 0; }
.hc-btn-sm:hover { background: var(--c-primary); }
.hc-num-sm  { font-size: 1.35rem; font-weight: 800; color: var(--c-primary);
              min-width: 28px; text-align: center; }
.eth-btn-sm { padding: .25rem .6rem; font-size: .82rem;
              border-radius: 14px; border-width: 1px; font-weight: 600; }
.hc-title   { font-size: 1rem; font-weight: 700; color: var(--c-muted);
              text-transform: uppercase; letter-spacing: .06em; }
.hc-controls{ display: flex; align-items: center; gap: 1.5rem; }
.hc-btn     { width: 56px; height: 56px; border-radius: 50%;
              background: var(--c-border); border: none; color: var(--c-text);
              font-size: 2rem; font-weight: 700; cursor: pointer; }
.hc-btn:hover { background: var(--c-primary); }
.hc-num     { font-size: 4rem; font-weight: 900; color: var(--c-primary);
              min-width: 80px; text-align: center; }
.hc-note    { font-size: .78rem; color: var(--c-muted); }
.eth-btns   { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.eth-btn    { padding: .45rem .9rem; border-radius: 20px; border: 2px solid var(--c-border);
              background: var(--c-bg); color: var(--c-text); font-size: .95rem;
              font-weight: 700; cursor: pointer; transition: all .15s; }
.eth-btn:hover  { border-color: var(--c-primary); color: var(--c-primary); }
.eth-btn.active { background: var(--c-primary); border-color: var(--c-primary);
                  color: #fff; }
.order-pax-bar { padding: .35rem .8rem; background: #0d2a1a;
                 color: var(--c-success); font-size: .85rem; font-weight: 700;
                 border-bottom: 1px solid var(--c-border); }

/* ── 권한 체크박스 ───────────────────────────────────── */
.perm-cell  { white-space: nowrap; }
.perm-checks{ display: flex; flex-wrap: wrap; gap: .3rem; }
.perm-check { display: inline-flex; align-items: center; gap: .25rem;
              font-size: .78rem; padding: .15rem .45rem;
              border: 1px solid var(--c-border); border-radius: 4px;
              cursor: pointer; user-select: none; }
.perm-check input { accent-color: var(--c-primary); cursor: pointer; }
.perm-check:has(input:checked) { border-color: var(--c-primary);
                                   background: #0d1e3d; color: var(--c-primary); }

/* ── 반응형 ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .order-page { flex-direction: column; height: auto; }
  .order-panel { width: 100%; }
  .table-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .6rem; }
  .table-card { min-height: 80px; padding: .8rem .5rem; }
  .table-number { font-size: 1.1rem; }
}

/* ────────────────────────────────────────────────────────
   주방 전용 화면 (Kitchen Display)
   ──────────────────────────────────────────────────────── */
.kitchen-body { background: #0b0d14; }

.kitchen-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.kitchen-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}

.shift-toggle {
  display: inline-flex; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: 999px; padding: 4px;
}
.shift-btn {
  background: transparent; color: var(--c-muted); border: none;
  padding: .55rem 1.4rem; border-radius: 999px; font-size: 1rem;
  font-weight: 600; cursor: pointer; transition: background .15s, color .15s;
}
.shift-btn.active { background: var(--c-primary); color: #fff; }
.shift-btn:not(.active):hover { color: var(--c-text); }

.kitchen-status {
  color: var(--c-muted); font-size: .95rem;
}
.kitchen-refresh {
  display: inline-block; margin-left: .6rem;
  color: var(--c-success); font-size: .8rem;
  animation: k-pulse 2s infinite;
}
@keyframes k-pulse { 0%,100% { opacity: .6 } 50% { opacity: 1 } }

.kitchen-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.kitchen-empty {
  margin-top: 3rem; text-align: center;
  color: var(--c-muted); font-size: 1.1rem;
}

/* ── 주문 카드 ── */
.k-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.k-card-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem;
  background: #141821;
  border-bottom: 1px solid var(--c-border);
}
.k-label {
  font-size: 1.3rem; font-weight: 700; color: var(--c-primary);
  letter-spacing: .02em;
}
.k-head-count {
  background: #1e2d1e; color: #7ecf7e;
  padding: 2px 9px; border-radius: 6px;
  font-size: .8rem; font-weight: 600;
}
.k-new-badge {
  background: var(--c-danger); color: #fff;
  padding: 2px 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  animation: k-pulse 1.2s infinite;
}
.k-order-timer {
  margin-left: auto;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 1rem; color: var(--c-muted);
}
.k-order-note {
  padding: .5rem .9rem;
  background: #2a1c10; color: #f0c070;
  border-bottom: 1px solid var(--c-border);
  font-size: .9rem; font-style: italic;
}
.k-items {
  list-style: none; padding: 0; margin: 0;
}

/* ── 개별 메뉴 아이템 ── */
.k-item {
  padding: .7rem .9rem .9rem;
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.k-item:last-child { border-bottom: none; }

.k-item-head {
  display: flex; align-items: center; gap: .6rem;
}
.k-item-no {
  color: var(--c-muted); min-width: 1.5rem;
  font-weight: 600;
}
.k-item-names { flex: 1; min-width: 0; }
.k-name-km {
  font-size: 1.15rem; line-height: 1.3;
  color: var(--c-text);
  word-break: break-word;
}
.k-name-en {
  font-size: .88rem; color: var(--c-muted);
  margin-top: 2px;
}
.k-qty {
  min-width: 48px; height: 44px;
  border: 2px solid var(--c-border);
  background: #1f2433; color: var(--c-text);
  border-radius: 8px;
  font-size: 1.4rem; font-weight: 700;
  cursor: pointer; user-select: none;
  transition: transform .08s;
  display: flex; align-items: center; justify-content: center;
}
.k-qty:active { transform: scale(.92); }
.k-qty.struck {
  text-decoration: line-through;
  color: var(--c-muted);
  background: #181b24;
  border-color: #2a2d3a;
}
.k-item-timer {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 1rem; min-width: 3.4rem; text-align: right;
  color: var(--c-muted);
  transition: color 0.3s ease;
}
.k-item-note {
  margin-top: .35rem; padding: .3rem .5rem;
  background: #2a1c10; color: #f0c070;
  border-radius: 4px; font-size: .85rem;
}

/* ── 상태 바 (타이머 기반 색상) ── */
.k-statusbar {
  height: 6px; margin-top: .6rem;
  background: #0c0e14; border-radius: 4px; overflow: hidden;
}
.k-statusbar-fill {
  height: 100%; width: 100%;
  transition: width .5s linear, background .3s;
}
.k-item.s-ok   .k-statusbar-fill { background: var(--c-success); }
.k-item.s-warn .k-statusbar-fill { background: var(--c-warning); }
.k-item.s-late .k-statusbar-fill { background: var(--c-danger); }
.k-item.s-ok   .k-item-timer { color: var(--c-success); }
.k-item.s-warn .k-item-timer { color: var(--c-warning); }
.k-item.s-late .k-item-timer { color: var(--c-danger); }
/* 터치 시 잠깐 초록 */
.k-item.tap-flash .k-item-timer {
  color: var(--c-success) !important;
  transition: none;
}

/* 조리 완료 항목: 이름에 가운뎃줄, 타이머 ✓ 초록 */
.k-item.done .k-name-km,
.k-item.done .k-name-en {
  text-decoration: line-through;
  color: var(--c-muted);
}
.k-item.done .k-item-timer {
  color: var(--c-success);
  font-size: 1.1rem;
}

/* 결제 완료(closed) 카드 */
.k-card.closed {
  opacity: .55;
  border-color: #1e3320;
}
.k-card.closed .k-card-head {
  background: #0d1a0f;
}
.k-paid-badge {
  margin-left: auto;
  background: #1a4a22; color: #5ddb7a;
  padding: 2px 9px; border-radius: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
}

/* 소형 화면: 카드 한 줄 */
@media (max-width: 640px) {
  .kitchen-list { grid-template-columns: 1fr; }
  .k-name-km { font-size: 1.05rem; }
  .k-qty { min-width: 42px; height: 40px; font-size: 1.2rem; }
}

/* ── 주방 메시지 패널 (order.html) ───────────────────────────── */
.kn-panel {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: .35rem .45rem;
  margin: .35rem 0;
  background: #0f1218;
}
.kn-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .35rem;
}
.kn-select, .kn-input {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 5px;
  padding: .4rem .55rem; font-size: .9rem;
  box-sizing: border-box;
}
.kn-select-cat  { min-width: 8.5rem; }
.kn-select-list { flex: 1 1 10rem; min-width: 9rem; }
.kn-input       { flex: 1 1 10rem; min-width: 9rem; }
.kn-add-btn {
  background: #f0c070; color: #1a1208;
  border: 0; border-radius: 5px;
  padding: .4rem .8rem; font-weight: 700; cursor: pointer;
  font-size: .9rem;
}
.kn-current-list {
  display: flex; flex-wrap: wrap; gap: .3rem;
  margin-top: .4rem;
}
.kn-current-list[hidden] { display: none; }
.kn-current-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #2a1c10; color: #f0c070;
  border: 1px solid #f0c070; border-radius: 14px;
  padding: .15rem .35rem .15rem .6rem;
  font-size: .8rem; font-weight: 700;
}
.kn-current-x {
  background: transparent; border: 0; color: #f0c070;
  font-size: .9rem; cursor: pointer; padding: 0 .2rem; line-height: 1;
}

/* 메시지가 있는 주방 카드: 노란색 테두리 강조 */
.k-card.has-note {
  border: 2px solid #f0c070;
  box-shadow: 0 0 0 1px rgba(240, 192, 112, .25) inset;
}
.k-card-head {
  flex-wrap: wrap;
}
.k-card-head .k-order-note {
  display: inline-block;
  flex: 1 1 auto;
  margin: 0 .3rem;
  padding: .25rem .55rem;
  background: #2a1c10; color: #f0c070;
  border: 1px solid #f0c070; border-radius: 4px;
  font-size: .85rem; font-style: normal; font-weight: 600;
  text-align: center;
  white-space: normal; word-break: break-word;
}
.k-card-head .k-order-note[hidden] { display: none; }
