/* =========================================================================
   Rasha Clinic Hub — compact operations UI
   Dense CRM layout: 13px base, hairline borders, small radii, tight rhythm.
   ========================================================================= */

:root {
    --bg: #0a0f1a;
    --bg-deep: #070b13;
    --surface: #111826;
    --surface-2: #161f30;
    --surface-3: #1c2637;
    --line: #232e42;
    --line-soft: #1b2434;

    --text: #e8edf6;
    --text-dim: #9aa8be;
    --text-mute: #6d7b91;

    --brand: #3f7dff;
    --brand-soft: rgba(63, 125, 255, 0.14);
    --brand-line: rgba(63, 125, 255, 0.36);

    --ok: #2fd6a3;
    --ok-soft: rgba(47, 214, 163, 0.12);
    --warn: #f7b84b;
    --warn-soft: rgba(247, 184, 75, 0.12);
    --danger: #f76a7f;
    --danger-soft: rgba(247, 106, 127, 0.12);
    --info: #52b7ff;
    --info-soft: rgba(82, 183, 255, 0.12);
    --violet: #9b7dff;

    --r-sm: 6px;
    --r: 9px;
    --r-lg: 12px;

    --sidebar-w: 232px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.38);

    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs: 13px;
    --fs-md: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: var(--fs);
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 19px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
p { margin: 0 0 8px; }

/* Inline SVG icon set: stroked, currentColor, never shrinking in flex rows. */
.ico {
    width: 14px;
    height: 14px;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ico-lg { width: 18px; height: 18px; }

.muted { color: var(--text-dim); }
.mute-xs { color: var(--text-mute); font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-deep);
    border-right: 1px solid var(--line-soft);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
}

.brand-mark {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-mark img { width: 22px; height: 22px; object-fit: contain; }
.brand-text strong { display: block; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.brand-text small { display: block; font-size: 10px; color: var(--text-mute); letter-spacing: 0.06em; text-transform: uppercase; }

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.nav-label {
    display: block;
    padding: 12px 8px 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-mute);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    margin-bottom: 1px;
    border-radius: var(--r-sm);
    color: var(--text-dim);
    font-size: var(--fs);
    line-height: 1.3;
    transition: background 0.12s ease, color 0.12s ease;
}

.nav-link:hover { background: var(--surface); color: var(--text); }

.nav-link.active {
    background: var(--brand-soft);
    color: #cfe0ff;
    box-shadow: inset 2px 0 0 var(--brand);
}

.nav-link .ico { width: 15px; height: 15px; opacity: 0.85; }

.nav-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-count {
    flex: none;
    font-style: normal;
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 99px;
    background: var(--surface-3);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
}

.nav-count.hot { background: var(--ok-soft); color: var(--ok); }

.sidebar-foot {
    padding: 9px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    color: #bcd3ff;
    font-size: var(--fs-xs);
    font-weight: 700;
}

.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who strong { display: block; font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who small { display: block; font-size: 10px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
    width: 28px;
    height: 28px;
    flex: none;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-dim);
    cursor: pointer;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); filter: none; }

.content { min-width: 0; padding: 0 0 32px; }

/* ---------- topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 18px;
    background: rgba(10, 15, 26, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line-soft);
}

.topbar h1 { font-size: 15px; }
.topbar .crumb { font-size: var(--fs-xs); color: var(--text-mute); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-tools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.sidebar-toggle { display: none; }

.clock {
    font-size: var(--fs-sm);
    color: var(--text-mute);
    font-variant-numeric: tabular-nums;
}

/* Explicit minmax(0, 1fr) everywhere a grid track could otherwise be forced
   wide by a min-content child, which is what pushes the page into horizontal
   scroll on small screens. */
.page {
    padding: 16px 18px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.page-head p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-dim); }

/* ---------- surfaces ---------- */

.card {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--line-soft);
}

.card-head h2 { font-size: var(--fs-md); }
.card-head .sub { font-size: var(--fs-xs); color: var(--text-mute); }
.card-body { padding: 13px; }
.card-body.tight { padding: 9px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 9px 13px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.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)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* ---------- stat tiles ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }

.stat {
    min-width: 0;
    position: relative;
    padding: 11px 12px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: var(--line);
}

