/* VisualWeb shell — RTL/LTR aware via CSS logical properties.
   No external framework: full control over direction and theme. */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --sidebar: #16234d;        /* navy / كحلي */
    --sidebar-soft: #22336a;
    --sidebar-text: #ccd6ec;
    --sidebar-active: #4a6ab3; /* selection / active highlight (steel-blue) */
    --border: #e6e9f2;
    --text: #1d2433;
    --muted: #6b7488;
    --primary: #2f6bff;
    --primary-dark: #2253d6;
    --danger: #e0413c;
    --radius: 12px;
    --sidebar-w: 256px;
    --topbar-h: 60px;
    --font: "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ---------- App layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: margin .25s ease;
}

/* Desktop: collapse the sidebar off-canvas when toggled. */
body.nav-collapsed .sidebar { margin-inline-start: calc(-1 * var(--sidebar-w)); }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: var(--sidebar-text); font-size: 11px; opacity: .8; }

.nav { padding: 12px 10px; }
.nav-group { margin-bottom: 14px; }
.nav-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #7e8bb5;
    padding: 8px 12px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 14px;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-soft); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .ico { width: 20px; height: 20px; flex: 0 0 20px; }

/* Expandable parent ("Invoices" -> books from tblPropInvoice) */
.nav-parent { margin-bottom: 2px; }
.nav-toggle {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    text-align: inherit;
}
.nav-toggle .chev {
    width: 16px; height: 16px;
    margin-inline-start: auto;
    transition: transform .2s ease;
}
[dir="rtl"] .nav-toggle .chev { transform: scaleX(-1); }
.nav-parent.open > .nav-toggle .chev { transform: rotate(90deg); }
[dir="rtl"] .nav-parent.open > .nav-toggle .chev { transform: scaleX(-1) rotate(90deg); }

/* Tree accordion. Each .nav-children shows ONLY when its OWN parent is open (direct-child
   selector ">", so opening a module does not reveal a closed sub-group's leaves), and indents
   one step with a guide line — so it cascades to any depth and children read as "inside" parents. */
.nav-children {
    display: none;
    padding: 2px 0 4px;
    padding-inline-start: 14px;
    margin-inline-start: 9px;
    border-inline-start: 1px solid rgba(255,255,255,.10);
}
.nav-parent.open > .nav-children { display: block; }
.nav-l1 { margin-bottom: 4px; }
.nav-l1 > .nav-toggle { font-weight: 600; }
.nav-leaf { border-inline-start-color: rgba(255,255,255,.05); }

