/* ============================================================
   GradingSystem — premium design system
   Same indigo SaaS language as SchoolERP / TradeERP so the three
   products feel like one family.
   ============================================================ */

:root {
    --primary: #5b5fef;
    --primary-dark: #4a3fe0;
    --primary-light: #ececfd;
    --primary-soft: #f3f3ff;

    --sidebar-bg: #0d1437;
    --sidebar-bg-2: #0a1030;
    --sidebar-active: #5b5fef;
    --sidebar-text: #a3aed0;

    --bg: #f4f7fe;
    --card: #ffffff;
    --border: #e6edf5;
    --border-soft: #eef2f9;

    --text: #1b2559;
    --text-muted: #8f9bba;

    --green: #05cd99;
    --green-soft: #e6faf5;
    --red: #ee5d50;
    --red-soft: #fdeceb;
    --amber: #ffb547;
    --amber-soft: #fff6e6;
    --blue: #4318ff;
    --blue-soft: #ece9ff;
    --teal: #2bc4c4;
    --teal-soft: #e3f8f8;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 18px 40px rgba(112, 144, 176, 0.12);
    --shadow-sm: 0 6px 18px rgba(112, 144, 176, 0.10);
    --sidebar-w: 258px;
    --topbar-h: 78px;

    --surface-2: #fbfcfe;
    --track: #eef1f6;
    --font: 'Cairo', 'Segoe UI', 'Inter', 'Tahoma', system-ui, -apple-system, sans-serif;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0b1020;
    --card: #141b2e;
    --surface-2: #0f1626;
    --border: #28324c;
    --border-soft: #1e2740;

    --text: #e6e9f5;
    --text-muted: #8b94b4;

    --track: #26304a;
    --primary-light: #29234f;
    --primary-soft: #1d2442;
    --green-soft: #103226;
    --red-soft: #3a1a18;
    --amber-soft: #3a2e12;
    --blue-soft: #181d3e;
    --teal-soft: #0e3232;

    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font);
    background: var(--bg); color: var(--text);
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 700; }
p { margin: 0; }

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

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
    position: fixed; inset-inline-start: 0; top: 0; bottom: 0;
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .25s ease;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 18px; }
.sidebar__logo {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, #ffd86b, #f7b733);
    display: grid; place-items: center; color: #0d1437; font-weight: 800; font-size: 16px;
    box-shadow: 0 6px 16px rgba(247, 183, 51, .35);
}
.sidebar__title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar__subtitle { color: var(--sidebar-text); font-size: 11px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 14px 20px; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; }

.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 14px; margin: 3px 0; border-radius: 12px;
    color: var(--sidebar-text); font-weight: 500; font-size: 13.5px;
    cursor: pointer; transition: all .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 8px 18px rgba(91,95,239,.45); }
.nav-item .nav-icon { width: 20px; height: 20px; flex: none; opacity: .9; display: inline-flex; }

.nav-section__label {
    padding: 15px 14px 6px; margin-top: 2px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--sidebar-text); opacity: .5; white-space: nowrap;
}
[dir="rtl"] .nav-section__label { letter-spacing: normal; text-transform: none; }

.sidebar__footer { padding: 14px 18px 22px; }
.help-card {
    background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px 14px;
    color: #cfd6ea; font-size: 12px; line-height: 1.6;
}
.help-card b { color: #fff; display: block; font-size: 12.5px; margin-bottom: 2px; }

.nav-backdrop { position: fixed; inset: 0; background: rgba(11,16,32,.45); z-index: 35; }

/* ---------- Main ---------- */
.main { flex: 1; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h); background: var(--bg);
    display: flex; align-items: center; gap: 14px; padding: 0 30px;
    position: sticky; top: 0; z-index: 30;
}
.topbar__spacer { flex: 1; }
.nav-burger { display: none; }

.year-pill { background: var(--card); border-radius: 16px; padding: 8px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; line-height: 1.1; }
.year-pill small { color: var(--text-muted); font-size: 10px; }
.year-pill b { font-size: 13px; }

.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow-sm); color: var(--text-muted); position: relative; cursor: pointer; border: 0; }
.icon-btn:hover { color: var(--primary); }

