/* dashboard 화면 (1단계 뼈대) - PC·모바일 같은 화면, 폭에 따라 바뀐다(설계 5절) */
:root {
  --bg: #fff; --fg: #1d1d1f; --muted: #6b6b70; --line: #e3e3e6; --soft: #f5f5f7;
  --accent: #2856c7; --warn: #b45309; --bad: #b91c1c; --ok: #15803d;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #18181b; --fg: #ececf0; --muted: #a0a0a8; --line: #2e2e33; --soft: #222226;
          --accent: #8aa8ff; --warn: #f59e0b; --bad: #f87171; --ok: #4ade80; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 system-ui, "Malgun Gothic", sans-serif; background: var(--bg); color: var(--fg); }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--line);
         padding-top: max(10px, env(safe-area-inset-top)); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.tab.on { background: var(--soft); font-weight: 600; }
main { padding: 16px; max-width: 1600px; margin: 0 auto; }
footer { padding: 8px 16px 16px; font-size: 12px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
h2 { font-size: 17px; margin: 4px 0 12px; }
.muted { color: var(--muted); }
.bad { color: var(--bad); }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 32px 20px; text-align: center; }
.empty p { margin: 6px 0; }
#toast { position: fixed; right: 16px; bottom: 16px; max-width: 420px; padding: 8px 12px; border-radius: 8px; background: var(--fg); color: var(--bg); opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: .95; }
#toast.err { background: var(--bad); color: #fff; }

.small { font-size: 12px; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.board-head h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
input, button { font: inherit; color: inherit; }
input { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; }
button { border: 1px solid var(--line); background: var(--soft); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.chart { width: 100%; height: 100%; min-height: 140px; }
.kpis { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.kpi-value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-label { font-size: 12px; }
.scroll { overflow-x: auto; max-height: 320px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12px; position: sticky; top: 0; background: var(--bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }


/* 보드: PC는 gridstack(12칸), 모바일 폭은 한 줄씩(.mobile-list) */
.widget { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.widget-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.widget-head h3 { font-size: 14px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-head.drag { cursor: move; }
.widget-note { font-size: 11px; white-space: nowrap; margin-left: auto; }
.widget-tools { display: flex; gap: 4px; }
.widget-tools button { padding: 1px 8px; font-size: 12px; }
.widget-body { flex: 1; min-height: 0; overflow: auto; }
.grid-stack { margin: 0 -6px; }
.grid-stack-item-content { overflow: visible !important; inset: 6px !important; }
.grid-stack-item-content > .widget { height: 100%; }
.mobile-list { display: flex; flex-direction: column; gap: 8px; }
.mobile-list .chart { height: 240px; }
.mobile-list .widget-body { overflow: visible; }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 8px; background: var(--soft); color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: default; }
select { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; }
input.n { width: 80px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; }
.row.end { justify-content: flex-end; }
dialog.editor { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--fg); padding: 16px 18px; }
dialog.small-dlg { width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h2 { margin-top: 0; }
dialog h3 { font-size: 14px; margin: 12px 0 4px; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form > label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.form > label > input, .form > label > select { color: var(--fg); font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0; }
legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 2px; margin: 2px 12px 2px 0; }
.preview { border: 1px dashed var(--line); border-radius: 8px; padding: 8px; min-height: 120px; margin-top: 10px; display: flex; flex-direction: column; }
.preview .chart { height: 220px; }
ol.order, ul.people { padding-left: 20px; margin: 6px 0; }
ol.order li, ul.people li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); }
ul.people { list-style: none; padding-left: 0; max-height: 200px; overflow: auto; }

/* 폰 등록(4단계) */
button.big { font-size: 16px; padding: 10px 18px; margin: 8px 0; }
.qr { margin: 10px 0; }
.qr img { background: #fff; padding: 6px; border-radius: 8px; }

/* 모바일 폭: 머리글을 한 줄로 줄이고 여백을 좁힌다 */
@media (max-width: 640px) {
  header { padding: 8px 12px; gap: 6px 10px; }
  main { padding: 12px; }
  .common-user { font-size: 12px; }
  #toast { left: 12px; right: 12px; max-width: none; }
  .kpi-value { font-size: 22px; }
}

/* 런처로 링크(M-40) */
.to-launcher { color: inherit; opacity: .75; font-size: 13px; text-decoration: none; margin-right: 12px; white-space: nowrap; }
.to-launcher:hover { opacity: 1; text-decoration: underline; }
.to-launcher[hidden] { display: none; }
