/* ───────── tokens — FanSee 색상 (day / night) ─────────
 * 브랜드 핑크 #FF2E93, 보조 블루 #488EFF
 * day  : 배경 #FFFFFF · 패널 #F5F6F9 / #F1F1F5 · 글자 #15151B · 보조 글자 #667085 · 선 #E0E2E8 · 연핑크 #FFE7F2
 * night: 배경 #0A0A0D · 패널 #181920 / #24242C · 글자 #FFFFFF · 보조 글자 #A2A8B8 · 선 #30323B · 진핑크 #321626
 */
:root {
  --page: #ffffff;          /* 쇼핑몰 바탕 */
  --bg: #f5f6f9;            /* 백오피스 바탕 */
  --surface: #ffffff;
  --surface-2: #f1f1f5;
  --ink: #15151b;
  --muted: #667085;
  --line: #e0e2e8;
  --accent: #ff2e93;
  --accent-ink: #ffffff;
  --accent-soft: #ffe7f2;
  --accent-soft-ink: #d6006f;
  --info: #488eff;
  --sticker: #ff2e93;
  --sticker-ink: #ffffff;
  --star: #f5a300;
  --star-off: #dfe2e8;
  --good: #12a150;
  --warn: #c77700;
  --bad: #e5484d;
  --overlay: rgb(10 10 13 / .6);
  --shadow: 0 1px 2px rgb(21 21 27 / .06), 0 8px 24px -12px rgb(21 21 27 / .18);
  --radius: 14px;
  --f-display: "Do Hyeon", "IBM Plex Sans KR", system-ui, sans-serif;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0a0a0d; --bg: #0a0a0d; --surface: #181920; --surface-2: #24242c; --ink: #ffffff; --muted: #a2a8b8;
    --line: #30323b; --accent: #ff2e93; --accent-ink: #ffffff; --accent-soft: #321626; --accent-soft-ink: #ff6fb9;
    --info: #488eff; --sticker: #ff2e93; --sticker-ink: #ffffff; --star: #ffc445; --star-off: #30323b;
    --good: #40c97a; --warn: #ffc445; --bad: #ff6b6b; --overlay: rgb(0 0 0 / .7);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0a0a0d; --bg: #0a0a0d; --surface: #181920; --surface-2: #24242c; --ink: #ffffff; --muted: #a2a8b8;
  --line: #30323b; --accent: #ff2e93; --accent-ink: #ffffff; --accent-soft: #321626; --accent-soft-ink: #ff6fb9;
  --info: #488eff; --sticker: #ff2e93; --sticker-ink: #ffffff; --star: #ffc445; --star-off: #30323b;
  --good: #40c97a; --warn: #ffc445; --bad: #ff6b6b; --overlay: rgb(0 0 0 / .7);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* ───────── base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--f-body); letter-spacing: -0.01em;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 20px; }
@media (max-width: 480px) { .wrap { padding-inline: 16px; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── controls ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
a.btn { color: inherit; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 9px 12px; min-height: 40px;
}
.textarea { resize: vertical; min-height: 88px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pill.bad  { color: var(--bad);  background: color-mix(in srgb, var(--bad) 14%, transparent); }

.stars { color: var(--star); letter-spacing: 1px; }
.stars .off { color: var(--star-off); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }

/* dialog */
dialog {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--ink);
  width: min(960px, calc(100% - 24px)); max-height: calc(100% - 24px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45);
}
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
dialog { overflow-x: hidden; overscroll-behavior: contain; }
@media (max-width: 640px) {
  /* 휴대폰에서는 아래에서 올라오는 시트 */
  dialog {
    width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0;
    border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
body:has(dialog[open]) { overflow: hidden; }
.dlg-close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; line-height: 1; z-index: 2;
}

/* 좁은 화면에서 표를 카드처럼 쌓기: <table class="stack">, 셀마다 data-label */
@media (max-width: 640px) {
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  table.stack td.main { grid-column: 1 / -1; }
  table.stack td.m-first { grid-column: 1; grid-row: 1; }
  table.stack td.end { grid-column: 2; grid-row: 1; justify-self: end; text-align: right; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; margin-right: 6px; }
  table.stack td[colspan] { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