.global-search { position: relative; width: min(420px, 34vw); }
.global-search__input { width: 100%; border: 0; border-radius: 30px; padding: 12px 20px; background: var(--card); box-shadow: var(--shadow-sm); font: inherit; font-size: 13px; color: var(--text); outline: none; }
.global-search__input::placeholder { color: var(--text-muted); }
.global-search__input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent), var(--shadow-sm); }
.global-search__panel { position: absolute; top: calc(100% + 8px); inset-inline-start: 0; width: min(460px, 80vw); max-height: 430px; overflow-y: auto; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg, 0 18px 40px rgba(27,37,89,.16)); border: 1px solid var(--border); z-index: 60; padding: 6px; }
.gs-cat { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); padding: 8px 12px 4px; }
.gs-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: start; border: 0; background: transparent; border-radius: 9px; padding: 8px 12px; cursor: pointer; font: inherit; }
.gs-item:hover, .gs-item.active { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.gs-item .gs-title { font-size: 13px; font-weight: 700; color: var(--text); }
.gs-item .gs-sub { font-size: 11.5px; color: var(--text-muted); }
.gs-empty { padding: 14px; font-size: 12.5px; color: var(--text-muted); text-align: center; }
@media (max-width: 760px) { .global-search { display: none; } }

/* Blazor's FocusOnNavigate lands focus on each page's first h1 — keep the focus
   for screen readers, never draw a rectangle around a plain heading. */
h1:focus, h1:focus-visible { outline: none; }

/* ---------- screen-guide tour ---------- */
.gstour-btn { position: fixed; bottom: 20px; inset-inline-end: 20px; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
    background: linear-gradient(135deg, #5b5fef, #8a5cf6); color: #fff; font: 800 20px Cairo, Inter, sans-serif;
    box-shadow: 0 10px 24px rgba(67, 24, 255, .4); z-index: 60; transition: transform .15s; }
.gstour-btn:hover { transform: scale(1.08); }
.gstour-spot { position: fixed; z-index: 998; pointer-events: none; border-radius: 14px; opacity: 0;
    box-shadow: 0 0 0 9999px rgba(10, 15, 34, .58), 0 0 0 3px #5b5fef, 0 0 24px rgba(91, 95, 239, .55);
    transition: top .45s cubic-bezier(.4,0,.2,1), left .45s cubic-bezier(.4,0,.2,1), width .45s cubic-bezier(.4,0,.2,1), height .45s cubic-bezier(.4,0,.2,1), opacity .3s; }
.gstour-bubble { position: fixed; z-index: 999; background: var(--card, #fff); color: var(--text, #1b2559); border-radius: 14px; padding: 16px 18px 12px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, .35); opacity: 0; transition: top .45s cubic-bezier(.4,0,.2,1), left .45s cubic-bezier(.4,0,.2,1), opacity .3s; }
.gstour-bubble b { display: block; font-size: 14.5px; margin-bottom: 6px; }
.gstour-bubble p { margin: 0 0 12px; font-size: 13px; line-height: 1.7; color: var(--text-muted, #62719c); }
.gstour-nav { display: flex; align-items: center; gap: 6px; }
.gstour-nav span { font: 700 11.5px Inter, Cairo, sans-serif; color: var(--text-muted, #8f9bba); margin-inline-end: auto; }
.gstour-nav button { border: 1px solid var(--border, #e2e7f5); background: transparent; color: inherit; border-radius: 8px; min-width: 34px; height: 30px; cursor: pointer; font-size: 15px; }
.gstour-nav button.pri { background: #5b5fef; border-color: #5b5fef; color: #fff; }
.gstour-nav button:disabled { opacity: .35; cursor: default; }

.lang-flags { display: flex; align-items: center; gap: 5px; background: var(--card); border-radius: 30px; padding: 6px 9px; box-shadow: var(--shadow-sm); }
.flag-btn { display: grid; place-items: center; padding: 3px 4px; border-radius: 7px; border: 2px solid transparent; background: transparent; cursor: pointer; opacity: .45; filter: saturate(.7); transition: opacity .15s, filter .15s, border-color .15s; }
.flag-btn svg { display: block; border-radius: 2px; }
.flag-btn:hover { opacity: .85; filter: saturate(1); }
.flag-btn.active { opacity: 1; filter: saturate(1); border-color: var(--primary); }

.user-chip { display: flex; align-items: center; gap: 11px; background: var(--card); border-radius: 30px; padding: 7px 16px 7px 7px; box-shadow: var(--shadow-sm); border: 0; font-family: inherit; }
.user-chip .u-name { font-weight: 700; font-size: 13px; color: var(--text); }
.user-chip .u-role { color: var(--text-muted); font-size: 11px; }
.user-chip .u-text { text-align: start; line-height: 1.25; }
.avatar-initials { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 13px; flex: none; background: linear-gradient(135deg, #5b5fef, #8a5cf6); }

.content { padding: 8px 30px 40px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin: 10px 0 22px; flex-wrap: wrap; gap: 14px; }
.page-title { font-size: 26px; font-weight: 800; }
.page-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; max-width: 720px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 17px; font-weight: 700; }
.card-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.stat__icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.stat__label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.stat__value { font-size: 24px; font-weight: 800; margin-top: 2px; }

.bg-indigo { background: var(--primary-light); color: var(--primary); }
.bg-green { background: var(--green-soft); color: var(--green); }
.bg-red { background: var(--red-soft); color: var(--red); }
.bg-amber { background: var(--amber-soft); color: #f7991c; }
.bg-blue { background: var(--blue-soft); color: var(--blue); }
.bg-teal { background: var(--teal-soft); color: var(--teal); }

/* ---------- Quick-action tiles (the TradeERP launch keypad) ---------- */
.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; margin-bottom: 22px; }
.qa-tile {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px;
    padding: 20px 12px 16px; border-radius: 18px; color: #fff !important;
    box-shadow: 0 14px 28px -14px rgba(15, 33, 54, .5);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
    position: relative; overflow: hidden;
}
/* diagonal gloss sheen */
.qa-tile::after {
    content: ""; position: absolute; inset-block-start: -55%; inset-inline-start: -20%;
    inline-size: 70%; block-size: 160%; background: rgb(255 255 255 / .12);
    transform: rotate(22deg); pointer-events: none;
}
.qa-tile:hover { transform: translateY(-3px); box-shadow: 0 20px 36px -14px rgba(15, 33, 54, .55); filter: saturate(1.08); }
.qa-tile__ic { width: 48px; height: 48px; border-radius: 14px; background: rgb(255 255 255 / .22); display: grid; place-items: center; }
.qa-tile__t { font-weight: 800; font-size: 13.5px; line-height: 1.2; }
.qa-tile__s { font-size: 11px; opacity: .88; }

.qa--indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }
.qa--violet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.qa--teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.qa--green  { background: linear-gradient(135deg, #10b981, #047857); }
.qa--amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.qa--blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }

/* Marks, totals and hashes stay LTR + tabular even on an RTL page. */
.t-num { font-family: 'Inter', 'Segoe UI', ui-monospace, monospace; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
td.t-num, th.t-num { direction: inherit; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 30px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: #f7991c; }
.badge-indigo { background: var(--primary-light); color: var(--primary); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-grey { background: var(--track); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13px; padding: 11px 18px; border-radius: 12px; transition: all .15s ease; }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91,95,239,.35); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 8px 18px rgba(5,205,153,.32); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 8px 18px rgba(238,93,80,.30); }
.btn-light { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-light:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-light); }
.btn-sm { padding: 8px 13px; font-size: 12.5px; border-radius: 10px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 9px; background: var(--surface-2); color: var(--text-muted); }
.btn-icon:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }

/* ---------- Filter / toolbar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.input, .select { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-family: inherit; color: var(--text); outline: 0; box-shadow: var(--shadow-sm); }
.input:focus, .select:focus { border-color: var(--primary); }
.input-search { flex: 1; min-width: 220px; max-width: 420px; }

/* ---------- Tables ---------- */
.table-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table thead th { text-align: start; padding: 15px 20px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); white-space: nowrap; }
[dir="rtl"] .table thead th { letter-spacing: normal; text-transform: none; }
.table tbody td { padding: 14px 20px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.t-main { font-weight: 700; }
.t-sub { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Empty / states ---------- */
.empty { padding: 46px 22px; text-align: center; color: var(--text-muted); }
.empty svg { opacity: .45; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

.alert { display: flex; gap: 12px; align-items: flex-start; border-radius: 16px; padding: 14px 18px; font-size: 13px; margin-bottom: 18px; }
.alert svg { flex: none; margin-top: 1px; }
.alert-ok { background: var(--green-soft); color: #04a97e; }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warn { background: var(--amber-soft); color: #b57314; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert ul { margin: 6px 0 0; padding-inline-start: 18px; }

.progress-line { height: 3px; background: var(--track); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.progress-line span { display: block; height: 100%; width: 35%; background: var(--primary); border-radius: 3px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { margin-inline-start: -35%; } 100% { margin-inline-start: 100%; } }

/* ---------- Scheme designer tree ---------- */
.tree-row { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 12px; flex-wrap: wrap; }
.tree-row:hover { background: var(--surface-2); }
.tree-row + .tree-row { margin-top: 2px; }
.tree-name { font-weight: 700; font-size: 13.5px; }
.tree-code { color: var(--text-muted); font-size: 11.5px; font-family: 'Inter', monospace; }
.tree-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.tree-actions { margin-inline-start: auto; display: flex; gap: 6px; opacity: 0; transition: opacity .15s ease; }
.tree-row:hover .tree-actions { opacity: 1; }

/* ---------- Marks entry grid ---------- */
.entry-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.entry-grid th, .entry-grid td { border-bottom: 1px solid var(--border-soft); border-inline-end: 1px solid var(--border-soft); padding: 8px 10px; text-align: center; font-size: 12.5px; }
.entry-grid thead th { background: var(--surface-2); color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.entry-grid thead tr:nth-child(2) th { cursor: pointer; }
.entry-grid thead tr:nth-child(2) th:hover { color: var(--primary); }
[dir="rtl"] .entry-grid thead th { letter-spacing: normal; text-transform: none; }
.entry-grid .group-head { color: var(--primary); background: var(--primary-soft); }
.entry-grid .sticky-col { position: sticky; inset-inline-start: 0; background: var(--card); text-align: start; min-width: 190px; z-index: 2; }
.entry-grid thead .sticky-col { background: var(--surface-2); z-index: 3; }
.entry-grid tbody tr:hover td { background: var(--surface-2); }
.entry-grid tbody tr:hover .sticky-col { background: var(--surface-2); }
.leaf-max { color: var(--text-muted); font-size: 10.5px; font-weight: 600; }
.cell-input { width: 62px; padding: 6px 4px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); text-align: center; font-family: inherit; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.cell-input:hover:not(:disabled) { border-color: var(--border); }
.cell-input:focus { outline: 0; border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px rgba(91,95,239,.15); }
.cell-input:disabled { background: transparent; color: var(--text-muted); }
.result-cell { background: var(--primary-soft); font-weight: 800; font-variant-numeric: tabular-nums; }
.result-head { background: var(--primary-light) !important; color: var(--primary) !important; }

/* ---- entry grid, pro pass: sticky headers, live fill states, row status ---- */
.entry-scroll { max-height: calc(100vh - 290px); overflow: auto; }
.entry-grid thead tr:first-child th { position: sticky; top: 0; z-index: 4; height: 33px; }
.entry-grid thead tr:nth-child(2) th { position: sticky; top: 33px; z-index: 3; background: var(--surface-2); }
.entry-grid thead .sticky-col { z-index: 5; }
.cell-miss .cell-input:not(:focus) { background: rgba(245, 166, 35, .10); border-color: rgba(245, 166, 35, .28); }
.entry-grid tbody tr:focus-within td { background: var(--primary-soft); }
.entry-grid tbody tr:focus-within .sticky-col { background: var(--primary-soft); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-chip { min-width: 20px; height: 20px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800; padding: 0 5px; flex: none; }
.row-chip--ok { background: rgba(34, 177, 124, .16); color: #1d9e6e; }
.row-chip--todo { background: rgba(245, 166, 35, .18); color: #c07b00; }
.result-dim { opacity: .45; }
.fillbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fillbar-track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); overflow: hidden; }
.fillbar-track > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #8a5cf6); transition: width .35s ease; }
.fillbar-label { font-size: 11.5px; font-weight: 800; color: var(--text-muted); min-width: 34px; text-align: end; }

/* ---------- Auth pages ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 15% 10%, #2a2f7a 0%, #0d1437 55%, #080c22 100%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 38px 34px; box-shadow: 0 30px 70px rgba(0,0,0,.35); }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, #5b5fef, #8a5cf6); display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; box-shadow: 0 10px 24px rgba(91,95,239,.4); margin-bottom: 14px; }
.auth-brand h1 { font-size: 21px; color: #1b2559; margin-bottom: 4px; }
.auth-brand p { font-size: 12.5px; color: #8f9bba; }
.auth-card form { display: flex; flex-direction: column; }
.auth-card label { font-size: 12.5px; color: #4a5578; font-weight: 600; margin: 14px 0 6px; }
.auth-card input[type="text"], .auth-card input[type="password"] {
    padding: 12px 14px; border: 1px solid #e6edf5; border-radius: 12px; font-size: 14px;
    font-family: inherit; background: #fbfcfe; color: #1b2559; outline: 0;
}
.auth-card input[type="text"]:focus, .auth-card input[type="password"]:focus { border-color: #5b5fef; box-shadow: 0 0 0 3px rgba(91,95,239,.15); background: #fff; }
.auth-remember { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 12.5px; color: #4a5578; font-weight: 500; }
.auth-card button[type="submit"] { margin-top: 22px; padding: 13px; background: #5b5fef; color: #fff; font-size: 14.5px; font-weight: 700; font-family: inherit; border: 0; border-radius: 12px; cursor: pointer; box-shadow: 0 10px 24px rgba(91,95,239,.35); }
.auth-card button[type="submit"]:hover { background: #4a3fe0; }
.auth-error { background: #fdeceb; color: #d43f32; border-radius: 12px; padding: 11px 14px; font-size: 12.5px; font-weight: 600; }

/* ---------- Utilities ---------- */
.muted { color: var(--text-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-6 { gap: 6px; }
.gap-10 { gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt-10 { margin-top: 10px; }
.mt-18 { margin-top: 18px; }
.mono { font-family: 'Inter', ui-monospace, monospace; font-size: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .app-shell.nav-open .sidebar { transform: none; }
    .main { margin-inline-start: 0; }
    .nav-burger { display: grid; }
    .content, .topbar { padding-inline: 16px; }
}

#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ============================================================= setup path + wizard */
.path-strip { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.path-step { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); cursor: pointer; font-family: inherit; color: var(--text); text-align: start; }
.path-step:hover { border-color: var(--primary); }
.path-step.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.path-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: var(--surface-2); color: var(--text-muted); flex: none; }
.path-step.done .path-num { background: #16a34a; color: #fff; }
.path-step.active .path-num { background: var(--primary); color: #fff; }
.path-label { font-size: 12.5px; font-weight: 800; line-height: 1.25; }
.path-sub { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.path-arrow { align-self: center; color: var(--text-muted); font-weight: 800; }

.tab-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-pill { padding: 8px 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.tab-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.form-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.field .input, .field .select { width: 100%; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }

.term-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 10px; align-items: end; flex: 1; }
.terms-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.term-panel { display: flex; align-items: end; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface-2); margin-top: 10px; }
.term-num { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-light); color: var(--primary); font-weight: 800; font-size: 12.5px; display: grid; place-items: center; flex: none; align-self: center; }
.term-side { display: flex; align-items: center; gap: 8px; flex: none; align-self: center; }
@media (max-width: 860px) { .term-panel { flex-wrap: wrap; } .term-row { grid-template-columns: 1fr 1fr; } }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tpl-card { text-align: start; background: var(--card); border: 2px solid var(--border); border-radius: 18px; padding: 18px; cursor: pointer; font-family: inherit; color: var(--text); box-shadow: var(--shadow-sm); }
.tpl-card:hover { border-color: var(--primary); }
.tpl-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.tpl-title { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.tpl-desc { font-size: 12px; color: var(--text-muted); line-height: 1.55; }
.tpl-tree { margin-top: 10px; font-size: 11.5px; color: var(--text-muted); font-family: Consolas, monospace; white-space: pre-line; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.review-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 26px; font-size: 13.5px; margin: 0; }
.review-list dt { font-weight: 700; color: var(--text-muted); }
.review-list dd { margin: 0; font-weight: 800; }

/* drag & drop in the designer tree */
.tree-row[draggable=true] { cursor: grab; }
.tree-row.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 7%, transparent); }
.drag-grip { color: var(--text-muted); opacity: .55; flex: none; display: inline-flex; }

/* build-path checklist (dashboard) */
.build-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.build-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--text); background: var(--card); }
.build-step:hover { border-color: var(--primary); }
.build-step.done .path-num { background: #16a34a; color: #fff; }
.build-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.build-body b { font-size: 13px; font-weight: 800; }
.build-body span { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.build-go { color: var(--text-muted); font-weight: 800; }

/* removable chip button inside a badge */
.chip-x { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; cursor: pointer; margin-inline-start: 6px; opacity: .7; padding: 0; }
.chip-x:hover { opacity: 1; }
