/* ============================================================
   晚开的花 · WANWAN CONSOLE
   Editorial cream + deep green visual system
   ============================================================ */
:root {
  --ink: #102b1d;
  --ink-2: #1b3a2a;
  --ink-3: #2b4d3b;
  --cream: #f3ead8;
  --cream-2: #e7d8bb;
  --cream-3: #d9c59f;
  --paper: #fffdf7;
  --bg: #f6f1e7;
  --bg-2: #efe7d7;
  --line: #e5dac6;
  --line-strong: #d7c7a9;
  --gold: #ac8850;
  --gold-soft: #c9ae7c;
  --muted: #8a8477;
  --muted-2: #aea797;
  --green: #3e6d52;
  --red: #b04a3d;
  --blue: #4d6f82;
  --shadow: 0 18px 50px rgba(35, 30, 20, 0.08);
  --shadow-soft: 0 8px 26px rgba(35, 30, 20, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 22px;
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
.hidden, [hidden] { display: none !important; }
.icon-14 { width: 14px; height: 14px; opacity: .7; }
.mono { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: var(--bg);
}
.login-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #0b160f;
}
.login-hero {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(.75) brightness(.72);
  transform: scale(1.015);
}
.login-visual-scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 20% 20%, rgba(9, 30, 18, .15), transparent 55%),
    linear-gradient(180deg, rgba(6, 20, 12, .58) 0%, rgba(6, 20, 12, .18) 42%, rgba(6, 20, 12, .86) 100%);
}
.login-brand {
  position: absolute; top: 44px; left: 52px;
  display: flex; align-items: center; gap: 16px;
  color: var(--cream);
}
.brand-mark { width: 50px; height: 50px; border-radius: 50%; }
.brand-mark.small { width: 42px; height: 42px; }
.login-brand .brand-en {
  font-size: 9px; letter-spacing: .3em; color: var(--gold-soft); margin-bottom: 4px;
}
.login-brand h1 {
  font-family: var(--serif); font-size: 30px; font-weight: 500; letter-spacing: .12em; line-height: 1;
}
.login-quote {
  position: absolute; left: 52px; bottom: 124px; color: var(--cream);
}
.quote-cn {
  font-family: var(--serif); font-size: clamp(32px, 3.4vw, 52px);
  line-height: 1.42; letter-spacing: .08em; font-weight: 400;
  text-shadow: 0 4px 40px rgba(0,0,0,.25);
}
.quote-en {
  margin-top: 22px; font-size: 10px; letter-spacing: .32em; color: rgba(243, 234, 216, .62);
}
.login-foot {
  position: absolute; left: 52px; bottom: 46px;
  font-size: 11px; color: rgba(243, 234, 216, .45); letter-spacing: .16em;
}
.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; position: relative;
}
.login-panel::before {
  content: ""; position: absolute; width: 56%; height: 76%;
  border: 1px solid var(--line); border-radius: 48% 48% 40% 40%;
  opacity: .55; pointer-events: none;
}
.login-card { width: min(410px, 100%); position: relative; z-index: 1; }
.login-kicker {
  font-size: 9px; letter-spacing: .32em; color: var(--gold); margin-bottom: 18px;
}
.login-card h2 {
  font-family: var(--serif); font-size: 44px; font-weight: 500; letter-spacing: .06em;
}
.login-sub { color: var(--muted); margin: 12px 0 34px; line-height: 1.7; font-size: 13px; }
.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block; font-size: 11px; letter-spacing: .12em; color: var(--muted);
  margin-bottom: 8px;
}
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); background: rgba(255, 253, 247, .7);
  border-radius: 12px; padding: 13px 15px; outline: none; transition: .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink-2); background: var(--paper);
  box-shadow: 0 0 0 4px rgba(27, 58, 42, .06);
}
.field textarea { min-height: 100px; resize: vertical; line-height: 1.65; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error {
  background: #f8e9e5; color: var(--red); padding: 10px 13px; border-radius: 10px;
  font-size: 12px; margin: -4px 0 14px;
}
.btn {
  border: 1px solid transparent; border-radius: 999px; padding: 11px 20px;
  background: transparent; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 13px; letter-spacing: .04em; transition: .2s ease; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--ink-3); }
