/* ═══════════════════════════════════════════════════════
   Kanda "Soft Bold" — tokens, Blueprint theme, Kanda pieces.
   Source: docs/kanda/KANDA_REBUILD_HANDOVER.md §3. Light only in v1.
   Load AFTER _content/BlazorBlueprint.Components/blazorblueprint.css.
   Layout uses logical properties (inline-start/end) so Arabic (dir="rtl") mirrors without extra rules.
   ═══════════════════════════════════════════════════════ */

:root {
    /* brand */
    --k-violet: #4b2fd1;
    --k-violet-strong: #36209e;  /* hover */
    --k-sunrise: #ff6b3d;        /* logo dot, highlights, progress; never behind white text */
    --k-ink: #1c1540;
    --k-ink-2: #3d3763;
    --k-muted: #5a5480;          /* 4.5:1 on white */
    --k-line: #ebe8f5;
    --k-bg: #f6f5fb;
    --k-surface: #ffffff;
    --k-overlay: rgba(28, 21, 64, 0.45);

    /* service tints + their ink */
    --k-lilac: #ebe7ff;  --k-peach: #ffe9e1;  --k-mint: #ddf3ef;  --k-sand: #f8ecd6;  --k-rose: #fde4ec;
    --k-teal: #1e8c7e;   --k-ochre: #b5770f;  --k-hibiscus: #e23d6a;
    --k-peach-ink: #6a3a1f;  --k-mint-ink: #2c5a54;  --k-soon-ink: #6a6490;

    /* semantic */
    --k-good: #0b6b43;  --k-good-bg: #e3f5ea;
    --k-warn: #7a3d00;  --k-warn-bg: #fff1dc;
    --k-bad:  #a01d14;  --k-bad-bg:  #fdecea;
    --k-mpesa: #2fb35c;          /* ONLY the M-PESA badge in the payment sheet */

    /* shape */
    --k-r-card: 22px;  --k-r-sheet: 28px;  --k-r-pill: 999px;  --k-r-tile: 24px;
    --k-h-primary: 52px;  --k-h-secondary: 46px;  --k-touch: 44px;

    /* type */
    --k-font-ui: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --k-font-head: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
    --k-font-mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', monospace;
}

/* Arabic: Bricolage and Geist have no Arabic letters. */
:root:lang(ar) {
    --k-font-ui: 'Noto Sans Arabic', 'Geist', system-ui, sans-serif;
    --k-font-head: 'Noto Sans Arabic', 'Geist', system-ui, sans-serif;
}

/* ─── Blueprint theme mapped to Kanda (html.kanda outranks Blueprint's :root defaults) ─── */
html.kanda {
    --background: var(--k-surface);
    --foreground: var(--k-ink);
    --card: var(--k-surface);
    --card-foreground: var(--k-ink);
    --popover: var(--k-surface);
    --popover-foreground: var(--k-ink);
    --primary: var(--k-violet);
    --primary-foreground: #ffffff;
    --secondary: var(--k-bg);
    --secondary-foreground: var(--k-ink);
    --muted: var(--k-bg);
    --muted-foreground: var(--k-muted);
    --accent: var(--k-lilac);
    --accent-foreground: var(--k-ink);
    --destructive: var(--k-bad);
    --destructive-foreground: #ffffff;
    --border: var(--k-line);
    --input: var(--k-line);
    --ring: var(--k-violet);
    --radius: 14px;
    color-scheme: light;
}

/* ─── Base ─── */
html.kanda body {
    margin: 0;
    font-family: var(--k-font-ui);
    font-size: 14px;
    line-height: 1.45;
    color: var(--k-ink);
    background: var(--k-surface);
    -webkit-font-smoothing: antialiased;
}
html.kanda a { color: var(--k-violet); }
html.kanda a:hover { color: var(--k-violet-strong); }
html.kanda :focus-visible { outline: 2px solid var(--k-violet); outline-offset: 2px; }
#blazor-error-ui { display: none; }

.k-head { font-family: var(--k-font-head); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin: 0; }
:lang(ar) .k-head { letter-spacing: 0; }
.k-mono, .k-money { font-family: var(--k-font-mono); font-variant-numeric: tabular-nums; }
/* Money and codes always read left to right, also inside Arabic text. */
.k-money, .k-code { direction: ltr; unicode-bidi: isolate; }
.k-muted { color: var(--k-muted); }

/* Icons that point (back, forward) turn round in right-to-left. */
[dir="rtl"] .k-icon--directional { transform: scaleX(-1); }