.nav-subtitle {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b78a6;
    padding: 8px 12px 4px;
}
.nav-child {
    display: block;
    padding: 8px 12px;
    margin-bottom: 1px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 13px;
    border-inline-start: 2px solid rgba(255,255,255,.08);
}
.nav-child:hover { background: var(--sidebar-soft); color: #fff; }
.nav-child.active { background: var(--sidebar-active); color: #fff; border-inline-start-color: var(--sidebar-active); }

/* ---------- Data grid (master lists) ---------- */
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid thead th {
    position: sticky; top: 0;
    background: #f4f6fb;
    text-align: start;
    font-weight: 600;
    color: var(--text);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.grid tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.grid tbody tr:hover { background: #f4f6fb; }
.grid .num { text-align: end; font-variant-numeric: tabular-nums; }
.grid .empty { text-align: center; color: var(--muted); padding: 18px; }

/* ---------- Main column ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-title { font-weight: 600; font-size: 16px; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: #d2d7e6; }
.icon-btn svg { width: 20px; height: 20px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--muted);
    font-size: 13px;
}
.pill:hover { color: var(--text); border-color: #d2d7e6; }
.pill svg { width: 17px; height: 17px; }
/* connection info pill in the top bar (server/database from login) */
.conn-pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: 18px; color: var(--muted); font-size: 12px;
    max-width: 260px; overflow: hidden; }
.conn-pill svg { width: 15px; height: 15px; flex: 0 0 auto; }
.conn-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* subscription pills: expiring soon (≤30 days) / expired */
.conn-pill.pill-warn { color: #b45309; border-color: #f59e0b; background: #fef3c7; }
.conn-pill.pill-danger { color: #b91c1c; border-color: #ef4444; background: #fee2e2; }
/* the working-branch selector pill (desktop cmbBranch in the top bar) */
.conn-pill.pill-branch select { border: 0; background: transparent; color: inherit; font-size: 12px;
    max-width: 160px; cursor: pointer; outline: none; }
.conn-pill.pill-branch select:disabled { cursor: default; appearance: none; -webkit-appearance: none; }
/* the directed-movements indicator (desktop VisualTasksBackground icons) */
.conn-pill.pill-tasks { position: relative; cursor: pointer; overflow: visible; }
.conn-pill.pill-tasks.has-tasks { color: #b45309; border-color: #f59e0b; background: #fef3c7; font-weight: 700; }
.conn-pill.pill-tasks .tasks-drop { display: none; position: absolute; top: calc(100% + 6px); inset-inline-end: 0;
    min-width: 280px; max-width: 420px; max-height: 340px; overflow: auto; background: #fff;
    border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.18);
    padding: 6px; z-index: 60; text-align: start; }
.conn-pill.pill-tasks .tasks-drop.open { display: block; }
.conn-pill.pill-tasks .tasks-drop a { display: block; padding: 7px 10px; border-radius: 7px; color: #1f2a44;
    font-size: 12.5px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-pill.pill-tasks .tasks-drop a:hover { background: #eef2f9; }
.conn-pill.pill-tasks .tasks-empty { padding: 10px; color: var(--muted); font-size: 12.5px; }
.conn-pill.pill-tasks .tasks-drop .urow { padding: 7px 10px; border-radius: 7px; color: #1f2a44;
    font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-pill.pill-tasks .tasks-drop .urow .urow-ago { color: var(--muted); font-size: 11.5px; flex: none; }

.user { display: flex; align-items: center; gap: 9px; }
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 500; }
.logout-form { margin: 0; }

.content { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Tabbed workspace (desktop AddTabItem analogue) ---------- */
.tabbar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 10px 0;
    background: var(--surface-2, #eef1f8);
    border-bottom: 1px solid var(--border);
}
.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 9px 9px 0 0;
    background: #f4f6fb;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    max-width: 240px;
}
.tab .tab-label { overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; }
.tab-close {
    border: none; background: transparent; cursor: pointer;
    font-size: 16px; line-height: 1; color: var(--muted); padding: 0 2px; border-radius: 4px;
}
.tab-close:hover { color: #e03131; background: rgba(224,49,49,.1); }
.tabpanels { flex: 1 1 auto; overflow: hidden; padding: 0; min-height: 0; position: relative; }
.tabpanel { display: none; height: 100%; }
.tabpanel.active { display: block; }
.tab-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.tab-loading { text-align: center; color: var(--muted); padding: 48px; font-size: 22px; }

/* "Please wait" overlay shown over the screen area while a menu window opens (see tabs.js). */
.scr-loader {
    position: absolute; inset: 0; z-index: 50;
    display: none; align-items: center; justify-content: center;
    background: rgba(244,246,251,.72);
}
.scr-loader.show { display: flex; }
.scr-loader-box {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    padding: 26px 34px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(15,27,61,.15);
}
.scr-loader-spin {
    width: 40px; height: 40px; border-radius: 50%;
    border: 4px solid var(--border); border-top-color: var(--primary);
    animation: scr-spin .8s linear infinite;
}
.scr-loader-text { font-size: 15px; font-weight: 600; color: var(--text); }
@keyframes scr-spin { to { transform: rotate(360deg); } }

/* ---------- Dashboard ---------- */
.page-head h1 { margin: 0 0 6px; font-size: 22px; }
.page-head p { margin: 0 0 22px; color: var(--muted); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.card-title { font-weight: 600; font-size: 16px; margin-bottom: 10px; }
.card-soon {
    display: inline-block;
    font-size: 12px;
    color: var(--muted);
    background: var(--bg);
    border-radius: 20px;
    padding: 3px 10px;
}
.note {
    background: #eef3ff;
    border: 1px solid #d7e2ff;
    color: #29407a;
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Document form (invoice / transfer / order) ---------- */
.doc-header {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}
.doc-header .field-wide { grid-column: 1 / -1; }

.doc-posting {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.doc-posting summary { cursor: pointer; font-weight: 600; color: var(--text); }
.doc-posting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.doc-items {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.doc-items-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.doc-items-bar .spacer { flex: 1; }
#flexGrid { height: 340px; }

.btn-ghost {
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }

.doc-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.totals {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
}
.totals > div { display: flex; flex-direction: column; gap: 4px; }
.totals span { font-size: 12px; color: var(--muted); }
.totals b { font-size: 17px; }
.totals .net b { color: var(--primary); }

/* ---------- Login (promotional two-panel) ---------- */
.auth { min-height: 100vh; background: var(--bg); }
.auth-lang { position: fixed; top: 18px; inset-inline-end: 22px; z-index: 5; }
/* inline language switch inside the login card (next to the username/password) */
.auth-lang-inline { display: flex; justify-content: center; margin: 2px 0 14px; }

/* ---- language switcher (segmented: both languages, active highlighted) ---- */
.lang-switch {
    display: inline-flex; align-items: stretch;
    border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
    background: #fff;
}
.lang-opt {
    padding: 5px 13px; font-size: 12.5px; font-weight: 600; color: var(--muted);
    line-height: 1.5; transition: background .15s, color .15s; cursor: pointer;
}
.lang-opt + .lang-opt { border-inline-start: 1px solid var(--border); }
.lang-opt:hover { background: #f2f5fa; color: var(--text); }
.lang-opt.on, .lang-opt.on:hover { background: var(--primary); color: #fff; }

/* over the dark login hero: solid high-contrast variant (user request: white pill, black
   labels, the ACTIVE language on a blue background) */
.auth-lang .lang-switch { border-color: #fff; background: #fff; }
.auth-lang .lang-opt { color: #000; }
.auth-lang .lang-opt + .lang-opt { border-inline-start-color: var(--border); }
.auth-lang .lang-opt:hover { background: #e8eefc; color: #000; }
.auth-lang .lang-opt.on, .auth-lang .lang-opt.on:hover { background: var(--primary); color: #000; font-weight: 700; }

.auth-split { display: grid; grid-template-columns: 1.15fr .85fr; min-height: 100vh; }

/* ---- promo hero ---- */
.auth-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    background:
        radial-gradient(1100px 520px at 120% -10%, rgba(74,106,179,.45), transparent 60%),
        radial-gradient(760px 480px at -10% 120%, rgba(40,70,140,.30), transparent 55%),
        linear-gradient(135deg, #0a142e 0%, #16234d 55%, #22336a 100%);
}
.auth-hero > * { position: relative; z-index: 1; }
.hero-glow {
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        radial-gradient(circle at 18% 30%, rgba(255,255,255,.06) 0, transparent 22%),
        radial-gradient(circle at 82% 72%, rgba(255,255,255,.05) 0, transparent 24%);
}

.hero-top { display: flex; align-items: center; gap: 16px; }
.hero-logo {
    height: 68px; width: auto; flex: 0 0 auto;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,.35));
}
/* faint oversized logo as a background watermark */
.hero-watermark {
    position: absolute; z-index: 0; pointer-events: none;
    inset-inline-end: -70px; bottom: -80px;
    width: 440px; height: auto; opacity: .07;
}
.hero-name strong { display: block; font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.hero-name small { color: rgba(255,255,255,.72); font-size: 12.5px; letter-spacing: 2px; text-transform: uppercase; }

.hero-body { max-width: 560px; }
.hero-tagline { margin: 0 0 12px; font-size: clamp(26px, 3vw, 38px); line-height: 1.18; font-weight: 800; }
.hero-sub { margin: 0 0 30px; color: rgba(255,255,255,.82); font-size: 15.5px; line-height: 1.7; max-width: 520px; }

.hero-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.hero-features li {
    display: flex; align-items: flex-start; gap: 14px;
    animation: heroUp .5s ease both; animation-delay: calc(var(--i) * .08s);
}
.hf-ic {
    flex: 0 0 42px; width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.16);
    color: #cfe0ff;
}
.hf-ic svg { width: 22px; height: 22px; }
.hero-features b { display: block; font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.hero-features span { color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.55; }

.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.hero-chips span {
    font-size: 12px; font-weight: 600;
    padding: 6px 12px; border-radius: 20px;
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.18);
    color: rgba(255,255,255,.9);
}
.hero-foot { color: rgba(255,255,255,.55); font-size: 12.5px; }

@keyframes heroUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- login panel ---- */
.auth-panel { display: grid; place-items: center; padding: 32px 24px; }
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 34px;
    box-shadow: 0 24px 60px rgba(8, 18, 50, .10);
    animation: heroUp .45s ease both;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo { height: 44px; width: auto; flex: 0 0 auto; }
.auth-brand strong { display: block; font-size: 16px; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-title { margin: 0 0 4px; font-size: 22px; }
.auth-lead { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* the panel stacks the login card + the separate connection-settings card */
.auth-stack { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth-stack .auth-card { max-width: none; animation: none; }

/* ---- connection settings: its own collapsible card ---- */
.auth-settings { padding: 0; overflow: hidden; }
.auth-settings > .settings-head {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 20px; font-size: 14px; font-weight: 600; color: var(--text);
    transition: background .15s;
}
.auth-settings > .settings-head::-webkit-details-marker { display: none; }
.auth-settings > .settings-head:hover { background: #f7f9fd; }
.settings-title { display: inline-flex; align-items: center; gap: 9px; }
.settings-ic { width: 18px; height: 18px; color: var(--primary); }
.settings-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s ease; }
.auth-settings[open] > .settings-head .settings-chev { transform: rotate(180deg); }
.settings-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); }
.field-row { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }
.field-narrow .input { text-align: center; }

/* login CAPTCHA (shown after repeated failed attempts) */
.captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.captcha-row img { height: 48px; border: 1px solid var(--border); border-radius: 10px; background: #f5f7fa; }
.captcha-refresh { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border);
    border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.captcha-refresh:hover { color: var(--primary); border-color: var(--primary); }
.captcha-refresh svg { width: 17px; height: 17px; }

/* stack to a single column on smaller screens: hero on top, then the card */
@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-hero { padding: 34px 28px; gap: 22px; }
    .hero-features li:nth-child(n+3) { display: none; }
    .auth-panel { padding: 26px 18px 40px; }
}
@media (max-width: 560px) {
    .auth-hero { display: none; }
    /* hero (dark bg) is gone — same high-contrast colors, just a visible border on the light page */
    .auth-lang .lang-switch { background: #fff; border-color: var(--border); }
    .auth-lang .lang-opt { color: #000; }
    .auth-lang .lang-opt + .lang-opt { border-inline-start-color: var(--border); }
    .auth-lang .lang-opt:hover { background: #e8eefc; color: #000; }
    .auth-lang .lang-opt.on, .auth-lang .lang-opt.on:hover { background: var(--primary); color: #000; font-weight: 700; }
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 500; color: var(--text); }
.input {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }

.advanced summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    padding: 4px 0;
}
.advanced[open] { display: flex; flex-direction: column; gap: 14px; }

/* ---- Per-user toolbar (desktop UserToolBarGrid over tblItemsIcon): a button strip
   under the topbar; each button opens its screen as a tab. ---- */
.user-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex: 0 0 auto;
}
.user-toolbar .tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: border-color .15s, color .15s, background .15s;
}
.user-toolbar .tb-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef3ff;
}
.user-toolbar .tb-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.advanced summary:hover { color: var(--text); }

.btn-primary {
    height: 46px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }

.alert {
    background: #fdecec;
    border: 1px solid #f6c9c7;
    color: var(--danger);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    margin-bottom: 18px;
}

/* ---------- Responsive ---------- */
.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 18, 50, .45);
    z-index: 30;
}

@@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        z-index: 40;
        inset-block: 0;
        inset-inline-start: 0;
        margin-inline-start: calc(-1 * var(--sidebar-w));
        box-shadow: 0 0 40px rgba(0,0,0,.3);
    }
    body.nav-open .sidebar { margin-inline-start: 0; }
    body.nav-open .backdrop { display: block; }
    .user-name { display: none; }
}