.btn-cream { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.btn-cream:hover { background: #fbf4e5; }
.btn-outline { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-outline:hover { border-color: var(--ink-2); background: rgba(255,255,255,.4); }
.btn-danger { color: var(--red); border-color: #e3bdb4; background: rgba(255,255,255,.55); }
.btn-danger:hover { background: #fbeeea; }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: rgba(16,43,29,.05); }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-xs { padding: 5px 10px; font-size: 11px; }
.btn-block { width: 100%; padding: 15px 20px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.demo-accounts { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.demo-accounts > p { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin-bottom: 12px; }
.account-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.account-chips button {
  border: 1px solid var(--line); background: rgba(255,253,247,.55); border-radius: 999px;
  padding: 7px 13px; font-size: 11px; color: var(--ink-2); transition: .2s;
}
.account-chips button:hover { background: var(--paper); border-color: var(--gold-soft); }
.login-note {
  margin-top: 26px; font-size: 10px; color: var(--muted-2); display: flex; align-items: center; gap: 7px;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%; background: #5b8a68; display: inline-block;
  box-shadow: 0 0 0 4px rgba(91,138,104,.12);
}
.dot.offline { background: var(--red); box-shadow: 0 0 0 4px rgba(176,74,61,.12); }
.dot.gold { background: var(--gold); box-shadow: 0 0 0 4px rgba(172,136,80,.12); }

/* ---------- App shell ---------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background:
    radial-gradient(90% 55% at 10% 0%, rgba(74, 111, 84, .28), transparent 60%),
    linear-gradient(180deg, #122f20 0%, #0b2016 100%);
  color: var(--cream);
  display: flex; flex-direction: column;
  padding: 26px 18px 18px;
  overflow-y: auto;
  z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 0; }
.sidebar-brand {
  display: flex; gap: 12px; align-items: center; padding: 0 10px 26px;
  border-bottom: 1px solid rgba(243, 234, 216, .12);
}
.sidebar-brand strong {
  display: block; font-family: var(--serif); font-size: 19px; font-weight: 500;
  letter-spacing: .1em;
}
.sidebar-brand span {
  display: block; font-size: 7px; letter-spacing: .24em; color: rgba(243,234,216,.45);
  margin-top: 4px;
}
.nav { flex: 1; padding: 20px 0 10px; }
.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 8px; letter-spacing: .24em; color: rgba(243,234,216,.32);
  padding: 0 12px; margin-bottom: 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px; color: rgba(243,234,216,.72);
  font-size: 12.5px; letter-spacing: .03em; transition: .18s ease; position: relative;
}
.nav-item img { width: 18px; height: 18px; opacity: .68; transition: .18s; }
.nav-item:hover { background: rgba(243,234,216,.06); color: var(--cream); }
.nav-item.active { background: var(--cream); color: var(--ink); font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.nav-item.active img { opacity: 1; }
.nav-item .nav-count {
  margin-left: auto; min-width: 19px; height: 19px; border-radius: 10px;
  background: rgba(243,234,216,.12); color: var(--cream); font-size: 9px;
  display: grid; place-items: center; padding: 0 5px;
}
.nav-item.active .nav-count { background: var(--ink); color: var(--cream); }
.sidebar-foot { border-top: 1px solid rgba(243,234,216,.12); padding-top: 14px; }
.realtime-state {
  display: flex; align-items: center; gap: 8px; font-size: 10px;
  color: rgba(243,234,216,.48); padding: 0 10px 14px;
}
.realtime-state .dot { width: 5px; height: 5px; }
.sidebar-user {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 0; background: rgba(243,234,216,.06);
  border-radius: 12px; color: var(--cream); text-align: left;
}
.sidebar-user:hover { background: rgba(243,234,216,.1); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--cream); color: var(--ink);
  display: grid; place-items: center; font-family: var(--serif); font-size: 15px;
}
.sidebar-user-text { min-width: 0; flex: 1; }
.sidebar-user-text strong { display: block; font-size: 11.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-text em { display: block; font-style: normal; font-size: 9px; color: rgba(243,234,216,.45); margin-top: 3px; }
.logout-btn {
  width: 100%; border: 0; background: transparent; color: rgba(243,234,216,.38);
  font-size: 10px; margin-top: 8px; padding: 6px;
}
.logout-btn:hover { color: var(--cream); }

.main-area { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 92px; padding: 0 34px;
  display: flex; align-items: center; gap: 22px;
  border-bottom: 1px solid rgba(215, 199, 169, .55);
  background: rgba(246, 241, 231, .78);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.crumb { min-width: 0; flex: 1; }
.crumb > span {
  display: block; font-size: 9px; letter-spacing: .24em; color: var(--gold);
  margin-bottom: 5px; text-transform: uppercase;
}
.crumb h1 {
  font-family: var(--serif); font-size: 25px; font-weight: 500; letter-spacing: .03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.store-switcher {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-strong); background: rgba(255,253,247,.6);
  border-radius: 999px; padding: 7px 8px 7px 13px;
}
.store-switcher img { width: 15px; height: 15px; opacity: .65; }
.store-switcher select {
  border: 0; background: transparent; outline: none; padding: 3px 24px 3px 2px;
  font-size: 12px; max-width: 190px; cursor: pointer;
}
.store-switcher.single {
  background: transparent; border-color: transparent; padding-left: 0;
}
.store-switcher.single select {
  appearance: none; -webkit-appearance: none; cursor: default;
  padding-right: 0; color: var(--ink); font-weight: 500;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: rgba(255,253,247,.55); display: grid; place-items: center;
  transition: .2s;
}
.icon-btn img { width: 17px; height: 17px; opacity: .65; }
.icon-btn:hover { background: var(--paper); box-shadow: var(--shadow-soft); }
.admin-pill {
  display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted);
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
}
.mobile-menu { display: none; border: 0; background: transparent; width: 36px; height: 36px; }
.mobile-menu img { width: 22px; }
.sidebar-scrim { display: none; }

.view {
  padding: 30px 34px 56px;
  max-width: 1580px;
  width: 100%;
  margin: 0 auto;
  outline: none;
}
.view > .page-enter { animation: pageIn .38s cubic-bezier(.2,.7,.2,1) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Shared page components ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head-left h2 {
  font-family: var(--serif); font-size: 31px; font-weight: 500; letter-spacing: .03em;
}
.page-head-left p { color: var(--muted); font-size: 12px; margin-top: 7px; line-height: 1.6; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 28px 0 13px;
}
.section-head h3 {
  font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: .03em;
}
.section-head p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.text-link {
  border: 0; background: transparent; color: var(--gold); font-size: 11px; letter-spacing: .08em;
  padding: 4px 0; display: inline-flex; align-items: center; gap: 5px;
}
.text-link::after { content: "↗"; font-size: 10px; }
.text-link:hover { color: var(--ink); }

.card {
  background: var(--paper);
  border: 1px solid rgba(229, 218, 198, .8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.card-pad { padding: 24px; }
.card-head {
  padding: 20px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.card-head h3 { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.card-head p { font-size: 10px; color: var(--muted); margin-top: 4px; }
.card-body { padding: 20px 22px; }
.card-tight { border-radius: 18px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 22px 22px 20px;
  min-height: 142px;
  background: var(--paper);
  border: 1px solid rgba(229,218,198,.8);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}
.kpi.primary { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.kpi.primary::after {
  content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%;
  border: 1px solid rgba(243,234,216,.15); right: -52px; top: -62px;
}
.kpi.primary::before {
  content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%;
  border: 1px solid rgba(243,234,216,.1); right: -18px; top: -25px;
}
.kpi-label { font-size: 10px; letter-spacing: .14em; color: var(--muted); margin-bottom: 18px; }
.kpi.primary .kpi-label { color: rgba(243,234,216,.55); }
.kpi-value {
  font-family: var(--serif); font-size: 38px; line-height: 1; font-weight: 500;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums;
}
.kpi-value small { font-size: 15px; margin-right: 2px; color: var(--muted); }
.kpi.primary .kpi-value small { color: rgba(243,234,216,.55); }
.kpi-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; font-size: 10px; color: var(--muted);
}
.kpi.primary .kpi-foot { color: rgba(243,234,216,.55); }
.delta-up { color: #3e7a52; }
.delta-down { color: var(--red); }
.kpi.primary .delta-up { color: #a8d3b1; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 14px; margin-top: 14px; }
.dashboard-grid.equal { grid-template-columns: 1fr 1fr; }
.dashboard-grid.three { grid-template-columns: 1.2fr .9fr 1fr; }
.chart-wrap { padding: 16px 20px 12px; }
.chart-wrap svg { width: 100%; height: 230px; overflow: visible; }
.chart-grid-line { stroke: #eee7d9; stroke-width: 1; stroke-dasharray: 2 5; }
.chart-label { font-size: 9px; fill: var(--muted-2); }
.chart-line { fill: none; stroke: var(--ink-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaFill); opacity: .55; }
.chart-dot { fill: var(--paper); stroke: var(--ink-2); stroke-width: 2; }
.chart-value { font-size: 9px; fill: var(--ink-2); font-family: var(--serif); }
.chart-legend { display: flex; gap: 16px; font-size: 10px; color: var(--muted); padding: 0 4px 8px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 18px; height: 2px; background: var(--ink-2); display: inline-block; }

.donut-wrap { display: flex; align-items: center; gap: 24px; padding: 26px 22px; }
.donut {
  width: 138px; height: 138px; border-radius: 50%; flex: 0 0 138px;
  position: relative; display: grid; place-items: center;
}
.donut::after {
  content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--paper);
}
.donut-center { position: relative; z-index: 2; text-align: center; }
.donut-center strong { font-family: var(--serif); font-size: 30px; font-weight: 500; display: block; }
.donut-center span { font-size: 9px; color: var(--muted); letter-spacing: .1em; }
.legend-list { flex: 1; display: grid; gap: 9px; }
.legend-row { display: flex; align-items: center; font-size: 11px; gap: 8px; }
.legend-row i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.legend-row span { color: var(--muted); }
.legend-row b { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; }

.mini-order-list { display: grid; }
.mini-order {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid #f2ecdf; transition: .15s; cursor: pointer;
}
.mini-order:last-child { border-bottom: 0; }
.mini-order:hover { background: #fbf7ed; }
.mini-order .order-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--cream);
  display: grid; place-items: center; font-family: var(--serif); font-size: 14px; flex: 0 0 34px;
}
.mini-order-main { flex: 1; min-width: 0; }
.mini-order-main strong { display: block; font-size: 12px; font-weight: 500; }
.mini-order-main span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.mini-order .amount { font-size: 12px; font-family: var(--serif); white-space: nowrap; }
.mini-order .badge { margin-left: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px; font-size: 9.5px;
  background: #f0ecdf; color: var(--muted); white-space: nowrap;
  letter-spacing: .02em;
}
.badge.pending_payment { background: #f6eddd; color: #9a7437; }
.badge.paid { background: #f9e6e2; color: var(--red); }
.badge.accepted { background: #e9eff1; color: var(--blue); }
.badge.preparing { background: #f1eddc; color: #8a7035; }
.badge.ready { background: #e6f0e6; color: var(--green); }
.badge.delivering { background: #e4eef1; color: var(--blue); }
.badge.completed { background: #e6efe6; color: #3e6d52; }
.badge.cancelled { background: #eeeae2; color: #9c9588; }
.badge.refunded { background: #f1e4e0; color: #9c5147; }
.badge.active, .badge.available { background: #e7f0e7; color: var(--green); }
.badge.paused, .badge.expired, .badge.used, .badge.gifted { background: #f0ece2; color: #958d7e; }
.badge.locked { background: #f7eddb; color: #9a7437; }
.badge.archived { background: #ede9df; color: #8a8477; }
.badge.gold { background: #f5eddc; color: var(--gold); }
.badge.soft { background: #f4f0e5; color: var(--muted); }

.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 15px; min-width: 240px;
}
.search-box img { width: 14px; height: 14px; opacity: .45; }
.search-box input { border: 0; background: transparent; outline: none; flex: 1; font-size: 12px; }
.select-pill {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 9px 13px; font-size: 11px; outline: none; cursor: pointer;
}
.tabs {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--bg-2); border-radius: 999px; padding: 4px;
  overflow-x: auto; max-width: 100%;
}
.tab {
  border: 0; background: transparent; border-radius: 999px;
  padding: 8px 15px; font-size: 11.5px; color: var(--muted); white-space: nowrap;
  transition: .18s;
}
.tab.active { background: var(--paper); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.05); font-weight: 600; }
.tab .count { font-size: 9px; color: var(--muted-2); margin-left: 5px; }
.tab.active .count { color: var(--gold); }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.segmented button { border: 0; background: transparent; padding: 8px 14px; font-size: 11px; color: var(--muted); }
.segmented button.active { background: var(--ink); color: var(--cream); }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 7px 13px; font-size: 10.5px; color: var(--muted);
}
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data th {
  text-align: left; font-size: 9.5px; font-weight: 500; letter-spacing: .12em;
  color: var(--muted-2); padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: #fbf7ed; white-space: nowrap;
}
table.data td { padding: 13px 14px; border-bottom: 1px solid #f2ecdf; font-size: 12px; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: .15s; }
table.data tbody tr:hover { background: #fcf8ef; }
table.data .cell-main { font-weight: 500; }
table.data .cell-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
table.data .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }
.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 18px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted);
}
.pager { display: flex; gap: 5px; }
.pager button {
  min-width: 29px; height: 29px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 8px; font-size: 10px; color: var(--muted);
}
.pager button.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.pager button:disabled { opacity: .35; }

.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.product-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; box-shadow: var(--shadow-soft); transition: .22s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.product-cover { aspect-ratio: 1.2; overflow: hidden; background: var(--cream); position: relative; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; transition: .4s; }
.product-card:hover .product-cover img { transform: scale(1.035); }
.product-flags { position: absolute; top: 9px; left: 9px; display: flex; gap: 5px; flex-wrap: wrap; }
.product-body { padding: 14px 15px 15px; }
.product-body h4 { font-size: 13px; font-weight: 600; line-height: 1.45; }
.product-meta { font-size: 10px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.product-price-row { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 12px; gap: 8px; }
.product-price { font-family: var(--serif); font-size: 20px; }
.product-price small { font-size: 11px; }
.product-price s { font-size: 10px; color: var(--muted-2); margin-left: 5px; }
.product-stock { font-size: 9px; color: var(--muted); }
.product-stock.low { color: var(--red); }
.product-actions { display: flex; gap: 6px; margin-top: 12px; }
.product-actions .btn { flex: 1; }
.product-list { display: grid; gap: 10px; }

.member-cell { display: flex; align-items: center; gap: 10px; }
.member-cell .avatar { width: 32px; height: 32px; flex-basis: 32px; background: var(--cream); font-size: 13px; }
.member-cell strong { display: block; font-size: 12px; font-weight: 500; }
.member-cell span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; margin-bottom: 16px;
}
.stat-strip > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip span { display: block; font-size: 9px; letter-spacing: .12em; color: var(--muted); }
.stat-strip strong { display: block; font-family: var(--serif); font-size: 24px; font-weight: 500; margin-top: 7px; font-variant-numeric: tabular-nums; }

/* ---------- Drawer & modal ---------- */
.drawer-root, .modal-root { position: fixed; inset: 0; z-index: 100; }
.drawer-scrim, .modal-scrim {
  position: absolute; inset: 0; background: rgba(10, 24, 16, .48);
  backdrop-filter: blur(3px); animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: absolute; right: 0; top: 0; height: 100%; width: min(580px, 100%);
  background: var(--bg); box-shadow: -30px 0 80px rgba(0,0,0,.15);
  display: flex; flex-direction: column; animation: drawerIn .32s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes drawerIn { from { transform: translateX(35px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head, .modal-head {
  padding: 24px 26px 18px; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; border-bottom: 1px solid var(--line); background: rgba(246,241,231,.8);
}
.drawer-head h2, .modal-head h2 { font-family: var(--serif); font-size: 25px; font-weight: 500; }
.modal-kicker { font-size: 8px; letter-spacing: .26em; color: var(--gold); margin-bottom: 6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }
.modal-root { display: grid; place-items: center; padding: 24px; }
.modal {
  position: relative; width: min(720px, 100%); max-height: min(88vh, 900px);
  background: var(--bg); border-radius: 26px; box-shadow: 0 40px 120px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .28s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes modalIn { from { transform: translateY(14px) scale(.985); opacity: .4; } to { transform: none; opacity: 1; } }
.modal.wide { width: min(940px, 100%); }
.modal.narrow { width: min(480px, 100%); }
.modal-body { flex: 1; overflow-y: auto; padding: 24px 26px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px; padding: 16px 26px;
  border-top: 1px solid var(--line); background: rgba(246,241,231,.65);
}
.detail-section { margin-bottom: 26px; }
.detail-section-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px;
}
.detail-section-head h3 {
  font-size: 9px; letter-spacing: .2em; color: var(--gold); font-weight: 500;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-item span { display: block; font-size: 9px; color: var(--muted); margin-bottom: 4px; }
.detail-item strong { font-size: 12.5px; font-weight: 500; line-height: 1.55; word-break: break-all; }
.detail-item.full { grid-column: 1 / -1; }
.detail-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
}
.order-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 0;
  border-bottom: 1px solid #f1ebdf;
}
.order-item:last-child { border-bottom: 0; }
.order-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.order-item-main { flex: 1; min-width: 0; }
.order-item-main strong { font-size: 12px; font-weight: 500; display: block; }
.order-item-main span { font-size: 10px; color: var(--muted); display: block; margin-top: 3px; }
.order-item-amount { font-size: 12px; font-family: var(--serif); white-space: nowrap; }
.totals { margin-top: 10px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
.total-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 4px 0; }
.total-row.grand { font-size: 14px; color: var(--ink); padding-top: 9px; }
.total-row.grand b { font-family: var(--serif); font-size: 24px; font-weight: 500; }
.timeline { display: grid; gap: 0; }
.timeline-item { display: flex; gap: 13px; position: relative; padding-bottom: 18px; }
.timeline-item::before {
  content: ""; position: absolute; left: 5px; top: 13px; bottom: 0; width: 1px; background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--line-strong);
  background: var(--bg); flex: 0 0 11px; margin-top: 3px; z-index: 1;
}
.timeline-item.done .timeline-dot { background: var(--ink); border-color: var(--ink); }
.timeline-text strong { display: block; font-size: 11.5px; font-weight: 500; }
.timeline-text span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.drawer-actions {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 0 0; margin-top: 6px;
  border-top: 1px solid var(--line);
}

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title {
  grid-column: 1 / -1; font-size: 9px; letter-spacing: .2em; color: var(--gold);
  margin: 8px 0 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.form-section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.field-note { font-size: 9px; color: var(--muted-2); margin-top: 5px; line-height: 1.5; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }
.image-field { display: flex; gap: 12px; align-items: flex-start; }
.image-preview {
  width: 84px; height: 84px; border-radius: 12px; object-fit: cover;
  background: var(--cream); border: 1px solid var(--line); flex: 0 0 84px;
}
.image-field .field { flex: 1; margin-bottom: 0; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row strong { display: block; font-size: 12px; font-weight: 500; }
.switch-row span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.switch {
  width: 44px; height: 25px; border-radius: 999px; border: 0; background: #d8d1c2;
  position: relative; flex: 0 0 44px; transition: .2s;
}
.switch::after {
  content: ""; position: absolute; width: 19px; height: 19px; border-radius: 50%;
  background: var(--paper); left: 3px; top: 3px; transition: .2s; box-shadow: 0 2px 5px rgba(0,0,0,.12);
}
.switch.on { background: var(--ink); }
.switch.on::after { left: 22px; }
.sku-list { display: grid; gap: 8px; }
.sku-row { display: grid; grid-template-columns: 1.4fr .9fr .8fr 30px; gap: 8px; align-items: center; }
.sku-row input { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: var(--paper); }
.sku-remove { border: 0; background: transparent; color: var(--muted); }
.sku-remove:hover { color: var(--red); }

/* ---------- Marketing ---------- */
.marketing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.marketing-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.marketing-card .cover { aspect-ratio: 1.9; overflow: hidden; position: relative; background: var(--cream); }
.marketing-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.marketing-card .cover .badge { position: absolute; top: 10px; left: 10px; }
.marketing-card .body { padding: 16px 17px 17px; }
.marketing-card h4 { font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.4; }
.marketing-card p { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.marketing-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 8px; }
.marketing-card .foot small { font-size: 9px; color: var(--muted-2); }
.poster-preview {
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  max-height: 280px; background: var(--cream);
}
.poster-preview img { width: 100%; height: 100%; max-height: 280px; object-fit: cover; }
.points-item-row, .plan-row {
  display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.points-item-row:last-child, .plan-row:last-child { border-bottom: 0; }
.points-item-row img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.points-item-row .main, .plan-row .main { flex: 1; }
.points-item-row strong, .plan-row strong { font-size: 12px; font-weight: 500; display: block; }
.points-item-row span, .plan-row span { font-size: 10px; color: var(--muted); display: block; margin-top: 3px; }

/* ---------- Support ---------- */
.support-layout {
  display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 14px;
  height: calc(100vh - 210px); min-height: 520px;
}
.session-list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; }
.session-head { padding: 18px 18px 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 2; }
.session-head h3 { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.session-head p { font-size: 10px; color: var(--muted); margin-top: 4px; }
.session-item {
  display: flex; gap: 11px; padding: 14px 17px; border-bottom: 1px solid #f4eee2; cursor: pointer;
  transition: .15s;
}
.session-item:hover { background: #fcf8ef; }
.session-item.active { background: var(--cream); }
.session-item .avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: 13px; }
.session-main { min-width: 0; flex: 1; }
.session-main strong { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 500; }
.session-main strong time { font-size: 8.5px; color: var(--muted-2); font-weight: 400; }
.session-main p { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-head {
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 11px;
}
.chat-head .main { flex: 1; }
.chat-head h3 { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.chat-head p { font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; background: #faf6ec; display: grid; align-content: start; gap: 12px; }
.chat-time { text-align: center; font-size: 9px; color: var(--muted-2); padding: 4px; }
.chat-msg { max-width: 74%; display: flex; flex-direction: column; gap: 3px; }
.chat-msg .bubble { padding: 10px 13px; border-radius: 15px; font-size: 12px; line-height: 1.6; }
.chat-msg.customer { justify-self: start; }
.chat-msg.customer .bubble { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.staff { justify-self: end; align-items: flex-end; }
.chat-msg.staff .bubble { background: var(--ink); color: var(--cream); border-bottom-right-radius: 4px; }
.chat-msg.system { justify-self: center; max-width: 90%; }
.chat-msg.system .bubble { background: transparent; color: var(--muted-2); font-size: 9.5px; padding: 2px; text-align: center; }
.chat-msg small { font-size: 8.5px; color: var(--muted-2); padding: 0 4px; }
.chat-compose { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 9px; background: var(--paper); }
.chat-compose textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; resize: none; padding: 10px 12px;
  min-height: 42px; max-height: 120px; outline: none; font-size: 12px; line-height: 1.5;
}
.chat-compose textarea:focus { border-color: var(--ink-2); }
.chat-empty { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 11px; height: 100%; gap: 10px; }
.chat-empty img { width: 100px; opacity: .55; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 14px; align-items: start; }
.settings-card { margin-bottom: 14px; }
.domain-list { display: grid; gap: 9px; }
.domain-row { display: flex; align-items: flex-start; gap: 10px; font-size: 10.5px; }
.domain-row .label { width: 88px; color: var(--muted); flex: 0 0 88px; }
.domain-row code {
  background: #f3eee2; padding: 3px 7px; border-radius: 5px; font-size: 9.5px;
  color: var(--ink-2); word-break: break-all; line-height: 1.5;
}
.info-banner {
  background: linear-gradient(135deg, #f1e6cf, #faf5e9);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  font-size: 10.5px; color: var(--muted); line-height: 1.7;
}
.info-banner strong { color: var(--ink); }

/* ---------- Empty, skeleton, toast ---------- */
.empty {
  display: grid; place-items: center; text-align: center; padding: 60px 20px; gap: 10px;
}
.empty img { width: 150px; opacity: .9; }
.empty h3 { font-family: var(--serif); font-size: 19px; font-weight: 500; margin-top: 5px; }
.empty p { font-size: 11px; color: var(--muted); line-height: 1.6; }
.skeleton { background: linear-gradient(90deg, #eee7d9 25%, #f8f3e9 37%, #eee7d9 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton-block { height: 120px; border-radius: 18px; }
.loading-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: grid; gap: 8px; }
.toast {
  background: var(--ink); color: var(--cream); border-radius: 12px;
  padding: 11px 16px; font-size: 12px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px; animation: toastIn .25s ease both; max-width: 360px;
}
.toast.error { background: #6e2b22; }
.toast.success { background: #1d4a32; }
.toast.info { background: #2f3d36; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.note { font-size: 10px; color: var(--muted); line-height: 1.65; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.row { display: flex; align-items: center; gap: 9px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.red { color: var(--red); }
.green { color: var(--green); }
.tiny { font-size: 9.5px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.no-wrap { white-space: nowrap; }
.clickable { cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .marketing-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1080px) {
  :root { --sidebar: 224px; }
  .view { padding: 24px 24px 48px; }
  .topbar { padding: 0 24px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .support-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-strip > div:nth-child(2) { border-right: 0; }
  .stat-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; background: radial-gradient(80% 60% at 50% 0%, #fbf5e8, var(--bg)); }
  .login-panel::before { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: min(290px, 84vw); height: 100vh;
    transform: translateX(-102%); transition: .28s cubic-bezier(.2,.7,.2,1);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(10,24,16,.42); z-index: 35; opacity: 0; pointer-events: none; transition: .25s; }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .mobile-menu { display: grid; place-items: center; }
  .topbar { height: 78px; padding: 0 18px; gap: 10px; }
  .crumb h1 { font-size: 20px; }
  .crumb > span { font-size: 8px; }
  .view { padding: 20px 18px 44px; }
  .admin-pill { display: none; }
  .store-switcher select { max-width: 110px; }
  .drawer { width: 100%; }
  .modal { max-height: 92vh; border-radius: 20px; }
  .modal-root { padding: 12px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .marketing-grid { grid-template-columns: 1fr; }
  .support-layout { grid-template-columns: 1fr; height: auto; }
  .session-list { max-height: 260px; }
  .chat-panel { min-height: 520px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .form-grid .form-section-title { grid-column: auto; }
}
@media (max-width: 620px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { min-height: 118px; padding: 17px; }
  .kpi-value { font-size: 28px; }
  .kpi-label { margin-bottom: 12px; }
  .kpi-foot { margin-top: 10px; }
  .topbar-tools .store-switcher { max-width: 150px; }
  .topbar-tools .icon-btn { display: none; }
  .page-head-left h2 { font-size: 26px; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .product-body { padding: 11px; }
  .product-body h4 { font-size: 12px; }
  .product-price { font-size: 17px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.full { grid-column: auto; }
  .table-wrap { margin: 0 -18px; border-radius: 0; }
  .toolbar { gap: 7px; }
  .search-box { min-width: 100%; order: 5; }
  .drawer-body { padding: 18px 18px 30px; }
  .modal-body { padding: 18px; }
  .modal-head { padding: 18px; }
  .modal-foot { padding: 12px 18px; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
