:root {
  --ground: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #FBFAF8;
  --ink: #1C1D21;
  --ink-2: #45474F;
  --muted: #5B5D66;
  --muted-2: #6B6E78;
  --line: #E3E1DA;
  --line-2: #ECEAE3;
  --line-3: #D9D7CF;
  --line-4: #C9C7BF;
  --accent: #1F48C4;
  --accent-ink: #16358F;
  --accent-soft: #E6EDFD;
  --accent-wash: #F1F4FD;
  --ok-bg: #E3F4EC; --ok: #11643F;
  --warn-bg: #FDF1E2; --warn: #9A4508; --warn-line: #F1C98F; --warn-ink: #6E3106;
  --review-bg: #F0E9FB; --review: #5B2E9E; --review-ink: #3E1F6E;
  --err-bg: #FBE7E6; --err: #A3261E; --err-line: #F0B9B4; --err-ink: #7A1C16;
  --teal-bg: #E1F3F4; --teal: #0E5E66;
  --stone-bg: #EEEDE8; --stone: #45474F;
  --busy: #B45309;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px;
  --shadow-pop: 0 18px 44px rgba(20, 20, 25, 0.16);
  --shadow-bar: 0 14px 36px rgba(20, 20, 25, 0.28);
  --info-w: clamp(400px, 30vw, 540px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(31, 72, 196, 0.45); outline-offset: 2px; }
.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--mono); }
.num { text-align: right; }

/* ---------- buttons ---------- */
.btn {
  height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line-3);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--line-4); background: var(--surface-2); color: var(--ink); }
