/* =============================================================
   STORE WEB PANEL — extension layer over design-system.css
   -------------------------------------------------------------
   design-system.css is a verbatim copy and is never edited.
   Everything the panel needs that the guide does not cover is
   built here, measured on the nearest existing component, with
   the 14 palette tokens and the status tokens only.
   ============================================================= */

/* ---- E0) `hidden` must win: .toolbar-btn, .nbadge and .nav-count set their
   own display, which would otherwise override the attribute. ---- */
[hidden] { display: none !important; }

/* ---- E1) Status: finished successfully. Green like st-active, but without
   the pulse ring, which the guide reserves for live states. ---- */
.status-pill.st-done { background: var(--ok-bg); color: var(--ok-ink); }
.status-pill.st-done .dot { background: var(--ok); }

/* ---- E2) Money and identifiers: mono, LTR, isolated inside Arabic text ---- */
.money { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; font-weight: 700; white-space: nowrap; }
.money.soft { font-weight: 500; color: var(--ink-soft); }
.cell-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.cell-time { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }
/* Relative time is Arabic words ("قبل 12 دقيقة"): body font, RTL. */
.cell-ago { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.data-table tbody tr[data-id], .data-table tbody tr[data-href] { cursor: pointer; }
.data-table .status-pill { white-space: nowrap; }
/* No presence dot: a buyer is not "online", this is just their initials. */
.cell-avatar.plain::after { display: none; }

/* ---- E3) Progressive column hiding (guide §5.4: never cards on mobile) ---- */
@media (max-width: 1100px) { .col-1100 { display: none; } }
@media (max-width: 880px)  { .col-880  { display: none; } }
@media (max-width: 720px)  { .col-720  { display: none; } }

/* ---- E4) View chips with counts — .chip, plus a count bubble ---- */
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-count { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: var(--r-pill); background: var(--bg-2); color: var(--ink-soft); min-width: 18px; text-align: center; }
.chip.active .chip-count { background: var(--primary-hover); color: var(--card); }
.chip.attn .chip-count { background: var(--warn-bg); color: var(--warn-ink); }
.chip.active.attn .chip-count { background: var(--accent); color: var(--card); }
.filter-toolbar.single { grid-template-columns: 1fr auto; }
@media (max-width: 900px) { .filter-toolbar.single { grid-template-columns: 1fr auto; } .filter-toolbar.single > *:first-child { grid-column: auto; } }

/* ---- E5) Detail facts (guide §6-د names .info-item; defined here) ---- */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 18px; }
@media (max-width: 500px) { .info-grid { grid-template-columns: 1fr; } }
.info-item { min-width: 0; }
.info-item.wide { grid-column: 1 / -1; }
.info-label { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.info-label.ar { font-family: var(--font-body); letter-spacing: 0; text-transform: none; }
.info-value { font-size: 13.5px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.info-value .cell-sub { margin-top: 3px; }
.panel-head-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---- E6) Notes inside a panel: warning, info, danger — status tokens ---- */
.note-box { border-radius: var(--r-md); padding: 11px 13px; font-size: 12.5px; line-height: 1.7; margin-bottom: 16px; display: flex; gap: 9px; align-items: flex-start; }
.note-box svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; }
.note-box.warn   { background: var(--warn-bg);   color: var(--warn-ink); }
.note-box.info   { background: var(--info-bg);   color: var(--info-ink); }
.note-box.danger { background: var(--danger-bg); color: var(--danger-ink); }
.note-box.ok     { background: var(--ok-bg);     color: var(--ok-ink); }

/* ---- E7) Delivered secrets: hidden until asked for ---- */
.secret-box { position: relative; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 16px; }
.secret-box pre { font-family: var(--font-mono); font-size: 12px; direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); max-height: 220px; overflow: auto; }
.secret-box.hidden pre { filter: blur(6px); user-select: none; }
.secret-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---- E8) Receipt image ---- */
.receipt-frame { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 8px; margin-bottom: 16px; text-align: center; }
.receipt-frame img { max-width: 100%; max-height: 420px; border-radius: var(--r-md); display: block; margin: 0 auto; }
.receipt-frame a { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; }
.receipt-frame a svg { width: 13px; height: 13px; }

