/* Yawsel — merchant dashboard mockup. Shared design tokens + components.
   RTL Arabic first. System fonts only (no external font CDN). */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #9ca3af;
  /* Yawsel brand (brand/README.md): navy is the primary, lime only on navy/dark, olive for accents on white. */
  --navy: #0f2340;
  --navy-2: #1b3560;       /* hover */
  --lime: #c5f04a;
  --olive: #4a7d00;
  --brand: var(--navy);
  --brand-2: #e8edf5;      /* navy tint: selected backgrounds */
  --brand-line: #c9d3e3;   /* navy tint: borders, focus rings */
  --accent: var(--lime);
  /* Status colours tuned to the brand (2026-11-10 audit): success = olive family, info = navy tint,
     warn/bad stay amber/red (meaning beats brand) but warmed to sit beside navy. */
  --ok: #3f6f00;  --ok-bg: #f2f8e6;  --ok-line: #cfe3a8;  --ok-ink: #2f5300;
  --warn: #a75d00; --warn-bg: #fff7e8; --warn-line: #f2d7a2; --warn-ink: #7a4300;
  --bad: #c0281d; --bad-bg: #fdf2f1; --bad-line: #f3c4bf; --bad-ink: #8f1d15;
  --info: #1b3560; --info-bg: #eef2f8; --info-line: #c9d3e3; --info-ink: #0f2340;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(17,24,39,.06), 0 4px 16px rgba(17,24,39,.04);
  --sidebar-w: 248px;
  --font: "Readex Pro", "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  --mono: ui-monospace, Consolas, "SF Mono", Menlo, "Readex Pro", monospace;
}
/* Brand typeface (brand/README.md), self-hosted: variable weight 160–700, Arabic + Latin subset, OFL. */
@font-face { font-family: "Readex Pro"; src: url("/fonts/readex-pro.woff2") format("woff2"); font-weight: 160 700; font-style: normal; font-display: swap; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; color: var(--text-2); }
small, .small { font-size: .85rem; color: var(--muted); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-inline-start: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; padding: 4px 8px 14px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 18px; }
.store-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface-2); }
.store-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: #111827; color: #facc15; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.store-chip .name { font-weight: 700; font-size: .92rem; }
.store-chip .plan { font-size: .78rem; color: var(--muted); }
.nav-group { font-size: .75rem; color: var(--muted); padding: 10px 10px 4px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .93rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-2); color: var(--brand); }
.nav .ico { width: 20px; text-align: center; }
.nav .badge { margin-inline-start: auto; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .crumbs { color: var(--muted); font-size: .9rem; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 24px 28px 48px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.menu-btn { display: none; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

.kpi .label { color: var(--text-2); font-size: .88rem; font-weight: 600; }
.kpi .value { font-size: 1.7rem; font-weight: 800; margin: 4px 0; }
.kpi .delta { font-size: .82rem; font-weight: 700; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.kpi .hint { font-size: .78rem; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge.brand { background: var(--brand-2); color: var(--brand); border-color: var(--brand-line); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; }
.alert.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.alert.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.alert.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
/* The flex row is for "icon + one text". An alert built from several lines (import result, deep-check progress)
   stacks them — in a row each line became a narrow column, one word per line (2026-11-17). Children may shrink and
   wrap long numbers/addresses so nothing overflows on a phone. */
.alert:has(> :is(div, p) + :is(div, p)) { flex-direction: column; align-items: stretch; gap: 6px; }
.alert > * { min-width: 0; overflow-wrap: break-word; }

label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=time], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-line); border-color: var(--brand); }
textarea { min-height: 100px; resize: vertical; }
.ltr { direction: ltr; text-align: left; }
code, .mono, pre { font-family: var(--mono); font-size: .85rem; direction: ltr; }

.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: #fff; }
.choice:hover { border-color: var(--brand-line); }
.choice.selected { border-color: var(--brand); background: var(--brand-2); }
.choice input { margin-top: 4px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; width: 18px; height: 18px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(-18px); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: start; color: var(--muted); font-weight: 700; font-size: .8rem; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #fafafa; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 10px 16px; border: 0; background: none; font: inherit; font-weight: 700; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step { flex: 1; min-width: 150px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-size: .85rem; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: .8rem; background: var(--surface-2); margin-inline-end: 6px; }
.step.done .n { background: var(--ok); color: #fff; }
.step.current { border-color: var(--brand); background: var(--brand-2); }
.step.current .n { background: var(--brand); color: #fff; }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--brand); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 2rem; }

/* simple bar chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding: 8px 4px 0; border-bottom: 1px solid var(--border); }
.bars .b { flex: 1; background: linear-gradient(180deg, var(--brand), #4b6a99); border-radius: 6px 6px 0 0; position: relative; min-height: 4px; }
.bars .b span { position: absolute; top: -20px; inset-inline: 0; text-align: center; font-size: .72rem; color: var(--text-2); font-weight: 700; }
.bars-x { display: flex; gap: 8px; padding: 6px 4px 0; }
.bars-x span { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); }

/* email preview frame */
.email-frame { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #f3f4f6; }
.email-frame .bar { background: #fff; border-bottom: 1px solid var(--border); padding: 10px 14px; font-size: .85rem; }
.email-frame .body { padding: 16px; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #eef7d4, transparent 40%), var(--bg); }
.auth-card { width: 100%; max-width: 430px; }
.auth-card .brand { justify-content: center; font-size: 1.3rem; }

.mock-note { position: fixed; bottom: 12px; inset-inline-end: 12px; background: #111827; color: #facc15; font-size: .75rem; padding: 6px 10px; border-radius: 8px; z-index: 50; opacity: .85; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset-inline-start: 0; z-index: 30; transform: translateX(100%); transition: .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}

/* fixes after visual review */
.btn.menu-btn { display: none; }
.nav .badge { white-space: nowrap; flex-shrink: 0; }
.nav a { white-space: nowrap; }
@media (max-width: 760px) { .btn.menu-btn { display: inline-flex; } }
.mock-note { pointer-events: none; opacity: .7; bottom: auto; top: 70px; }
.mock-note { display: none !important; }

/* ---------- Brand layer (2026-11-10): navy sidebar, lime active item, real logo ---------- */
::selection { background: var(--lime); color: var(--navy); }
a { color: var(--olive); }
p a, .auth-card a, td a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(74,125,0,.4); }
p a:hover, .auth-card a:hover, td a:hover { text-decoration-color: currentColor; }
.brand img { display: block; height: auto; }
.brand-sub { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--brand-2); color: var(--navy); }
.auth-card .brand { flex-direction: column; gap: 8px; padding-bottom: 18px; }
.sidebar { background: var(--navy); border-inline-start-color: var(--navy); color: #e8edf5; }
.sidebar .brand { padding: 6px 8px 18px; }
.sidebar .brand-sub { background: rgba(255,255,255,.12); color: var(--lime); }
.sidebar .store-chip { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
.sidebar .store-chip .avatar { background: var(--lime); color: var(--navy); }
.sidebar .store-chip .name { color: #fff; }
.sidebar .store-chip .plan { color: #a9b6cc; }
.sidebar .nav-group { color: #8c9bb5; }
.sidebar .nav a { color: #d4dcea; }
.sidebar .nav a:hover { background: rgba(255,255,255,.08); }
.sidebar .nav a.active { background: var(--lime); color: var(--navy); }
.sidebar .sidebar-foot { border-top-color: rgba(255,255,255,.12); }
.sidebar .sidebar-foot .btn { background: transparent; border-color: rgba(255,255,255,.2); color: #e8edf5; }
.sidebar .sidebar-foot .btn:hover { background: rgba(255,255,255,.08); }
.sidebar :focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }

/* ---------- Audit layer (2026-11-10): one type, drawn icons, brand states, fixes ---------- */
html, body { font-feature-settings: "kern"; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2, h3 { font-weight: 700; }
.kpi .value, .value, b, strong, th { font-weight: 700; }
.kpi .value, td, .limit-row b, .bars span { font-variant-numeric: tabular-nums; }
/* Cards inside a grid never take the "card after card" stacking gap: it offset every card but the first. */
.grid > .card + .card, [class*="grid"] > .card + .card { margin-top: 0; }
/* Drawn icons (assets/icons.js): one stroke, one weight, colour from the text. */
svg.i { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.btn svg.i, .badge svg.i { width: 1.05em; height: 1.05em; }
.badge svg.i { vertical-align: -.15em; }
.nav .ico { display: inline-grid; place-items: center; width: 22px; height: 22px; }
.nav .ico svg.i { width: 19px; height: 19px; }
.sidebar .nav a .ico { color: #8fa3c2; }
.sidebar .nav a:hover .ico { color: #e8edf5; }
.sidebar .nav a.active .ico { color: var(--navy); }
.empty .big svg.i { width: 40px; height: 40px; stroke-width: 1.5; color: var(--brand-line); }
.alert > span:first-child:has(> svg.i:only-child) { display: inline-grid; place-items: center; padding-top: 1px; }
h1 svg.i, h2 svg.i, h3 svg.i { color: var(--olive); margin-inline-end: 2px; }
/* Form controls the browser draws: themed, finger-sized. */
input[type=checkbox], input[type=radio] { accent-color: var(--navy); width: 18px; height: 18px; vertical-align: -3px; cursor: pointer; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 0; }
::placeholder { color: #8a94a6; }
.switch input:checked + .slider { background: var(--olive); }
.switch input:focus-visible + .slider { outline: 2px solid var(--navy); outline-offset: 2px; }
.step.done .n { background: var(--olive); }
/* Weekly chart: an empty week is a baseline, not a full bar. */
.bars .b { background: var(--navy); }
.bars .b.zero { background: transparent; border-top: 2px solid var(--border); min-height: 0; border-radius: 0; }
.bars .b.zero span { color: var(--muted); font-weight: 600; }
/* Phone: the brand stays in view when the sidebar is folded away. */
.topbar-logo { display: none; }
@media (max-width: 760px) { .topbar-logo { display: block; height: 30px; width: auto; } .topbar .crumbs { display: none; } }