.stat.is-brand::before { background: var(--brand); }
.stat.is-ok::before { background: var(--ok); }
.stat.is-warn::before { background: var(--warn); }
.stat.is-danger::before { background: var(--danger); }
.stat.is-info::before { background: var(--info); }

.stat .k {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mute);
}

.stat .v {
    display: block;
    margin-top: 3px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat .n { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-mute); }
.stat.is-ok .v { color: var(--ok); }
.stat.is-danger .v { color: var(--danger); }
.stat.is-warn .v { color: var(--warn); }

/* ---------- chips / badges ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: 99px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.chip.ok, .chip.status-open, .chip.status-active { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.danger, .chip.status-closed, .chip.status-inactive { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.chip.brand { background: var(--brand-soft); border-color: transparent; color: #9dbcff; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(47, 214, 163, 0.5); }
    70% { box-shadow: 0 0 0 5px rgba(47, 214, 163, 0); }
    100% { box-shadow: 0 0 0 0 rgba(47, 214, 163, 0); }
}

/* ---------- buttons ---------- */

.btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover,
button:hover,
input[type="submit"]:hover { filter: brightness(1.1); }

button:disabled, .btn:disabled, button[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }

.btn-secondary,
button.btn-secondary {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text-dim);
}

.btn-secondary:hover { background: var(--surface-3); color: var(--text); filter: none; }

.btn-ghost, button.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text-dim);
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); filter: none; }

.btn-danger, button.btn-danger {
    background: var(--danger-soft);
    border-color: transparent;
    color: var(--danger);
}

.btn-danger:hover { background: rgba(247, 106, 127, 0.2); filter: none; }

.btn-ok, button.btn-ok { background: var(--ok); color: #04241a; }

.btn-xs, button.btn-xs { height: 24px; padding: 0 8px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.btn-lg, button.btn-lg { height: 36px; padding: 0 16px; font-size: var(--fs); }

.btn-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- forms ---------- */

.form { display: grid; gap: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.field, .field-full { display: grid; gap: 4px; align-content: start; }
.field-full { grid-column: 1 / -1; }

label {
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-dim);
}

.field-note { font-size: 10px; line-height: 1.4; color: var(--text-mute); }

input, select, textarea {
    width: 100%;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg-deep);
    color: var(--text);
    font: inherit;
    font-size: var(--fs);
}

select {
    appearance: none;
    padding-right: 26px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236d7b91' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}

textarea { height: auto; min-height: 64px; padding: 7px 9px; resize: vertical; line-height: 1.5; }

input[type="file"] { height: auto; padding: 6px 9px; font-size: var(--fs-sm); color: var(--text-dim); }
input[type="checkbox"], input[type="radio"] { width: 14px; height: 14px; accent-color: var(--brand); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-line);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

input::placeholder, textarea::placeholder { color: var(--text-mute); }

.check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg-deep);
    font-size: var(--fs-sm);
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
}

.check:hover { border-color: var(--brand-line); color: var(--text); }
.check input { width: 14px; height: 14px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- search bar ---------- */

.searchbar { display: flex; gap: 6px; align-items: center; }
.searchbar input { max-width: 280px; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 13px;
    border-bottom: 1px solid var(--line-soft);
}

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.tab {
    padding: 5px 11px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-dim);
    border: 1px solid transparent;
}

.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--brand-soft); color: #a9c5ff; border-color: var(--brand-line); }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs); }

.table th {
    padding: 7px 12px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-mute);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}

.table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .right, .table th.right { text-align: right; }
.table td strong { font-weight: 600; }

.cell-main { display: flex; align-items: center; gap: 8px; }
.cell-main .avatar { width: 26px; height: 26px; font-size: 10px; }
.cell-main b { display: block; font-weight: 600; }
.cell-main small { display: block; font-size: var(--fs-xs); color: var(--text-mute); }

.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.bar { flex: 1; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }

.empty {
    padding: 22px 14px;
    text-align: center;
    font-size: var(--fs-sm);
    color: var(--text-mute);
}

.empty strong { display: block; margin-bottom: 3px; color: var(--text-dim); font-size: var(--fs); }

/* ---------- lists ---------- */

.rows { display: grid; }