/* ─── Screen frame (phone-first; centred on wide screens) ─── */
.k-screen {
    min-height: 100dvh;
    max-width: 480px;
    margin-inline: auto;
    background: var(--k-surface);
    display: flex;
    flex-direction: column;
    position: relative;
}
.k-pad { padding: 24px 18px; display: flex; flex-direction: column; gap: 16px; }

/* ─── Buttons (Blueprint BbButton + Kanda shape) ─── */
.k-btn {
    border-radius: var(--k-r-pill) !important;
    min-height: var(--k-h-secondary);
    padding-inline: 22px !important;
    font-family: var(--k-font-ui);
    font-size: 15px !important;
    font-weight: 700 !important;
    gap: 8px;
}
.k-btn--primary { min-height: var(--k-h-primary); }
.k-btn--block { width: 100%; }
.k-btn--soft { background: var(--k-bg) !important; color: var(--k-ink) !important; border: 0 !important; }
.k-btn--soft:hover { background: var(--k-line) !important; }

.k-icon-btn {
    width: var(--k-touch); height: var(--k-touch); flex-shrink: 0;
    border: 0; border-radius: 50%;
    background: var(--k-bg); color: var(--k-ink);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.k-icon-btn:hover { background: var(--k-line); }

/* ─── Bottom sheet ─── */
.k-sheet-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: var(--k-overlay);
    display: flex; align-items: flex-end; justify-content: center;
    animation: k-fade 0.15s ease-out;
}
.k-sheet {
    width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto;
    background: var(--k-surface);
    border-radius: var(--k-r-sheet) var(--k-r-sheet) 0 0;
    padding: 12px 20px calc(28px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 14px;
    animation: k-rise 0.2s ease-out;
}
.k-sheet:focus { outline: none; }
.k-sheet__handle { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--k-line); }
.k-sheet__title { font-size: 20px; }
@keyframes k-fade { from { opacity: 0; } }
@keyframes k-rise { from { transform: translateY(24px); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .k-sheet-overlay, .k-sheet { animation: none; } }

/* ─── Service tiles ─── */
.k-tile {
    display: flex; align-items: center; gap: 14px;
    padding: 18px; border-radius: var(--k-r-tile);
    color: var(--k-ink); text-decoration: none;
    border: 0; font: inherit; text-align: start; cursor: pointer;
    min-height: var(--k-touch);
}
html.kanda a.k-tile, html.kanda a.k-tile:hover { color: var(--k-ink); }
.k-tile__icon {
    width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0;
    background: #ffffff;
    display: flex; align-items: center; justify-content: center;
}
.k-tile__text { display: flex; flex-direction: column; gap: 3px; }
.k-tile__title { font-size: 17px; font-weight: 700; }
.k-tile__sub { font-size: 13px; line-height: 1.4; color: var(--k-ink-2); }
.k-tile--compact { flex-direction: column; justify-content: center; gap: 4px; padding: 12px 6px 10px; }
.k-tile--compact .k-tile__icon { width: auto; height: auto; background: transparent; }
.k-tile--compact .k-tile__title { font-size: 12px; }
.k-tile--soon { opacity: 0.85; cursor: default; }
.k-tile__soon { font-size: 10px; font-weight: 700; color: var(--k-soon-ink); background: #ffffff; padding: 2px 7px; border-radius: 8px; }
.k-tile--eats  { background: var(--k-peach); }  .k-tile--eats  .k-tile__sub { color: var(--k-peach-ink); }
.k-tile--send, .k-tile--ride { background: var(--k-lilac); }
.k-tile--stay  { background: var(--k-mint); }   .k-tile--stay  .k-tile__sub { color: var(--k-mint-ink); }
.k-tile--homes { background: var(--k-sand); }

/* ─── Status pill (text + colour, never colour alone) ─── */
.k-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--k-r-pill);
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
.k-pill--neutral { background: var(--k-bg);      color: var(--k-ink-2); }
.k-pill--brand   { background: var(--k-lilac);   color: var(--k-violet); }
.k-pill--good    { background: var(--k-good-bg); color: var(--k-good); }
.k-pill--warn    { background: var(--k-warn-bg); color: var(--k-warn); }
.k-pill--bad     { background: var(--k-bad-bg);  color: var(--k-bad); }
.k-pill--mpesa   { background: var(--k-mpesa);   color: #0b2d16; letter-spacing: 0.04em; }

/* ─── Language list ─── */
.k-lang-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.k-lang {
    width: 100%; min-height: 52px; padding-inline: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 1px solid var(--k-line); border-radius: 16px; background: var(--k-surface);
    font: inherit; font-size: 15px; font-weight: 600; color: var(--k-ink); cursor: pointer; text-align: start;
}
.k-lang[aria-checked="true"] { border-color: var(--k-violet); background: var(--k-lilac); }
