/* ============================================================
   SIPO Franchise Platform — Design Language
   Display: Outfit · UI/Data: IBM Plex Sans
   Brand: red→orange→amber gradient (from the "8" mark)
   Source: claude.ai/design "Sipo E-suit" → sipo/sipo.css (authoritative
   SIPO Platform design, imported 2026-06-28 via the claude_design MCP).
   The e-suite SPA wraps its root in `.sipo` and uses the `.s-*` classes below.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=IBM+Plex+Sans:wght@400;450;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Baloo+2:wght@500;600;700;800&display=swap');

:root {
  /* Brand */
  --sipo-red: #DA291C;
  --sipo-orange: #F4711F;
  --sipo-amber: #FBA919;
  --sipo-grad: linear-gradient(118deg, #DA291C 0%, #F4711F 55%, #FBA919 100%);
  --sipo-grad-soft: linear-gradient(118deg, #FDEDE6 0%, #FEF3E2 100%);
  --sipo-orange-50: #FEF4EC;
  --sipo-orange-100: #FCE4D2;
  --sipo-orange-600: #E05E0D;
  --sipo-orange-700: #BC4D08;

  /* Warm neutrals */
  --ink: #241D1A;
  --ink-2: #4F4641;
  --ink-3: #877C75;
  --ink-4: #B3A9A2;
  --line: #EAE3DE;
  --line-strong: #DCD3CC;
  --paper: #FFFFFF;
  --bg: #F7F4F1;
  --bg-2: #F1ECE7;
  --sidebar-bg: #211A17;
  --sidebar-ink: #C9BEB7;

  /* Semantic */
  --green: #1E8A4C;  --green-bg: #E5F4EB;
  --amber: #B97509;  --amber-bg: #FCF1DC;
  --red: #C92F23;    --red-bg: #FBE9E7;
  --blue: #2563B8;   --blue-bg: #E8F0FB;
  --purple: #7C4DBE; --purple-bg: #F1EAFB;
  --teal: #0E7E84;   --teal-bg: #E2F3F4;

  /* Type */
  --display: 'Outfit', sans-serif;
  --ui: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  /* Shape */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(36,29,26,.06);
  --shadow-md: 0 2px 8px rgba(36,29,26,.07), 0 1px 2px rgba(36,29,26,.05);
  --shadow-lg: 0 12px 32px rgba(36,29,26,.14);

  /* Warehouse (wh2) warm palette — the e-Suite reskin targets these.
     Copied verbatim from resources/warehouse/app.css .wh2 so the two SPAs read as twins. */
  --w-bg: #F6F2EE;  --w-panel: #FFFFFF;
  --w-line: #ECE6DF; --w-line-2: #E2DAD1;
  --w-ink: #241C17; --w-ink-2: #52483F; --w-ink-3: #8B7E73; --w-ink-4: #ABA096;
  --w-orange: var(--sipo-orange); --w-orange-600: #DE5F14;
  --w-orange-grad: linear-gradient(140deg, #F58A34 0%, #E9631A 100%);
  --w-side-top: #2A1D15; --w-side-bot: #150D09; --w-side-active: #3B2415; --w-side-ink: #B8A99E;
  --w-round: 'Baloo 2', 'Outfit', sans-serif;
}

/* Global reset — the SPA owns the whole viewport; without this the browser's default
   body margin leaves a white gutter around the dark sidebar / topbar. */
html, body { margin: 0; padding: 0; background: var(--w-bg); }

.sipo { font-family: var(--ui); color: var(--w-ink); font-size: 13px; line-height: 1.45; }
.sipo * { box-sizing: border-box; }
/* wh2 uses the rounded Baloo 2 face for all display text; repoint here so real
   <h1/h2/h3> tags (higher specificity than .es-*) still pick up Baloo. */
.sipo h1, .sipo h2, .sipo h3, .sipo .display { font-family: var(--w-round); }
.sipo .num { font-variant-numeric: tabular-nums; }
.sipo .mono { font-family: var(--mono); }

/* ---------- Buttons ---------- */
.s-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--w-round); font-weight: 600; font-size: 13px;
  height: 36px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: filter .15s, background .15s;
}
.s-btn:hover { filter: brightness(.96); }
.s-btn:disabled { opacity: .55; cursor: default; }
/* wh2-btn look: primary = orange gradient (keeps its glow), ghost = panel + line-2 */
.s-btn-primary { background: var(--w-orange-grad); color: #fff; box-shadow: 0 4px 12px rgba(233,99,26,.28); }
.s-btn-brand { background: var(--w-orange-grad); color: #fff; box-shadow: 0 4px 12px rgba(233,99,26,.28); }
.s-btn-dark { background: var(--w-ink); color: #fff; }
.s-btn-ghost { background: var(--w-panel); color: var(--w-ink-2); border-color: var(--w-line-2); }
.s-btn-soft { background: var(--sipo-orange-50); color: var(--sipo-orange-700); }
.s-btn-danger-soft { background: #FBEAE7; color: #C93321; }
.s-btn-green { background: var(--green); color: #fff; }
.s-btn-primary:hover, .s-btn-brand:hover { filter: brightness(1.04); }
.s-btn-ghost:hover { filter: none; background: var(--w-bg); }
.s-btn-sm { height: 29px; padding: 0 11px; font-size: 12px; border-radius: var(--r-sm); }
.s-btn-lg { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.s-btn-block { width: 100%; }

/* ---------- Cards ---------- */
.s-card { background: var(--w-panel); border: 1px solid var(--w-line); border-radius: 16px; box-shadow: none; }
.s-card-pad { padding: 18px; }
.s-card-title { font-family: var(--w-round); font-weight: 700; font-size: 14px; letter-spacing: -.01em; color: var(--w-ink); }

/* ---------- KPI tile ---------- */
.s-kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.s-kpi-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.s-kpi-value { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.s-kpi-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.s-kpi-delta.up { color: var(--green); } .s-kpi-delta.down { color: var(--red); }

/* ---------- Badges / status pills ---------- */
.s-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.s-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-badge.gray   { background: var(--w-bg); color: var(--w-ink-2); }
.s-badge.green  { background: var(--green-bg); color: var(--green); }
.s-badge.amber  { background: var(--amber-bg); color: var(--amber); }
.s-badge.red    { background: var(--red-bg); color: var(--red); }
.s-badge.blue   { background: var(--blue-bg); color: var(--blue); }
.s-badge.purple { background: var(--purple-bg); color: var(--purple); }
.s-badge.teal   { background: var(--teal-bg); color: var(--teal); }
.s-badge.orange { background: var(--sipo-orange-100); color: var(--sipo-orange-700); }
.s-badge.solid-red { background: var(--red); color: #fff; }

/* ---------- Tables ---------- */
.s-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.s-table th {
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-3); padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: #FBF9F7;
}
.s-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.s-table tr:last-child td { border-bottom: none; }
.s-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.s-table th.r { text-align: right; }
.s-table tbody tr:hover { background: #FCFAF8; }

/* ---------- Inputs ---------- */
.s-input, .s-select {
  height: 36px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--paper);
  font-family: var(--ui); font-size: 13px; color: var(--ink); outline: none;
  width: 100%;
}
.s-input:focus, .s-select:focus { border-color: var(--sipo-orange); }
.s-input::placeholder { color: var(--ink-4); }
.s-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink-4); font-size: 13px; }
.s-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }

/* Qty stepper */
.s-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.s-stepper button { width: 28px; height: 30px; border: none; background: var(--bg); color: var(--ink-2); font-size: 15px; cursor: pointer; font-weight: 600; }
.s-stepper span { min-width: 38px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }

/* ---------- Tabs ---------- */
.s-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.s-tab { font-family: var(--w-round); font-weight: 600; font-size: 13px; color: var(--w-ink-3); padding: 9px 14px; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; background: none; border-left: none; border-right: none; border-top: none; }
.s-tab:hover { color: var(--w-ink-2); }
.s-tab.on { color: var(--w-orange-600); border-bottom-color: var(--w-orange); }

/* Segmented */
.s-seg { display: inline-flex; background: var(--bg-2); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.s-seg > div { font-family: var(--display); font-weight: 600; font-size: 12px; padding: 5px 13px; border-radius: 7px; color: var(--ink-3); cursor: pointer; }
.s-seg > div.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Chips ---------- */
.s-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; font-weight: 500; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.s-chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* ---------- Progress ---------- */
.s-progress { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.s-progress > div { height: 100%; border-radius: 999px; background: var(--sipo-orange); }
.s-progress.green > div { background: var(--green); }
.s-progress.red > div { background: var(--red); }
.s-progress.amber > div { background: var(--amber); }
.s-progress.grad > div { background: var(--sipo-grad); }

/* ---------- Avatar ---------- */
.s-avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 11px; color: #fff; background: var(--ink-3); flex-shrink: 0; }

/* ---------- Alerts ---------- */
.s-alert { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--r-md); font-size: 12.5px; align-items: flex-start; }
.s-alert.red { background: #FBEAE7; color: #9A2A1C; }
.s-alert.amber { background: var(--amber-bg); color: #6E4605; }
.s-alert.blue { background: var(--blue-bg); color: #1C4B8F; }

/* ---------- Icon box ---------- */
.s-icon { width: 34px; height: 34px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Toggle ---------- */
.s-toggle { width: 36px; height: 21px; border-radius: 999px; background: var(--ink-4); position: relative; flex-shrink: 0; cursor: pointer; border: none; padding: 0; }
.s-toggle::after { content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #fff; top: 2px; left: 2px; box-shadow: var(--shadow-sm); transition: left .15s; }
.s-toggle.on { background: var(--green); }
.s-toggle.on::after { left: 17px; }

/* ---------- Checkbox ---------- */
.s-check { width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--line-strong); background: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.s-check.on { background: var(--green); border-color: var(--green); }
.s-check.on::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }

/* ============================================================
   App chrome — sidebar / topbar
   ============================================================ */
.s-app { display: flex; background: var(--w-bg); overflow: hidden; height: 100vh; }
.s-sidebar { width: 218px; background: linear-gradient(178deg, var(--w-side-top), var(--w-side-bot) 78%); color: var(--w-side-ink); display: flex; flex-direction: column; flex-shrink: 0; }
.s-side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; font-family: var(--display); font-weight: 800; font-size: 17px; color: #fff; }
.s-side-brand img { height: 26px; }
.s-side-ws { margin: 0 12px 10px; padding: 9px 11px; border-radius: var(--r-md); background: rgba(255,255,255,.06); display: flex; align-items: center; gap: 9px; }
.s-side-ws .ws-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--sipo-grad); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 12px; color: #fff; }
.s-side-ws .ws-name { font-family: var(--display); font-weight: 600; font-size: 12.5px; color: #fff; line-height: 1.15; }
.s-side-ws .ws-sub { font-size: 10.5px; color: var(--sidebar-ink); }
.s-side-group { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #7A6A5E; padding: 14px 18px 5px; }
.s-side-item { display: flex; align-items: center; gap: 10px; padding: 7.5px 12px; margin: 1px 8px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--w-side-ink); cursor: pointer; }
.s-side-item:not(.on):hover { background: rgba(255,255,255,.04); color: #E9E0D9; }
.s-side-item.on { background: var(--w-side-active); color: #fff; font-weight: 600; }
.s-side-item.on svg { color: var(--w-orange); }
.s-side-item svg { width: 16px; height: 16px; flex-shrink: 0; color: #93837A; }
.s-side-item .cnt { margin-left: auto; font-size: 10px; font-weight: 700; background: var(--sipo-red); color: #fff; border-radius: 999px; padding: 1px 6px; }
.s-topbar { height: 56px; background: var(--w-panel); border-bottom: 1px solid var(--w-line); display: flex; align-items: center; gap: 14px; padding: 0 20px; flex-shrink: 0; }
.s-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.s-page { flex: 1; padding: 16px 20px; overflow: auto; }
.s-page-title { font-family: var(--w-round); font-weight: 700; font-size: 19px; letter-spacing: -.02em; color: var(--w-ink); }
.s-crumb { font-size: 12px; color: var(--w-ink-3); display: flex; gap: 6px; align-items: center; }

/* ---------- Login (split-screen) ---------- */
.s-login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.s-login-hero { background: var(--sipo-grad); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.s-login-hero h1 { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: -.02em; line-height: 1.12; }
.s-login-hero p { font-size: 14px; opacity: .92; max-width: 420px; }
.s-login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.s-login-card { width: 100%; max-width: 380px; }
@media (max-width: 860px) {
  .s-login { grid-template-columns: 1fr; }
  .s-login-hero { display: none; }
}

/* ---------- Mobile ---------- */
.s-m { font-family: var(--ui); font-size: 14px; color: var(--ink); }
.s-m-header { padding: 10px 18px 14px; }
.s-m-title { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.s-m-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.s-m-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.s-m-row:last-child { border-bottom: none; }
.s-m-tabbar { display: flex; justify-content: space-around; padding: 10px 8px 4px; border-top: 1px solid var(--line); background: rgba(255,255,255,.94); }
.s-m-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 600; color: var(--ink-4); }
.s-m-tab.on { color: var(--sipo-orange-600); }
.s-m-tab svg { width: 21px; height: 21px; }

/* ── Communication module ─────────────────────────────────────────────── */
.comm-wrap { display: flex; gap: 0; height: calc(100vh - 118px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--paper); }
.comm-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: #fff; }
.comm-list-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.comm-list-scroll { flex: 1; overflow-y: auto; }
.comm-git { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.comm-git:hover { background: #FCFAF8; }
.comm-git.on { background: var(--sipo-orange-50); }
.comm-git-body { min-width: 0; flex: 1; }
.comm-git-name { font-weight: 650; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comm-git-prev { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.comm-unread { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.comm-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.comm-pins { border-bottom: 1px solid var(--line); background: var(--amber-bg); }
.comm-pin { padding: 8px 16px; font-size: 12.5px; color: #6E4605; display: flex; gap: 8px; align-items: flex-start; }
.comm-feed { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-2); }
.comm-row { display: flex; }
.comm-row.mine { justify-content: flex-end; }
.comm-bubble { max-width: 74%; border-radius: 12px; padding: 8px 11px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.comm-row.mine .comm-bubble { background: var(--sipo-orange-50); border-color: var(--sipo-orange-100); }
.comm-meta { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; display: flex; gap: 7px; align-items: baseline; }
.comm-author { font-weight: 650; color: var(--ink-2); }
.comm-text { font-size: 13px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.comm-quote { border-left: 3px solid var(--sipo-orange); padding: 3px 8px; margin-bottom: 5px; background: rgba(0,0,0,.03); border-radius: 4px; font-size: 11.5px; color: var(--ink-3); }
.comm-quote b { color: var(--ink-2); font-weight: 600; }
.comm-card { border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 12px; background: #fff; max-width: 74%; }
.comm-notice { background: var(--amber-bg); border-color: #E9D8A6; }
.comm-opt { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12.5px; }
.comm-optbar { position: relative; flex: 1; height: 24px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.comm-optfill { position: absolute; inset: 0; background: var(--sipo-orange-100); border-radius: 6px; }
.comm-optlbl { position: relative; padding: 3px 8px; font-size: 12px; color: var(--ink); display: flex; justify-content: space-between; }
.comm-file { display: flex; gap: 9px; align-items: center; }
.comm-composer { border-top: 1px solid var(--line); padding: 10px 14px; background: #fff; flex-shrink: 0; }
.comm-composer textarea { width: 100%; resize: none; border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 8px 12px; font: inherit; font-size: 13px; min-height: 38px; max-height: 120px; }
.comm-replybar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); padding: 5px 8px; background: var(--bg-2); border-radius: 6px; margin-bottom: 6px; }
.comm-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 24px; text-align: center; color: var(--ink-3); font-size: 13px; height: 100%; }
@media (max-width: 760px) {
  .comm-wrap { height: calc(100vh - 150px); }
  .comm-list { width: 100%; }
  .comm-list.hide-mobile { display: none; }
  .comm-main.hide-mobile { display: none; }
}
.comm-pick-store { border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 8px; }
.comm-pick-store-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-2); border-bottom: 1px solid var(--line); font-weight: 650; font-size: 12.5px; }
.comm-pick-staff { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; max-height: 160px; overflow: auto; }
.comm-pick-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; padding: 2px 0; }
.comm-ctab { display: flex; gap: 2px; margin-bottom: 8px; }


/* ===== .es-* Enterprise Suite layer (imported 2026-07-06) ===== */
/* ============================================================
   Sipo Enterprise Suite — layout + component styles
   (builds on sipo.css design tokens)
   ============================================================ */

.es-app { background: var(--w-bg); }

/* ---------- Sidebar ---------- */
/* wh2 gradient sidebar — this wins over the base .s-sidebar bg (equal specificity, later source). */
.es-side { width: 244px; padding-bottom: 0; background: linear-gradient(178deg, var(--w-side-top), var(--w-side-bot) 78%); color: var(--w-side-ink); }
.es-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; }
.es-brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--w-orange-grad);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--w-round); font-weight: 800; font-size: 18px; color: #fff;
  box-shadow: 0 4px 12px rgba(233,99,26,.35);
}
/* Real Sipo icon image (the SVG carries its own rounded orange tile). */
.es-brand-mark-img { width: 34px; height: 34px; display: block; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(233, 99, 26, .35)); }
.es-brand-word { font-family: var(--w-round); font-weight: 700; font-size: 17px; color: #fff; letter-spacing: -.01em; white-space: nowrap; }
.es-brand-word span { font-weight: 700; }

.es-ws { margin: 0 14px 6px; padding: 11px 12px; border-radius: 13px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 11px; cursor: pointer; transition: background .15s ease; }
.es-ws:hover { background: rgba(255,255,255,.08); }
.es-ws-tile {
  width: 38px; height: 38px; border-radius: 10px; background: var(--w-orange-grad);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--w-round); font-weight: 800; font-size: 16px; color: #fff; flex-shrink: 0;
}
.es-ws-name { font-family: var(--w-round); font-weight: 700; font-size: 15px; color: #fff; line-height: 1.1; }
.es-ws-sub { font-size: 11.5px; color: var(--w-side-ink); margin-top: 1px; }

.es-side .s-side-group { padding: 16px 20px 8px; font-size: 10px; color: #7A6A5E; }
.es-item {
  font-size: 14px; font-weight: 500; gap: 12px; padding: 10px 14px; margin: 2px 12px; border-radius: 10px;
  font-family: var(--ui); color: var(--w-side-ink);
}
.es-item svg { width: 18px; height: 18px; color: #93837A; }
.es-item.on { background: var(--w-side-active); color: #fff; font-weight: 600; }
.es-item.on svg { color: var(--w-orange); }
.es-subnav { display: flex; flex-direction: column; margin: 2px 12px 6px 12px; padding-left: 14px; border-left: 1px solid var(--w-line); }
.es-navchild {
  font-size: 13px; font-weight: 500; padding: 7px 12px; margin: 1px 0; border-radius: 8px;
  font-family: var(--ui); color: var(--w-side-ink); cursor: pointer; background: none; border: none; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.es-navchild:hover { background: var(--w-side-active); color: #fff; }
.es-navchild.on { background: var(--w-side-active); color: #fff; font-weight: 600; }

.es-signout {
  display: flex; align-items: center; gap: 12px; padding: 16px 22px; margin: 0;
  border-top: 1px solid rgba(255,255,255,.06); color: var(--w-side-ink);
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.es-signout:hover { color: #E9E0D9; }
.es-signout svg { color: #93837A; }

/* ---------- Main / header ---------- */
.es-main { background: var(--w-bg); }
.es-page { padding: 22px 34px 48px; }

/* ---------- Page head ---------- */
.es-pagehead { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
/* Left group: hamburger + title + inline subtitle. flex:1 pushes ESHead children to the right.
   flex-wrap lets the subtitle drop under the title on narrow widths (no truncation). */
.es-pagehead-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.es-h1 { font-family: var(--w-round); font-weight: 700; font-size: 21px; letter-spacing: -.01em; line-height: 1.15; color: var(--w-ink); }
.es-sub { font-size: 13.5px; color: var(--w-ink-3); }
/* Middot separator — only rendered because ESHead emits .es-sub solely when `sub` is truthy. */
.es-sub::before { content: '·'; margin-right: 8px; color: var(--w-ink-4); }
/* Relocated mobile nav hamburger — hidden on desktop (sidebar is docked above 860px). */
.es-pagehead-burger { display: none; }
@media (max-width: 860px) {
  .es-pagehead-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0; padding: 0;
    border: 1px solid var(--w-line-2); border-radius: 10px;
    background: var(--w-panel); color: var(--w-ink-2); cursor: pointer;
  }
  .es-pagehead-burger:hover { background: var(--w-bg); }
  /* Narrow: give the title cluster the full row so the ESHead action slot
     (range seg / action buttons) wraps below it instead of overlapping. */
  .es-pagehead-main { flex-basis: 100%; }
  .es-pagehead > :last-child { flex-basis: 100%; }
}

/* ---------- Tabs ---------- */
.es-tabs { margin-bottom: 22px; gap: 6px; }
.es-tabs .s-tab { font-size: 15px; padding: 10px 4px; margin-right: 22px; }
.es-tabs .s-tab.on { border-bottom-width: 2.5px; }

/* ---------- Cards ---------- */
.es-card { background: var(--w-panel); border: 1px solid var(--w-line); border-radius: 16px; box-shadow: none; }
.es-card-pad { padding: 22px 24px; }
.es-card-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.es-card-title { font-family: var(--w-round); font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--w-ink); }
.es-card-meta { font-size: 13px; color: var(--w-ink-3); }

/* ---------- KPI ---------- */
.es-kpi { background: var(--w-panel); border: 1px solid var(--w-line); border-radius: 16px; box-shadow: none; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.es-kpi-label { font-size: 12px; font-weight: 700; color: var(--w-ink-3); text-transform: uppercase; letter-spacing: .1em; }
.es-kpi-value { font-family: var(--w-round); font-weight: 700; font-size: 34px; letter-spacing: -.01em; line-height: 1; color: var(--w-ink); font-variant-numeric: tabular-nums; }
.es-kpi-delta { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.es-kpi-delta.up { color: var(--green); }
.es-kpi-delta.down { color: var(--red); }

/* ---------- Segmented (Today / Last 7 / Month) ---------- */
.es-seg { display: inline-flex; background: var(--w-bg); border-radius: 11px; padding: 4px; gap: 3px; }
.es-seg > button {
  font-family: var(--w-round); font-weight: 600; font-size: 13.5px; padding: 7px 16px; border-radius: 8px;
  color: var(--w-ink-3); cursor: pointer; border: none; background: transparent; white-space: nowrap;
}
.es-seg > button.on { background: var(--w-panel); color: var(--w-ink); box-shadow: none; }

/* ---------- Rank list (top/bottom stores) ---------- */
.es-rank { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--w-line); }
.es-rank:last-child { border-bottom: none; }
.es-rank-n { font-family: var(--w-round); font-weight: 700; font-size: 15px; color: var(--w-orange); width: 16px; }
.es-rank-name { font-weight: 600; font-size: 14.5px; flex-shrink: 0; min-width: 116px; color: var(--w-ink); }
.es-rank-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--w-bg); overflow: hidden; }
.es-rank-bar > div { height: 100%; border-radius: 999px; background: var(--w-orange-grad); }
.es-rank-val { font-family: var(--w-round); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 66px; text-align: right; color: var(--w-ink); }

/* ---------- Inputs ---------- */
.es-input, .es-select, .es-textarea {
  width: 100%; border: 1px solid var(--w-line-2); background: var(--w-panel);
  border-radius: 11px; font-family: var(--ui); font-size: 14px; color: var(--w-ink); outline: none;
}
.es-input, .es-select { height: 48px; padding: 0 15px; }
.es-textarea { padding: 13px 15px; resize: vertical; min-height: 84px; line-height: 1.5; }
.es-input:focus, .es-select:focus, .es-textarea:focus { border-color: var(--w-orange); box-shadow: 0 0 0 3px rgba(244,113,31,.14); }
.es-input::placeholder, .es-textarea::placeholder { color: var(--w-ink-4); }
.es-select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B7E73' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; padding-right: 40px; cursor: pointer; }
input.es-input[type="date"], input.es-input[type="datetime-local"], input.es-input[type="time"] { cursor: pointer; }

.es-field { display: flex; flex-direction: column; gap: 8px; }
.es-field-label { font-size: 12px; font-weight: 700; color: var(--w-ink-3); text-transform: uppercase; letter-spacing: .07em; }
.es-req { color: #D8493A; margin-left: 3px; }
.es-field-hint { font-size: 12px; color: var(--w-ink-4); }

/* ---------- Filter bar labels ---------- */
.es-flabel { font-size: 13px; color: var(--w-ink-3); margin-bottom: 7px; }

/* ---------- Big table ---------- */
.es-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.es-table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--w-ink-3); padding: 12px 16px; border-bottom: 1px solid var(--w-line); }
.es-table td { padding: 15px 16px; border-bottom: 1px solid var(--w-line); vertical-align: middle; }
.es-table tr:last-child td { border-bottom: none; }
.es-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.es-table th.r { text-align: right; }
.es-table tbody tr:hover { background: var(--w-bg); }
.es-table .name { font-family: var(--w-round); font-weight: 700; color: var(--w-ink); }

/* ---------- Toggle (role matrix) — keep green on/off semantics ---------- */
.es-switch { width: 44px; height: 25px; border-radius: 999px; background: var(--w-line-2); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.es-switch::after { content: ''; position: absolute; width: 21px; height: 21px; border-radius: 50%; background: #fff; top: 2px; left: 2px; box-shadow: var(--shadow-sm); transition: left .15s; }
.es-switch.on { background: var(--green); }
.es-switch.on::after { left: 21px; }

/* ---------- Checkbox — wh2-cbox: orange fill when on ---------- */
.es-cbx { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--w-line-2); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.es-cbx.on { background: var(--w-orange); border-color: var(--w-orange); }
.es-cbx.on::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }
.es-cbx-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; padding: 6px 0; }

/* ---------- Pills used in tables ---------- */
.es-pill { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--w-bg); color: var(--w-ink-2); }
.es-pill.none { color: var(--w-ink-4); background: var(--w-bg); }
.es-pill.green { background: var(--green-bg); color: var(--green); }
.es-pill.shared { background: var(--w-bg); color: var(--w-ink-2); }

/* ---------- Buttons rounded ---------- */
.es-btn { height: 42px; border-radius: 11px; padding: 0 20px; font-size: 14px; }
.es-btn.s-btn-sm { height: 36px; border-radius: 9px; font-size: 13px; padding: 0 14px; }
.es-iconbtn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--w-line-2); background: var(--w-panel); display: inline-flex; align-items: center; justify-content: center; color: var(--w-ink-3); cursor: pointer; }
.es-iconbtn:hover { color: #C93321; border-color: #FBEAE7; background: #FBEAE7; }

/* ---------- Overlay / modal ---------- */
.es-overlay { position: fixed; inset: 0; background: rgba(21,13,9,.5); display: flex; align-items: center; justify-content: center; z-index: 4000; padding: 32px; animation: esFade .16s ease; }
.es-overlay-right { justify-content: flex-end; align-items: stretch; padding: 0; }
@keyframes esFade { from { opacity: 0; } to { opacity: 1; } }
.es-modal { background: var(--w-panel); border-radius: 16px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 24px 70px rgba(28,18,11,.34); animation: esPop .18s ease; }
@keyframes esPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.es-modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 24px 26px 6px; }
.es-modal-title { font-family: var(--w-round); font-weight: 700; font-size: 22px; letter-spacing: -.01em; color: var(--w-ink); }
.es-modal-sub { font-size: 14px; color: var(--w-ink-3); margin-top: 4px; }
.es-modal-body { padding: 18px 26px 8px; }
.es-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px 24px; }

/* ---------- Drawer ---------- */
.es-drawer { width: 460px; max-width: 92vw; background: var(--w-panel); height: 100%; box-shadow: 0 24px 70px rgba(28,18,11,.34); display: flex; flex-direction: column; animation: esSlide .2s ease; }
@keyframes esSlide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.es-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--w-line); }
.es-drawer-body { padding: 22px 24px; overflow: auto; flex: 1; }

/* ---------- Empty state ---------- */
.es-empty { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--w-ink-3); font-size: 15px; padding: 80px 20px; }

/* ---------- Skeleton loading ----------
   Shimmer placeholders shown while a report pane loads (reports-section.jsx).
   Each .es-skel block is a grey slab with a soft light sweep; the sweep is
   disabled for users who prefer reduced motion. */
.es-skel { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 8px; flex-shrink: 0; }
.es-skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
  animation: esSkelSweep 1.3s ease-in-out infinite; }
@keyframes esSkelSweep { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .es-skel::after { animation: none; } }

/* ---------- Scheduled report delivery ---------- */
.es-schedule-stack { display: flex; flex-direction: column; gap: 16px; }
.es-schedule-card-title { font-family: var(--w-round); font-weight: 700; font-size: 17px; color: var(--w-ink); }
.es-schedule-card-sub { margin-top: 5px; color: var(--w-ink-3); font-size: 13.5px; line-height: 1.5; }
.es-schedule-download-grid { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(210px, 1.4fr) auto; gap: 14px; align-items: end; margin-top: 20px; }
.es-schedule-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.es-schedule-modal { max-width: 720px; }
.es-schedule-table-wrap { width: 100%; overflow-x: auto; }
.es-table-sub { color: var(--w-ink-4); font-size: 12px; margin-top: 4px; white-space: nowrap; }
.es-schedule-actions { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.es-email-list { display: flex; flex-wrap: wrap; gap: 5px; max-width: 260px; }
.es-email-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 5px 9px; border-radius: 999px; background: var(--sipo-orange-50); color: var(--sipo-orange-700); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-email-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; font-size: 16px; line-height: 1; }
.es-email-more { display: inline-flex; align-items: center; color: var(--w-ink-3); font-size: 12px; }
.es-email-box { min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--w-line-2); border-radius: 11px; background: var(--w-panel); }
.es-email-box:focus-within { border-color: var(--w-orange); box-shadow: 0 0 0 3px rgba(244,113,31,.14); }
.es-email-box > input { min-width: 190px; flex: 1; height: 30px; border: 0; outline: 0; font: inherit; color: var(--w-ink); background: transparent; }
.es-schedule-error { color: var(--red); font-size: 11.5px; margin-top: 6px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 980px) {
  .es-schedule-download-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .es-schedule-download-grid > button { width: 100%; }
}
@media (max-width: 620px) {
  .es-schedule-download-grid, .es-schedule-form-grid { grid-template-columns: 1fr; }
  .es-schedule-actions { justify-content: flex-start; flex-wrap: wrap; }
}

/* ---------- Historical sales import ---------- */
.es-import-stack { display: flex; flex-direction: column; gap: 16px; }
.es-import-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
.es-import-step { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--w-line); background: var(--w-panel); color: var(--w-ink-4); font-size: 12px; font-weight: 700; text-align: center; }
.es-import-step.on { border-color: var(--w-orange); background: var(--sipo-orange-50); color: var(--sipo-orange-700); }
.es-import-step.done { border-color: #BFE1D0; background: var(--green-bg); color: var(--green); }
.es-import-alert { margin-bottom: 16px; border: 1px solid var(--w-line-2); border-radius: 12px; padding: 14px 16px; background: var(--w-panel); color: var(--w-ink-2); line-height: 1.5; }
.es-import-alert.info { background: var(--blue-bg); border-color: #C7DCF5; }
.es-import-alert.warning { background: var(--amber-bg); border-color: #E9D8A6; }
.es-import-alert.error { background: var(--red-bg); border-color: #F0C7C2; color: var(--red); }
.es-import-alert.success { background: var(--green-bg); border-color: #BFE1D0; color: var(--green); }
.es-import-alert-title { font-family: var(--w-round); font-weight: 700; font-size: 14px; }
.es-import-alert-body { margin-top: 5px; font-size: 13px; }
.es-import-alert-body p { margin: 0 0 7px; }
.es-import-alert-body ul { margin: 6px 0 0; padding-left: 20px; }
.es-import-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.es-import-drop { min-height: 170px; border: 1.5px dashed var(--w-line-2); border-radius: 14px; background: var(--w-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--w-ink-3); cursor: pointer; padding: 24px; text-align: center; }
.es-import-drop:hover { border-color: var(--w-orange); background: var(--sipo-orange-50); }
.es-import-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.es-import-drop-title { font-family: var(--w-round); color: var(--w-ink); font-weight: 700; font-size: 15px; word-break: break-word; }
.es-import-drop-sub { color: var(--w-ink-4); font-size: 12px; }
.es-import-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.es-import-table-wrap { width: 100%; overflow-x: auto; }
.es-import-map-table { min-width: 720px; }
.es-import-confirm { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 15px 16px; border: 1px solid var(--w-line-2); border-radius: 12px; background: var(--w-bg); color: var(--w-ink-2); line-height: 1.45; cursor: pointer; }
.es-import-confirm input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--w-orange); flex-shrink: 0; }
.es-import-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--w-ink-3); font-size: 13px; }
.es-import-progress-head strong { font-family: var(--w-round); color: var(--w-ink); font-size: 22px; }
.es-import-progress { width: 100%; height: 12px; margin-top: 10px; border-radius: 999px; background: var(--w-bg); overflow: hidden; }
.es-import-progress > div { height: 100%; border-radius: inherit; background: var(--w-orange-grad); transition: width .25s ease; }
.es-import-progress-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; color: var(--w-ink-3); font-size: 12.5px; }
.es-import-statgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; }

@media (max-width: 980px) {
  .es-import-form-grid { grid-template-columns: 1fr 1fr; }
  .es-import-statgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .es-import-steps { display: flex; overflow-x: auto; }
  .es-import-step { min-width: 96px; }
  .es-import-form-grid, .es-import-statgrid { grid-template-columns: 1fr; }
  .es-import-actions { justify-content: stretch; }
  .es-import-actions .s-btn { flex: 1 1 auto; }
  .es-import-progress-head { align-items: flex-start; flex-direction: column; }
}

/* ---------- Communication ---------- */
.es-comms { display: grid; grid-template-columns: 320px 1fr; gap: 16px; height: calc(100vh - 210px); min-height: 420px; }
.es-comms-list { display: flex; flex-direction: column; overflow: hidden; }
.es-comms-listhead { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--w-line); flex-wrap: wrap; }
.es-conv { padding: 14px 18px; border-bottom: 1px solid var(--w-line); cursor: pointer; }
.es-conv:hover { background: var(--w-bg); }
.es-conv.on { background: #FBF3EC; box-shadow: inset 3px 0 0 var(--w-orange); }
.es-conv-name { font-family: var(--w-round); font-weight: 700; font-size: 15px; color: var(--w-ink); }
.es-conv-last { font-size: 13px; color: var(--w-ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.es-comms-thread { display: flex; flex-direction: column; overflow: hidden; }
.es-thread-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--w-line); flex-shrink: 0; }
.es-pinbar { display: flex; align-items: center; gap: 7px; padding: 11px 20px; background: #FBF3E6; color: #8A6A1E; font-size: 13.5px; border-bottom: 1px solid #F1E4CE; flex-shrink: 0; }
.es-pinbar svg { color: var(--w-orange-600); }
.es-thread-body { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; background: #FAF7F3; }

.es-msg { max-width: 62%; border-radius: 14px; padding: 12px 14px; background: var(--w-panel); border: 1px solid var(--w-line); box-shadow: none; }
.es-msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.es-msg-author { font-family: var(--w-round); font-weight: 700; font-size: 13px; color: var(--w-ink); }
.es-msg-ago { font-size: 11.5px; color: var(--w-ink-4); }
.es-msg-del { margin-left: auto; width: 24px; height: 24px; border-radius: 6px; border: none; background: transparent; color: var(--w-ink-4); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.es-msg-del:hover { color: #C93321; background: #FBEAE7; }
.es-msg-body { font-size: 14px; color: var(--w-ink); line-height: 1.5; white-space: pre-wrap; }
.es-msg-text.mine { background: #FBF3EC; border-color: #F3DEC9; }
.es-reply { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--w-ink-2); background: var(--w-panel); border: 1px solid var(--w-line-2); border-radius: 8px; padding: 5px 11px; cursor: pointer; font-family: var(--w-round); }
.es-msg-notice { background: #FDF3E0; border-color: #F3E3C4; }
.es-notice-title { font-family: var(--w-round); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--w-ink); }
.es-notice-title svg { color: var(--w-orange-600); }
.es-poll-q { font-family: var(--w-round); font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 7px; color: var(--w-ink); }
.es-poll-q svg { color: var(--w-orange-600); }
.es-poll-opt { position: relative; overflow: hidden; border: 1px solid var(--w-line-2); border-radius: 9px; padding: 9px 12px; display: flex; align-items: center; cursor: pointer; background: var(--w-panel); }
.es-poll-opt:hover { border-color: var(--w-orange); }
.es-poll-opt.voted { border-color: var(--w-orange); }
.es-poll-fill { position: absolute; inset: 0 auto 0 0; background: #FBEEE3; z-index: 0; transition: width .3s; }
.es-poll-label { position: relative; z-index: 1; font-weight: 600; font-size: 13.5px; flex: 1; color: var(--w-ink); }
.es-poll-pct { position: relative; z-index: 1; font-family: var(--w-round); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--w-ink); }
.es-msg-event { background: var(--blue-bg); border-color: #C7DCF5; }

.es-composer { border-top: 1px solid var(--w-line); padding: 14px 18px 16px; flex-shrink: 0; background: var(--w-panel); }
.es-composer-tabs { display: flex; gap: 2px; margin-bottom: 12px; }
.es-composer-tabs .s-tab { font-size: 13.5px; padding: 6px 4px; margin-right: 18px; }
.es-composer-row { display: flex; gap: 10px; }
.es-composer-row .es-input { flex: 1; }

/* ---------- SOP ---------- */
.es-sop { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; min-height: 540px; }
.es-sop-list { display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 260px); }
.es-sop-detail { display: flex; flex-direction: column; overflow: hidden; min-height: 540px; }
.es-tpl-form { display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.es-tpl-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--w-line); flex-shrink: 0; }
.es-tpl-body { padding: 22px 24px; overflow: auto; flex: 1; }
.es-tpl-foot { padding: 16px 24px; border-top: 1px solid var(--w-line); flex-shrink: 0; }
.es-item-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--w-line); border-radius: 12px; background: var(--w-bg); }
.es-item-move { display: flex; flex-direction: column; gap: 5px; padding-top: 8px; }
.es-item-move button { width: 30px; height: 26px; border: 1px solid var(--w-line-2); background: var(--w-panel); border-radius: 7px; color: var(--w-ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.es-item-move button:hover:not(:disabled) { color: var(--w-ink); background: var(--w-bg); }
.es-item-move button:disabled { opacity: .35; cursor: default; }

/* ---------- Interaction polish ---------- */
.es-item, .s-side-item, .es-signout, .es-conv, .es-poll-opt, .es-switch, .es-cbx, .es-iconbtn, .es-btn, .s-btn { transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease; }
.es-item:not(.on):hover { background: rgba(255,255,255,.04); color: #E9E0D9; }
.es-card { transition: border-color .18s ease; }
.es-hoverable { cursor: pointer; }
/* wh2 cards are flat — no elevation or lift on hover; keep a subtle warm border shift only */
.es-hoverable:hover { border-color: var(--w-line-2); }
.es-kpi { transition: border-color .18s ease; }
.es-kpi.es-hoverable:hover { border-color: var(--w-line-2); }
.es-table tbody tr.es-rowlink { cursor: pointer; }
.es-tabs .s-tab, .es-composer-tabs .s-tab { transition: color .15s ease, border-color .15s ease; }
.es-page > div { animation: esRise .22s ease; }
@keyframes esRise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* KPI head row (icon + trend) */
.es-kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.es-kpi-ic { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.es-kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.es-delta-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; font-family: var(--w-round); }
.es-delta-pill.up { background: var(--green-bg); color: var(--green); }
.es-delta-pill.down { background: var(--red-bg); color: var(--red); }
.es-delta-pill.flat { background: var(--w-bg); color: var(--w-ink-3); }

/* Dashboard sales-performance comparisons */
.es-performance { display: flex; flex-direction: column; gap: 14px; }
.es-performance-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 2px 2px 0; }
.es-performance-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 16px; }
.es-performance-grid > * { min-width: 0; }
.es-performance-table-wrap { overflow-x: auto; padding: 10px 8px 6px; }
.es-performance-table { min-width: 560px; }
.es-performance-totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.es-performance-sub { margin-top: 4px; color: var(--w-ink-3); font-size: 11.5px; font-weight: 500; line-height: 1.35; }
@media (max-width: 1180px) {
  .es-performance-grid { grid-template-columns: 1fr; }
  .es-performance-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .es-performance-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .es-performance-totals { grid-template-columns: 1fr 1fr; }
}

/* Search box */
.es-searchbox { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--w-line-2); background: var(--w-panel); min-width: 240px; }
.es-searchbox svg { color: var(--w-ink-4); flex-shrink: 0; }
.es-searchbox input { border: none; outline: none; background: transparent; font-family: var(--ui); font-size: 14px; color: var(--w-ink); width: 100%; }
.es-searchbox input::placeholder { color: var(--w-ink-4); }
.es-searchbox:focus-within { border-color: var(--w-orange); box-shadow: 0 0 0 3px rgba(244,113,31,.14); }

/* Summary stat card (SOP answers) */
.es-statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px){ .es-statgrid { grid-template-columns: repeat(2, 1fr); } }
.es-stat { background: var(--w-panel); border: 1px solid var(--w-line); border-radius: 14px; padding: 16px 18px; }
.es-stat-v { font-family: var(--w-round); font-weight: 700; font-size: 24px; letter-spacing: -.01em; line-height: 1; color: var(--w-ink); }
.es-stat-l { font-size: 12px; color: var(--w-ink-3); margin-top: 6px; font-weight: 500; }

/* Row-level select-all in role matrix — warm orange-soft */
.es-mini-tag { font-size: 10.5px; font-weight: 700; color: var(--w-orange-600); background: #FCE9D8; border-radius: 6px; padding: 2px 7px; cursor: pointer; letter-spacing: .02em; }
.es-mini-tag:hover { background: #FADBC0; }

/* status dot */
.es-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.es-dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.es-dot.off { background: var(--w-ink-4); box-shadow: 0 0 0 3px var(--w-bg); }

/* unread badge on group/nav — keep red semantics */
.es-unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--sipo-red); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-family: var(--w-round); }
.es-item .es-unread { margin-left: auto; }

/* grids */
.es-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.es-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .es-grid-4 { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   Mobile layer (phones) — added 2026-08 for the mobile-UI pass.
   Desktop selectors above are untouched; everything here only
   applies under the breakpoints, so wide layouts cannot change.
   ============================================================ */

/* Two-pane layouts stack: SOP templates (list over editor) and — as a CSS
   backstop — the comms grid (its JSX already renders single-pane on mobile). */
@media (max-width: 760px) {
  .es-sop { grid-template-columns: 1fr; min-height: 0; }
  .es-sop-list { max-height: 340px; }
  .es-sop-detail { min-height: 0; }
  .es-comms { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* Page frame: reclaim the desktop gutters. */
  .es-page { padding: 14px 12px 40px; }

  /* KPI tiles: two-up stays, but tighter, and the value scales with the
     viewport instead of clipping ("$19,886.06" at 34px overflows a 160px tile). */
  .es-grid-4, .es-grid-2 { gap: 10px; }
  .es-grid-4 > *, .es-grid-2 > * { min-width: 0; }
  .es-kpi { padding: 13px 14px; gap: 8px; border-radius: 13px; }
  .es-kpi-value { font-size: clamp(17px, 6.4vw, 26px); }
  .es-kpi-label { font-size: 10.5px; letter-spacing: .07em; }
  .es-kpi-ic { width: 32px; height: 32px; border-radius: 9px; }
  .es-statgrid { gap: 10px; }

  /* Cards hug the phone edge a little closer. */
  .es-card-pad { padding: 14px; }
  .es-card-head { padding: 14px 16px 0; flex-wrap: wrap; }

  /* Charts: the SVG kit (width="100%" + viewBox) scales down so far at 375px
     that labels become ~5px. Give charts a readable floor and let the card
     scroll sideways instead. Attribute-guarded so inline icons are untouched. */
  .es-card-pad { overflow-x: auto; }
  .es-card-pad svg[width="100%"] { min-width: 560px; }

  /* Control strips scroll instead of wrapping mid-pill / mid-tab. */
  .es-seg { max-width: 100%; overflow-x: auto; }
  .es-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .es-tabs .s-tab { white-space: nowrap; margin-right: 14px; }
  .es-searchbox { min-width: 0; width: 100%; }
  .es-card-head > .es-searchbox { order: 3; flex: 1 1 100%; min-width: 0 !important; width: 100%; }

  /* Overlays: modals and drawers use the full phone width. */
  .es-overlay { padding: 10px; }
  .es-drawer { width: 100%; max-width: 100%; }
  .es-modal-head { padding: 18px 18px 4px; }
  .es-modal-body { padding: 14px 18px 6px; }
  .es-modal-foot { padding: 14px 18px 18px; flex-wrap: wrap; }
  .es-modal-title { font-size: 19px; }

  /* Rank rows (dashboard top stores): the pinned name column eats the bar. */
  .es-rank { gap: 10px; }
  .es-rank-name { min-width: 88px; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Filter bars (Royalty, Deal/Item Performance, planning Customers): on
     desktop the fields sit in one wrapping row; at phone width each field's
     intrinsic width forced one-per-line, so the bar swallowed half the screen.
     Two fields per row instead — From|To pair up, Store|Refresh share a row —
     matching the reports Custom from/to layout. min-width:0 overrides the
     inline minWidth on store selects so a 50% cell can actually shrink. */
  /* basis accounts for the bar's inline gap:12 (inline style wins over a CSS
     gap override): two cells + one 12px gap must fit the row, so each cell
     gets 50% - 8px with a little slack. */
  .es-filterbar .es-field { flex: 1 1 calc(50% - 8px); min-width: 0 !important; }
  .es-filterbar > .s-btn { flex: 1 1 auto; }
}