.row-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 13px;
    border-bottom: 1px solid var(--line-soft);
    font-size: var(--fs);
}

.row-line:last-child { border-bottom: 0; }
.row-line .lbl { color: var(--text-dim); min-width: 0; }
.row-line .val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.kv { display: grid; gap: 9px; }
.kv > div { display: grid; gap: 2px; }
.kv dt, .kv .k { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-mute); }
.kv dd, .kv .v { margin: 0; font-size: var(--fs); color: var(--text); }

/* ---------- alerts ---------- */

.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 18px 0;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}

.page .alert { margin: 0; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- charts ---------- */

.chart-canvas { width: 100%; height: 168px; display: block; }
.chart-canvas.tall { height: 210px; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-dim); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ---------- board (active clients) ---------- */

.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 10px; }

.board-card {
    display: grid;
    gap: 9px;
    padding: 11px 12px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    transition: border-color 0.12s ease, transform 0.12s ease;
}

.board-card:hover { border-color: var(--brand-line); }
.board-card.pending { box-shadow: inset 3px 0 0 var(--warn); }

.board-top { display: flex; align-items: center; gap: 9px; }
.board-top .avatar { width: 32px; height: 32px; font-size: var(--fs-sm); }
.board-top .who { flex: 1; min-width: 0; }
.board-top .who b { display: block; font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-top .who small { display: block; font-size: var(--fs-xs); color: var(--text-mute); }

.board-meta { display: flex; flex-wrap: wrap; gap: 5px; }

.board-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; }

.alert-flag { color: var(--warn); font-size: var(--fs-xs); display: flex; gap: 5px; align-items: center; }

/* ---------- POS ---------- */

.pos { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }

.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; padding: 11px; }

.pos-item {
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    text-align: left;
    height: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: var(--fs-sm);
    white-space: normal;
}

.pos-item:hover { border-color: var(--brand-line); background: var(--surface-3); filter: none; }
.pos-item b { font-size: var(--fs); font-weight: 600; line-height: 1.3; }
.pos-item .price { color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; }
.pos-item .stk { font-size: 10px; color: var(--text-mute); }
.pos-item.out { opacity: 0.42; pointer-events: none; }
.pos-item.low .stk { color: var(--warn); }

.cart { position: sticky; top: 60px; }
.cart-lines { max-height: 320px; overflow-y: auto; }

.cart-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
}

.cart-line b { font-size: var(--fs); font-weight: 600; }
.cart-line .unit { font-size: var(--fs-xs); color: var(--text-mute); }
.cart-line .amt { font-weight: 600; font-variant-numeric: tabular-nums; }

