/* Afya Njia web: "Mint Laini". The same named colours as lib/core/brand.dart
   in the app, so a colour means the same thing on the phone and the laptop.
   Plain CSS with variables: no build step, nothing to install. */

:root {
  --primary: #1B7F64;          /* buttons, today's bar, the hero card */
  --primary-strong: #156B55;   /* green TEXT on mint (5.5:1); #1B7F64 fails there */
  --primary-soft: #DDF3EA;     /* active menu item, chips */
  --bar: #4E9A7E;              /* ordinary chart bars (3.4:1 on white) */
  --bar-best: #145F4B;         /* the best day */
  --surface: #FFFFFF;
  --surface-2: #F6FAF8;        /* sidebar, table header */
  --page: #EEF3F0;
  --line: #DCE6E1;
  --ink: #14211D;
  --muted: #5B6F69;
  --danger: #C2412D;   --danger-soft: #FBE9E5;
  --warning: #8A5300;  --warning-soft: #FDF1DC;   /* amber only as text-on-soft or a dot */
  --info: #2563EB;     --info-soft: #E8F0FD;      /* "waiting for you" */
  --momo: #5B3FC4;                                /* mobile money */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 29, .05), 0 4px 16px rgba(20, 33, 29, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.num, table, .stat-value, .bars { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Keyboard users always see where they are. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ── Layout ─────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface-2); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-shop { font-size: 12px; color: var(--muted); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 6px; }
.nav a, .nav span {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--ink); font-weight: 500;
}
.nav a:hover { background: #E8F1ED; text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.nav span.soon { color: var(--muted); font-weight: 400; cursor: default; }
.nav .tag { margin-left: auto; font-size: 10px; background: var(--line); color: var(--muted); padding: 1px 7px; border-radius: 99px; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.who { font-weight: 600; }

.main { padding: 24px 32px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-1 { grid-template-columns: 1fr 1fr; }
.mt { margin-top: 16px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .spacer { flex: 1; }
.hero { background: var(--primary); color: #fff; }
.hero .muted, .hero .stat-label { color: rgba(255, 255, 255, .82); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat-sub { font-size: 12px; margin-top: 2px; }

/* ── Buttons, inputs, chips ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; background: var(--primary); color: #fff;
  transition: background .12s, transform .06s; white-space: nowrap;
}
.btn:hover { background: var(--primary-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--primary-strong); border-color: var(--line); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.block { width: 100%; height: 46px; }
.input {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
}
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 13px; }
.error { color: var(--danger); font-size: 13px; }
.notice { background: var(--info-soft); color: #1E4FBF; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 500; font-size: 13px; cursor: pointer;
}
.chip:hover { text-decoration: none; background: #F2F7F4; }
.chip.on { background: var(--primary-soft); border-color: transparent; color: var(--primary-strong); font-weight: 600; }
.chip .n { color: var(--muted); font-weight: 500; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--primary-soft); color: var(--primary-strong); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }

/* ── "Leo: mambo 3" ─────────────────────────────────────── */
.todo { display: grid; gap: 10px; }
.todo a, .todo .row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: var(--ink); }
.todo a:hover { text-decoration: none; filter: brightness(.98); }
.todo .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.todo .info { background: var(--info-soft); } .todo .info .dot { background: var(--info); }
.todo .warn { background: var(--warning-soft); } .todo .warn .dot { background: var(--warning); }
.todo .bad { background: var(--danger-soft); } .todo .bad .dot { background: var(--danger); }
.todo .count { margin-left: auto; font-weight: 600; white-space: nowrap; }
.todo .done { color: var(--muted); padding: 12px 14px; }

/* ── Week bars (CSS only, no chart library) ─────────────── */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; height: 210px; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; gap: 6px; }
.bar-val { font-size: 12px; color: var(--muted); min-height: 38px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.best-tag { font-size: 11px; font-weight: 600; color: var(--primary-strong); background: var(--primary-soft); padding: 0 8px; border-radius: 99px; }
.bar-track { display: flex; align-items: flex-end; border-bottom: 2px solid var(--line); }
.bar { width: 100%; background: var(--bar); border-radius: 8px 8px 0 0; }
.bar.today { background: var(--primary-strong); }
.bar-day { font-size: 12px; color: var(--muted); }
.bar-day.today { color: var(--primary-strong); font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ── Busy hours ─────────────────────────────────────────── */
.heat { display: grid; grid-template-columns: 76px repeat(15, 1fr); gap: 3px; font-size: 11px; }
.heat .h { color: var(--muted); text-align: center; }
.heat .d { color: var(--muted); align-self: center; }
.heat .c { height: 20px; border-radius: 4px; background: #EEF3F0; }
.heat .l1 { background: #CFE8DD; } .heat .l2 { background: #9BCDB8; }
.heat .l3 { background: #4E9A7E; } .heat .l4 { background: #145F4B; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.heat-legend .c { width: 16px; height: 12px; border-radius: 3px; }

/* ── Top sellers ────────────────────────────────────────── */
.rank { display: grid; gap: 12px; }
.rank-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.rank-track { grid-column: 1 / -1; height: 6px; background: #EEF3F0; border-radius: 99px; overflow: hidden; }
.rank-track span { display: block; height: 100%; background: var(--bar); border-radius: 99px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #EDF2EF; vertical-align: top; }
tr:hover td { background: #FAFCFB; }
td.r, th.r { text-align: right; }
td .sub { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 40px; color: var(--muted); }

.search { display: flex; gap: 8px; }
.search .input { width: 280px; }

/* ── Sign-in pages ──────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 32px 28px; }
.auth-card .brand { padding: 0 0 22px; }
.auth-card p { margin: 6px 0 20px; color: var(--muted); }
.code { font-size: 34px; font-weight: 700; letter-spacing: .25em; text-align: center; color: var(--primary-strong);
        background: var(--primary-soft); border-radius: 14px; padding: 16px; margin: 6px 0 18px; font-variant-numeric: tabular-nums; }
.steps { margin: 0 0 20px; padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 4px; }

/* ── Smaller screens: the sidebar becomes a top strip ───── */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-1 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .brand { padding: 0 8px 0 0; }
  .nav-label, .nav span.soon, .sidebar-foot .muted { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .nav { display: flex; gap: 4px; }
  .main { padding: 16px; }
  .g-4 { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .heat { grid-template-columns: 60px repeat(15, 1fr); }
}

/* ── v0.13: shared widgets ──────────────────────────────── */
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #A33522; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.busy { opacity: .6; cursor: progress; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost.danger { background: transparent; color: var(--danger); border-color: #F1C9C1; }
.btn.ghost.danger:hover { background: var(--danger-soft); }
select.input { padding-right: 28px; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 24px 0 10px; }
.banner { padding: 12px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }
.banner.ok { background: var(--primary-soft); color: var(--primary-strong); }
.banner.bad { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--info-soft); color: #1E4FBF; }
.banner.warn { background: var(--warning-soft); color: var(--warning); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 16px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
.change.up { color: var(--primary-strong); } .change.down { color: var(--danger); }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { padding: 12px 18px; border-radius: 12px; color: #fff; font-weight: 500; box-shadow: var(--shadow); max-width: 520px; }
.toast.ok { background: var(--primary-strong); } .toast.bad { background: var(--danger); }

dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(20,33,29,.25); color: var(--ink); }
dialog.modal.wide { width: min(720px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(20, 33, 29, .35); }
dialog.modal form { padding: 22px 24px; }
.modal-head { display: flex; align-items: center; margin-bottom: 8px; }
.modal-head h2 { flex: 1; }
.modal-head .x { border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.suggest { position: absolute; z-index: 90; background: var(--surface); border-radius: 12px; box-shadow: 0 12px 32px rgba(20,33,29,.18); padding: 6px; max-height: 360px; overflow-y: auto; max-width: 520px; }
.suggest .opt { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest .opt.on, .suggest .opt:hover { background: var(--primary-soft); }
.suggest .opt .sub { font-size: 12px; color: var(--muted); }
.suggest .opt.typed { color: var(--primary-strong); font-weight: 600; }
.suggest .opt.catalogue .sub { color: var(--info); }
.suggest .opt.none { color: var(--muted); cursor: default; }

/* ── Ingiza kwa wingi: the grid ─────────────────────────── */
.sheet td { padding: 4px 6px; vertical-align: middle; }
.sheet th { padding: 8px 6px; }
.sheet input.cell, .sheet select.cell { width: 100%; height: 36px; border: 1px solid transparent; border-radius: 8px; padding: 0 8px; font: inherit; background: transparent; color: var(--ink); }
.sheet input.cell:hover, .sheet select.cell:hover { border-color: var(--line); }
.sheet input.cell:focus, .sheet select.cell:focus { border-color: var(--primary); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.sheet .n { color: var(--muted); font-size: 12px; text-align: right; width: 32px; }
.sheet .chosen { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 0 8px; }
.sheet .chosen .tag { font-size: 10px; font-weight: 600; background: var(--info-soft); color: var(--info); border-radius: 99px; padding: 1px 7px; }
.sheet .chosen button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 4px; }
.sheet tr.bad td { background: var(--danger-soft); }
.sheet tr.expired td { background: var(--warning-soft); }
.sheet tr .msg { font-size: 12px; color: var(--danger); padding: 0 8px 6px; }
.sheet tr.expired .msg { color: var(--warning); }
.sheet .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.sheet .del:hover { color: var(--danger); }
.sheet-foot { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.units-edit { display: grid; grid-template-columns: 1fr 110px 120px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.similar { display: grid; gap: 8px; margin-bottom: 14px; }
.similar button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; }
.similar button:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ── Month bars (Ripoti) ────────────────────────────────── */
.mbars { display: flex; gap: 3px; align-items: flex-end; height: 160px; border-bottom: 2px solid var(--line); }
.mbars div { flex: 1; background: var(--bar); border-radius: 4px 4px 0 0; min-width: 4px; }
.mbars div.today { background: var(--primary-strong); }
.mbars-axis { display: flex; gap: 3px; font-size: 10px; color: var(--muted); }
.mbars-axis span { flex: 1; text-align: center; min-width: 4px; }

/* ── Printing a report: just the content ───────────────── */
@media print {
  .sidebar, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .g-4 { grid-template-columns: repeat(4, 1fr); }
  .g-2-1, .g-1-1 { grid-template-columns: 1fr 1fr; }
}
.nav .badge { margin-left: auto; background: var(--info); color: #fff; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; }
.sidebar { overflow-y: auto; }
[hidden] { display: none !important; }
.sheet td + td { border-left: 1px solid #EDF2EF; }
.sheet tbody tr:hover td { background: #FAFCFB; }
.sheet input.cell::placeholder { color: #A9B8B3; }
.sheet input.cell { background: #FBFDFC; }
.units-edit .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.units-edit .del:hover { color: var(--danger); }
.perm-row { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; margin-bottom: 10px; cursor: pointer; }
.perm-row input { margin-top: 4px; }
.nowrap { white-space: nowrap; }
.batch-cell { display: flex; align-items: center; gap: 4px; }
.batch-cell .nob { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.batch-cell input.cell:disabled { background: var(--surface-2); }
.lang-switch { display: flex; gap: 4px; justify-content: center; margin-top: 18px; }
.sidebar .lang-switch { justify-content: flex-start; margin-top: 10px; }
.lang-switch button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 99px; cursor: pointer; }
.lang-switch button.on { background: var(--primary-soft); color: var(--primary-strong); border-color: transparent; font-weight: 600; }

/* ---------- Msaada and the Saola panel (v0.18) ---------- */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--primary-soft); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.tabs a.active { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.tabs a.active .muted { color: rgba(255,255,255,.8); }
.thread { display: grid; gap: 10px; max-width: 760px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; max-width: 85%; }
.msg.mine { justify-self: end; background: var(--primary-soft); border-color: transparent; }
.msg.saola .msg-head b { color: var(--primary-strong); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.pin-once { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pin-once .code { font-size: 30px; letter-spacing: 6px; margin: 0; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: center; }
.steps .tick { width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--line); color: var(--muted); }
.steps li.done .tick { background: var(--primary-strong); color: #fff; }