/* ---- E9) Panel footer actions: primary at the end, danger kept apart ---- */
.panel-footer .spacer { flex: 1; }
.panel-footer .btn-add { padding: 10px 18px; }
.btn-ghost-danger { padding: 10px 16px; background: transparent; border: 1px solid var(--danger-bg); color: var(--danger-ink); border-radius: var(--r-md); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all var(--t-base); }
.btn-ghost-danger:hover { background: var(--danger-bg); }
@media (max-width: 500px) { .panel-footer { flex-wrap: wrap; } .panel-footer .panel-footer-status { flex-basis: 100%; } }

/* ---- E10) Toast — top corner at the start side (right in RTL), 3 seconds.
   Same surface as .bulk-bar: ink background, floating shadow. ---- */
.toast-stack { position: fixed; top: 18px; inset-inline-start: 18px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 36px); }
.toast { background: var(--ink); color: var(--card); padding: 11px 15px; border-radius: 12px; box-shadow: var(--sh-float); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 9px; animation: toastIn 0.22s ease; pointer-events: auto; max-width: 380px; line-height: 1.6; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ok); }
.toast.warn .dot { background: var(--warn); }
.toast.danger .dot { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all 0.22s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- E11) Confirm dialog in a non-destructive tone (approve, credit) ---- */
.confirm-icon-wrap.tone-primary { background: var(--primary-soft); color: var(--primary); }

/* ---- E12) Dashboard ---- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.dash-grid .card { margin-bottom: 16px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.attn-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warn-bg); border: 1px solid var(--warn-bg); border-radius: var(--r-lg); padding: 11px 14px; margin-bottom: 16px; font-size: 13px; color: var(--warn-ink); font-weight: 600; }
.attn-strip svg { width: 16px; height: 16px; }
.attn-strip a { color: var(--warn-ink); background: var(--card); border-radius: var(--r-pill); padding: 4px 11px; text-decoration: none; font-size: 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.attn-strip a:hover { transform: translateY(-1px); }
.card-body.flush { padding: 0; }
.card-body.flush .data-table tbody tr:last-child td { border-bottom: none; }

/* Seven-day bars: one column per day, height = share of the best day. */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 150px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar { width: 100%; max-width: 34px; background: var(--primary-soft); border-radius: 7px 7px 3px 3px; min-height: 3px; transition: background var(--t-fast); position: relative; }
.bar-col.today .bar { background: var(--primary); }
.bar-col:hover .bar { background: var(--primary-hover); }
.bar-val { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--ink-soft); direction: ltr; }
.bar-day { font-size: 10.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.bars-foot { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-soft); font-size: 12px; color: var(--ink-soft); }