.qty { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.qty button { width: 22px; height: 22px; padding: 0; border-radius: 0; background: var(--surface-2); border: 0; color: var(--text-dim); font-size: var(--fs-md); }
.qty button:hover { background: var(--surface-3); color: var(--text); filter: none; }
.qty input { width: 34px; height: 22px; padding: 0; border: 0; border-radius: 0; text-align: center; background: var(--bg-deep); font-size: var(--fs-sm); }

.totals { display: grid; gap: 5px; padding: 10px 12px; border-top: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.totals .line { display: flex; justify-content: space-between; color: var(--text-dim); }
.totals .line.grand { padding-top: 6px; border-top: 1px dashed var(--line); font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.totals .line .num { font-variant-numeric: tabular-nums; }

/* ---------- rendered documentation ---------- */

/* Standalone shell for the public guidance page (no sidebar, no app chrome). */
.doc-shell {
    max-width: 940px;
    margin: 0 auto;
    padding: 18px 16px 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.doc-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
}

.doc-foot {
    padding: 4px 2px;
    font-size: var(--fs-xs);
    color: var(--text-mute);
    text-align: center;
}

.doc {
    padding: 18px 22px 24px;
    max-width: 860px;
    font-size: var(--fs-md);
    line-height: 1.65;
    color: var(--text-dim);
}

.doc > :first-child { margin-top: 0; }

.doc h2 {
    margin: 26px 0 10px;
    padding-bottom: 7px;
    font-size: 16px;
    color: var(--text);
    border-bottom: 1px solid var(--line-soft);
}

.doc h3 { margin: 18px 0 7px; font-size: var(--fs-md); color: var(--text); }
.doc h4 { margin: 14px 0 6px; font-size: var(--fs); color: var(--text-dim); }
.doc p { margin: 0 0 10px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc em { color: var(--text); font-style: italic; }

.doc a {
    color: var(--info);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Inline easter-egg link: a real anchor, but drawn as ordinary body text. */
.doc a[href^="https://www.google.com"] {
    color: inherit;
    text-decoration: none;
}

.doc ul, .doc ol { margin: 0 0 12px; padding-left: 20px; }
.doc li { margin-bottom: 4px; }
.doc li::marker { color: var(--text-mute); }

.doc blockquote {
    margin: 14px 0;
    padding: 10px 14px;
    border-left: 2px solid var(--brand);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: var(--brand-soft);
    color: var(--text);
}

.doc blockquote p:last-child { margin-bottom: 0; }

.doc code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--surface-3);
    color: #cfe0ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--fs-sm);
}

.doc pre {
    margin: 0 0 12px;
    padding: 11px 13px;
    overflow-x: auto;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    background: var(--bg-deep);
}

.doc pre code { padding: 0; background: none; }

.doc hr { margin: 22px 0; border: 0; border-top: 1px solid var(--line-soft); }

/* Wide comparison tables must scroll inside the article, not the page. */
.doc table {
    display: block;
    width: 100%;
    overflow-x: auto;
    margin: 0 0 14px;
    border-collapse: collapse;
    font-size: var(--fs);
}

.doc th {
    padding: 7px 11px;
    text-align: left;
    white-space: nowrap;
    color: var(--text-mute);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-soft);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.doc td {
    padding: 7px 11px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}

.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:hover { background: var(--surface-2); }

@media (max-width: 720px) {
    .doc { padding: 14px 14px 18px; font-size: var(--fs); }
}

/* ---------- login ---------- */

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(900px 420px at 15% -10%, rgba(63, 125, 255, 0.16), transparent 70%),
        radial-gradient(700px 380px at 100% 110%, rgba(155, 125, 255, 0.1), transparent 70%),
        var(--bg);
}

.login-card {
    width: min(880px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-side {
    padding: 28px 26px;
    background: linear-gradient(160deg, var(--surface-2), var(--bg-deep));
    border-right: 1px solid var(--line-soft);
    display: grid;
    align-content: space-between;
    gap: 20px;
}

.login-side h2 { font-size: 20px; letter-spacing: -0.02em; }
.login-side p { font-size: var(--fs); color: var(--text-dim); line-height: 1.6; }
.login-points { display: grid; gap: 7px; }
.login-points div { display: flex; gap: 8px; font-size: var(--fs-sm); color: var(--text-dim); }
.login-points i { color: var(--brand); font-style: normal; }

.login-form { padding: 28px 26px; display: grid; align-content: center; gap: 14px; }
.login-form h1 { font-size: 20px; }

.hint-accounts { display: grid; gap: 3px; font-size: 10px; color: var(--text-mute); font-family: ui-monospace, SFMono-Regular, monospace; }

/* ---------- pagination ---------- */

.pagination { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 10px 13px; font-size: var(--fs-sm); }
.pagination li { display: inline-flex; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text-dim);
}
.pagination .active span, .pagination a:hover { background: var(--surface-3); color: var(--text); }
.pagination svg { width: 12px; height: 12px; }
nav[role="navigation"] .hidden { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
    .pos { grid-template-columns: minmax(0, 1fr); }
    .cart { position: static; }
    .grid-2-1, .grid-1-2, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        z-index: 60;
        left: 0;
        top: 0;
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow-lg);
    }

    body.nav-open .sidebar { transform: translateX(0); }

    body.nav-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(3, 6, 12, 0.6);
    }

    .sidebar-toggle { display: grid; }
    .page { padding: 12px 12px 0; }
    .topbar { padding: 8px 12px; }
    .alert { margin: 0 12px; }
    .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2, .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .clock { display: none; }
}

@media (max-width: 560px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .board { grid-template-columns: minmax(0, 1fr); }
    .topbar h1 { font-size: var(--fs-md); }
}

@media print {
    .sidebar, .topbar, .btn-row, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .card { border-color: #ddd; box-shadow: none; }
}