.btn-primary { border: 0; background: var(--accent); color: #FFFFFF; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-ink); color: #FFFFFF; }
.btn-primary:disabled { background: var(--line-2); color: var(--muted-2); }
.btn:not(.btn-primary):disabled { opacity: 0.5; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative;
  border: 1px solid var(--line-3); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-expanded="true"] { background: var(--accent-wash); border-color: #B9C7F2; color: var(--accent); }
.icon-btn.bare { border: 0; background: transparent; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.c-ready { background: var(--ok-bg); color: var(--ok); }
.c-size, .c-queued, .c-sending, .c-progress { background: var(--accent-soft); color: var(--accent); }
.c-missing, .c-processing, .c-waiting, .c-artwork, .c-session { background: var(--warn-bg); color: var(--warn); }
.c-review { background: var(--review-bg); color: var(--review); }
.c-error, .c-hold, .c-late { background: var(--err-bg); color: var(--err); }
.c-tracking { background: var(--teal-bg); color: var(--teal); }
.c-done, .c-other { background: var(--stone-bg); color: var(--stone); }

/* ---------- app shell: left menu + main column ---------- */
.app { height: 100vh; height: 100dvh; display: flex; overflow: hidden; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.side {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
  padding: 18px 12px; background: #1C1D21; color: #E9E8E3;
}
.side-top { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-grow: 1; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; white-space: nowrap; }
.brand-text span { font-size: 12px; color: #B9B8B2; white-space: nowrap; }
.brand-logo { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; object-fit: cover; }
.brand-logo.big { width: 52px; height: 52px; border-radius: 14px; }
.side-toggle {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; border: 1px solid #3A3B42;
  background: transparent; color: #C9C8C2; font-size: 16px; line-height: 1;
}
.side-toggle:hover { background: #26272C; color: #FFFFFF; }
.nav-list, .side-foot { display: flex; flex-direction: column; gap: 2px; }
.side-foot { border-top: 1px solid #2E2F35; padding-top: 12px; }
.nav-item {
  width: 100%; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: #C9C8C2; text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; text-align: left;
}
.nav-item:hover { background: #26272C; color: #FFFFFF; }
.nav-item[aria-current="page"] { background: #2E2F35; color: #FFFFFF; font-weight: 600; }
.nav-short {
  width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; background: #26272C; color: #C9C8C2; font-size: 12px; font-weight: 700;
}
.nav-item[aria-current="page"] .nav-short { background: var(--accent); color: #FFFFFF; }
/* The page letters only show on the collapsed menu, where they are the only way to tell pages apart. */
.nav-list .nav-short { display: none; }
.side-collapsed .nav-list .nav-short { display: inline-flex; }
.nav-label { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-label small { font-size: 12px; color: #8E8D88; font-weight: 400; }
.nav-ext { opacity: 0; color: #8E8D88; }
.nav-item:hover .nav-ext { opacity: 1; }
.nav-spacer { flex-grow: 1; }
.side-backdrop { display: none; }
.menu-btn { display: none; }
/* Collapsed menu (the "‹" button, and always between 900 and 1199px). */
.side-collapsed .side { width: 72px; padding: 18px 10px; }
.side-collapsed .side-top { flex-direction: column; padding: 0; }
.side-collapsed .brand { flex-grow: 0; }
.side-collapsed .brand-text, .side-collapsed .nav-label, .side-collapsed .nav-ext { display: none; }
.side-collapsed .nav-item { justify-content: center; padding: 0; }
.side-collapsed .side-toggle { transform: rotate(180deg); }
.top {
  min-height: 72px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.store-pick { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.store-pick select {
  height: 40px; min-width: 180px; border-radius: 10px; border: 1px solid var(--line-4); background: var(--surface);
  padding: 0 12px; font-size: 15px; font-weight: 700; color: var(--ink);
}
.top-sep { width: 1px; height: 44px; background: var(--line); margin: 0 4px; }
.top-title { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.top-title h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.top-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-activity {
  height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; max-width: 340px;
  border-radius: 10px; border: 1px solid var(--line-3); background: var(--surface); color: var(--ink);
}
.btn-activity[aria-expanded="true"] { background: var(--accent-wash); border-color: #B9C7F2; }
.btn-activity .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.btn-activity .dot.busy { background: var(--busy); animation: pulse 1.4s ease-in-out infinite; }
.btn-activity-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.btn-activity-text strong { font-size: 13px; }
.btn-activity-text span { font-size: 12px; color: var(--muted); max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .btn-activity .dot.busy, .spin, .meter i, .skeleton-row { animation: none !important; } }
.badge {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface);
  background: var(--err); color: #FFFFFF; font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.badge.calm { background: var(--teal); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; padding: 14px 24px 0; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 16px; flex-shrink: 0;
  border-radius: 12px 12px 0 0; border: 1px solid transparent; border-bottom: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); border-color: var(--line); }
.tab .count {
  min-width: 26px; padding: 2px 8px; border-radius: 999px; background: #E6E4DD; color: var(--ink-2);
  font-family: var(--mono); font-size: 12px; text-align: center;
}
.tab[aria-selected="true"] .count { background: var(--accent); color: #FFFFFF; }

/* ---------- body: list + Order information ---------- */
.body { flex-grow: 1; min-height: 0; display: flex; gap: 16px; padding: 0 24px 24px; }
.panel {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 14px 14px 14px; overflow: hidden;
}
.toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-shrink: 0; }
#chips, #notice { flex-shrink: 0; }
.search {
  flex-grow: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  border: 1px solid var(--line-3); border-radius: 10px; background: var(--surface-2); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); background: var(--surface); }
.search input { flex-grow: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; color: var(--ink); }
.range { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.range select { height: 44px; border-radius: 10px; border: 1px solid var(--line-3); background: var(--surface); padding: 0 10px; font-size: 14px; color: var(--ink); }
.btn-primary-fulfill { padding: 0 18px; }

.chips { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.fchip {
  height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-3); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600;
}
.fchip span { font-family: var(--mono); font-size: 12px; }
.fchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

.notice { display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: 13px; border-bottom: 1px solid #DDE4F8; background: var(--accent-wash); color: #1B2F73; }
.notice span { flex-grow: 1; }
.notice .btn { height: 36px; padding: 0 12px; font-size: 13px; border-color: #B9C7F2; color: #1B2F73; }
.notice.err { background: var(--err-bg); color: var(--err-ink); border-bottom-color: var(--err-line); }

.thead, .row {
  display: grid; grid-template-columns: 44px 128px minmax(0, 1fr) minmax(0, 1.4fr) 96px minmax(224px, 264px);
  column-gap: 12px; align-items: center; padding: 0 20px;
}
.thead {
  height: 42px; flex-shrink: 0; background: var(--surface-2); border-bottom: 1px solid var(--line-2);
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.thead .st, .row .state-cell { padding-left: 44px; }
.rows { flex-grow: 1; min-height: 0; overflow-y: auto; }
.row { min-height: 66px; border-bottom: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
.row:hover { background: #FAFAF7; }
.row.is-checked { background: #F5F7FD; }
.row.is-open { background: #EEF2FC; box-shadow: inset 3px 0 0 var(--accent); }
.row .check { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.row .check.none { cursor: default; }
.row .check input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
.cell-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; width: 100%;
  padding: 6px 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 14px;
}
.cell-btn .main-line { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-btn .sub-line { max-width: 100%; font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-name { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.customer-name { font-weight: 600; }
.total { text-align: right; font-family: var(--mono); font-weight: 500; }
.state-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.state-cell .sub-line { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 64px 20px; color: var(--muted); text-align: center; }
.empty strong { color: var(--ink); }
.more { display: flex; justify-content: center; padding: 16px; }
.skeleton-row { height: 66px; border-bottom: 1px solid var(--line-2); background: linear-gradient(90deg, #FBFAF8 25%, #F3F2EE 37%, #FBFAF8 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Order information (panel on wide screens, drawer below) ---------- */
.info {
  width: var(--info-w); flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.info-empty { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px; }
.info-empty p { margin: 0; color: var(--muted); line-height: 1.5; }
.overline { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.scrim { position: fixed; inset: 0; background: rgba(28, 29, 33, 0.16); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 100vw; z-index: 51;
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -18px 0 44px rgba(20, 20, 25, 0.14);
}
.oi-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px 16px; border-bottom: 1px solid var(--line-2); }
.oi-head .grow { display: flex; flex-direction: column; gap: 6px; flex-grow: 1; min-width: 0; }
.oi-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oi-title .order-name { font-size: 20px; }
.oi-head .meta { font-size: 13px; color: var(--muted); }
.oi-body { flex-grow: 1; min-height: 0; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 22px; }
.oi-foot { display: flex; flex-direction: column; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line-2); }
.oi-foot .note { font-size: 13px; color: var(--warn-ink); }
.oi-foot .btns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.oi-body h2 { margin: 0; font-size: 15px; font-weight: 700; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.alert strong { font-weight: 600; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert.a-review { background: var(--review-bg); color: var(--review-ink); }
.alert.a-error { background: var(--err-bg); color: var(--err-ink); }
.alert.a-info { background: var(--accent-soft); color: #1B2F73; }
.alert.a-warn { background: var(--warn-bg); color: var(--warn-ink); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fact > span { font-size: 12px; color: var(--muted-2); }
.fact strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.fact small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 400; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; }
.swatch {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: rgba(0,0,0,0.45);
}
.item-body { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; min-width: 0; }
.item-body strong { font-weight: 600; }
.item-body .v { font-size: 13px; color: var(--muted); }
.item-body .chip { align-self: flex-start; max-width: 100%; white-space: normal; line-height: 1.3; border-radius: 10px; }
/* Order information: the product picture, the price of each line and Shopify's "Paid" box. */
.thumb { width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow: hidden; cursor: zoom-in; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb:hover, .thumb:focus-visible { border-color: var(--accent); }
.item-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-price small { font-size: 12px; color: var(--muted); }
.item-price b { font-size: 14px; font-weight: 600; }
.item.item-extra { background: var(--surface-2); border-style: dashed; }
.money { display: flex; flex-direction: column; gap: 10px; }
.mbox { display: flex; flex-direction: column; padding: 4px 14px; border: 1px solid var(--line-2); border-radius: 12px; }
.mrow { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 0; font-size: 14px; }
.mrow .mid { min-width: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.mrow .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mrow.mtotal { margin-top: 2px; padding-top: 9px; border-top: 1px solid var(--line-2); font-weight: 700; }
.money .hint { margin: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.img-pop { position: fixed; z-index: 95; width: 300px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 44px rgba(20, 20, 25, 0.22); pointer-events: none; }
.img-pop[hidden] { display: none; }
.img-pop img { display: block; width: 100%; height: 300px; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.img-pop span { display: block; padding: 6px 2px 0; font-size: 12px; color: var(--muted); }
.zoom { position: fixed; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 15, 18, 0.86); cursor: zoom-out; }
.zoom figure { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0; max-width: 100%; max-height: 100%; }
.zoom img { max-width: 100%; max-height: calc(100dvh - 110px); object-fit: contain; border-radius: 10px; background: #FFFFFF; }
.zoom figcaption { color: #FFFFFF; font-size: 14px; text-align: center; }
.zoom-x { position: absolute; top: 16px; right: 16px; background: rgba(255, 255, 255, 0.92); }
.syncbox { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); }
.syncbox strong { font-weight: 700; }
.syncbox p { margin: 0; font-size: 13px; line-height: 1.5; }
.syncbox .btn { align-self: flex-start; background: var(--warn); color: #FFFFFF; border: 0; }
.syncbox .btn:hover { background: #7E3806; color: #FFFFFF; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.step { display: flex; gap: 12px; align-items: stretch; }
.step .rail { display: flex; flex-direction: column; align-items: center; width: 18px; flex-shrink: 0; }
.step .knob { width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--line-4); background: var(--surface); }
.step .bar { width: 2px; flex-grow: 1; min-height: 14px; background: var(--line); }
.step:last-child .bar { background: transparent; }
.step .txt { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; min-width: 0; }
.step .txt strong { font-weight: 600; color: var(--muted-2); }
.step .txt span { font-size: 12px; color: var(--muted-2); overflow-wrap: anywhere; }
.step.reached .knob { border-color: var(--accent); }
.step.passed .knob { background: var(--accent); border-color: var(--accent); }
.step.passed .bar { background: var(--accent); }
.step.reached .txt strong { color: var(--ink); }
.step.late .knob { border-color: var(--err); }
.step.late .txt span { color: var(--err); }
.loglist { display: flex; flex-direction: column; gap: 8px; }
.logline { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; font-size: 13px; line-height: 1.5; }
.logline time { font-family: var(--mono); color: var(--muted-2); }
.logline span { overflow-wrap: anywhere; }
.logline.err { color: var(--err); }
.hint { font-size: 12px; color: var(--muted-2); }

/* ---------- selection bar ---------- */
.selbar {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px;
  background: var(--ink); color: #FFFFFF; border-radius: 14px; box-shadow: var(--shadow-bar);
  max-width: calc(100vw - 32px);
}
.selbar strong { font-weight: 600; margin-right: 6px; white-space: nowrap; }
.selbar .btn { height: 44px; border-color: #45464D; background: transparent; color: #FFFFFF; font-weight: 500; }
.selbar .btn:hover:not(:disabled) { background: #2E2F35; color: #FFFFFF; }
.selbar .btn-primary { background: var(--accent); font-weight: 600; }
.selbar .btn-primary:hover:not(:disabled) { background: #3A63DD; }
.selbar .btn-track { border: 0; background: var(--teal); font-weight: 600; }
.selbar .btn-track:hover:not(:disabled) { background: #0B4B52; }

/* ---------- popovers: activity, alerts, menu ---------- */
.pop {
  position: fixed; top: 76px; right: 24px; width: 460px; max-width: calc(100vw - 24px); max-height: calc(100vh - 96px); overflow-y: auto; z-index: 60;
  display: flex; flex-direction: column; gap: 16px; padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop);
}
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pop-head strong { font-size: 15px; }
.sect { display: flex; flex-direction: column; gap: 8px; }
.sect-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.runcard { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.runcard .row2 { display: flex; justify-content: space-between; gap: 10px; }
.runcard .row2 strong { font-weight: 600; overflow-wrap: anywhere; }
.runcard .row2 span { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.meter { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; position: relative; }
.meter i { position: absolute; top: 0; left: 0; bottom: 0; background: var(--accent); border-radius: 999px; }
.meter.indeterminate i { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
.qitem { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.qitem b { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.muted { font-size: 13px; color: var(--muted); }
.logfilters { display: flex; gap: 6px; flex-wrap: wrap; }
.logfilters .fchip { height: 32px; padding: 0 10px; font-size: 12px; }
.logs { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.logrow { display: grid; grid-template-columns: 48px 70px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; line-height: 1.45; }
.logrow time { font-family: var(--mono); color: var(--muted-2); }
.logrow .kind { justify-self: start; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.logrow span:last-child { overflow-wrap: anywhere; }
.logrow.err span:last-child { color: var(--err); }
.k-fulfill { background: var(--accent-soft); color: var(--accent); }
.k-sync { background: var(--warn-bg); color: var(--warn); }
.k-scan { background: var(--teal-bg); color: var(--teal); }
.k-tracking { background: var(--ok-bg); color: var(--ok); }
.k-order, .k-check { background: var(--stone-bg); color: var(--stone); }
.k-error { background: var(--err-bg); color: var(--err); }
.k-warn { background: #FFF4D6; color: #7A5200; }
.alerts { width: 440px; gap: 12px; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); text-align: left;
}
.alert-item:hover { border-color: var(--line-4); background: var(--surface-2); }
.alert-item .ai-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.alert-item .ai-store { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.alert-item .ai-text { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.alert-item .new { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(28, 29, 33, 0.42); }
.modal {
  width: 620px; max-width: 100%; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; gap: 16px; padding: 26px;
  background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px rgba(20, 20, 25, 0.3); overflow: hidden;
}
.modal h2 { margin: 0; font-size: 20px; font-weight: 700; }
.modal p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.plan { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; overflow-y: auto; min-height: 0; }
.plan-line { display: grid; grid-template-columns: 24px 110px 170px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.plan-line:last-child { border-bottom: 0; }
.plan-line .order-name { padding-top: 1px; }
.plan-line .chip { justify-self: start; }
.plan-line .note { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.plan-line .note ul { margin: 4px 0 0; padding-left: 16px; }
.plan-line input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.plan-line.off { opacity: 0.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal .busy-note { padding: 12px 14px; border-radius: 12px; background: var(--accent-wash); color: #1B2F73; font-size: 13px; line-height: 1.5; }
.modal .err-note { padding: 12px 14px; border-radius: 12px; background: var(--err-bg); color: var(--err-ink); font-size: 13px; line-height: 1.5; }
.progress-line { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: rot 0.8s linear infinite; flex-shrink: 0; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 84px; right: 24px; width: 440px; max-width: calc(100vw - 24px); z-index: 90;
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 10px 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(20, 20, 25, 0.16);
}
.toast .dot { width: 10px; height: 10px; flex-shrink: 0; margin-top: 6px; border-radius: 50%; }
.toast .grow { display: flex; flex-direction: column; gap: 3px; flex-grow: 1; min-width: 0; }
.toast .grow span { font-size: 13px; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }

/* ---------- login & boot ---------- */
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; background: var(--accent); color: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.brand-mark.big { width: 44px; height: 44px; border-radius: 12px; font-size: 20px; }
.login { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--ground); }
.login-card { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-card input { height: 44px; padding: 0 12px; border: 1px solid var(--line-3); border-radius: 10px; font-size: 15px; }
.login-card .login-error { color: var(--err); min-height: 1em; }
.boot { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); z-index: 99; background: var(--ground); }

/* ---------- below 1200px: Order information opens as a drawer ---------- */
@media (max-width: 1199px) {
  .info { display: none; }
  .thead, .row { grid-template-columns: 44px 112px minmax(0, 1fr) minmax(0, 1.25fr) 88px minmax(196px, 236px); column-gap: 10px; padding: 0 14px; }
  .thead .st, .row .state-cell { padding-left: 36px; }
  .side-toggle { display: none; }
  .top { padding: 10px 20px; gap: 10px; }
  .tabs { padding: 12px 20px 0; }
  .body { padding: 0 20px 20px; }
  .btn-activity-text span { max-width: 170px; }
}

/* ---------- phone ---------- */
@media (max-width: 899px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 8px; min-height: 0; }
  .top-sep, .top-sub { display: none; }
  .store-pick { order: 2; flex-direction: row; align-items: center; gap: 6px; flex-basis: 100%; font-weight: 500; }
  .store-pick select { height: 36px; min-width: 0; flex-grow: 1; font-size: 14px; }
  .top-title { order: 1; flex-grow: 1; }
  .top-title h1 { font-size: 20px; }
  .menu-btn { display: inline-flex; order: 0; }
  .btn-activity, .btn-scan, .bell, #care-settings { order: 1; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 71; width: 264px; transform: translateX(-102%); transition: transform 0.2s ease; }
  .side-open .side { transform: none; box-shadow: 12px 0 40px rgba(20, 20, 25, 0.3); }
  .side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(28, 29, 33, 0.4); }
  .side-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .btn-activity { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .btn-activity-text, .btn-activity .chev { display: none; }
  .btn-scan { height: 40px; width: 40px; padding: 0; }
  .btn-scan span { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .tabs { padding: 10px 16px 6px; gap: 8px; }
  .tab { height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-3); background: var(--surface); font-size: 13px; }
  .tab .count { min-width: 0; padding: 0; background: transparent !important; color: inherit !important; }
  .tab[aria-selected="true"] { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
  .body { padding: 0; }
  .panel { border: 0; border-radius: 0; background: transparent; }
  .toolbar { flex-wrap: wrap; padding: 6px 16px 10px; border: 0; gap: 8px; }
  .search { flex: 1 1 200px; background: var(--surface); }
  .range span { display: none; }
  .btn-primary-fulfill { position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); height: 52px; border-radius: 14px; z-index: 30; box-shadow: 0 12px 30px rgba(20, 20, 25, 0.24); font-size: 15px; }
  .btn-primary-fulfill:disabled, .has-selection .btn-primary-fulfill { display: none; }
  .chips { padding: 4px 16px 10px; border: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips .fchip { flex-shrink: 0; height: 34px; }
  .notice { margin: 0 16px 10px; border-radius: 12px; border: 0; flex-wrap: wrap; }
  .thead { display: none; }
  .rows { padding: 0 16px 96px; display: flex; flex-direction: column; gap: 10px; }
  .rows > * { flex-shrink: 0; }
  .row {
    grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "chk name total" "cust cust cust" "prod prod prod" "state state state";
    row-gap: 6px; column-gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; min-height: 0; background: var(--surface);
  }
  .row .check { grid-area: chk; width: 34px; height: 34px; margin: -4px 0 -4px -6px; }
  .row .check.none { display: none; }
  .row .c-name { grid-area: name; }
  .row .c-name .cell-btn { flex-direction: row; align-items: baseline; gap: 8px; padding: 0; }
  .row .c-cust { grid-area: cust; }
  .row .c-prod { grid-area: prod; }
  .row .c-cust .cell-btn, .row .c-prod .cell-btn { padding: 0; }
  .row .total { grid-area: total; padding-right: 0; }
  .row .state-cell { grid-area: state; padding-left: 0; }
  .skeleton-row { border-radius: 14px; height: 120px; }
  .selbar { left: 12px; right: 12px; transform: none; bottom: calc(14px + env(safe-area-inset-bottom)); gap: 6px; padding: 8px 8px 8px 14px; flex-wrap: wrap; }
  .selbar strong { flex-grow: 1; font-size: 13px; }
  .selbar .btn { height: 44px; padding: 0 12px; font-size: 13px; }
  .scrim { background: rgba(28, 29, 33, 0.4); }
  .drawer { top: auto; left: 0; width: 100%; max-height: 90dvh; border-left: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(20, 20, 25, 0.2); }
  .oi-head { padding: 16px 18px 12px; }
  .oi-body { padding: 14px 18px; gap: 18px; }
  .oi-foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); }
  .oi-foot .btns .btn { flex-grow: 1; height: 48px; }
  .facts { gap: 12px 16px; }
  .pop { top: 60px !important; left: 12px !important; right: 12px !important; width: auto; max-height: calc(100dvh - 80px); }
  .modal { padding: 20px; }
  .plan-line { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "chk name chip" "note note note"; }
  .plan-line input, .plan-line .blank { grid-area: chk; }
  .plan-line .order-name { grid-area: name; }
  .plan-line .chip { grid-area: chip; }
  .plan-line .note { grid-area: note; }
  .toast { top: 12px; right: 12px; left: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) { .side { transition: none !important; } }

/* =====================================================================
   Report v2
   ===================================================================== */
body:not([data-route="orders"]) .orders-only { display: none !important; }
body:not([data-route="report"]) .report-only { display: none !important; }
body:not([data-route="listing"]) .listing-only { display: none !important; }
body:not([data-route="email"]) .email-only { display: none !important; }
body:not([data-route="care"]) .care-only { display: none !important; }
body[data-route="report"] .work-only, body[data-route="email"] .work-only, body[data-route="care"] .work-only, body[data-route="careads"] .work-only,
body[data-route="extension"] .work-only, body[data-route="password"] .work-only, body[data-route="stores"] .work-only { display: none !important; }
body:not([data-route="extension"]) .extension-only { display: none !important; }
body:not([data-route="password"]) .password-only { display: none !important; }
body:not([data-route="stores"]) .stores-only { display: none !important; }
body:not([data-route="fbads"]) .fbads-only { display: none !important; }
body[data-route="fbads"] .work-only { display: none !important; }
body:not([data-route="careads"]) .careads-only { display: none !important; }
.num-t { font-variant-numeric: tabular-nums; }
.rp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; flex-shrink: 0; justify-content: flex-end; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: #EEEDE8; gap: 2px; }
.seg button {
  height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 20, 25, 0.12); }
.rp-custom { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.rp-custom input { height: 38px; border: 1px solid var(--line-3); border-radius: 10px; padding: 0 8px; font-size: 13px; background: var(--surface); }
.rp-compare { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.rp-compare input { width: 16px; height: 16px; accent-color: var(--accent); }
#rp-refresh.spinning svg { animation: rot 0.9s linear infinite; }
#rp-tabs { padding-bottom: 12px; }
#rp-tabs .tab { height: 38px; border-radius: 999px; border: 1px solid transparent; }
#rp-tabs .tab[aria-selected="true"] { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
#rp-tabs .tab[aria-selected="true"] .count { background: rgba(255, 255, 255, 0.18); color: #FFFFFF; }
.report-view { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 24px 32px; }
.rp-health { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.rp-flag {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.35; border: 1px solid transparent; text-align: left; background: var(--surface);
}
.rp-flag .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rp-flag.err { background: var(--err-bg); color: var(--err-ink); } .rp-flag.err .dot { background: var(--err); }
.rp-flag.warn { background: var(--warn-bg); color: var(--warn-ink); } .rp-flag.warn .dot { background: #D97706; }
.rp-flag.info { background: var(--surface); color: var(--ink-2); border-color: var(--line); } .rp-flag.info .dot { background: var(--line-4); }
button.rp-flag { cursor: pointer; }
button.rp-flag:hover { filter: brightness(0.97); }
.rp-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .hint { font-size: 12px; }
.info-i {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--line-4); color: var(--muted-2); font-size: 10px; font-weight: 700; font-style: normal; cursor: help; flex-shrink: 0;
}
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 12px; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.pos { color: var(--ok); } .kpi-value.neg { color: var(--err); }
.kpi-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); min-height: 20px; }
.kpi-meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12px; color: var(--warn-ink); background: var(--warn-bg); border-radius: 8px; padding: 4px 8px; align-self: flex-start; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--ok); } .delta.bad { color: var(--err); } .delta.flat { color: var(--muted-2); }
.delta small { font-weight: 500; color: var(--muted-2); }
.spark { width: 100%; height: 38px; display: block; margin-top: 2px; }
.skeleton { background: linear-gradient(90deg, #F3F2EE 25%, #ECEAE3 37%, #F3F2EE 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart .axis text { font-size: 11px; fill: var(--muted-2); font-family: var(--mono); }
.chart .grid line { stroke: var(--line-2); }
.chart .zero { stroke: var(--line-4); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; }
.rp-tip {
  position: fixed; z-index: 95; pointer-events: none; min-width: 180px; max-width: 280px; padding: 10px 12px; border-radius: 10px;
  background: #1C1D21; color: #FFFFFF; font-size: 12px; line-height: 1.5; box-shadow: 0 10px 30px rgba(20, 20, 25, 0.3);
}
.rp-tip strong { display: block; font-size: 13px; margin-bottom: 4px; }
.rp-tip .row-t { display: flex; justify-content: space-between; gap: 14px; }
.rp-tip .row-t span:last-child { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.flow { display: flex; flex-direction: column; gap: 8px; }
.flow-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px; gap: 10px; align-items: center; font-size: 13px; }
.flow-row .lbl { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ink-2); }
.flow-row .lbl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-row .amt { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.flow-row .pct { font-size: 12px; color: var(--muted-2); text-align: right; font-variant-numeric: tabular-nums; }
.flow-bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin-top: -3px; }
.flow-bar i { display: block; height: 100%; border-radius: 999px; }
.flow-row.is-total { padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--line-2); font-size: 15px; }
.flow-row.is-total .lbl { color: var(--ink); font-weight: 700; }
.flow-note { font-size: 12px; color: var(--muted-2); margin-top: 6px; line-height: 1.5; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; z-index: 1;
}
.rp-table th.r, .rp-table td.r { text-align: right; }
.rp-table th button { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.rp-table th button[aria-sort="descending"]::after { content: " ↓"; }
.rp-table th button[aria-sort="ascending"]::after { content: " ↑"; }
.rp-table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.rp-table td.mono, .rp-table td.r { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.rp-table tr:last-child td { border-bottom: 0; }
.rp-table tbody tr:hover td { background: #FAFAF7; }
.rp-table .pname { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rp-table .pname a, .rp-table .pname strong { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; display: block; }
.rp-table .pname a:hover { color: var(--accent); text-decoration: underline; }
.rp-table .colors { display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted-2); }
.rp-table .colors i { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--line); display: inline-block; }
.inbar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inbar i { display: inline-block; height: 6px; border-radius: 999px; background: #BFD0F6; }
.pos-t { color: var(--ok); } .neg-t { color: var(--err); }
.rp-table-wrap { overflow-x: auto; }
.rp-table-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.rp-table-tools .search { max-width: 360px; height: 40px; }
.rp-table-tools .hint { flex-grow: 1; }
.rp-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.rp-pager .btn { height: 36px; padding: 0 12px; font-size: 13px; }
.hbar { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.hbar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar-row .val { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.hbar-row .val small { color: var(--muted-2); font-weight: 500; margin-left: 6px; }
.hbar-row .bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.hbar-row .bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.mini-seg { display: inline-flex; padding: 2px; border-radius: 9px; background: #EEEDE8; }
.mini-seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mini-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 20, 25, 0.1); }
.weekbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 120px; }
.weekbars .wb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.weekbars .wb i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: #BFD0F6; min-height: 3px; }
.weekbars .wb.peak i { background: var(--accent); }
.weekbars .wb { cursor: default; }
.weekbars .wb:hover i { filter: brightness(0.9); }
.weekbars .wb span { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; margin-top: 16px; }
.hours i { display: block; height: 22px; border-radius: 4px; background: var(--accent); }
.hours-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-2); margin-top: 4px; font-family: var(--mono); }
.stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.stack i { display: block; height: 100%; }
.stack-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stack-legend div { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.stack-legend b { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-row .fbar { height: 22px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.funnel-row .fbar i { display: block; height: 100%; background: #BFD0F6; border-radius: 6px; }
.funnel-row .fv { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.big-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.big-empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.rp-foot { margin-top: 16px; font-size: 12px; color: var(--muted-2); line-height: 1.6; }

@media (max-width: 1499px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1199px) {
  .span-8, .span-4, .span-6 { grid-column: span 12; }
  .report-view { padding: 0 20px 28px; }
}
@media (max-width: 899px) {
  .rp-controls { order: 3; flex-basis: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .seg { overflow-x: auto; max-width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px 10px; }
  .kpi-value { font-size: 22px; }
  .report-view { padding: 0 16px 24px; }
  #rp-tabs { padding: 4px 16px 10px; }
  .card { padding: 14px; }
  .rp-grid { gap: 12px; }
}
@media (max-width: 480px) {
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 11px; }
}

/* Report v2, round 2 (owner feedback 2026-09-27) */
.pnl-pos { color: #0E9F6E; font-weight: 600; }
.pnl-neg { color: #DC2626; font-weight: 600; }
.flow-row.sub .lbl { padding-left: 14px; color: var(--muted); }
.flow-row.sub .amt { font-weight: 500; color: var(--ink-2); }
.src-journey { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; max-width: 100%; }
.src-arrow { color: #94A3B8; font-size: 12px; font-weight: 800; }
.src-pill {
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 999px;
  background: #F1F5F9; color: #475569; font-size: 11px; font-weight: 800; white-space: nowrap; font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}
.src-meta { background: #E7F0FF; color: #1557B0; }
.src-meta_google { background: #CFFAFE; color: #155E75; white-space: normal; }
.src-google { background: #E7F6EC; color: #137333; }
.src-email { background: #F3E8FF; color: #7E22CE; }
.src-google_organic, .src-organic { background: #DCFCE7; color: #166534; white-space: normal; }
.src-direct { background: #FEF3C7; color: #92400E; }
.src-other, .src-unknown { background: #F1F5F9; color: #64748B; }
.hbar-row .lbl .src-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.st-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 74px; padding: 5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; white-space: nowrap;
}
.st-done { background: #DCFCE7; color: #059669; }
.st-progress { background: #DBEAFE; color: #2563EB; }
.st-todo { background: #FFEDD5; color: #F97316; }
.age-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.age-legend-item { display: flex; align-items: flex-start; gap: 8px; line-height: 1.4; }
.age-legend-item i { width: 12px; height: 12px; border-radius: 3px; margin-top: 3px; flex-shrink: 0; }

@media (max-width: 899px) {
  /* Phone: the 7 main numbers fit in two rows (3 + 4), without sparklines. */
  .kpis { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; }
  .kpis .kpi { grid-column: span 3; padding: 9px 9px 8px; gap: 3px; border-radius: 12px; }
  .kpis .kpi:nth-child(-n+3) { grid-column: span 4; }
  .kpis .spark, .kpis .kpi-extra, .kpis .kpi-note, .kpis .info-i, .kpi-skel-spark { display: none; }
  .kpi-label { font-size: 10px; letter-spacing: 0.03em; }
  .kpi-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpi-value { font-size: 15px; letter-spacing: -0.01em; }
  .kpis .kpi:nth-child(-n+3) .kpi-value { font-size: 16px; }
  .kpis .kpi-value { overflow: visible; text-overflow: clip; }
  .kpis .kpi-value.long { font-size: 12.5px; }
  .kpis .kpi:nth-child(-n+3) .kpi-value.long { font-size: 15px; }
  .kpis .kpi-value.xlong { font-size: 11px; }
  .kpis .kpi:nth-child(-n+3) .kpi-value.xlong { font-size: 13.5px; }
  .kpi-meta { min-height: 0; font-size: 11px; }
  .delta { font-size: 11px; }
  /* Revenue → PnL right after the main numbers. */
  .rp-grid .flow-card { order: -1; }
}

/* Report order drawer: the order's numbers above Order information */
.oi-report { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); }
.oi-report-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.oi-report-head h2 { display: flex; align-items: center; gap: 6px; }
.oi-pnl { display: flex; flex-direction: column; gap: 6px; }
.oi-pnl-row { display: grid; grid-template-columns: 110px auto minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 13px; }
.oi-pnl-row span { color: var(--ink-2); }
.oi-pnl-row b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 84px; }
.oi-pnl-row small { color: var(--muted-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-pnl-row.is-total { padding-top: 6px; border-top: 1px solid var(--line-2); font-size: 14px; }
.oi-pnl-row.is-total span { color: var(--ink); font-weight: 700; }
.oi-source { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oi-touches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.oi-touches li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 899px) {
  .oi-pnl-row { grid-template-columns: 92px auto minmax(0, 1fr); gap: 8px; }
  .oi-pnl-row small { white-space: normal; line-height: 1.3; }
}

/* Menu counts, same look as the current app */
.nav-item { position: relative; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: #FEE2E2; color: #DC2626; font-size: 12px; font-weight: 900; line-height: 1; flex-shrink: 0;
}
.side-collapsed .nav-badge {
  position: absolute; top: 1px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px;
  background: #DC2626; color: #FFFFFF; border: 2px solid #1C1D21; font-size: 10px;
}

/* =====================================================================
   Listing v2
   ===================================================================== */
.btn-scan.is-busy .ico { animation: rot 1s linear infinite; }
.ls-thead, .ls-row {
  display: grid; grid-template-columns: 44px minmax(0, 2.1fr) minmax(0, 1.3fr) minmax(200px, 260px);
  column-gap: 24px; align-items: center; padding: 0 20px;
}
.ls-thead {
  height: 42px; flex-shrink: 0; background: var(--surface-2); border-bottom: 1px solid var(--line-2);
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.ls-thead .check, .ls-row .check { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.ls-thead input, .ls-row .check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ls-row { min-height: 64px; border-bottom: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
.ls-row:hover { background: #FAFAF7; }
.ls-row.is-checked { background: #F5F7FD; }
.ls-row.is-open { background: #EEF2FC; box-shadow: inset 3px 0 0 var(--accent); }
.ls-prod, .ls-state { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 10px 0; }
.ls-meta { display: flex; align-items: center; gap: 6px 12px; min-width: 0; font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; }
.ls-meta > span { flex-shrink: 0; }
.ls-meta > span:last-child { flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
.ls-state { align-items: flex-start; }
.ls-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-row .sub-line { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ls-sws { display: flex; align-items: center; gap: 4px; min-height: 16px; }
.ls-sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.18); flex-shrink: 0; }
.ls-more { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-left: 2px; }
.ls-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ls-tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--stone-bg); color: var(--ink-2); white-space: nowrap; }
.ls-tag.dual { background: #FFF4D6; color: #7A5200; }
.ls-pills { display: flex; gap: 6px; flex-wrap: wrap; }
/* Same colours as the current Listing tab: Synced green, Unsynced orange, Reviewing purple, Lỗi red. */
.lp-synced { background: var(--ok-bg); color: var(--ok); }
.lp-unsynced { background: var(--warn-bg); color: var(--warn); }
.lp-review { background: var(--review-bg); color: var(--review); }
.lp-error { background: var(--err-bg); color: var(--err); }
.lp-pick { background: #FFF4D6; color: #7A5200; }
.lp-new { background: var(--accent-soft); color: var(--accent); }
.lp-update { background: var(--teal-bg); color: var(--teal); }
.lp-other { background: var(--stone-bg); color: var(--stone); }
.ls-dot-busy { width: 10px; height: 10px; border-radius: 50%; background: var(--busy); flex: 0 0 10px !important; animation: pulse 1.4s ease-in-out infinite; }

/* selection bar + status menu */
.ls-selnote { font-size: 13px; color: #C9C8C2; padding: 0 8px; white-space: nowrap; }
.ls-menu {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; gap: 2px; min-width: 210px; padding: 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
}
.ls-menu .hint { margin: 0; padding: 4px 8px 6px; max-width: 240px; }
.ls-menu-item { display: flex; align-items: center; height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.ls-menu-item:hover:not(:disabled) { background: var(--surface-2); }
.ls-menu-item:disabled { opacity: 0.5; }

/* Listing information */
.ls-ptitle { margin: 4px 0 0; font-size: 18px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.ls-sect { display: flex; flex-direction: column; gap: 10px; }
.ls-sect h2 { margin: 0; font-size: 15px; font-weight: 700; }
.ls-colorlist { display: flex; flex-wrap: wrap; gap: 6px 12px; font-weight: 500; }
.ls-colorlist span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.ls-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ls-pick { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 2px solid var(--line-2); border-radius: 12px; background: var(--surface); text-align: left; font-size: 12px; }
.ls-pick img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface-2); border-radius: 8px; }
.ls-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); }
.ls-pick span { overflow-wrap: anywhere; }
.ls-sect > .btn-primary { align-self: flex-start; }
.ls-dsp-item { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; }
.ls-dsp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.ls-mini { height: 34px; padding: 0 12px; font-size: 13px; }
.ls-dsp { display: flex; flex-direction: column; gap: 8px; }
.ls-dsp img { width: 100%; max-height: 320px; object-fit: contain; background: var(--surface-2); border-radius: 10px; }
.ls-edit { border-top: 1px solid var(--line-2); padding-top: 10px; }
.ls-edit summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.ls-edit[open] > summary { margin-bottom: 10px; }
.ls-edit label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.ls-edit input, .ls-edit select, .ls-status-edit select {
  height: 40px; border: 1px solid var(--line-3); border-radius: 10px; padding: 0 10px; font-size: 14px; background: var(--surface); color: var(--ink); min-width: 0;
}
.ls-edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ls-edit .hint { display: block; margin: 0 0 10px; }
.ls-status-edit { display: flex; gap: 10px; }
.ls-status-edit select { flex-grow: 1; }
.ls-status-edit .btn { height: 40px; }
.ls-err { margin: 0; font-size: 13px; color: var(--err); overflow-wrap: anywhere; }
.ls-ok { margin: 0; font-size: 13px; color: var(--ok); }

/* Sync wizard */
.ls-wiz { width: 760px; gap: 14px; }
.ls-wiz.is-wide { width: 1180px; }
.ls-wiz-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; }
.ls-wiz-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.ls-wiz-head .icon-btn { margin: -8px -10px -8px 0; }
.ls-steps { grid-column: 1 / -1; display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.ls-steps li {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.ls-steps b { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--line-2); color: var(--muted); font-size: 11px; }
.ls-steps li.is-now { border-color: #B9C7F2; color: var(--accent-ink); background: var(--accent-wash); }
.ls-steps li.is-now b { background: var(--accent); color: #FFFFFF; }
.ls-steps li.is-done b { background: var(--ok); color: #FFFFFF; }
.ls-wiz-body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; }
.ls-plan { max-height: 44vh; }
.ls-plan-line { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.ls-plan-line:last-child { border-bottom: 0; }
.ls-plan-line .chip { justify-self: start; }
.ls-plan-line.off { opacity: 0.72; }
.ls-plan-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ls-plan-main strong { font-weight: 600; overflow-wrap: anywhere; }
.ls-route { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ls-route-col { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line-2); border-radius: 14px; min-width: 0; }
.ls-route-col.is-dark { background: #F3F2EE; }
.ls-route-img {
  height: 200px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px;
  background: repeating-conic-gradient(#EEEDE8 0% 25%, #FFFFFF 0% 50%) 50% / 16px 16px;
}
.ls-route-col.is-dark .ls-route-img { background: #1E1E22; }
.ls-route-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ls-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.ls-color {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px;
  border: 1px solid var(--line-3); background: var(--surface); font-size: 13px; font-weight: 500;
}
.ls-color[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
.ls-color.is-static { cursor: default; }
.ls-art { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr); gap: 20px; align-items: start; }
.ls-art-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ls-art-meta { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; }
.ls-art-meta strong { font-size: 15px; overflow-wrap: anywhere; }
.ls-art-meta span { font-size: 13px; color: var(--muted); }
.ls-art-meta .ls-art-count { margin-left: auto; font-family: var(--mono); font-size: 12px; }
/* Garment picture + Dreamship print area: same positions as the current page. */
.ls-stage {
  position: relative; width: min(100%, 560px, 54vh); aspect-ratio: 1.06; margin: 0 auto; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px; background: radial-gradient(circle at 50% 34%, #FFFFFF 0, #F8FAFC 58%, #E9EEF5 100%);
}
.ls-mock { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(15, 23, 42, 0.16)); pointer-events: none; user-select: none; }
.ls-stage[data-model="long-sleeve"], .ls-stage[data-model="sweatshirt"] { aspect-ratio: 1; background: #FFFFFF; }
.ls-stage[data-model="long-sleeve"] .ls-mock, .ls-stage[data-model="sweatshirt"] .ls-mock { width: 200%; height: 200%; max-width: none; object-fit: fill; filter: none; left: 0; top: 0; right: auto; bottom: auto; }
.ls-stage:not([data-model="tee"])[data-shirt="black"] .ls-mock, .ls-stage:not([data-model="tee"])[data-shirt="forest"] .ls-mock { left: -100%; }
.ls-stage:not([data-model="tee"])[data-shirt="royal"] .ls-mock, .ls-stage:not([data-model="tee"])[data-shirt="forest"] .ls-mock { top: -100%; }
.ls-print {
  position: absolute; left: 31.4%; top: 24.2%; z-index: 2; width: 36.5%; aspect-ratio: var(--ls-ratio, 0.8); overflow: hidden;
  border: 1.5px solid #22D3EE; border-radius: 2px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18);
}
.ls-stage[data-model="long-sleeve"] .ls-print { left: 33.75%; top: 26%; width: 32.5%; }
.ls-stage[data-model="sweatshirt"] .ls-print { left: 34.5%; top: 26%; width: 31%; }
.ls-safe { position: absolute; inset: 0; z-index: 3; border: 1px dashed rgba(37, 99, 235, 0.8); pointer-events: none; }
.ls-sel { position: absolute; z-index: 2; border: 2px solid #16A34A; cursor: grab; touch-action: none; user-select: none; box-sizing: border-box; }
.ls-sel.is-dragging { cursor: grabbing; }
.ls-sel img { width: 100%; height: 100%; display: block; max-width: none; object-fit: fill; pointer-events: none; user-select: none; }
.ls-handle {
  position: absolute; z-index: 5; width: 18px; height: 18px; padding: 0; border: 2px solid #FFFFFF; border-radius: 50%;
  background: #2563EB; box-shadow: 0 1px 5px rgba(15, 23, 42, 0.4); cursor: nwse-resize; touch-action: none; transform: translate(-50%, -50%);
}
.ls-stage-over {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; text-align: center; background: rgba(255, 255, 255, 0.88); font-size: 14px; color: var(--ink-2);
}
.ls-stage-over.is-err { color: var(--err-ink); }
.ls-tools { display: flex; align-items: center; justify-content: center; gap: 10px 14px; flex-wrap: wrap; }
.ls-shirts, .ls-toolgroup { display: flex; align-items: center; gap: 6px; }
.ls-shirt { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-3); padding: 0; }
.ls-shirt[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.ls-toolgroup .icon-btn { width: 40px; height: 40px; font-size: 18px; font-weight: 700; }
.ls-toolgroup .btn { height: 40px; padding: 0 12px; font-size: 13px; }
.ls-art-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ls-ref {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 180px;
  padding: 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2);
}
.ls-ref img { width: 100%; max-height: 290px; object-fit: contain; border-radius: 8px; }
.ls-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ls-metrics div, .ls-art-facts div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); min-width: 0; }
.ls-metrics span, .ls-art-facts span { font-size: 11px; color: var(--muted-2); }
.ls-metrics strong { font-family: var(--mono); font-size: 15px; }
.ls-art-facts { display: grid; gap: 8px; }
.ls-art-facts strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ls-art-side .hint { margin: 0; line-height: 1.5; }
.ls-queue { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.ls-qdot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-3); }
.ls-qdot.is-ok { background: var(--ok); }
.ls-qdot.is-err { background: var(--err); }
.ls-qdot.is-now { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.ls-art-status { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.ls-art-status.is-err { color: var(--err); }
.ls-grow { flex-grow: 1; }
.ls-result { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.ls-result strong { font-size: 16px; }
.ls-result.is-ok { background: var(--ok-bg); color: #0B4A2E; }
.ls-result.is-info { background: var(--accent-wash); color: #1B2F73; }
.ls-result.is-warn { background: var(--warn-bg); color: var(--warn-ink); }
.ls-result.is-err { background: var(--err-bg); color: var(--err-ink); }
.ls-confirm { width: 480px; }

@media (max-width: 1199px) {
  .ls-thead, .ls-row { grid-template-columns: 44px minmax(0, 2fr) minmax(0, 1fr) minmax(180px, 220px); column-gap: 16px; padding: 0 14px; }
  .ls-art { grid-template-columns: minmax(0, 1fr) 250px; }
}
@media (max-width: 899px) {
  .ls-thead { display: none; }
  .ls-row {
    grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "chk prod" "chk state";
    row-gap: 4px; column-gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; min-height: 0;
  }
  .ls-row > span:first-child { display: none; }
  .ls-row .check { grid-area: chk; width: 34px; height: 34px; margin: -2px 0 0 -6px; align-self: start; }
  .ls-row .ls-prod { grid-area: prod; padding: 0; }
  .ls-row .ls-state { grid-area: state; padding: 0; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
  .ls-row .ls-tags { display: none; }
  .ls-title { white-space: normal; }
  .ls-selbar .ls-menu { left: 0; transform: none; }
  .ls-wiz, .ls-wiz.is-wide { width: 100%; }
  .ls-plan-line { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ls-route { grid-template-columns: minmax(0, 1fr); }
  .ls-route-img { height: 140px; }
  .ls-art { grid-template-columns: minmax(0, 1fr); }
  .ls-stage { width: 100%; }
  .ls-ref { min-height: 0; }
  .ls-ref img { max-height: 180px; }
  .ls-steps li { height: 26px; font-size: 11px; }
  .ls-edit-row { grid-template-columns: minmax(0, 1fr); }
}

/* =====================================================================
   Email MKT v2
   ===================================================================== */
#em-refresh.is-busy .ico { animation: rot 1s linear infinite; }
.em-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.em-kpi.is-link { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.em-kpi.is-link:hover { border-color: #B9C7F2; background: #FBFCFF; }
.em-kpi .kpi-label { justify-content: space-between; }
.em-more { font-size: 18px; line-height: 1; color: var(--accent); font-weight: 700; }
.em-kpi .kpi-meta > span { display: block; line-height: 1.4; }
.em-kpi .kpi-value.em-dual { font-size: 22px; line-height: 1.4; }
.em-pulse { animation: pulse 1.4s ease-in-out infinite; }
.em-flag-btn { height: 30px; padding: 0 10px; font-size: 12px; margin-left: 4px; }
.em-note { margin: 12px 0 0; line-height: 1.5; }
.em-counts { margin: 14px 2px 0; }
.em-foot { margin: 6px 2px 0; }
.em-share { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.em-share-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink-2); }
.em-share-head b { font-size: 18px; color: var(--ok); font-variant-numeric: tabular-nums; }
.em-share-bar { position: relative; height: 10px; border-radius: 999px; background: var(--line-2); overflow: visible; }
.em-share-bar i { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.em-share-bar em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: 0.35; }
.em-share-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-2); }
.em-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.em-preset { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); min-width: 0; }
.em-preset div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.em-preset strong { font-size: 13px; }
.em-preset span { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-preset b { font-size: 12px; white-space: nowrap; padding: 3px 9px; border-radius: 999px; }
.em-preset.is-live b { background: var(--ok-bg); color: var(--ok); }
.em-preset.is-off b { background: var(--warn-bg); color: var(--warn); }
.em-preset.is-missing { border-style: dashed; background: var(--surface); }
.em-preset.is-missing b { background: var(--stone-bg); color: var(--stone); }
.em-card-foot { margin-top: 12px; display: flex; justify-content: flex-end; }
.em-link { height: 36px; padding: 0 12px; font-size: 13px; }
.em-card-wide { margin-bottom: 16px; }
.em-chips { padding: 0 0 12px; border: 0; }
.em-list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.em-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; width: 100%;
  padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.em-row:last-child { border-bottom: 0; }
.em-row:hover { background: #FAFAF7; }
.em-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.em-row-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-row-main > span { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.em-row-side small { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.em-st-live, .em-st-sent { background: var(--ok-bg); color: var(--ok); }
.em-st-off, .em-st-canceled, .em-st-other { background: var(--stone-bg); color: var(--stone); }
.em-st-draft { background: var(--review-bg); color: var(--review); }
.em-st-scheduled, .em-st-sending { background: var(--accent-soft); color: var(--accent); }
.em-table td strong { font-weight: 600; }
.em-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--muted-2); font-family: inherit; }
.em-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.em-group {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.em-group b { font-size: 22px; font-variant-numeric: tabular-nums; }
.em-group span { font-size: 12px; color: var(--ink-2); }
.em-group[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.em-group.is-hot b { color: #C2410C; } .em-group.is-warm b { color: var(--accent); } .em-group.is-review b { color: var(--review); }
.em-group.is-good b, .em-group.is-vip b { color: var(--ok); } .em-group.is-new b { color: var(--teal); } .em-group.is-none b { color: var(--muted); }
.em-group-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.em-group-note strong { font-weight: 700; }
.em-group-note span { color: var(--ink-2); }
.em-group-note .btn { margin-left: auto; }
.em-total { font-family: var(--mono); font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.em-search { margin: 0 0 12px; }
.em-gchips { display: flex; flex-wrap: wrap; gap: 4px; }
.em-gchip { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--stone-bg); color: var(--ink-2); white-space: nowrap; }
.em-gchip.is-hot { background: #FFEDD5; color: #9A3412; } .em-gchip.is-warm { background: var(--accent-soft); color: var(--accent-ink); }
.em-gchip.is-review { background: var(--review-bg); color: var(--review); } .em-gchip.is-good, .em-gchip.is-vip { background: var(--ok-bg); color: var(--ok); }
.em-gchip.is-new { background: var(--teal-bg); color: var(--teal); }
.em-mail { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.em-mail.yes { background: var(--ok-bg); color: var(--ok); } .em-mail.no { background: var(--stone-bg); color: var(--stone); }
.em-drawer { width: 640px; }
.em-dsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.em-dsum div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); }
.em-dsum span { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.em-dsum b { font-size: 16px; font-variant-numeric: tabular-nums; }
.em-check { font-size: 13px; padding: 10px 12px; border-radius: 10px; line-height: 1.5; }
.em-check.ok { background: var(--ok-bg); color: #0B4A2E; }
.em-check.info { background: var(--accent-wash); color: #1B2F73; }
.em-check.warn { background: var(--warn-bg); color: var(--warn-ink); }
.em-sent-buy { background: var(--ok-bg); color: var(--ok); } .em-sent-bad { background: var(--err-bg); color: var(--err); }
.em-sent-click { background: var(--accent-soft); color: var(--accent); } .em-sent-open { background: var(--teal-bg); color: var(--teal); }
.em-sent-got { background: var(--stone-bg); color: var(--stone); }
.em-mini { height: 30px; padding: 0 10px; font-size: 12px; }
/* Report: Shopify Billing and payouts */
.rp-head-links { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.rp-link { height: 30px; padding: 0 10px; font-size: 12px; }
.rp-mini { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.rp-armed { border-color: var(--err); color: var(--err); }
.rp-drawer { width: 620px; }
.rp-bill-sync { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rp-bill-sync .hint { flex: 1 1 220px; }
.rp-bill-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); }
.rp-bill-form .btn { grid-column: 1 / -1; justify-self: end; }
.rp-bill-paste { display: flex; flex-direction: column; gap: 8px; }
.rp-bill-paste[open] { gap: 10px; }
.rp-bill-paste summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rp-bill-paste .btn { align-self: flex-end; }
.rp-pay-dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rp-pay-dates .sm-in { width: auto; }
/* Email MKT: ticked customers, Kết nối, AI campaigns */
.em-crow { display: flex; align-items: stretch; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.em-crow:last-child { border-bottom: 0; }
.em-crow .em-row { flex: 1 1 auto; min-width: 0; border-bottom: 0; background: transparent; }
.em-crow:not(.no-pick) .em-row { padding-left: 0; }
.em-crow:hover { background: #FAFAF7; }
.em-crow.is-picked { background: #F5F7FD; }
.em-crow .check { display: flex; align-items: center; justify-content: center; width: 44px; flex-shrink: 0; cursor: pointer; }
.em-crow .check input, .card-head h3 .check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.card-head h3 .check { display: inline-flex; vertical-align: -3px; margin-right: 10px; cursor: pointer; }
.em-touched { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--accent-wash); color: var(--accent-ink); white-space: nowrap; }
.em-group-btns { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.em-group-note .em-group-btns .btn { margin-left: 0; }
.em-conn { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.em-conn-state { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.em-conn-state .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--stone); }
.em-conn-state.is-ok .dot { background: var(--ok); }
.em-conn-state.is-warn .dot { background: var(--warn); }
.em-conn-state > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.em-conn-state strong { font-size: 15px; font-weight: 700; }
.em-conn-state span { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.em-adv summary, .eb-preview summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.em-adv[open] summary { margin-bottom: 12px; }
.em-conn-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.em-plans { display: flex; flex-direction: column; gap: 6px; }
.em-plan { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.em-plan-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; background: transparent; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.em-plan-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-plan-main small { font-size: 12px; color: var(--muted-2); }
.em-confirm-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.eb .oi-body { gap: 14px; }
.eb [data-eb-slot]:empty { display: none; }
.eb-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.eb-who .is-bad, .eb-foot .is-bad { color: var(--err); }
.eb-who small { font-size: 12px; color: var(--muted-2); }
.eb-who .em-link { height: 26px; padding: 0 8px; }
.eb-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.eb-row .grow, .eb-foot .grow { flex: 1 1 auto; }
.eb-meta { font-size: 13px; color: var(--muted); }
.eb-reuse { width: auto; max-width: 260px; }
.eb-rewrite .sm-in { flex: 1 1 240px; }
.eb-note { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.eb-note .is-warn { color: var(--warn-ink); }
.eb-done { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.eb-warn { font-size: 12px; color: var(--warn-ink); }
.eb-foot { display: flex; align-items: center; gap: 10px; padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); }
.eb-mail { margin-top: 10px; padding: 18px 20px; border: 1px solid var(--line-2); border-radius: 12px; background: #FFFFFF; color: #1F2937; }
.eb-mail h1 { margin: 0 0 12px; font-size: 22px; line-height: 1.25; color: #111827; }
.eb-mail p { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: #4B5563; white-space: pre-line; overflow-wrap: anywhere; }
.eb-mail p.eb-muted { font-size: 13px; color: #6B7280; }
.eb-inbox { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--line-3); font-size: 13px; }
.eb-inbox span { color: var(--muted-2); }
.eb-cta span { display: inline-block; padding: 10px 18px; border-radius: 8px; background: #2F5BEA; color: #FFFFFF; font-weight: 700; }
.eb-fine { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 12px; color: #6B7280; }
.em-hist { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.em-hist:last-child { border-bottom: 0; }
.em-hist > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.em-hist strong { font-weight: 600; overflow-wrap: anywhere; }
.em-hist small { font-size: 12px; color: var(--muted-2); }
.em-hist-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.em-preview { width: 760px; height: min(86dvh, 900px); gap: 10px; }
.em-frame { flex: 1 1 auto; min-height: 0; width: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: #FFFFFF; }
.em-text { flex: 1 1 auto; overflow: auto; white-space: pre-wrap; font-size: 13px; background: var(--surface-2); padding: 12px; border-radius: 10px; margin: 0; }
@media (max-width: 1499px) {
  .em-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .em-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* The Report's phone grid gives its cards fixed spans; the Email cards flow in 2 columns. */
  .kpis.em-kpis .kpi.em-kpi { grid-column: auto; }
  .rp-controls.email-only { flex-wrap: nowrap; flex-shrink: 1; min-width: 0; max-width: 100%; }
  .em-kpis .kpi-value.em-dual { font-size: 16px; }
  #em-periods { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  #em-periods::-webkit-scrollbar { display: none; }
  #em-periods button { flex-shrink: 0; }
  .em-kpis .kpi { padding: 10px 10px 8px; gap: 3px; border-radius: 12px; }
  .em-kpis .kpi-value { font-size: 17px; }
  .em-kpis .kpi-meta { font-size: 11px; }
  .em-presets { grid-template-columns: minmax(0, 1fr); }
  .em-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .em-row-side { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px; text-align: left; }
  .em-drawer { width: 100%; }
  .rp-drawer { width: 100%; }
  .rp-bill-form { grid-template-columns: minmax(0, 1fr); }
  .em-preview { height: 90dvh; }
}

/* =====================================================================
   Customer Care v2
   ===================================================================== */
.cr-layout { gap: 16px; }
.cr-list { flex: 0 0 clamp(340px, 31vw, 460px); }
.cr-chips { align-items: center; gap: 6px 8px; }
.cr-chips::-webkit-scrollbar { display: none; }
.cr-chips .fchip { flex-shrink: 0; padding: 0 11px; }
.cr-chips .hint { white-space: nowrap; }
.cr-all { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 36px; flex-shrink: 0; cursor: pointer; }
.cr-all input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
#cr-chips, #cr-notice { flex-shrink: 0; }
#cr-chips:empty, #cr-notice:empty { display: none; }

.cr-row { display: flex; align-items: flex-start; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.cr-row:hover { background: #FAFAF7; }
.cr-row.is-checked { background: #F5F7FD; }
.cr-row.is-open { background: #EEF2FC; box-shadow: inset 3px 0 0 var(--accent); }
.cr-row .check { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; margin-top: 4px; cursor: pointer; }
.cr-row .check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.cr-row-main {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 12px 18px 12px 0;
  border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 14px;
}
.cr-row.no-check .cr-row-main { padding-left: 18px; }
.cr-row-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cr-row-top strong { flex: 1 1 auto; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-row-top time { flex-shrink: 0; font-family: var(--mono); font-size: 12px; color: var(--muted-2); }
.cr-row.is-unread .cr-row-top strong::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent); vertical-align: 1px;
}
.cr-row-subject { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-row.is-unread .cr-row-subject { color: var(--ink); font-weight: 600; }
.cr-row-preview { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cr-tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--stone-bg); color: var(--stone); white-space: nowrap; }
.cr-tag.mono { font-family: var(--mono); }
.cr-tag-warn { background: var(--warn-bg); color: var(--warn); }
.cr-st { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.cr-row-tags .cr-st { font-size: 11px; padding: 2px 8px; }
.cr-st-todo { background: var(--warn-bg); color: var(--warn); }
.cr-st-wait { background: var(--accent-soft); color: var(--accent); }
.cr-st-done { background: var(--ok-bg); color: var(--ok); }
.cr-st-spam { background: var(--err-bg); color: var(--err); }

.cr-detail {
  flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.cr-head { flex-shrink: 0; }
.cr-head:empty { display: none; }
.cr-head-row { display: flex; align-items: flex-start; gap: 10px; padding: 16px 22px 12px; }
.cr-back { display: none; }
.cr-head-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto; }
.cr-head-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cr-head h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.cr-head .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 22px 14px; border-bottom: 1px solid var(--line-2); }
.cr-head-row:last-child { border-bottom: 1px solid var(--line-2); }
.cr-actions .btn { height: 38px; padding: 0 14px; font-size: 13px; }
.cr-move { height: 38px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line-3); background: var(--surface); padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.cr-spam-btn { margin-left: auto; color: var(--err); }
.cr-spam-btn:hover:not(:disabled) { color: var(--err-ink); background: var(--err-bg); border-color: var(--err-line); }

.cr-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 22px 20px; background: var(--surface-2); }
.cr-scroll > * { flex-shrink: 0; }
.cr-empty { margin: auto 0; align-items: center; text-align: center; }
.cr-ai { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 12px; background: var(--review-bg); color: var(--review-ink); overflow-wrap: anywhere; }
.cr-ai b { font-weight: 700; margin-right: 4px; }
.cr-mini { height: 34px; padding: 0 12px; font-size: 13px; }

.cr-order { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.cr-order.is-empty { padding: 10px 14px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.cr-order.is-empty b { color: var(--ink-2); }
.cr-order > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.cr-order > summary::-webkit-details-marker { display: none; }
.cr-order > summary::after { content: "▾"; margin-left: auto; color: var(--muted-2); font-size: 12px; transition: transform 0.15s ease; }
.cr-order[open] > summary::after { transform: rotate(180deg); }
.cr-order > summary .hint { white-space: nowrap; }
.cr-order-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-order-sum b { color: var(--ink); font-weight: 600; }
.cr-order-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 14px 14px; }
.cr-order-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-order-pick .fchip { height: 32px; font-family: var(--mono); }
.cr-items, .cr-address { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.cr-items em { color: var(--muted); font-style: normal; }
.cr-actions-log { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.cr-actions-log .is-bad { color: var(--err); }
.cr-actions-log .is-ok { color: var(--ok); }
.cr-actions-log .is-wait { color: var(--warn); }
.cr-order-links { display: flex; flex-wrap: wrap; gap: 8px; }

.cr-msg { display: flex; flex-direction: column; gap: 6px; max-width: min(88%, 760px); padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.cr-msg-in { align-self: flex-start; border-top-left-radius: 4px; }
.cr-msg-out { align-self: flex-end; background: var(--accent-wash); border-color: #DDE4F8; border-top-right-radius: 4px; }
.cr-msg-note { align-self: stretch; max-width: none; background: #FFF8E6; border-color: #F3DFA8; border-style: dashed; }
.cr-msg-sup { align-self: flex-start; background: var(--teal-bg); border-color: #BFE3E6; }
.cr-msg header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12px; color: var(--muted-2); }
.cr-msg header strong { color: var(--ink-2); font-weight: 600; }
.cr-msg header time { margin-left: auto; font-family: var(--mono); }
.cr-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; color: var(--ink); }
.cr-quote summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.cr-quote .cr-msg-body { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line-3); color: var(--muted); font-size: 13px; }

.cr-compose { flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 22px 16px; border-top: 1px solid var(--line-2); background: var(--surface); }
.cr-compose-top, .cr-compose-bottom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cr-compose-top .hint { min-width: 0; overflow-wrap: anywhere; }
.cr-grow { flex: 1 1 auto; }
.cr-compose textarea {
  width: 100%; min-height: 96px; max-height: 40vh; resize: vertical; padding: 10px 12px; border: 1px solid var(--line-3); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5;
}
.cr-compose textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 72, 196, 0.12); }
.cr-compose textarea[readonly] { background: var(--surface-2); color: var(--muted); }
.cr-compose [data-slot]:empty { display: none; }
.cr-warn { font-size: 13px; color: var(--err-ink); background: var(--err-bg); padding: 8px 12px; border-radius: 10px; }
.cr-templates { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.cr-template { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 9px 12px; text-align: left; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.cr-template:hover { border-color: var(--line-4); background: var(--surface); }
.cr-template b { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.cr-template span:not(.cr-tag) { max-width: 100%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-confirm { width: 460px; }
.cr-act { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cr-act-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.cr-order-links .btn.is-off { color: var(--muted-2); background: var(--surface-2); }
.cr-more { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 14px 12px 18px; }
.cr-tpl-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.modal.cr-form { width: 520px; }
.modal.cr-form.is-wide { width: 640px; }
.cr-form-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cr-form-title .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cr-form-body { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 2px 6px; }
.cr-form-body [data-slot]:empty { display: none; }
.cr-refund-row { display: flex; align-items: center; gap: 10px; }
.cr-refund-row .seg { flex: 0 0 auto; }
.cr-refund-row .sm-in { flex: 1 1 auto; height: 44px; font-size: 18px; font-weight: 700; }
.cr-calc { font-size: 14px; color: var(--ink-2); }
.cr-calc b { color: var(--ink); }
.cr-calc .is-bad { color: var(--err); }
.cr-calc .is-warn { color: var(--warn-ink); }
.cr-effects { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.cr-form-hint { flex: 1 1 160px; min-width: 0; align-self: center; font-size: 12px; }
textarea.sm-in { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; font: inherit; font-size: 14px; font-weight: 400; }
.sm-in:disabled { background: var(--surface-2); color: var(--ink-2); }
.cr-tpl-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.cr-tpl-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cr-tpl-main b { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.cr-tpl-main span:not(.cr-tag) { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-tpl-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.cr-check { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--ink-2); }
.cr-check input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.cr-check small { flex-basis: 100%; padding-left: 26px; font-size: 12px; color: var(--muted-2); }
.cr-check-top { align-self: end; padding-bottom: 10px; }
.cr-check .cr-num { width: 64px; height: 36px; text-align: center; }
.selbar .cr-bulk-move { height: 44px; padding: 0 10px; border: 1px solid #45464D; border-radius: 10px; background: transparent; color: #FFFFFF; font: inherit; font-size: 14px; }
.selbar .cr-bulk-move option { color: var(--ink); }
.alert .alert-btn { margin-left: 8px; vertical-align: middle; }
.push-list { display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1199px) {
  .cr-list { flex-basis: 330px; }
  .cr-head-row { padding: 14px 18px 10px; }
  .cr-actions { padding: 0 18px 12px; }
  .cr-scroll { padding: 14px 18px 18px; }
  .cr-compose { padding: 12px 18px 14px; }
}
@media (max-width: 899px) {
  .cr-layout { gap: 0; }
  .cr-list { flex: 1 1 auto; }
  .cr-detail { display: none; }
  .cr-layout.has-open .cr-detail {
    display: flex; position: fixed; inset: 0; z-index: 60; border: 0; border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .cr-back { display: inline-flex; }
  .cr-head-row { padding: 12px 14px 10px; gap: 8px; }
  .cr-head h2 { font-size: 16px; }
  .cr-actions { padding: 0 14px 12px; gap: 6px; }
  .cr-actions .btn, .cr-move { height: 40px; }
  .cr-actions .btn { padding: 0 11px; }
  .cr-move { max-width: 122px; padding: 0 6px; }
  .cr-compose-top .hint { flex-basis: 100%; }
  .cr-compose-top .cr-grow { display: none; }
  .cr-form .sm-grid2.cr-addr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cr-form-hint { flex-basis: 100%; }
  .cr-tpl-row { flex-direction: column; align-items: stretch; }
  .cr-tpl-btns { justify-content: flex-end; }
  .cr-scroll { padding: 12px 14px 16px; }
  .cr-msg { max-width: 94%; }
  .cr-compose { padding: 10px 14px 12px; }
  .cr-compose textarea { min-height: 84px; max-height: 32vh; }
  .cr-row { border: 1px solid var(--line); border-radius: 14px; }
  .cr-row.is-open { box-shadow: none; }
  .cr-row .check { width: 40px; height: 40px; }
  .cr-row-main { padding: 12px 14px 12px 0; }
  .cr-row.no-check .cr-row-main { padding-left: 14px; }
  .cr-chips .hint { font-size: 12px; }
}

/* =====================================================================
   Care Ads v2
   ===================================================================== */
.ca-view { padding-top: 16px; }
.ca-view.is-readonly .ca-ads, .ca-view.is-readonly .ca-review { display: none; }
.ca-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; max-width: 1380px; }
.ca-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ca-card { display: flex; flex-direction: column; gap: 14px; }
.ca-card-head { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.ca-card-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.ca-step {
  width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #FFFFFF; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.ca-grow { flex-grow: 1; }
.btn.ca-mini { height: 34px; padding: 0 12px; font-size: 13px; }
.ca-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ca-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.ca-field small { font-size: 12px; font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; }
.ca-field select, .ca-in {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line-3); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400;
}
textarea.ca-in { height: auto; padding: 9px 12px; line-height: 1.45; resize: vertical; font: inherit; }
.ca-in::placeholder { color: var(--muted-2); }
.ca-field select:focus, .ca-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 72, 196, 0.12); }
.ca-field select:disabled { background: var(--surface-2); color: var(--muted); }
.ca-inline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ca-inline > select, .ca-inline > input { flex: 1 1 auto; }
.ca-inline > input[type="date"] { flex: 3 1 0; padding: 0 8px; }
.ca-inline > input[type="time"] { flex: 2 1 0; padding: 0 8px; }
.ca-bad { color: var(--err); }
.ca-mode-row { display: flex; }
.ca-sentence { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ca-sentence b { color: var(--ink); font-weight: 600; }
.ca-existing { display: flex; flex-direction: column; gap: 10px; }
.ca-search { flex-grow: 0; height: 40px; }
.ca-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 292px; overflow-y: auto; padding: 1px; }
.ca-pick {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px; flex-shrink: 0;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left;
}
.ca-pick:hover { border-color: var(--line-4); background: var(--surface-2); }
.ca-pick.is-on { border-color: var(--accent); background: var(--accent-wash); }
.ca-radio { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--line-4); background: var(--surface); }
.ca-pick.is-on .ca-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.ca-pick-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ca-pick-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.ca-pick-meta { font-size: 12px; color: var(--muted); }
.ca-badge { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; }
.ca-badge.ca-cbo { background: var(--teal-bg); color: var(--teal); }
.ca-badge.ca-abo { background: var(--review-bg); color: var(--review); }
.ca-sub-head { margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); }
.ca-pick-foot { margin: 0; }
.ca-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.ca-link:hover { text-decoration: underline; }

.ca-rows { display: flex; flex-direction: column; gap: 12px; }
.ca-row {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "thumb top" "thumb main";
  gap: 8px 14px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
}
.ca-row.has-issues { border-color: var(--err-line); }
.ca-thumb {
  grid-area: thumb; position: relative; width: 112px; height: 112px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); cursor: pointer;
}
.ca-thumb.is-empty { border: 2px dashed var(--line-4); }
.ca-thumb.is-empty:hover, .ca-thumb.is-drop { border-color: var(--accent); background: var(--accent-wash); }
.ca-thumb-pic { display: contents; }
.ca-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ca-thumb small {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; background: rgba(28, 29, 33, 0.62); color: #FFFFFF;
  font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-thumb-empty { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.ca-thumb-empty b { font-size: 22px; font-weight: 500; line-height: 1; }
.ca-row-main { grid-area: main; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ca-row-top { grid-area: top; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 34px; }
.ca-row-top > b { font-size: 14px; }
.icon-btn.ca-x { width: 34px; height: 34px; }
.ca-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ca-chip-ok { background: var(--ok-bg); color: var(--ok); }
.ca-chip-bad { background: var(--err-bg); color: var(--err); }
.ca-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.ca-span2 { grid-column: 1 / -1; }
.ca-msg { margin: 0; font-size: 12px; font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; }
.ca-msg.ca-ok { color: var(--ok); }
.ca-msg.ca-warn { color: var(--warn-ink); }
.ca-msg.ca-error { color: var(--err); }
.ca-msg.ca-busy, .ca-msg.ca-info, .ca-msg.ca-hint { color: var(--muted); }
.ca-issues { margin: 0; padding: 8px 12px 8px 28px; border-radius: 10px; background: var(--err-bg); color: var(--err-ink); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.btn.ca-add { align-self: flex-start; height: 40px; }

.ca-review { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; }
.ca-state { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.ca-state.ca-good { color: var(--ok); }
.ca-state.ca-bad { color: var(--err); }
.ca-state.ca-warn-t { color: var(--warn); }
.ca-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.ca-sum { display: flex; flex-direction: column; gap: 10px; transition: opacity 0.15s; }
.ca-sum.is-stale { opacity: 0.45; }
.ca-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ca-counts > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.ca-counts b { font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ca-counts span { font-size: 12px; color: var(--muted); }
.ca-money { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: #FFFFFF; }
.ca-money span { font-size: 13px; opacity: 0.8; }
.ca-money b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ca-money small { margin-left: 2px; font-size: 13px; font-weight: 500; opacity: 0.8; }
.ca-groups { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line-2); border-radius: 10px; }
.ca-groups li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name money" "rows money"; gap: 1px 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.ca-groups li:last-child { border-bottom: 0; }
.ca-g-name { grid-area: name; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink-2); }
.ca-g-name b { color: var(--ink); font-weight: 600; }
.ca-g-rows { grid-area: rows; font-size: 12px; color: var(--muted-2); }
.ca-g-money { grid-area: money; align-self: center; font-variant-numeric: tabular-nums; }
.ca-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ca-review .hint { margin: 0; line-height: 1.5; }
.ca-notes { padding: 8px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.ca-notes summary { font-weight: 600; cursor: pointer; }
.ca-notes ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; }
.ca-actions { display: flex; gap: 8px; }
.ca-actions .btn-primary { flex-grow: 1; }
.ca-exported { margin: 0; font-size: 13px; color: var(--ok); }

.ca-drawer .ca-form { gap: 14px; }
.ca-form h3 { margin: 8px 0 0; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); }
.ca-form .seg { align-self: flex-start; }
.ca-adv summary { font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; }
.ca-adv[open] { display: flex; flex-direction: column; gap: 12px; }
.ca-adv[open] summary { margin-bottom: 2px; }
textarea.ca-paste { min-height: 150px; }

@media (max-width: 1199px) {
  .ca-layout { grid-template-columns: minmax(0, 1fr); }
  .ca-review { position: static; }
}
@media (max-width: 899px) {
  .ca-view { padding-top: 12px; }
  .ca-grid2, .ca-more { grid-template-columns: minmax(0, 1fr); }
  .ca-row { grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "thumb top" "main main"; gap: 10px; padding: 12px; }
  .ca-thumb { width: 64px; height: 64px; }
  .ca-thumb small { display: none; }
  .ca-card-head, .ca-row-top { flex-wrap: wrap; }
  .ca-row-top { align-content: center; }
  .ca-mode-row .seg { width: 100%; }
  .ca-mode-row .seg button { flex: 1 1 0; }
}

/* =====================================================================
   Chrome Extension · Đổi mật khẩu · Đăng xuất (account.js)
   ===================================================================== */
.alert.a-ok { background: var(--ok-bg); color: var(--ok); }
.acc-view { padding-top: 16px; }
.acc-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; max-width: 1080px; }
.acc-wrap.acc-narrow { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
.acc-card { display: flex; flex-direction: column; gap: 14px; }
.acc-head { display: flex; align-items: center; gap: 12px; }
.acc-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.acc-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.acc-icon { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.acc-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.acc-status > div { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.acc-status b { font-size: 14px; color: var(--ink); }
.acc-status small { color: var(--muted); line-height: 1.45; }
.acc-status .dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50%; background: var(--line-4); }
.acc-status.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.acc-status.off .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.acc-pill { flex-shrink: 0; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.acc-pill.acc-ok { background: var(--ok-bg); color: var(--ok); }
.acc-pill.acc-warn { background: var(--warn-bg); color: var(--warn); }
.btn.acc-big { height: 48px; font-size: 15px; }
.acc-card .hint { margin: 0; line-height: 1.5; }
.acc-seg { align-self: flex-start; }
.acc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.acc-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--ink); }
.acc-steps li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-steps small { font-size: 12px; color: var(--muted); }
.acc-steps code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; }
.acc-num { width: 24px; height: 24px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ink); color: #FFFFFF; font-size: 12px; font-weight: 700; }
.acc-copy { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); vertical-align: middle; }
.acc-copy:hover { background: var(--surface-2); color: var(--ink); }
.acc-flow { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.acc-flow li { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.acc-flow li .acc-num { background: var(--line-4); }
.acc-flow li.on { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); }
.acc-flow li.on .acc-num { background: var(--accent); }
.acc-flow li.done .acc-num { background: var(--ok); }

/* =====================================================================
   Store Manager (stores.js)
   ===================================================================== */
#st-tabs { padding-bottom: 0; }
.st-view { padding-top: 14px; padding-bottom: 0; }
/* The save bar sticks to the very bottom: the page's bottom space is a margin, not padding. */
.st-view > .st-layout, .st-view > .st-lark-wrap { margin-bottom: 24px; }
.st-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; max-width: 1280px; }
.st-list { display: flex; flex-direction: column; gap: 8px; padding: 14px; position: sticky; top: 0; }
.btn.sm-add { height: 40px; }
.sm-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; }
button.sm-item:hover { border-color: var(--line-4); background: var(--surface-2); }
.sm-item.is-on { border-color: var(--accent); background: var(--accent-wash); }
.sm-item-name { font-size: 15px; font-weight: 700; }
.sm-item-url { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.sm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.sm-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--stone-bg); color: var(--stone); font-size: 11px; font-weight: 700; }
.sm-chip-main { background: var(--accent-soft); color: var(--accent-ink); }
.sm-chip-warn { background: var(--warn-bg); color: var(--warn); }
.sm-chip-hot { background: var(--err-bg); color: var(--err); }
.sm-item-health { font-size: 12px; font-weight: 600; }
.sm-item-health.ok { color: var(--ok); }
.sm-item-health.bad { color: var(--err); }
.st-detail { display: flex; flex-direction: column; padding: 0; min-width: 0; }
.sm-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.sm-head .grow { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.sm-head h2 { margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.sm-secs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.sm-sec { position: relative; height: 40px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.sm-sec:hover { color: var(--ink); }
.sm-sec[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.sm-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.sm-body { display: flex; flex-direction: column; gap: 16px; padding: 18px 20px; }
.sm-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-2); background: var(--surface); border-radius: 0 0 14px 14px; }
.sm-foot .grow { flex-grow: 1; }
.sm-dirty { font-size: 13px; font-weight: 700; color: var(--warn); }
.sm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.sm-field > small { font-weight: 400; line-height: 1.45; }
.sm-in { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line-3); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400; }
.sm-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 72, 196, 0.12); }
.sm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sm-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sm-h3 { margin: 6px 0 -4px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); }
.sm-h3 small { margin-left: 6px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.sm-secret { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sm-secret .sm-in { flex: 1 1 auto; }
.sm-saved { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; font-weight: 500; }
.sm-saved i { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--ok); }
.sm-secret.is-clear .sm-saved { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.btn.sm-mini { height: 34px; padding: 0 12px; font-size: 13px; flex-shrink: 0; }
.btn.sm-danger-t { color: var(--err); }
.btn.btn-primary.sm-danger { background: var(--err); }
.btn.btn-primary.sm-danger:hover:not(:disabled) { background: #7E1D17; }
.sm-self { align-self: flex-start; }
.sm-current { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; }
.sm-current b { font-weight: 600; }
.sm-current small { flex-grow: 1; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.sm-current:not(:has(small)) b { flex-grow: 1; }
.sm-inline { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.sm-inline .sm-in { flex: 1 1 200px; }
.sm-picks { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding: 1px; }
.sm-pick { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; flex-shrink: 0; }
.sm-pick:hover { border-color: var(--line-4); background: var(--surface-2); }
.sm-pick.is-on { border-color: var(--accent); background: var(--accent-wash); }
.sm-pick > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-pick b { font-size: 14px; font-weight: 600; }
.sm-pick small { font-size: 12px; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.sm-radio, .sm-check { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; border: 2px solid var(--line-4); background: var(--surface); }
.sm-radio { border-radius: 50%; }
.sm-check { border-radius: 4px; }
.sm-pick.is-on .sm-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.sm-pick.is-on .sm-check { border-color: var(--accent); background: var(--accent); }
.sm-toggle { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; }
.sm-toggle:hover { background: var(--surface-2); }
.sm-toggle > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.sm-toggle b { font-size: 14px; font-weight: 600; }
.sm-toggle small { font-size: 12px; color: var(--muted); font-weight: 400; }
.sm-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; margin-top: 1px; border-radius: 999px; background: var(--line-4); transition: background 0.15s; }
.sm-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.sm-toggle[aria-checked="true"] .sm-switch { background: var(--accent); }
.sm-toggle[aria-checked="true"] .sm-switch::after { transform: translateX(16px); }
.sm-code { flex: 1 1 260px; min-width: 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.sm-accs { display: flex; flex-wrap: wrap; gap: 6px; }
.sm-acc { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 13px; }
.sm-acc b { font-weight: 600; }
.sm-acc small { color: var(--muted); font-weight: 400; }
.sm-acc .icon-btn { width: 26px; height: 26px; }
.sm-bad { color: var(--err); font-weight: 500; }
.sm-good { color: var(--ok); font-weight: 600; }
.sm-list { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.sm-review { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; overflow-y: auto; min-height: 0; }
.sm-rev { display: grid; grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.4fr); gap: 2px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.sm-rev:last-child { border-bottom: 0; }
.sm-rev-label { color: var(--muted); font-weight: 600; font-size: 13px; }
.sm-rev-val { overflow-wrap: anywhere; }
.sm-rev-val s { color: var(--muted-2); }
.sm-rev small { grid-column: 2; color: var(--err); font-size: 12px; }
.sm-rev.is-danger { background: var(--err-bg); }
.st-lark-wrap { max-width: 720px; }
.sm-lark .hint { margin: 0; line-height: 1.5; }

@media (max-width: 1199px) {
  .acc-wrap { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
}
@media (max-width: 899px) {
  .acc-view { padding-top: 12px; }
  .st-view { padding-top: 12px; padding-bottom: 0; }
  .st-layout { grid-template-columns: minmax(0, 1fr); }
  .st-list { position: static; }
  .sm-grid2, .sm-grid3 { grid-template-columns: minmax(0, 1fr); }
  .sm-head { flex-wrap: wrap; padding: 14px 16px; }
  .sm-body { padding: 16px; }
  .sm-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
  .sm-rev { grid-template-columns: minmax(0, 1fr); }
  .sm-rev small { grid-column: 1; }
}

/* =====================================================================
   Ads Manager (fbads.js, fbads-core.js)
   The table keeps the current tab's Meta-like layout: levels, columns, switches, totals.
   ===================================================================== */
.fa-view { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; padding-bottom: 0; }
.fa-view > * { flex-shrink: 0; }
.fa-view > :last-child { margin-bottom: 20px; }
.fa-kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.fa-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; }
button.fa-kpi { cursor: pointer; }
button.fa-kpi:hover { border-color: var(--line-4); background: var(--surface-2); }
.fa-kpi > span { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.fa-kpi > b { font-size: 19px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fa-kpi > small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fa-kpi > small.is-bad { color: var(--err); font-weight: 600; }
.fa-kpi .is-good { color: var(--fa-good); }
.fa-kpi .is-bad { color: var(--fa-bad); }
.fa-care { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.fa-care b { color: var(--ink); }
.fa-care .grow { flex-grow: 1; }
.fa-card { display: flex; flex-direction: column; padding: 0; min-width: 0; overflow: hidden; }
.fa-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.fa-levels { display: flex; gap: 4px; flex-wrap: wrap; }
.fa-level { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.fa-level:hover { background: var(--surface-2); }
.fa-level[aria-selected="true"] { border-color: var(--line-3); background: var(--accent-wash); color: var(--accent-ink); }
.fa-bar-right { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.fa-bar .seg button { height: 32px; font-size: 12px; }
.btn.fa-mini { height: 34px; padding: 0 12px; font-size: 13px; }
.fa-table-wrap { position: relative; overflow: auto; max-height: calc(100dvh - 300px); }
.fa-table { border-collapse: separate; border-spacing: 0; table-layout: auto; width: max-content; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.fa-table th, .fa-table td { height: 50px; padding: 6px 10px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); background: var(--surface); text-align: right; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.fa-table thead th { position: sticky; top: 0; z-index: 3; height: 44px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 700; }
.fa-table thead th.is-sortable { cursor: pointer; }
.fa-table thead th.is-sortable:hover { color: var(--ink); background: #F3F2EE; }
.fa-table thead th .fa-sort { margin-left: 3px; color: var(--muted-2); font-weight: 500; }
.fa-table thead th.is-sorted .fa-sort { color: var(--accent); }
.fa-table thead th.fa-spend-filter { cursor: pointer; }
.fa-table thead th.fa-spend-filter small { display: block; margin-top: 1px; font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; }
.fa-table tfoot td { position: sticky; bottom: 0; z-index: 3; height: 52px; background: #F7F6F2; border-top: 2px solid var(--line-3); }
.fa-table td small { display: block; margin-top: 1px; font-size: 11px; color: var(--muted-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.fa-table [data-col="name"], .fa-table [data-col="delivery"], .fa-table [data-col="care_signal"] { text-align: left; }
.fa-table [data-col="select"], .fa-table [data-col="toggle"], .fa-table [data-col="row_index"] { text-align: center; padding-left: 4px; padding-right: 4px; }
.fa-table .fa-stick { position: sticky; z-index: 2; }
.fa-table thead .fa-stick, .fa-table tfoot .fa-stick { z-index: 4; }
.fa-table .fa-stick-last { box-shadow: 4px 0 6px -4px rgba(20, 20, 25, 0.18); }
.fa-table tbody tr:hover td { background: #FAF9F6; }
.fa-table tbody tr.is-selected td { background: var(--accent-wash); }
.fa-table tbody tr.fa-child td[data-col="name"] { padding-left: 28px; }
.fa-table tbody tr.fa-grandchild td[data-col="name"] { padding-left: 46px; }
.fa-table tbody tr.fbads-catalog-product-row td { background: #FCFBF8; }
.fa-empty-state { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 36px 20px; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--muted); text-align: center; }
.fa-empty-state[hidden] { display: none; }
.fa-btn-ico { display: none; }
/* Phones (768 px and below, as the current tab): one card per row, the same cells as the table. */
.fa-cards { display: none; }
.fa-cards:empty { display: none !important; }
.fa-cards-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; font-size: 12px; color: var(--muted); }
.fa-card-item { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.fa-card-item.is-selected { border-color: var(--accent); background: var(--accent-wash); }
.fa-card-item.is-product { margin-left: 14px; background: #FCFBF8; }
.fa-ci-top { display: flex; align-items: center; gap: 10px; }
.fa-ci-top .grow { flex-grow: 1; }
.fa-ci-badge { padding: 2px 8px; border-radius: 999px; background: var(--stone-bg); color: var(--stone); font-size: 11px; font-weight: 700; }
.fa-ci-name .fa-name-text, .fa-ci-name .fbads-product-name { max-width: none; }
.fa-ci-name .fbads-name-link, .fa-ci-name .fbads-product-name-button { font-size: 15px; line-height: 1.35; white-space: normal; }
.fa-ci-name small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted-2); overflow-wrap: anywhere; }
.fa-ci-signal .fbads-care-signal { max-width: 100%; }
.fa-ci-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fa-ci-quick div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 10px; background: var(--surface-2); }
.fa-ci-quick span { font-size: 11px; color: var(--muted); }
.fa-ci-quick b { font-size: 16px; font-variant-numeric: tabular-nums; }
.fa-ci-actions { display: flex; gap: 6px; }
.fa-ci-actions .btn { flex: 1 1 0; min-width: 0; }
.fa-ci-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line-2); }
.fa-ci-metrics div { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 8px 4px; border-bottom: 1px solid var(--line-2); text-align: center; }
.fa-ci-metrics dt { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-2); }
.fa-ci-metrics dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.fa-ci-metrics dd small { display: block; font-size: 11px; color: var(--muted-2); }
.fa-ci-metrics .fbads-budget-button, .fa-ci-metrics .fbads-budget-drill { text-align: center; }
@media (max-width: 768px) {
  .fa-table-wrap { display: none; }
  .fa-cards { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--surface-2); }
  .fa-bar-right > :not(.fa-date) { display: none; }
  .fa-bar-right { width: 100%; margin-left: 0; }
  .btn.fa-date { width: 100%; justify-content: center; }
}
.fa-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.metric-muted { color: var(--muted-2); }
/* Brighter than --ok/--err and semibold, so a green or red number reads at a glance (AA contrast). */
.fa-view, .fa-drawer { --fa-good: #0B7D43; --fa-bad: #C0271F; }
.fbads-metric-tone.is-good, .fbads-value.is-good, .fbads-summary-value.is-good { color: var(--fa-good); font-weight: 650; }
.fbads-metric-tone.is-bad, .fbads-value.is-bad, .fbads-summary-value.is-bad { color: var(--fa-bad); font-weight: 650; }
.fbads-value { font-weight: 600; }
.fbads-summary-value { font-weight: 700; }
.fa-name { display: flex; align-items: center; gap: 4px; min-width: 0; }
.fa-name-text { display: flex; flex-direction: column; min-width: 0; max-width: 320px; }
.fbads-name-link { max-width: 100%; padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.fbads-name-link:hover { text-decoration: underline; }
.fa-caret { width: 20px; height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; transition: transform 0.12s; }
.fa-caret:hover { background: var(--stone-bg); color: var(--ink); }
.fa-caret.is-open { transform: rotate(90deg); }
.fbads-delivery { display: inline-flex; align-items: center; gap: 6px; }
.fbads-delivery i { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--line-4); }
.fbads-delivery i.active { background: var(--ok); }
.fbads-delivery i.scheduled { background: var(--teal); }
.fbads-delivery i.danger { background: var(--err); }
.fbads-onoff { position: relative; width: 34px; height: 18px; padding: 0; border: 0; border-radius: 999px; background: var(--line-4); vertical-align: middle; cursor: pointer; transition: background 0.15s; }
.fbads-onoff span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.fbads-onoff.is-on { background: var(--accent); }
.fbads-onoff.is-on span { transform: translateX(16px); }
.fbads-onoff:disabled { opacity: 0.4; cursor: not-allowed; }
.fbads-care-signal { max-width: 116px; padding: 3px 8px; border: 1px solid transparent; border-radius: 8px; font-size: 11px; font-weight: 700; line-height: 1.25; text-align: left; white-space: normal; cursor: pointer; background: var(--stone-bg); color: var(--stone); }
.fbads-care-signal .fa-sig-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.fbads-care-signal .fa-sig-pre { display: none; }
.fbads-care-signal--success { background: var(--ok-bg); color: var(--ok); }
.fbads-care-signal--danger { background: var(--err-bg); color: var(--err); }
.fbads-care-signal--preliminary { border-style: dashed; border-color: currentColor; }
.fbads-care-signal--stale { background: var(--warn-bg); color: var(--warn); }
.fbads-budget-button, .fbads-budget-drill { max-width: 100%; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: right; cursor: pointer; }
.fbads-budget-button .fbads-budget-amount { border-bottom: 1px dashed var(--line-4); }
.fbads-budget-button:hover .fbads-budget-amount { color: var(--accent); border-color: var(--accent); }
.fbads-budget-drill:hover { color: var(--accent); }
.fbads-budget-amount { display: inline-block; }
.fbads-budget-amount small { display: inline; margin-left: 3px; }
.fbads-product-name { display: flex; flex-direction: column; min-width: 0; max-width: 320px; }
.fbads-product-name-button { position: relative; padding: 0; border: 0; background: none; color: var(--ink); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbads-product-name-button:hover span:first-child { text-decoration: underline; }
.fbads-product-name-excluded span:first-child { color: var(--muted-2); text-decoration: line-through; }
.fbads-product-hover-card { display: none; }
.fa-ad-img { display: block; width: 100%; padding: 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); cursor: zoom-in; overflow: hidden; flex-shrink: 0; }
.fa-ad-img img { display: block; width: 100%; height: 420px; object-fit: contain; }
.fa-ad-img:hover { border-color: var(--line-4); }
.fa-zoom { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 15, 18, 0.86); cursor: zoom-out; }
.fa-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.fa-zoom-x { position: absolute; top: 16px; right: 16px; background: rgba(255, 255, 255, 0.92); }
.fa-ad-period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fa-ad-period .seg button { height: 32px; font-size: 12px; }
.fa-ai-state { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.fa-ai-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; border: 1px dashed var(--line-3); border-radius: 12px; }
.fa-ai-empty p { margin: 0; font-size: 14px; color: var(--ink-2); }
.fa-ai-result { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.fa-ai-head { display: flex; align-items: center; gap: 8px; }
.fa-ai-head .grow { flex-grow: 1; }
.fa-ai-summary { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); }
.fa-ai-text { font-size: 14px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.fa-ai-items { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fa-ai-items li { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 10px; align-items: start; padding-top: 8px; border-top: 1px solid var(--line-2); }
.fa-ai-items li:first-child { border-top: 0; padding-top: 0; }
.fa-ai-items li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.fa-ai-items li b { overflow-wrap: anywhere; }
.fa-ai-items li small { font-size: 12px; line-height: 1.45; color: var(--muted); }
.fa-ai-result .hint { margin: 0; }

/* header: account, dates, refresh */
.fa-account { height: 40px; max-width: 240px; min-width: 0; padding: 0 10px; border: 1px solid var(--line-4); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; text-overflow: ellipsis; }
.fa-account:disabled { opacity: 1; color: var(--ink); background: var(--surface-2); }
.btn.fa-date { gap: 6px; padding: 0 12px; }
.btn.fa-date span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
#fa-refresh.spinning svg { animation: rot 0.9s linear infinite; }
.fa-pop { position: fixed; z-index: 60; display: flex; width: 340px; max-width: calc(100vw - 24px); padding: 10px; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 44px rgba(20, 20, 25, 0.18); }
.fa-presets { display: flex; flex-direction: column; gap: 2px; width: 150px; flex-shrink: 0; }
.fa-presets button { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 13px; text-align: left; white-space: nowrap; }
.fa-presets button:hover { background: var(--surface-2); color: var(--ink); }
.fa-presets button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.fa-custom { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex-grow: 1; padding-left: 10px; border-left: 1px solid var(--line-2); }
.fa-custom label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.fa-custom .sm-in { height: 36px; padding: 0 8px; font-size: 13px; }
.fa-custom .btn { height: 36px; margin-top: auto; }

/* care strip, level bar, selection */
.fa-care .fa-care-bad b { color: var(--err); }
.fa-care .fa-care-good b { color: var(--ok); }
.fa-scope { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 260px; height: 32px; padding: 0 2px 0 12px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.fa-scope > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fa-scope .icon-btn { width: 28px; height: 28px; flex-shrink: 0; color: var(--accent-ink); }
#fa-notice .notice { padding: 8px 14px; }
.fa-selbar .btn, .fa-selbar .btn.fa-mini { height: 40px; }
.fa-selbar .icon-btn.bare { color: #FFFFFF; }
.fa-selbar .icon-btn.bare:hover { background: #2E2F35; }

/* drawers */
.drawer.fa-drawer { width: 620px; }
.drawer.fa-drawer-ad { width: 680px; }
.drawer.fa-drawer-product { width: 900px; }
.drawer.fa-drawer-balance { width: 760px; }
.fa-scroll-x { overflow-x: auto; min-width: 0; }
.fa-drawer .oi-head h2 { margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.fa-drawer .oi-head .hint { display: block; }
.fa-drawer .oi-body { gap: 16px; }
.fa-msgs { display: flex; flex-direction: column; gap: 10px; }
.fa-msg { max-width: 92%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.fa-msg-ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink); }
.fa-msg-me { align-self: flex-end; background: var(--accent); color: #FFFFFF; }
.fa-msg-pending { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.fa-chat { display: flex; gap: 8px; align-items: flex-end; }
.fa-chat textarea.sm-in { height: auto; min-height: 44px; padding: 10px 12px; resize: vertical; font: inherit; font-size: 14px; }
.fa-chat .btn { flex-shrink: 0; }
.fa-evidence { margin-top: 10px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.fa-evidence summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.fa-ev-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fa-ev-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); }
.fa-ev-row > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; }
.fa-ev-row small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.fa-ev-row strong { flex-shrink: 0; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fa-ev-rule { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.fa-ev-rule strong { color: var(--ink-2); font-size: 13px; }
.fa-evidence .hint { margin: 0; }
.fa-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.fa-kpi-grid div, .fa-funnel div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.fa-kpi-grid span, .fa-funnel span { font-size: 11px; font-weight: 600; color: var(--muted); }
.fa-kpi-grid b, .fa-funnel b { font-size: 15px; font-variant-numeric: tabular-nums; }
.fa-funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fa-mini-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.fa-mini-table th, .fa-mini-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
.fa-mini-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.fa-mini-table th:first-child, .fa-mini-table td:first-child, .fa-mini-table tbody th { text-align: left; }
.fa-mini-table tbody th { font-weight: 600; color: var(--ink-2); }
.fa-mini-table small { display: block; font-size: 11px; font-weight: 400; color: var(--muted-2); }
.fa-mini-table tfoot td { font-weight: 700; background: #F7F6F2; border-top: 2px solid var(--line-3); }
.fa-mini-table .is-good { color: var(--fa-good); font-weight: 650; }
.fa-mini-table .is-bad { color: var(--fa-bad); font-weight: 650; }
.fa-variant-wrap { overflow: auto; max-height: 55dvh; border: 1px solid var(--line-2); border-radius: 12px; }
.fa-variants td:nth-child(1), .fa-variants th:nth-child(1), .fa-variants td:nth-child(2), .fa-variants th:nth-child(2) { text-align: center; }
.fa-variants tfoot td:first-child, .fa-variants thead th:nth-child(3) { text-align: left; }
.fa-variant-name { text-align: left !important; white-space: normal !important; min-width: 160px; }
.fa-variant-name b { display: block; font-weight: 600; }
.fa-variants tr.is-excluded td { color: var(--muted-2); }
.fa-variants tr.is-excluded .fa-variant-name b { text-decoration: line-through; }
.fa-variants tr.is-current td { background: var(--accent-wash); }
.fa-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.fa-link:hover { text-decoration: underline; }
.fa-link:disabled { color: var(--muted-2); cursor: not-allowed; }

/* modals */
.fa-budget-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.fa-budget-row > div, .fa-budget-row > label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.fa-budget-row b { height: 44px; display: flex; align-items: center; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.fa-budget-row .sm-in { height: 44px; font-size: 18px; font-weight: 700; }
.fa-target-list { margin: 0; padding: 10px 14px 10px 30px; max-height: 180px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: 12px; font-size: 13px; line-height: 1.7; }
.fa-colpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 14px; overflow-y: auto; }
.fa-colpick label { display: flex; align-items: center; gap: 8px; font-size: 14px; }

@media (max-width: 1099px) {
  .fa-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .fa-view { padding-top: 12px; }
  .fa-kpis { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; }
  .fa-kpis > .fa-kpi { grid-column: span 3; }
  .fa-kpis > .fa-kpi:nth-child(-n+3) { grid-column: span 4; }
  .fa-kpi { padding: 10px 12px; }
  .fa-kpi > b { font-size: 18px; }
  .fa-table-wrap { max-height: calc(100dvh - 240px); }
  /* phones: only the checkbox and the switch stay pinned on the left */
  .fa-table tbody .fa-stick-2, .fa-table tbody .fa-stick-3 { position: static; }
  .fa-table thead .fa-stick-2, .fa-table thead .fa-stick-3, .fa-table tfoot .fa-stick-2, .fa-table tfoot .fa-stick-3 { left: auto !important; z-index: 3; }
  .fa-table .fa-stick-last { box-shadow: none; }
  .fa-table .fa-stick-1 { box-shadow: 4px 0 6px -4px rgba(20, 20, 25, 0.18); }
  .rp-controls.fbads-only { flex-wrap: nowrap; min-width: 0; max-width: 100%; }
  body[data-route="fbads"] .top::after { content: ""; order: 1; flex-basis: 100%; height: 0; margin-top: -8px; }
  body[data-route="fbads"] .store-pick { flex: 1 1 0; min-width: 0; }
  body[data-route="fbads"] .store-pick > span { display: none; }
  body[data-route="fbads"] .store-pick select { height: 40px; }
  body[data-route="fbads"] .rp-controls.fbads-only { order: 2; flex: 1 1 0; min-width: 0; }
  .fa-account { flex: 1 1 0; min-width: 0; max-width: none; }
  .btn.fa-date { min-width: 0; max-width: 100%; }
  .btn.fa-date svg { flex-shrink: 0; }
  .btn.fa-date span { min-width: 0; }
  .fa-bar { gap: 6px; }
  .fa-scope { max-width: 100%; }
  .fa-funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fa-budget-row { grid-template-columns: 1fr; }
  .fa-pop { flex-direction: column; }
  .fa-presets { width: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fa-custom { padding-left: 0; border-left: 0; }
}
@media (max-width: 599px) {
  .fa-kpis { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
  .fa-kpis > .fa-kpi { grid-column: span 3; padding: 8px; }
  .fa-kpis > .fa-kpi:nth-child(-n+3) { grid-column: span 4; }
  .fa-kpi > span { font-size: 10px; letter-spacing: 0.02em; }
  .fa-kpi > span[data-short] { font-size: 0; }
  .fa-kpi > span[data-short]::after { content: attr(data-short); font-size: 10px; }
  .fa-kpi > b { font-size: 15px; }
  .fa-kpis > .fa-kpi:nth-child(-n+3) > b { font-size: 17px; }
  .fa-kpi > small { font-size: 10px; line-height: 1.3; white-space: normal; }
  .fa-care { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; white-space: nowrap; }
  .fa-care-title, .fa-care-target, .fa-care .fa-long, .fa-care .fa-btn-txt { display: none; }
  .fa-care .fa-btn-ico { display: inline-block; }
  .fa-care .btn.fa-mini { height: 32px; min-width: 32px; padding: 0 9px; font-size: 12px; flex-shrink: 0; }
  .fa-ad-img img { height: 280px; }
  .fa-bar-right { margin-left: 0; justify-content: flex-start; }
  .fa-ai-items li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