.stat-list { display: grid; gap: 2px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.stat-row:last-child { border-bottom: none; }
.stat-row .lbl { color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.stat-row .lbl .cell-sub { display: inline; margin: 0; }

.feed { display: grid; }
.feed-item { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.feed-item:last-child { border-bottom: none; }
.feed-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--bg-2); color: var(--ink-soft); }
.feed-ic svg { width: 14px; height: 14px; }
.feed-ic.ok { background: var(--ok-bg); color: var(--ok-ink); }
.feed-ic.danger { background: var(--danger-bg); color: var(--danger-ink); }
.feed-ic.info { background: var(--info-bg); color: var(--info-ink); }
.feed-text { font-size: 12.5px; color: var(--ink); line-height: 1.6; min-width: 0; }
.feed-text .cell-sub { margin-top: 1px; }
.mini-empty { font-size: 12.5px; color: var(--muted); padding: 14px 0; text-align: center; }

/* ---- E13) Loading row ---- */
.loading-cell { padding: 40px 16px !important; text-align: center; color: var(--muted); font-size: 13px; }

/* ---- E14) Sign-in screen: no shell (guide §4) — top bar + two columns
   1.05fr / 0.95fr: an intro panel and the form card. ---- */
.topbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; }
.topbar-brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 14px; color: var(--ink); }
.login-wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 24px 28px 48px; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 28px; align-items: center; min-height: calc(100vh - 90px); }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; min-height: 0; padding: 8px 16px 40px; } .login-intro { order: 2; } }
.login-intro .page-hero-greet { font-size: 30px; margin-bottom: 10px; }
.login-points { display: grid; gap: 12px; margin-top: 22px; }
.login-point { display: flex; gap: 12px; align-items: flex-start; }
.login-point .kpi-icon { flex-shrink: 0; }
.login-point .t { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.login-point .d { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.6; }
.login-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-2xl); padding: 30px 28px; box-shadow: var(--sh-card); }
.login-card .title { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.login-card .sub { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 22px; }
.login-steps { display: grid; gap: 10px; margin-bottom: 6px; counter-reset: step; }
.login-step { display: flex; gap: 11px; align-items: center; font-size: 13px; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 11px 13px; }
.login-step::before { counter-increment: step; content: counter(step); font-family: var(--font-mono); font-weight: 800; font-size: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.login-step code { font-family: var(--font-mono); background: var(--card); border: 1px solid var(--line); padding: 1px 7px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; font-size: 12px; }

/* =============================================================
   E15) BRAND — Bee Store
   The store's own palette, taken from its logo: bee yellow on warm
   black, honey-cream surfaces. The same 14 tokens every palette in
   the guide defines (§3.1), so every component follows without a
   line changed. It is this panel's default; the other 11 remain.
   ============================================================= */
[data-palette="bee"] {
  --bg: #fff9eb; --bg-2: #fdf0cc; --bg-3: #f8e2a0;
  --ink: #15110a; --ink-soft: #3d3320; --muted: #7a6c4c;
  --primary: #2b2414; --primary-hover: #000000; --primary-soft: #ffefb5;
  --accent: #ffc300; --accent-soft: #ffe7a0;
  --line: #e9d7a2; --line-soft: #f2e6c2; --card: #ffffff;
}
.theme-swatch.bee { background: linear-gradient(135deg, #15110a 50%, #ffc300 50%); }

/* Yellow is a light fill: anything printed on it is ink, not white. */
[data-palette="bee"] .icon-btn .nbadge,
[data-palette="bee"] .chip.active.attn .chip-count { color: var(--ink); }
[data-palette="bee"] .user-avatar { background: var(--accent); color: var(--ink); }
/* The sidebar call to action wears the brand: yellow, inverting on hover. */
[data-palette="bee"] .new-visit-btn { background: var(--accent); color: var(--ink); }
[data-palette="bee"] .new-visit-btn:hover { background: var(--ink); color: var(--accent); }
[data-palette="bee"] .nav-item.active svg.lead { color: var(--accent); }
[data-palette="bee"] .kpi.highlight { border-color: var(--accent); }
[data-palette="bee"] .page-hero-greet .name { color: var(--ink); background: linear-gradient(transparent 58%, var(--accent) 58%); padding: 0 3px; border-radius: 3px; }
[data-palette="bee"] .bar { background: var(--accent-soft); }
[data-palette="bee"] .bar-col.today .bar { background: var(--accent); }
[data-palette="bee"] .bar-col:hover .bar { background: var(--ink); }
/* An "on" switch in near-black reads as off; on is the bee yellow. */
[data-palette="bee"] .toggle-switch .ts-track { background: var(--muted); }
[data-palette="bee"] .toggle-switch input:checked + .ts-track { background: var(--accent); }

/* ---- Logo in the sidebar and the sign-in bar ---- */
.sb-logo-mark.brand { padding: 0; overflow: hidden; background: var(--ink); }
.sb-logo-mark.brand img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Honeycomb: the logo's hexagons as a faint pattern. The shape is a
   mask, the colour is the palette's accent, so it follows every palette. ---- */
.page-hero > * { position: relative; z-index: 1; }
.page-hero::after, .brand-panel::after {
  content: ''; position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 48%;
  background: var(--accent); opacity: 0.28; pointer-events: none;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E"), linear-gradient(to right, black, transparent);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E"), linear-gradient(to right, black, transparent);
  -webkit-mask-size: 56px 100px, 100% 100%; mask-size: 56px 100px, 100% 100%;
  -webkit-mask-repeat: repeat, no-repeat; mask-repeat: repeat, no-repeat;
  -webkit-mask-composite: source-in; mask-composite: intersect;
}

/* ---- Sign-in intro as a brand panel: the logo glows on ink, like the
   logo itself. Tokens only, so it reads under any palette. ---- */
.brand-panel { background: var(--ink); color: var(--card); border-radius: var(--r-2xl); padding: 34px 32px; position: relative; overflow: hidden; }
.brand-panel::after { width: 70%; opacity: 0.16; }
.brand-panel > * { position: relative; z-index: 1; }
.brand-logo { width: 116px; height: 116px; border-radius: 50%; display: block; margin-bottom: 22px; box-shadow: 0 0 0 3px var(--accent), 0 0 46px color-mix(in srgb, var(--accent) 55%, transparent); }
.brand-panel .page-hero-greet { color: var(--card); }
.brand-panel .page-hero-greet .name { color: var(--accent); background: none; padding: 0; }
.brand-panel .page-hero-sub { color: var(--line-soft); }
.brand-panel .login-point .t { color: var(--card); }
.brand-panel .login-point .d { color: var(--line); }
.brand-panel .kpi-icon { background: var(--accent); color: var(--ink); }
@media (max-width: 600px) { .brand-panel { padding: 26px 20px; } .brand-logo { width: 88px; height: 88px; } }

/* =============================================================
   E16) CATALOGUE — products, stock, categories
   ============================================================= */
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-emoji { width: 34px; height: 34px; border-radius: 9px; background: var(--bg-2); display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.mini-tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 700; background: var(--bg-2); color: var(--ink-soft); margin-inline-start: 6px; white-space: nowrap; vertical-align: middle; }
.mini-tag.sale { background: var(--danger-bg); color: var(--danger-ink); }
.mini-tag.src  { background: var(--info-bg);   color: var(--info-ink); }
.filter-toolbar.with-select { grid-template-columns: 1fr minmax(160px, 220px); }
@media (max-width: 900px) { .filter-toolbar.with-select { grid-template-columns: 1fr; } .filter-toolbar.with-select > *:first-child { grid-column: auto; } }

/* Tabs inside the side panel (guide §5 .tabs, full width here) */
.panel-tabs { width: 100%; margin-bottom: 18px; }
.panel-tabs .tab { flex: 1; justify-content: center; }

/* Delivery type cards (guide §5.6 .radio-card), compact */
.radio-group.compact { gap: 8px; margin-bottom: 14px; }
.radio-group.compact .radio-card { padding: 10px 13px; }
.rc-text .t { font-size: 13px; font-weight: 700; color: var(--ink); }
.rc-text .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.55; }
.lang-tag { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--muted); background: var(--bg-2); border-radius: 5px; padding: 1px 6px; margin-inline-start: 6px; }

/* Stock */
.stock-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stock-stat { background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 12px 14px; }
.stock-stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stock-stat .l { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.code-head .left { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.code-list { border: 1px solid var(--line-soft); border-radius: var(--r-md); max-height: 320px; overflow: auto; margin-bottom: 16px; background: var(--card); }
.code-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.code-row:last-child { border-bottom: none; }
.code-row .c { font-family: var(--font-mono); font-size: 12px; direction: ltr; text-align: left; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.code-list.masked .c { filter: blur(5px); user-select: none; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-actions .form-input { width: 120px; }

/* Front-page order: one row per shelf or unfiled product, moved with arrows */
.front-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line-soft); }
.front-row:last-child { border-bottom: none; }
.front-row .pos { font-family: var(--font-mono); font-size: 11px; color: var(--muted); width: 22px; text-align: center; flex-shrink: 0; }
.front-row .name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.front-row.off .name { color: var(--muted); }
.front-row .icon-btn { width: 30px; height: 30px; }
.front-row .icon-btn svg { width: 15px; height: 15px; }
.front-row .icon-btn:disabled { opacity: 0.3; }
.prod-list { display: grid; gap: 6px; }
.prod-list a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); font-size: 13px; }
.prod-list a:hover { border-color: var(--primary); }

/* ---- E17) Arabic column headings: the guide's own §3.3 exception (as for
   .nav-section-title) — positive tracking breaks Arabic letter joining. ---- */
.data-table thead th { letter-spacing: 0; }

/* ---- E18) Numbers that link somewhere, inside stat rows ---- */
.stat-row a { color: var(--ink); font-family: var(--font-mono); font-weight: 700; text-decoration: none; border-bottom: 1px dashed var(--line); }
.stat-row a:hover { color: var(--primary); border-bottom-color: var(--primary); }
