/* =====================================================================
   QR 스마트 오더 — 관리자 공용 다크테마 (총괄/식당)
   팔레트: 배경 #1e1e1e / 패널 #2b2b2b / 포인트 #00bcd4 / 입력 #333
   ===================================================================== */
:root {
  --bg: #1e1e1e; --panel: #2b2b2b; --panel2: #333; --line: #3d3d3d;
  --text: #e8e8e8; --muted: #9a9a9a; --accent: #00bcd4; --accent-dark: #0097a7;
  --green: #2ecc71; --orange: #f5a623; --red: #e74c3c; --blue: #4f8cff; --purple: #b388ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'Malgun Gothic','Apple SD Gothic Neo','Noto Sans KR',sans-serif; font-size: 15px; line-height: 1.5; min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; }
button, input, select, textarea { font-family: inherit; font-size: 15px; }
img { max-width: 100%; }

/* ---------- 상단바 ---------- */
.topbar { background: #171717; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 14px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 800; color: #fff; font-size: 17px; white-space: nowrap; }
.brand small { color: var(--accent); font-weight: 700; margin-left: 6px; font-size: 12px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a, .nav button { background: none; border: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 14px; }
.nav a.active, .nav button.active { color: #fff; background: var(--panel); }
.nav a:hover, .nav button:hover { color: #fff; }
.who { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.who b { color: #fff; }

/* ---------- 레이아웃 ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 16px 60px; }
.section { display: none; }
.section.active { display: block; }
.panel { background: var(--panel); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16px; color: #fff; }
.panel-head .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }

/* ---------- 요약 카드 ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border-radius: 12px; padding: 14px 16px; }
.card .lbl { color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.card .val { font-size: 22px; font-weight: 800; color: #fff; white-space: nowrap; }
.card .val.accent { color: var(--accent); }
.card .val.green { color: var(--green); }
.card .val.orange { color: var(--orange); }
.card .val.red { color: var(--red); }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- 테이블 현황 그리드 ---------- */
.tgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.tcard { background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; min-height: 96px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; transition: transform .1s; position: relative; }
.tcard:active { transform: scale(.97); }
.tcard h4 { font-size: 15px; color: #fff; }
.tcard p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.tcard .amt { font-size: 13px; font-weight: 800; color: #fff; margin-top: 2px; }
.tcard.waiting   { border-color: var(--orange); background: rgba(245,166,35,.12); animation: blink 1.2s infinite; }
.tcard.accepted  { border-color: var(--red);    background: rgba(231,76,60,.12); }
.tcard.completed { border-color: var(--green);  background: rgba(46,204,113,.12); }
.tcard.waiting p { color: var(--orange); font-weight: 700; }
.tcard.accepted p { color: var(--red); font-weight: 700; }
.tcard.completed p { color: var(--green); font-weight: 700; }
.tcard .badge { position: absolute; top: 6px; right: 8px; background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; font-weight: 800; }
.tcard.off { opacity: .35; cursor: default; }
@keyframes blink { 0%,100% { box-shadow: 0 0 0 0 rgba(245,166,35,.5);} 50% { box-shadow: 0 0 0 6px rgba(245,166,35,0);} }

/* ---------- 표 ---------- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; }
th { background: #242424; color: var(--muted); font-size: 13px; font-weight: 700; padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 10px; border-bottom: 1px solid #353535; font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #303030; }
tr.row-empty td { color: #666; }
tr.total td { background: #242424; font-weight: 800; color: #fff; }
td.won, th.won { text-align: right; white-space: nowrap; }
.green { color: var(--green); } .orange { color: var(--orange); } .red { color: var(--red); } .accent { color: var(--accent); }

/* ---------- 상태 배지 ---------- */
.st { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.st-waiting   { background: rgba(245,166,35,.2); color: var(--orange); }
.st-accepted  { background: rgba(231,76,60,.2); color: var(--red); }
.st-completed { background: rgba(46,204,113,.2); color: var(--green); }
.st-cleared   { background: rgba(255,255,255,.08); color: var(--muted); }
.st-cancelled { background: rgba(255,255,255,.08); color: #777; text-decoration: line-through; }
.st-on  { background: rgba(46,204,113,.2); color: var(--green); }
.st-off { background: rgba(255,255,255,.08); color: var(--muted); }

/* ---------- 버튼 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #0b0b0b; border: none; padding: 10px 16px; border-radius: 8px; font-weight: 800; cursor: pointer; font-size: 14px; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.xs { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.gray { background: #444; color: #eee; } .btn.gray:hover { background: #555; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); } .btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn.green { background: var(--green); color: #0b0b0b; } .btn.green:hover { background: #27ae60; color: #fff; }
.btn.red { background: var(--red); color: #fff; } .btn.red:hover { background: #c0392b; }
.btn.orange { background: var(--orange); color: #0b0b0b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-sep { color: #555; }

/* ---------- 폼 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=month], input[type=time], input[type=url], select, textarea {
  width: 100%; background: var(--panel2); color: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[readonly], input:disabled { background: #2a2a2a; color: #888; }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, #aaa 50%), linear-gradient(135deg, #aaa 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=file] { color: var(--muted); font-size: 13px; }
input[type=time] { color-scheme: dark; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #555; border-radius: 24px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }

/* ---------- 모달 ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 100; display: none; align-items: center; justify-content: center; padding: 14px; }
.modal.open { display: flex; }
.modal-box { background: var(--panel); border-radius: 14px; width: 100%; max-width: 480px; max-height: calc(100dvh - 28px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-box.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.modal-head h3 { font-size: 16px; color: #fff; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; flex-wrap: wrap; }
.x { width: 40px; height: 40px; border: none; background: none; cursor: pointer; position: relative; font-size: 0; flex-shrink: 0; }
.x::before, .x::after { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 2px; background: #aaa; transform: translate(-50%,-50%) rotate(45deg); }
.x::after { transform: translate(-50%,-50%) rotate(-45deg); }
.x:hover::before, .x:hover::after { background: #fff; }

/* ---------- 주문 상세 ---------- */
.order-box { background: var(--panel2); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.order-box .oh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.order-box .oh b { color: #fff; }
.order-box .it { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; gap: 10px; }
.order-box .it span:last-child { white-space: nowrap; }
.order-box .sum { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; display: flex; justify-content: space-between; font-weight: 800; color: #fff; }
.order-box .memo { background: rgba(0,188,212,.1); color: var(--accent); font-size: 13px; border-radius: 6px; padding: 6px 10px; margin-top: 8px; }

/* ---------- 메뉴 관리 ---------- */
.menu-row { display: flex; align-items: center; gap: 12px; background: var(--panel2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.menu-row .thumb { width: 60px; height: 60px; border-radius: 8px; background: #222; object-fit: cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #555; font-size: 11px; overflow: hidden; }
.menu-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu-row .info { flex: 1; min-width: 0; }
.menu-row .info b { color: #fff; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-row .info .desc { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-row .info .price { color: var(--accent); font-weight: 800; font-size: 14px; }
.menu-row.soldout .info b { color: #888; }
.menu-row.hidden-menu { opacity: .5; }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-tabs button { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); padding: 7px 14px; border-radius: 20px; cursor: pointer; font-weight: 700; font-size: 13px; }
.cat-tabs button.active { background: var(--accent); color: #0b0b0b; border-color: var(--accent); }

/* ---------- 매출 그래프 ---------- */
.graph { display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 1px solid var(--line); padding-bottom: 4px; overflow-x: auto; }
.gbar { flex: 1; min-width: 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; cursor: pointer; }
.gbar div { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; transition: height .4s; }
.gbar.today div { background: var(--green); }
.gbar:hover div { opacity: 1; }
.gbar small { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ---------- QR ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.qr-item { background: #fff; color: #111; border-radius: 12px; padding: 14px; text-align: center; }
.qr-item .qrbox { display: flex; justify-content: center; margin: 6px 0; }
.qr-item b { display: block; font-size: 16px; }
.qr-item small { color: #555; font-size: 11px; word-break: break-all; }

/* ---------- 알림/토스트 ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #111; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 300; opacity: 0; pointer-events: none; transition: .25s; border: 1px solid var(--line); white-space: nowrap; }
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); }
.info-note { background: rgba(0,188,212,.08); border: 1px dashed rgba(0,188,212,.4); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: #cfd8dc; line-height: 1.7; }
.empty { color: #666; text-align: center; padding: 30px 0; }
.sync-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.sync-dot.off { background: var(--red); }

/* ---------- 로그인 ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: var(--panel); border-radius: 16px; padding: 34px 28px; width: 100%; max-width: 380px; }
.login-box h1 { color: #fff; font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: var(--accent); font-size: 13px; font-weight: 700; margin-bottom: 24px; }
.login-err { background: rgba(231,76,60,.15); color: #ff8a80; border-radius: 8px; padding: 10px; font-size: 13px; text-align: center; margin-bottom: 12px; }

/* ---------- 모바일 ---------- */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .tgrid { grid-template-columns: repeat(3, 1fr); }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .wrap { padding: 12px 10px 50px; }
  .panel { padding: 14px 12px; }
  .card .val { font-size: 18px; }
  .tgrid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tcard { min-height: 86px; }
  th, td { padding: 8px 6px; font-size: 13px; }
  .topbar-inner { padding: 0 10px; gap: 8px; }
  .nav a, .nav button { padding: 8px 9px; font-size: 13px; }
  .who { display: none; }
  .modal { padding: 8px; align-items: flex-end; }
  .modal-box { max-height: calc(100dvh - 16px); }
  .qr-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px), (pointer: coarse) {
  input, select, textarea, button { font-size: 16px; }
  .btn.sm { font-size: 14px; } .btn.xs { font-size: 13px; }
}
@media print {
  .topbar, .nav, .panel-head .tools, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
  .qr-item { border: 1px solid #ccc; page-break-inside: avoid; }
}

/* ---------- 영업시간 설정 UI (assets/js/hours_ui.js) ---------- */
.hours-ui { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.hours-head .hours-on-text { font-size: 13px; color: var(--muted); }
.hours-body { margin-top: 12px; }
.hours-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.chip { background: transparent; color: #ddd; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.tp-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.tp { display: grid; grid-template-columns: auto auto; gap: 6px; }
.tp-label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-weight: 700; }
.tp select { width: auto; min-width: 96px; padding: 9px 30px 9px 12px; font-size: 15px; background-color: var(--panel); }
.tp-sep { color: var(--muted); font-size: 18px; padding-bottom: 9px; }
.hours-preview { margin-top: 10px; color: #ddd; }
.hours-preview b { color: var(--accent); font-weight: 700; }
@media (max-width: 600px) { .tp select { min-width: 84px; font-size: 14px; } }
