/* TKT staff portal. Colours come from the institute logo:
   purple #2E0068, orange #F35C00, navy text #1B1A5E. */

:root {
	--font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;

	--bg: #f4f3f9;
	--surface: #ffffff;
	--surface-2: #f8f7fc;
	--line: #e4e1ef;
	--line-strong: #d3cee6;
	--ink: #1b1a5e;
	--ink-2: #47447a;
	--muted: #75729a;

	--brand: #2e0068;
	--brand-hover: #3f1188;
	--brand-ink: #ffffff;
	--brand-soft: #efeafb;
	--accent: #f35c00;
	--accent-hover: #d94f00;
	--accent-soft: #fff0e6;

	--ok: #0e7a4a;    --ok-soft: #e4f5ec;
	--warn: #8a5a00;  --warn-soft: #fff3d6;
	--bad: #b42318;   --bad-soft: #fdecea;
	--info: #2c4fb0;  --info-soft: #e9effd;

	--sb-top: #2e0068;
	--sb-bottom: #1a0747;
	--sb-ink: rgba(255, 255, 255, .74);
	--sb-ink-strong: #ffffff;
	--sb-hover: rgba(255, 255, 255, .08);
	--sb-active: rgba(255, 255, 255, .13);

	--focus: 0 0 0 3px rgba(243, 92, 0, .35);
	--shadow: 0 1px 2px rgba(27, 26, 94, .06), 0 1px 1px rgba(27, 26, 94, .03);
	--radius: 10px;
	--radius-lg: 14px;
	color-scheme: light;
}

[data-theme="dark"] {
	--bg: #120a26;
	--surface: #1b1236;
	--surface-2: #211843;
	--line: #30275a;
	--line-strong: #41377a;
	--ink: #eeebfb;
	--ink-2: #c9c3e6;
	--muted: #9d96c4;

	--brand: #7552e0;
	--brand-hover: #8667ea;
	--brand-ink: #ffffff;
	--brand-soft: #2a1e55;
	--accent: #ff7a2e;
	--accent-hover: #ff8f4f;
	--accent-soft: #3a2316;

	--ok: #4cc38a;    --ok-soft: #123629;
	--warn: #f0b44c;  --warn-soft: #3a2d12;
	--bad: #f2897b;   --bad-soft: #3d1b1b;
	--info: #8fa9f6;  --info-soft: #1c2548;

	--sb-top: #170a37;
	--sb-bottom: #0d0621;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3);
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
[data-theme="dark"] a { color: #b9a6ff; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
img { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.ic { flex: none; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
[hidden] { display: none !important; }
[data-theme="light"] .when-dark, [data-theme="dark"] .when-light { display: none; }

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
	position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
	background: linear-gradient(180deg, var(--sb-top), var(--sb-bottom));
	color: var(--sb-ink); padding: 20px 14px 14px; overflow-y: auto;
	border-inline-end: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; color: var(--sb-ink-strong); text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.brand-mark { width: 48px; height: 48px; border-radius: 12px; background: #fff; display: grid; place-items: center; flex: none; }
.brand-mark img { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 14px; font-weight: 700; color: #fff; }
.brand-text small { font-size: 12px; color: #ffb27f; }

.nav { flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-title { margin: 0 10px 6px; font-size: 12px; color: rgba(255,255,255,.45); font-weight: 500; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--sb-ink); font-weight: 500; text-decoration: none !important; position: relative; }
.nav-link:hover { background: var(--sb-hover); color: var(--sb-ink-strong); }
.nav-link.is-active { background: var(--sb-active); color: var(--sb-ink-strong); }
.nav-link.is-active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-link span:first-of-type { flex: 1; }
.nav-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
[data-theme] .nav-link { color: var(--sb-ink); }
[data-theme] .nav-link.is-active, [data-theme] .nav-link:hover { color: #fff; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user .who { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.sidebar-user strong { color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: rgba(255,255,255,.55); font-size: 12px; }
.sidebar-user .icon-btn { color: rgba(255,255,255,.75); border-color: rgba(255,255,255,.15); background: transparent; }
.sidebar-user .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--sb-top); display: grid; place-items: center; font-weight: 700; flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
	position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
	min-height: 64px; padding: 10px 28px; background: color-mix(in srgb, var(--surface) 92%, transparent);
	backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.clock { display: flex; align-items: center; gap: 18px; color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.clock-item { display: inline-flex; align-items: center; gap: 6px; }
.clock-item + .clock-item { padding-inline-start: 18px; border-inline-start: 1px solid var(--line); }
.clock-time { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.top-search { flex: 1; max-width: 460px; margin-inline-start: auto; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.top-search:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
.top-search input[type=search] { flex: 1; height: 38px; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; min-width: 0; box-shadow: none; }
.top-actions { display: flex; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.nav-toggle, .sidebar-scrim { display: none; }

.content { padding: 28px; max-width: 1320px; width: 100%; outline: none; }

/* ------------------------------------------------------------------ */
/* Page parts                                                          */
/* ------------------------------------------------------------------ */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card + .card, .card + .section, .section + .card { margin-top: 20px; }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 17px; font-weight: 600; }
.card-title { font-size: 17px; font-weight: 600; margin: 8px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.card-title:first-of-type { border-top: 0; padding-top: 0; }
.form-card { padding: 22px; }
.section { margin-top: 24px; }
.section > h2 { font-size: 18px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.nowrap { white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn-primary { background: var(--brand); color: var(--brand-ink) !important; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-accent { background: var(--accent); color: #fff !important; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink) !important; border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-2) !important; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad-soft); color: var(--bad) !important; border-color: transparent; }
.btn-danger:hover { background: var(--bad); color: #fff !important; }
.btn-ok { background: var(--ok); color: #fff !important; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 52px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* Pills */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
[data-theme="dark"] .pill-brand { color: #c4b3ff; }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 500; }
.alert ul { margin: 0; padding-inline-start: 18px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-info { background: var(--info-soft); color: var(--info); }

/* Forms */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.field { margin-bottom: 16px; }
.field-wide { grid-column: 1 / -1; }
.field label, .field .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.req { color: var(--accent); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local], input[type=number], input[type=search], input[type=password], select, textarea {
	width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
	background: var(--surface); color: var(--ink); font: inherit; font-size: 15px;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[readonly] { background: var(--surface-2); }
.help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.help-warn { color: var(--warn); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.copy-row { display: flex; gap: 8px; }

/* Toolbar: search + filters above a table */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 240px; position: relative; }
.toolbar .search .ic { position: absolute; inset-inline-start: 12px; top: 12px; color: var(--muted); }
.toolbar .search input { padding-inline-start: 38px; }
.toolbar select { width: auto; min-width: 170px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2) !important; font-weight: 600; font-size: 14px; text-decoration: none !important; }
.tab .count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); font-size: 12px; display: grid; place-items: center; }
.tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff !important; }
.tab.is-active .count { background: rgba(255,255,255,.2); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: 13px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .actions { white-space: nowrap; text-align: end; }
.table .actions > * + * { margin-inline-start: 6px; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.row-late td { background: var(--bad-soft) !important; }
.total-row td { font-weight: 700; background: var(--surface-2); }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 14px; }

.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager .page-numbers { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; }
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.stat { padding: 18px 20px; border-inline-start: 1px solid var(--line); text-decoration: none !important; color: inherit !important; display: block; }
.stat:first-child { border-inline-start: 0; }
a.stat:hover { background: var(--surface-2); }
.stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.25; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value { white-space: nowrap; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--muted); }
.stat-alert .stat-value { color: var(--accent); }

/* Dashboard */
.welcome { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 26px 28px; margin-bottom: 24px; color: #fff; background: linear-gradient(120deg, #2e0068, #4a1c9c); }
[data-theme="dark"] .welcome { background: linear-gradient(120deg, #24104f, #3a1980); }
.welcome h1 { font-size: 24px; font-weight: 700; }
.welcome p { margin: 6px 0 0; color: rgba(255,255,255,.8); }
.welcome::after { content: ""; position: absolute; inset-inline-end: -90px; top: -150px; width: 300px; height: 300px; border-radius: 50%; border: 12px solid var(--accent); opacity: .85; pointer-events: none; }
.welcome > * { position: relative; z-index: 1; }
.welcome .btn { margin-top: 16px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
.dash-grid .card { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.date-chip { width: 52px; flex: none; text-align: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); padding: 4px 0; line-height: 1.2; }
[data-theme="dark"] .date-chip { color: #c4b3ff; }
.date-chip b { display: block; font-size: 18px; }
.date-chip small { font-size: 11px; }

/* Project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; color: inherit !important; text-decoration: none !important; box-shadow: var(--shadow); }
.pcard:hover { border-color: var(--line-strong); }
.pcard-top { padding: 16px 18px 14px; border-top: 4px solid var(--brand); }
.pcard-top.is-running { border-top-color: var(--accent); }
.pcard-top.is-done { border-top-color: var(--line-strong); }
.pcard-top h3 { font-size: 17px; font-weight: 700; margin-top: 8px; }
.pcard-code { font-size: 12px; color: var(--muted); }
.pcard-meta { list-style: none; margin: 0; padding: 0 18px 14px; font-size: 14px; color: var(--ink-2); }
.pcard-meta li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.pcard-meta .ic { color: var(--muted); }
.pcard-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.pcard-foot strong { color: var(--ink); font-size: 18px; }

/* Info grid (profile pages) */
.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px 24px; padding: 20px 22px; }
.info dt { font-size: 13px; color: var(--muted); }
.info dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }

/* Student picker (projects) */
.picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.picker-pane { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); display: flex; flex-direction: column; min-height: 380px; }
.picker-pane-head { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.picker-pane-head h3 { font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.picker-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; max-height: 440px; flex: 1; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 6px; }
.picker-item label { flex: 1; display: flex; gap: 10px; align-items: center; cursor: pointer; min-width: 0; }
.picker-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.picker-item .who { min-width: 0; }
.picker-item .who b { display: block; font-weight: 600; }
.picker-item .who small { color: var(--muted); font-size: 12px; }
.picker-item select { width: 150px; height: 34px; font-size: 13px; flex: none; }
.picker-item.is-requested { border-color: var(--accent); }
.picker-empty { padding: 24px; text-align: center; color: var(--muted); }
.counter { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }

/* Segmented control: pass / fail result, month / week switch */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg label, .seg a { position: relative; display: inline-flex; align-items: center; padding: 0 14px; height: 34px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-decoration: none !important; border-inline-start: 1px solid var(--line); }
.seg label:first-child, .seg a:first-child { border-inline-start: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { box-shadow: inset var(--focus); }
.seg-passed:has(input:checked) { background: var(--ok); color: #fff; }
.seg-failed:has(input:checked) { background: var(--bad); color: #fff; }
.seg-pending:has(input:checked) { background: var(--surface-2); color: var(--ink); }
.seg a.is-on { background: var(--brand); color: #fff; }

/* Calendar */
.cal-bar { justify-content: space-between; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { font-size: 19px; min-width: 190px; text-align: center; }
.cal-legend { display: flex; gap: 8px; margin: -4px 0 12px; }
.cal-legend .chip { display: inline-flex; }
.cal-wrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); min-width: 780px; }
.cal-dow { padding: 10px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: center; }
.cal-day { min-height: 118px; padding: 6px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cal-day:nth-child(7n+1) { border-inline-start: 0; }
.cal-week .cal-day { min-height: 360px; }
.cal-num { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 2px 4px; }
.cal-day.is-out { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.cal-day.is-out .cal-num { color: var(--muted); opacity: .6; }
.cal-day.is-today .cal-num { align-self: flex-start; background: var(--accent); color: #fff; border-radius: 12px; padding: 2px 9px; }
.chip { display: flex; flex-direction: column; gap: 1px; padding: 4px 8px; border-radius: 7px; font-size: 12px; line-height: 1.4; text-decoration: none !important; border-inline-start: 3px solid; }
.chip b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip span, .chip small { color: inherit; opacity: .85; }
.chip em { font-style: normal; font-size: 11px; opacity: .8; }
.chip-project { background: var(--brand-soft); color: var(--brand) !important; border-color: var(--brand); }
.chip-c1 { background: #ece6fb; color: #3f1188 !important; border-color: #5b2bbf; }
.chip-c2 { background: #e5eefc; color: #1d4294 !important; border-color: #2c5fd0; }
.chip-c3 { background: #e3f4ef; color: #0d5f48 !important; border-color: #138a68; }
[data-theme="dark"] .chip-project, [data-theme="dark"] .chip-c1 { background: #2a1e55; color: #d2c6ff !important; border-color: #8a6cf0; }
[data-theme="dark"] .chip-c2 { background: #1c2a52; color: #b9cdfa !important; border-color: #6d8fe8; }
[data-theme="dark"] .chip-c3 { background: #133a30; color: #a6e3cf !important; border-color: #3fb592; }
.chip-exam { background: var(--accent-soft); color: var(--accent-hover) !important; border-color: var(--accent); }
[data-theme="dark"] .chip-exam { color: #ffb27f !important; }
a.chip:hover { filter: brightness(.97); }

/* Project form: type choice, weekly schedule, per-course certificate */
.seg-choice label { height: 40px; padding: 0 18px; font-size: 14px; }
.seg-choice label:has(input:checked) { background: var(--brand); color: #fff; }
.schedule { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 8px; }
.schedule-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.schedule-row.is-on { border-color: var(--brand); background: var(--surface); }
.schedule-row .check { min-width: 92px; font-weight: 600; }
.schedule-time { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.schedule-time input { width: 104px; height: 34px; padding: 0 6px; font-size: 13px; }
.schedule-row:not(.is-on) .schedule-time { opacity: .45; }
.picker-item-stack { flex-wrap: wrap; }
.cert-picks { display: flex; flex-direction: column; gap: 4px; }
.cert-pick { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cert-pick select { width: 150px; height: 32px; font-size: 13px; }
input[type=time] { height: 42px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }

.results-course { font-size: 15px; padding: 14px 22px 8px; border-top: 1px solid var(--line); }
.results-course:first-of-type { border-top: 0; }

/* Charts. Colours validated (light surface #fff, dark #1b1236): purple, orange, aqua, yellow. */
:root { --viz-1: #5b2bbf; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-grid: #ebe8f3; --viz-axis: #d6d1e6; --viz-text: #75729a; }
[data-theme="dark"] { --viz-1: #9085e9; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-grid: #2a2250; --viz-axis: #3a3166; --viz-text: #9d96c4; }
.viz { margin: 0; }
.viz-svg { display: block; width: 100%; height: auto; direction: ltr; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-base { stroke: var(--viz-axis); }
.viz-tick { fill: var(--viz-text); font-size: 11px; font-family: var(--font); }
.viz-val { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.viz-bar { fill: var(--viz-1); }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:hover, .viz-hit:focus-visible { fill: color-mix(in srgb, var(--viz-1) 8%, transparent); }
.viz-table { margin-top: 8px; font-size: 13px; }
.viz-table summary { cursor: pointer; color: var(--muted); }
.viz-table .table { margin-top: 8px; }
.viz-empty { color: var(--muted); margin: 8px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.viz-ranked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.viz-ranked li { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; gap: 12px; align-items: center; outline: none; border-radius: 6px; }
.viz-ranked li:hover .viz-fill, .viz-ranked li:focus-visible .viz-fill { filter: brightness(1.1); }
.viz-name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; }
.viz-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viz-track { height: 12px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; }
.viz-fill { display: block; height: 100%; background: var(--viz-1); border-radius: 4px 0 0 4px; }
.viz-fig { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.viz-seg { display: flex; gap: 2px; height: 28px; }
.viz-seg span { display: flex; align-items: center; padding: 0 8px; border-radius: 4px; min-width: 4px; outline: none; }
.viz-seg span:focus-visible, .viz-seg span:hover { box-shadow: inset 0 0 0 2px var(--surface); filter: brightness(1.08); }
.viz-seg b { font-size: 12px; color: #fff; }
.viz-seg .viz-c4 b { color: #0b0b0b; }
.viz-c1 { background: var(--viz-1); } .viz-c2 { background: var(--viz-2); } .viz-c3 { background: var(--viz-3); } .viz-c4 { background: var(--viz-4); }
.viz-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.viz-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.viz-legend span { flex: 1; color: var(--ink-2); }
.viz-legend strong { font-variant-numeric: tabular-nums; }

.viz-meter { outline: none; }
.viz-meter-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.viz-meter-head strong { color: var(--ink); font-size: 15px; }
.viz-meter-track { display: block; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--viz-1) 16%, var(--surface)); overflow: hidden; }
.viz-meter-track span { display: block; height: 100%; background: var(--viz-1); border-radius: 5px; }
.viz-meter small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.viz-tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; max-width: 280px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
[data-theme="dark"] .viz-tip { background: #eeebfb; color: #1b1236; }

/* Dashboard analytics layout */
.dash-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-filter h2 { font-size: 18px; }
.dash-section-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 6px 0 10px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 24px; }
.chart-grid .card { margin: 0; }
.chart-card .card-pad { padding-top: 14px; }
.chart-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.meters { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .viz-ranked li { grid-template-columns: minmax(0, 1fr) auto; } .viz-track { grid-column: 1 / -1; grid-row: 2; } }

/* Reports */
.report-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.report-type { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink) !important; text-decoration: none !important; }
.report-type span { font-size: 13px; color: var(--muted); }
.report-type:hover { border-color: var(--line-strong); }
.report-type.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.report-type.is-active strong { color: var(--brand); }
[data-theme="dark"] .report-type.is-active strong { color: #c4b3ff; }
.report-form { margin-bottom: 20px; }
.report-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.report-head h2 { font-size: 22px; }
.report-head p { margin: 4px 0 0; }
.report-table td { white-space: nowrap; }
.report-table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line-strong); }
.report-notes { margin-bottom: 20px; font-size: 14px; }
.report-notes summary { cursor: pointer; font-weight: 600; }
.report-notes ul { margin: 10px 0 0; padding-inline-start: 20px; color: var(--ink-2); }
.report-notes li + li { margin-top: 4px; }
@media print { .report-types, .report-form { display: none !important; } .chart-grid { grid-template-columns: 1fr 1fr; } .viz-table { display: none; } }

/* Project members: full / custom + customization popup */
.member-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.member-row > label { min-width: 0; }
.member-mode { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.member-summary { grid-column: 1 / -1; color: var(--ink-2); padding-inline-start: 28px; }
.seg-mini label { height: 30px; padding: 0 12px; font-size: 13px; }
.seg-mini label:has(input:checked) { background: var(--brand); color: #fff; }
.member-dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.member-dialog::backdrop { background: rgba(18, 10, 38, .55); }
.member-body { padding: 22px; }
.member-body h2 { font-size: 19px; }
.member-courses { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 50vh; overflow-y: auto; }
.member-course { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); flex-wrap: wrap; }
.member-course.is-on { border-color: var(--brand); background: var(--surface); }
.member-course select { width: 180px; height: 36px; }
@media (max-width: 560px) { .member-row { grid-template-columns: minmax(0, 1fr); } .member-mode { justify-content: flex-start; } .member-summary { padding-inline-start: 0; } }

/* Confirm dialog */
.confirm { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.confirm::backdrop { background: rgba(18, 10, 38, .55); }
.confirm form { padding: 24px; text-align: center; }
.confirm-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); }
.confirm h2 { font-size: 19px; }
.confirm p { color: var(--ink-2); margin: 8px 0 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* Responsive */
@media (max-width: 1100px) {
	.dash-grid, .picker { grid-template-columns: minmax(0, 1fr); }
	.clock-item:nth-child(2) { display: none; }
}
@media (max-width: 900px) {
	.shell { grid-template-columns: 1fr; }
	.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 50; transform: translateX(110%); transition: transform .2s ease; }
	.nav-open .sidebar { transform: none; }
	.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(18,10,38,.5); z-index: 40; }
	.nav-toggle { display: inline-grid; }
	.topbar { padding: 10px 16px; flex-wrap: wrap; }
	.top-search { order: 5; max-width: none; flex-basis: 100%; }
	.content { padding: 20px 16px; }
	.grid-2, .grid-3 { grid-template-columns: 1fr; }
	.clock { gap: 10px; font-size: 13px; }
	.clock-item + .clock-item { padding-inline-start: 10px; }
}
@media (max-width: 560px) {
	.clock-item:first-child { display: none; }
	.page-head h1 { font-size: 22px; }
	.stat { border-inline-start: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ */
/* Sign-in screens                                                     */
/* ------------------------------------------------------------------ */

.auth { background: var(--bg); }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-form-side { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-top { position: absolute; top: 24px; inset-inline-end: 24px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-lock { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--brand); border: 1px solid var(--line); box-shadow: var(--shadow); }
[data-theme="dark"] .auth-lock { color: #c4b3ff; }
.auth-title { text-align: center; font-size: 34px; font-weight: 700; }
.auth-sub { text-align: center; color: var(--muted); margin: 8px 0 0; }
.auth-sub::after { content: ""; display: block; width: 56px; height: 4px; border-radius: 2px; background: var(--accent); margin: 16px auto 26px; }
.auth-fields { display: flex; flex-direction: column; }
.auth-label { font-weight: 600; margin: 0 0 8px; }
.input-icon { position: relative; margin-bottom: 18px; }
.input-icon > .ic { position: absolute; inset-inline-start: 16px; top: 16px; color: var(--muted); pointer-events: none; }
.input-icon input { height: 54px; border-radius: 12px; padding-inline-start: 48px; padding-inline-end: 48px; font-size: 16px; text-align: right; }
.input-icon input[dir="ltr"]:placeholder-shown { text-align: right; }
.reveal { position: absolute; inset-inline-end: 8px; top: 8px; width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.reveal:hover { color: var(--ink); }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -4px 0 18px; flex-wrap: wrap; }
.auth-row .check { margin: 0; }
.auth-foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.auth .alert { margin-bottom: 20px; }

.auth-brand { position: relative; overflow: hidden; color: #fff; background: linear-gradient(165deg, #2e0068 0%, #24085a 55%, #1a0747 100%); display: flex; flex-direction: column; }
.auth-arc { position: absolute; inset-block: 0; inset-inline-start: -2px; width: 90px; height: 100%; color: var(--accent); z-index: 3; }
.auth-arc .arc-fill { fill: var(--bg); }
.auth-arc .arc-line { stroke: #f35c00; }
.auth-brand-inner { position: relative; z-index: 2; padding: 48px 56px 0 40px; text-align: center; }
.auth-emblem { width: 112px; height: 112px; margin: 0 auto 14px; border-radius: 28px; background: #fff; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.auth-inst { margin: 0; font-size: 22px; font-weight: 700; }
.auth-inst-en { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: rgba(255,255,255,.85); direction: ltr; }
.auth-headline { font-size: 38px; font-weight: 700; margin-top: 26px; }
.auth-headline::before { content: ""; display: block; width: 60px; height: 4px; border-radius: 2px; background: #f35c00; margin: 0 auto 24px; }
.auth-headline span { color: #ff8a3d; }
.auth-tagline { margin: 10px 0 0; color: rgba(255,255,255,.78); font-size: 17px; }
.auth-points { list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.auth-points li { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 14px; color: rgba(255,255,255,.85); }
.auth-points .ic { width: 56px; height: 56px; padding: 15px; border-radius: 14px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #ff8a3d; }
.auth-photo { position: relative; z-index: 1; flex: 1; min-height: 260px; margin-top: 30px; background-size: cover; background-position: center 35%; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 38%); mask-image: linear-gradient(180deg, transparent 0, #000 38%); }
.auth-photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(31,7,80,.6) 0%, rgba(46,0,104,.3) 100%); }

[data-theme="dark"] .auth-form-side { background: #120a26; }

@media (max-width: 960px) {
	.auth-layout { grid-template-columns: 1fr; }
	.auth-brand { order: -1; }
	.auth-brand-inner { padding: 32px 20px 28px; }
	.auth-headline, .auth-tagline, .auth-points, .auth-photo, .auth-arc { display: none; }
	.auth-emblem { width: 84px; height: 84px; border-radius: 22px; }
	.auth-emblem img { width: 70px; height: 70px; }
	.auth-title { font-size: 28px; }
}

/* ================================================================== */
/* Identity v0.8 — the certificate seal: royal ink, ember, seal gold.  */
/* ================================================================== */

:root {
	--display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
	--bg: #f4f2fa;
	--surface-2: #f8f6fd;
	--line: #e6e1f2;
	--line-strong: #d5cee9;
	--gold: #d9951a;
	--radius: 12px;
	--radius-lg: 18px;
	--shadow: 0 1px 2px rgba(46, 0, 104, .05), 0 14px 34px -24px rgba(46, 0, 104, .35);
	--shadow-hover: 0 1px 2px rgba(46, 0, 104, .06), 0 22px 44px -22px rgba(46, 0, 104, .45);
	--sb-top: #2a0763;
	--sb-bottom: #14043a;
}
[data-theme="dark"] {
	--bg: #0d0620;
	--surface: #170e30;
	--surface-2: #1e1440;
	--line: #2c2256;
	--line-strong: #3c3170;
	--brand: #7b52f0;
	--brand-hover: #8d68f5;
	--gold: #f2b94b;
	--shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 18px 40px -26px rgba(0, 0, 0, .9);
	--shadow-hover: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 50px -24px rgba(123, 82, 240, .35);
	--sb-top: #1a0a42;
	--sb-bottom: #0a0418;
}

body.portal { background: var(--bg); }
h1, h2, h3, .stat-value, .cal-title, .auth-title, .auth-headline, .auth-inst { font-family: var(--display); letter-spacing: -.005em; }

/* Ambient backdrop: engraved pattern + two slow glows. */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background-image: var(--pattern); background-size: 260px; }
.ambient .glow { position: absolute; border-radius: 50%; filter: blur(90px); animation: drift 30s ease-in-out infinite alternate; }
.ambient .g1 { width: 46vw; height: 46vw; top: -20vw; inset-inline-end: -14vw; background: #7a4cf0; opacity: .16; }
.ambient .g2 { width: 32vw; height: 32vw; bottom: -14vw; inset-inline-start: 20vw; background: var(--accent); opacity: .10; animation-duration: 38s; }
[data-theme="dark"] .ambient .g1 { opacity: .30; }
[data-theme="dark"] .ambient .g2 { opacity: .14; }
@keyframes drift { to { transform: translate3d(-5vw, 4vw, 0) scale(1.1); } }
.shell { position: relative; z-index: 1; }

/* Sidebar */
.sidebar { border-inline-end: 0; background: linear-gradient(185deg, var(--sb-top) 0%, var(--sb-bottom) 100%); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06); overflow-x: hidden; }
.sidebar::after { content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: 2px; background: linear-gradient(180deg, transparent, var(--accent) 30%, var(--gold) 70%, transparent); opacity: .8; }
.brand { border-bottom-color: rgba(255, 255, 255, .08); }
.brand-mark { border-radius: 14px; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .5); }
.brand-text strong { font-family: var(--display); font-weight: 600; }
.brand-text small { color: #ffb27f; }
.nav, .sidebar-user, .brand { position: relative; z-index: 1; }
.nav-title { font-size: 11.5px; color: rgba(255, 255, 255, .4); }
.nav-link { transition: background .25s, color .25s, padding .25s; }
.nav-link .ic { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), color .25s; }
.nav-link:hover { padding-inline-start: 16px; }
.nav-link:hover .ic { transform: scale(1.12) rotate(-6deg); color: #ffb27f; }
.nav-link.is-active { background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.nav-link.is-active .ic { color: #ff9a5c; }
.nav-link.is-active::before { box-shadow: 0 0 12px var(--accent); }
.sb-seal { position: absolute; inset-inline-start: -130px; bottom: -120px; z-index: 0; pointer-events: none; opacity: .22; }
.sb-seal .seal.seal { --seal: 360px; --seal-a: #b9a3ff; --seal-b: #ff9a5c; --seal-c: #f2b94b; }
.sb-seal .seal-emblem { display: none; }

/* Top bar */
.topbar { background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
.top-search { border-radius: 14px; transition: border-color .2s, box-shadow .2s, background .2s; }
.top-search:focus-within { background: var(--surface); }

/* Page header */
.page-head h1 { font-size: 27px; font-weight: 600; }
.page-head h1::after { content: ""; display: block; width: 44px; height: 3px; margin-top: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--gold)); transform-origin: right; animation: grow .7s .15s both cubic-bezier(.2, .8, .2, 1); }
@keyframes grow { from { transform: scaleX(0); } }

/* Content entrance: one short staggered rise when a page opens. */
.content > * { animation: rise .55s both cubic-bezier(.2, .8, .2, 1); }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .18s; }
.content > *:nth-child(n+5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Cards & surfaces */
.card, .pcard, .stats, .report-type { border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-title { font-family: var(--display); font-weight: 600; }
.pcard, .report-type, a.stat { transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s, border-color .3s; }
.pcard:hover, .report-type:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.pcard-top { border-top-width: 3px; background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent); }

/* Buttons */
.btn { border-radius: 12px; transition: background .2s, border-color .2s, transform .2s, box-shadow .25s; position: relative; overflow: hidden; }
.btn-primary { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #7a4cf0)); box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--brand) 90%, transparent); }
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-hover), color-mix(in srgb, var(--brand-hover) 70%, #7a4cf0)); transform: translateY(-1px); }
.btn-primary::after, .btn-accent::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s; }
.btn-primary:hover::after, .btn-accent:hover::after { transform: translateX(120%); }
.btn-secondary:hover { transform: translateY(-1px); }
.btn.is-busy { opacity: .7; pointer-events: none; }
.btn.is-busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Inputs */
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local], input[type=number], input[type=search], input[type=password], select, textarea { border-radius: 12px; transition: border-color .2s, box-shadow .2s; }

/* Tabs & pills */
.tab { transition: background .2s, color .2s, border-color .2s; }
.tab.is-active { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #7a4cf0)); }

/* Tables */
.table th { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); color: var(--ink-2); }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table tr.is-muted td { opacity: .55; }

/* Stats: separate tiles with a coloured edge and display numbers. */
.stats { background: transparent; border: 0; box-shadow: none; gap: 14px; overflow: visible; }
.stat { position: relative; border: 1px solid var(--line) !important; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.stat::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: 14px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--brand), #7a4cf0); }
.stat:nth-child(4n+2)::before { background: linear-gradient(180deg, var(--accent), var(--gold)); }
.stat:nth-child(4n+3)::before { background: linear-gradient(180deg, #1baf7a, #5fd3a4); }
.stat:nth-child(4n+4)::before { background: linear-gradient(180deg, var(--gold), #f5cf6e); }
a.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); background: var(--surface); }
.stat-value { font-weight: 600; }

/* Dashboard hero */
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 34px; min-height: 230px; border-radius: 24px; background: radial-gradient(120% 140% at 100% 0%, #5a26c4 0%, #2e0068 45%, #1a0646 100%); box-shadow: 0 26px 50px -30px rgba(46, 0, 104, .8); isolation: isolate; }
[data-theme="dark"] .welcome { background: radial-gradient(120% 140% at 100% 0%, #4a1fae 0%, #22084f 50%, #120433 100%); box-shadow: 0 0 0 1px rgba(157, 123, 255, .14), 0 26px 60px -30px rgba(0, 0, 0, .9); }
.welcome::after { display: none; }
.welcome::before { content: ""; position: absolute; inset: 0; z-index: 0; background-image: var(--welcome-pattern, none); opacity: .5; }
.welcome-text { position: relative; z-index: 1; max-width: 560px; }
.welcome-greet { margin: 0 0 2px !important; color: #ffb27f !important; font-weight: 600; font-size: 15px; }
.welcome h1 { font-size: 32px; font-weight: 600; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.welcome-actions .btn { margin: 0; }
.welcome .btn-secondary { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff !important; backdrop-filter: blur(6px); }
.welcome .btn-secondary:hover { background: rgba(255, 255, 255, .18); }
.welcome .btn-primary { background: var(--accent); box-shadow: 0 12px 24px -12px rgba(243, 92, 0, .9); }
.seal.welcome-seal { --seal: 210px; flex: none; margin: -10px 10px -10px 0; --seal-a: #c4b3ff; --seal-b: #ff9a5c; --seal-c: #f2b94b; --seal-card: rgba(255, 255, 255, .1); --seal-line: rgba(255, 255, 255, .22); }
.welcome-seal .seal-chip { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
.welcome-seal .seal-chip .bi { width: 17px; height: 17px; }
.welcome-seal .seal-chip-in { color: #fff !important; box-shadow: none; }
.welcome-seal .seal-emblem { box-shadow: 0 0 0 5px rgba(255, 255, 255, .12), 0 14px 30px -8px rgba(0, 0, 0, .5); }

/* Sign-in */
.auth-brand { background: radial-gradient(120% 90% at 50% 0%, #4b1aa3 0%, #2e0068 45%, #160440 100%); }
.auth-pattern { position: absolute; inset: 0; z-index: 0; background-image: var(--pattern); background-size: 240px; animation: pan 80s linear infinite; }
@keyframes pan { to { background-position: 240px 240px; } }
.seal.auth-seal { --seal: 230px; margin: 0 auto 18px; --seal-a: #c4b3ff; --seal-b: #ff9a5c; --seal-c: #f2b94b; --seal-card: rgba(255, 255, 255, .1); --seal-line: rgba(255, 255, 255, .22); }
.auth-seal .seal-chip { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
.auth-seal .seal-chip .bi { width: 18px; height: 18px; }
.auth-seal .seal-chip-in { color: #fff !important; box-shadow: none; }
.auth-points .bi { width: 56px; height: 56px; padding: 15px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #ff9a5c; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), background .3s; }
.auth-points li:hover .bi { transform: translateY(-4px) rotate(-6deg); background: rgba(255, 255, 255, .12); }
.auth-card { animation: rise .7s .1s both cubic-bezier(.2, .8, .2, 1); }
.auth-form-side { background: transparent; }
[data-theme="dark"] .auth-form-side { background: transparent; }
.auth { background: var(--bg); }
.input-icon input { border-radius: 14px; }
@media (max-width: 960px) { .seal.auth-seal { --seal: 150px; } .auth-seal .seal-orbit { display: none; } }
/* Sign-in page on desktop: the whole page fits the window (no scrolling, nothing cut off) at 768px high and up; a
   shorter window (zoom, an error message) grows the page and scrolls instead of clipping it.
   The brand column scales with the window height (clamp) and the photo takes whatever height is left. The form side
   reaches under the divider and is cut to the arc's curve, so the arc shows the form side's own ground (no seam). */
@media (min-width: 961px) {
	.auth-layout { min-height: 100vh; min-height: 100dvh; }
	.auth-form-side { z-index: 2; justify-content: safe center; margin-inline-end: -88px; padding: clamp(16px, 4vh, 40px) 24px; padding-inline-end: calc(24px + 88px);
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 1000' preserveAspectRatio='none'%3E%3Cpath d='M120 0 L113 0 C 113 170, 37 300, 37 500 S 113 830, 113 1000 L120 1000 Z'/%3E%3C/svg%3E") left top / 90px 100% no-repeat, linear-gradient(#000, #000) right top / calc(100% - 89px) 100% no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 1000' preserveAspectRatio='none'%3E%3Cpath d='M120 0 L113 0 C 113 170, 37 300, 37 500 S 113 830, 113 1000 L120 1000 Z'/%3E%3C/svg%3E") left top / 90px 100% no-repeat, linear-gradient(#000, #000) right top / calc(100% - 89px) 100% no-repeat; }
	.auth-top { inset-inline-end: calc(24px + 88px); }
	.auth-arc .arc-fill { fill: none; }
	.auth-brand { min-height: 0; }
	.auth-brand-inner { flex: none; padding: clamp(22px, 4.5vh, 48px) 56px 0 40px; }
	.seal.auth-seal { --seal: clamp(130px, 24vh, 230px); margin-bottom: clamp(6px, 1.6vh, 18px); }
	.auth-inst { font-size: clamp(17px, 2.3vh, 22px); }
	.auth-headline { font-size: clamp(24px, 3.9vh, 38px); margin-top: clamp(8px, 2.4vh, 26px); }
	.auth-headline::before { margin-bottom: clamp(10px, 2.2vh, 24px); }
	.auth-tagline { font-size: clamp(14px, 1.8vh, 17px); margin-top: clamp(4px, 1vh, 10px); }
	.auth-points { margin-top: clamp(12px, 2.8vh, 30px); }
	.auth-points .bi { width: clamp(40px, 5.6vh, 56px); height: clamp(40px, 5.6vh, 56px); padding: clamp(10px, 1.5vh, 15px); }
	.auth-photo { flex: 1 1 0; min-height: 0; margin-top: clamp(12px, 2.8vh, 30px); }
}

/* Staff & permissions */
.staff-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.staff-role { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.staff-role b { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.2; color: var(--brand); }
[data-theme="dark"] .staff-role b { color: #c4b3ff; }
.staff-role span { font-size: 12.5px; color: var(--muted); }
.staff-who { display: flex; align-items: center; gap: 10px; }
.staff-who .avatar { background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .staff-who .avatar { color: #c4b3ff; }
.cap-meter { display: inline-block; vertical-align: middle; width: 70px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.cap-meter span { display: block; height: 100%; width: calc(var(--v) * 100%); background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 3px; }
.role-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 10px; }
.role-opt { position: relative; cursor: pointer; }
.role-opt input { position: absolute; opacity: 0; }
.role-opt > span { display: flex; flex-direction: column; height: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .2s, background .2s, transform .2s; }
.role-opt b { font-size: 14px; }
.role-opt small { color: var(--muted); font-size: 12px; }
.role-opt:hover > span { transform: translateY(-2px); border-color: var(--line-strong); }
.role-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.role-opt input:focus-visible + span { box-shadow: var(--focus); }
.role-opt input:disabled + span { opacity: .5; cursor: not-allowed; }
.perm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 22px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.perm-head [data-perm-reset] { margin-inline-start: auto; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; margin-bottom: 18px; }
.perm-group { margin: 0; padding: 14px 16px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.perm-group legend { display: flex; align-items: center; gap: 6px; padding: 0 6px; font-family: var(--display); font-weight: 600; font-size: 15px; }
.perm-group.is-locked { background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, color-mix(in srgb, var(--line) 40%, var(--surface-2)) 10px 20px); }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px dashed var(--line); }
.switch { position: relative; flex: none; width: 42px; height: 24px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch-ui { position: absolute; inset: 0; border-radius: 12px; background: var(--line-strong); transition: background .25s; pointer-events: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .25s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + .switch-ui { background: linear-gradient(135deg, var(--brand), #7a4cf0); }
.switch input:checked + .switch-ui::after { inset-inline-start: 21px; }
.switch input:focus-visible + .switch-ui { box-shadow: var(--focus); }
.switch input:disabled + .switch-ui { opacity: .55; }
.switch-text { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.perm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); opacity: 0; transform: scale(0); transition: all .3s cubic-bezier(.3, 1.6, .5, 1); }
.is-custom .perm-dot { opacity: 1; transform: none; }
.perm-search { display: flex; align-items: center; gap: 8px; max-width: 420px; margin: 0 0 14px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--muted); }
.perm-search:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
.perm-search input[type=search] { flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.perm-dip { grid-column: 1 / -1; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); min-width: 0; }
.perm-dip-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.perm-dip-title { display: flex; align-items: center; gap: 6px; margin: 0; font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--ink); }
.perm-dip-head .perm-tools { margin-inline-start: auto; }
.perm-dip > .help { margin: 6px 0 12px; }
.perm-tools { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.perm-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 10px; align-items: start; }
.perm-sub { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.perm-sub > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; border-radius: 14px; }
.perm-sub > summary::-webkit-details-marker { display: none; }
.perm-sub > summary::before { content: ""; flex: none; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(135deg); transition: transform .2s; }
.perm-sub[open] > summary::before { transform: rotate(45deg); margin-top: -4px; }
.perm-sub > summary:focus-visible { outline: none; box-shadow: var(--focus); }
.perm-sub-title { flex: 1; min-width: 0; }
.perm-sub-body { padding: 0 14px 6px; border-top: 1px dashed var(--line); }
.perm-sub-body .perm-tools { padding: 8px 0 2px; }

/* File inputs */
input[type=file] { display: block; width: 100%; padding: 10px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; }
input[type=file]::file-selector-button { margin-inline-end: 12px; height: 34px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
[data-theme="dark"] input[type=file]::file-selector-button { color: #c4b3ff; }
.grid-2 > .card, .grid-3 > .card { margin-top: 0; }

/* Backup */
.backup-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 8%, var(--surface)), var(--surface)); }
.backup-stats { display: flex; gap: 10px 28px; flex-wrap: wrap; }
.backup-stats div { display: flex; flex-direction: column; }
.backup-stats b { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; color: var(--brand); }
[data-theme="dark"] .backup-stats b { color: #c4b3ff; }
.backup-stats span { font-size: 13px; color: var(--muted); }
.backup-stats-sm b { font-size: 20px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: linear-gradient(180deg, var(--bad-soft), var(--surface) 140px); }

@media (max-width: 700px) {
	.welcome { flex-direction: column-reverse; align-items: flex-start; padding: 24px 20px; }
	.seal.welcome-seal { --seal: 140px; margin: 0; }
	.welcome-seal .seal-orbit { display: none; }
	.welcome h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
	.ambient .glow, .auth-pattern, .content > *, .page-head h1::after { animation: none !important; }
}

/* Print: content only */
@media print {
	.sidebar, .topbar, .page-actions, .no-print, .pager, .toolbar, .tabs { display: none !important; }
	.shell { display: block; }
	.content { padding: 0; }
	.card { box-shadow: none; }
	body { background: #fff; }
}

/* Excel import */
.import-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.import-grid > .card { margin: 0; }
.import-drop { text-align: center; border: 2px dashed var(--line-strong); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 5%, var(--surface)), var(--surface)); }
.import-drop .field { max-width: 460px; margin: 0 auto 10px; text-align: start; }
.import-icon { display: grid; place-items: center; width: 76px; height: 76px; margin: 4px auto 12px; border-radius: 24px; background: var(--brand-soft); color: var(--brand); animation: float 4s ease-in-out infinite; }
[data-theme="dark"] .import-icon { color: #c4b3ff; }
@keyframes float { 50% { transform: translateY(-6px); } }
.import-cols { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.import-cols li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.import-cols small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.import-map { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 1000px) { .import-grid { grid-template-columns: minmax(0, 1fr); } }
.code-chip { font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 8px; }
[data-theme="dark"] .code-chip { color: #c4b3ff; }
.admin-tools { display: flex; flex-direction: column; gap: 12px; }
.admin-tools .card { margin: 0; }
.tool-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.tool-row p { margin: 2px 0 0; }
.code-form { display: flex; gap: 8px; align-items: center; }
.code-form input { width: 200px; font-weight: 600; letter-spacing: .04em; }
.check-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.check-list .is-ok { background: var(--ok-soft); color: var(--ok); }
.check-list .is-warn { background: var(--warn-soft); color: var(--warn); }
.check-list .is-bad { background: var(--bad-soft); color: var(--bad); }

/* Trainee file: tabs and statement of account */
.profile-tabs { margin: 4px 0 18px; }
.table.statement td[data-balance] { white-space: nowrap; }
.table .row-reversal td { color: var(--muted); }
@media print { .profile-tabs { display: none !important; } .table.statement { font-size: 12px; } }

/* Drill-down */
button.drill { all: unset; cursor: pointer; border-bottom: 1px dashed currentColor; }
button.drill:hover, button.drill:focus-visible { color: var(--brand, #4b2a8a); outline: none; }
.drill-dialog { border: 0; border-radius: 18px; padding: 0; width: min(920px, 94vw); max-height: 82vh; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(20,10,50,.3); }
.drill-dialog::backdrop { background: rgba(20,10,50,.45); }
.drill-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; }
.drill-head h2 { margin: 0; font-size: 18px; }
.drill-dialog [data-drill-body] { padding: 8px 12px 16px; overflow: auto; max-height: calc(82vh - 64px); }
.drill-dialog td.neg { color: #c0392b; }
/* Data health */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.health-card { display: flex; gap: 16px; align-items: flex-start; border-inline-start: 4px solid var(--line); }
.health-card h3 { margin: 0 0 4px; font-size: 16px; }
.health-card p { margin: 0 0 8px; }
.health-count { font-size: 30px; font-weight: 800; min-width: 56px; text-align: center; }
.health-card.is-ok { border-inline-start-color: #1e9e6a; } .health-card.is-ok .health-count { color: #1e9e6a; }
.health-card.is-warn { border-inline-start-color: #e08a00; } .health-card.is-warn .health-count { color: #e08a00; }
.health-card.is-bad { border-inline-start-color: #d64545; } .health-card.is-bad .health-count { color: #d64545; }
/* Guide */
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 28px; counter-reset: f; }
.flow li { position: relative; }
.flow li a { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; height: 100%; color: inherit; text-decoration: none; }
.flow li a:hover { border-color: var(--brand, #4b2a8a); }
.flow li:not(:last-child)::after { content: '←'; position: absolute; inset-inline-end: -22px; top: 30px; font-size: 20px; opacity: .55; }
.flow-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(75,42,138,.1); }
.terms dt { font-weight: 700; margin-top: 10px; } .terms dd { margin: 2px 0 0; color: var(--muted); }
.check-steps li { margin: 6px 0; }
@media (max-width: 900px) { .flow { grid-template-columns: 1fr 1fr; } .flow li::after { display: none; } }

/* Quick search palette */
.top-search { cursor: pointer; } .top-search input[readonly] { cursor: pointer; }
.kbd { font: 600 11px/1 ui-monospace, monospace; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface); white-space: nowrap; }
.palette { border: 0; padding: 0; background: transparent; width: min(640px, 94vw); margin-top: 10vh; color: inherit; }
.palette::backdrop { background: rgba(20,10,50,.45); }
.palette-box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(20,10,50,.3); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); outline: none; box-shadow: none; min-width: 0; }
.palette-results { max-height: min(60vh, 460px); overflow: auto; padding: 6px; }
.palette-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 10px 4px; }
.palette-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.palette-item.is-active, .palette-item:hover { background: var(--surface-2); outline: 1px solid var(--brand); }
.palette-empty { padding: 18px; text-align: center; color: var(--muted); margin: 0; }
.palette-foot { padding: 8px 14px; border-top: 1px solid var(--line); }
@media (max-width: 600px) { .top-search .kbd { display: none; } .palette { margin-top: 4vh; } }

/* Follow-ups */
.followup-form .seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.followup-form .seg label { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.followup-form .seg label:has(input:checked) { background: var(--brand); color: #fff; }
.followup-form .seg input { accent-color: #fff; }
.followup-form .task-only { display: none; } .followup-form.is-task .task-only { display: grid; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.timeline-item.is-task .timeline-dot { color: var(--accent, #e08a00); }
.timeline-item.is-done .timeline-dot { color: #1e9e6a; }
.timeline-body { flex: 1; min-width: 0; } .timeline-body p { margin: 0 0 4px; overflow-wrap: anywhere; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.timeline-actions { display: flex; gap: 6px; align-items: flex-start; }
.text-bad { color: #d64545; }

/* Notification bell */
.bell { position: relative; }
.bell > .icon-btn { position: relative; }
.bell-badge { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: min(340px, 90vw); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(20,10,50,.22); padding: 6px; z-index: 60; }
.bell-head { font-weight: 700; padding: 8px 10px; }
.bell-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.bell-item:hover, .bell-item:focus-visible { background: var(--surface-2); outline: none; }
.bell-item b { min-width: 24px; text-align: center; padding: 2px 6px; border-radius: 8px; background: var(--surface-2); }
.bell-ic { color: var(--brand); display: grid; }
.bell-empty { margin: 0; padding: 14px 10px; color: var(--muted); }

/* WhatsApp */
.wa-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -6px 0 14px; }
.wa-btn .ic { color: #1fa855; }
.btn.is-disabled { opacity: .45; pointer-events: none; }

/* New invoice: open-projects picker, provider percentage, attachment */
.inv-picker-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
.tkt-reg.inv-picker { display: block; font-size: 15px; }
.inv-picker { padding: 0 20px 18px; border-top: 1px dashed var(--line); background: transparent; }
.inv-picker .rg-projects { max-height: 560px; overflow: auto; padding: 4px; }
.provider-box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; background: var(--surface-2); }
.provider-box.is-confirmed { border-color: #1e9e6a; }
.provider-note { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.provider-ok { color: #1e9e6a; margin: 6px 0 0; }
.inv-picker .rg-search { max-width: 520px; }
.inv-picker .rg-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.inv-picker .rg-project.is-on { grid-column: 1 / -1; }

/* Attendance */
.att-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.att-opt { position: relative; }
.att-opt input { position: absolute; opacity: 0; pointer-events: none; }
.att-opt span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px; }
.att-opt input:focus-visible + span { box-shadow: var(--focus); }
.att-present input:checked + span { background: #1e9e6a; border-color: #1e9e6a; color: #fff; }
.att-late input:checked + span { background: #e08a00; border-color: #e08a00; color: #fff; }
.att-excused input:checked + span { background: #3b7dd8; border-color: #3b7dd8; color: #fff; }
.att-absent input:checked + span { background: #d64545; border-color: #d64545; color: #fff; }

/* Certificate QR */
.qr-dialog { width: min(420px, 94vw); }
.qr-body { padding: 16px; text-align: center; }
.qr-body canvas { width: 240px; height: 240px; image-rendering: pixelated; border-radius: 8px; }
.qr-body [data-qr-link] { word-break: break-all; color: var(--muted); }
@media (max-width: 600px) { .bell-pop { position: fixed; top: 64px; left: 12px; right: 12px; inset-inline-end: auto; width: auto; max-height: 70vh; overflow: auto; } }

/* Certificates: local / international split */
.cert-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.cert-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none !important; color: inherit !important; border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.cert-card:hover { border-color: var(--brand); }
.cert-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.cert-card-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.cert-card ul { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 14px; }
.cert-card li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.cert-card li b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Duplicates: merge screen */
.merge-table td { vertical-align: middle; }
.merge-table .pick { font: inherit; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: start; }
.merge-table .pick.diff { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.merge-table .pick:hover, .merge-table .pick.is-picked { border-color: var(--brand); background: var(--brand-soft, #efeafb); }
.merge-table input { width: 100%; min-width: 180px; }
.report-group { margin: 6px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.report-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Project member popup / review card: courses grouped by package (projects with several packages) */
.member-group, .rg-sp-group { margin: 12px 0 4px; font-weight: 700; font-size: 13.5px; color: var(--brand); }
.pill.pill-wrap { white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; line-height: 1.5; max-width: 100%; }
.rg-sp-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }

/* v27: project page — compact course table and per-trainee course details */
.course-mini { margin-top: 6px; max-height: 340px; overflow: auto; }
.table-compact td, .table-compact th { padding: 6px 10px; }
.table-compact [data-course-group] th { text-align: start; font-size: 12.5px; color: var(--brand); background: var(--surface-2); }
.course-name { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-details { margin-top: 4px; }
.mc-details > summary { cursor: pointer; color: var(--brand); width: max-content; }
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-top: 6px; min-width: 260px; }
.mc-item { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; }

/* v27: certificates list — the fields in one compact column, buttons wrap; nothing runs off the screen. */
.cert-table { table-layout: auto; }
.cert-table td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }
.cert-table .cert-check { width: 36px; padding-inline-end: 0; }
.cert-table .cert-who { min-width: 150px; max-width: 220px; }
.cert-table .cert-course { min-width: 160px; max-width: 260px; }
.cert-table .cert-course .cell-main { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cert-table .cert-edit { min-width: 300px; width: 34%; }
.cert-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; }
.cert-grid label { display: flex; flex-direction: column; gap: 3px; margin: 0; min-width: 0; }
.cert-grid label > span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cert-grid select, .cert-grid input { width: 100%; min-width: 0; height: 36px; padding-block: 0; font-size: 14px; }
.cert-table .cert-actions { width: 1%; min-width: 190px; }
.cert-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; max-width: 260px; margin-inline-start: auto; }
.cert-btns > * { margin: 0 !important; }
.cert-btns .inline-form { order: -1; }
@media (max-width: 900px) {
	.cert-table .cert-edit { min-width: 260px; }
	.cert-btns { justify-content: flex-start; }
}
/* Phone: each certificate row becomes a card (trainee, course, fields, buttons stacked). */
@media (max-width: 700px) {
	.cert-table thead { display: none; }
	.cert-table, .cert-table tbody, .cert-table tr, .cert-table td { display: block; width: auto; min-width: 0; max-width: none; }
	.cert-table tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
	.cert-table td { border: 0; padding: 4px 0; }
	.cert-table .cert-check { position: absolute; inset-inline-end: 14px; top: 14px; width: auto; }
	.cert-table .cert-who { padding-inline-end: 32px; }
	.cert-table .cert-edit { min-width: 0; padding-top: 8px; }
	.cert-btns { justify-content: flex-start; max-width: none; margin: 6px 0 0; }
	.cert-grid label:nth-child(3) { grid-column: 1 / -1; }
	.cert-table .cert-who, .cert-table .cert-course, .cert-table .cert-edit, .cert-table .cert-actions { width: auto; min-width: 0; max-width: none; }
}

/* Audit fixes (v2.4.0) */
/* U7: nothing runs off a phone screen. */
.inv-picker .rg-projects { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.stat-value { overflow-wrap: anywhere; }
@media (max-width: 480px) { .stat-value { font-size: 22px; } }
.health-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
/* U9: printed lists show every column. */
@media print { .table-wrap { overflow: visible !important; } }
/* U10/U11: visible keyboard focus; readable chips. */
button.drill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 2.6 «المهمات المطلوبة» */
.task-list li.is-new .cell-main::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-inline-start: 8px; vertical-align: middle; }
.task-view { display: grid; gap: 16px; }
.task-view > .card { margin: 0; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-body { margin: 14px 0 0; white-space: normal; line-height: 1.8; overflow-wrap: anywhere; }
.task-note { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2, rgba(0,0,0,.03)); font-size: 14px; overflow-wrap: anywhere; }
.task-note svg { flex: none; margin-top: 3px; color: var(--muted); }
.task-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.task-actions form { flex: 1 1 260px; margin: 0; }
.task-actions form.inline-form { flex: 0 0 auto; display: block; }
.task-admin { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.task-admin form { margin: 0; }
.task-form { max-width: 760px; }
.task-row { display: flex; flex-wrap: wrap; gap: 16px; }
.task-row .field { flex: 1 1 200px; }
.task-picker { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 18px; min-width: 0; }
.task-picker legend { padding: 0 6px; font-weight: 600; }
.task-pick-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.task-pick-btns .btn.is-on { background: var(--brand); color: #fff !important; border-color: var(--brand); }
.task-pick-btns .btn.is-on svg { color: #fff; }
.task-pick-search { margin-top: 12px; }
.task-pick-search input { width: 100%; }
.task-pick-results { display: grid; gap: 4px; margin-top: 6px; max-height: 260px; overflow: auto; }
.task-pick-hit { text-align: start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.task-pick-hit:hover:not(:disabled) { border-color: var(--brand); }
.task-pick-hit:disabled { opacity: .5; cursor: default; }
.task-pick-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.task-pick-list li { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.task-pick-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.task-pick-head [data-pick-remove] { margin-inline-start: auto; }
.task-pick-list textarea { width: 100%; }

/* 2.6 العملاء المحتملون: التواصل والملاحظات */
.lead-follow { white-space: nowrap; }
.lead-follow-in { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.lead-follow-in form { margin: 0; }
.lead-contact { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.lead-contact.is-on { background: var(--ok-soft, #e7f6ee); color: var(--ok, #157f4a) !important; border-color: transparent; }
.lead-last-note { display: flex; gap: 4px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-last-note svg { flex: none; }
.lead-notes-row > td { background: var(--surface-2, rgba(0,0,0,.02)); }
.lead-notes { max-width: 760px; padding: 6px 0; }
.lead-notes .timeline-actions { display: flex; gap: 6px; align-items: flex-start; }
.lead-note-edit form { margin-top: 6px; display: grid; gap: 6px; min-width: 240px; }
.lead-note-add { display: grid; gap: 6px; margin-top: 10px; justify-items: start; }
.lead-note-add textarea, .lead-note-edit textarea { width: 100%; }
.lead-type-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; }
.lead-type-line select { height: 28px; font-size: 12px; padding-block: 0; }

/* 2.6 diplomas */
.dip-figs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 14px; }
.dip-figs dt { color: var(--muted); }
.dip-figs dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .dip-figs { grid-template-columns: 1fr; } .dip-figs dd { margin-bottom: 6px; } }
/* 2.6 diplomas: reports, statement, trainee-file tab — narrow screens scroll the table, cells keep one line */
[data-dip-tab] td, [data-dip-overdue] td, [data-dip-contracts] td, [data-dip-rows] td { white-space: nowrap; }
.dip-grid { gap: 20px; align-items: start; }
.dip-grid > .card { margin-top: 0; }
@media (max-width: 760px) { .dip-grid { grid-template-columns: minmax(0, 1fr); } }
@media print { .dip-filters, [data-dip-tab] .actions, .wa-btn { display: none !important; } }

/* ===== 2.6 diplomas (simplified): screens, installment table, dashboard charts. Every selector is .dip-*. ===== */
.dip-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 32px; }
.dip-cards > .card { margin: 0; }
.dip-plan-code, .dip-term-no { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; margin-inline-end: 6px; }
[data-theme="dark"] .dip-plan-code, [data-theme="dark"] .dip-term-no { color: #c4b3ff; }
.dip-plan-total { margin: 0 0 6px; font-size: 15px; }
.dip-plan-total b { font-size: 22px; font-variant-numeric: tabular-nums; }
.dip-lines { margin: 8px 0 0; padding-inline-start: 18px; color: var(--ink-2); line-height: 1.8; }
.dip-terms { display: grid; gap: 16px; }
.dip-term .card-head { flex-wrap: wrap; gap: 6px; }
.dip-term-chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dip-term-chips li { padding: 2px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.dip-cohort-card { text-decoration: none !important; color: inherit !important; transition: border-color .15s; }
.dip-cohort-card:hover, .dip-cohort-card:focus-visible { border-color: var(--brand); }
.dip-cohort-card h2 { font-size: 17px; margin: 0 0 4px; }
.dip-date { min-width: 150px; }
.dip-terms-table td, .dip-inst-table td { vertical-align: middle; }
.dip-computed { font-variant-numeric: tabular-nums; color: var(--muted); }
.dip-find { position: relative; max-width: 520px; }
.dip-find-list { position: absolute; z-index: 20; inset-inline: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(27, 26, 94, .12); max-height: 280px; overflow: auto; }
.dip-find-list button { display: block; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.dip-find-list button:hover, .dip-find-list button:focus-visible { background: var(--brand-soft); }
.dip-inst-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.dip-pop { position: relative; }
.dip-pop > summary { list-style: none; }
.dip-pop > summary::-webkit-details-marker { display: none; }
.dip-pop-body { position: absolute; z-index: 15; inset-inline-end: 0; top: calc(100% + 6px); width: 280px; padding: 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(27, 26, 94, .16); text-align: start; }
.dip-pop-body .field { margin-bottom: 10px; }
.dip-confirm { border-inline-start: 4px solid var(--warn); }
.dip-warn-list { margin: 0 0 12px; padding-inline-start: 18px; line-height: 1.8; }
.dip-h2 { font-size: 18px; margin: 28px 0 12px; }
.dip-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.dip-kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.dip-kpi-label { color: var(--muted); font-size: 13px; }
.dip-kpi-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); text-align: start; }
.dip-kpi-unit { color: var(--muted); font-size: 12px; }
.dip-kpi.is-alert { border-color: var(--bad); }
.dip-kpi.is-alert .dip-kpi-value { color: var(--bad); }
.dip-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; margin-bottom: 8px; }
.dip-chart { margin: 0; }
.dip-chart.is-wide { grid-column: 1 / -1; }
.dip-chart .card-head p { margin: 2px 0 0; }
.dip-svg { width: 100%; height: auto; display: block; overflow: visible; }
.dip-svg .grid { stroke: var(--line); stroke-width: 1; }
.dip-svg .axis, .dip-svg .val { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.dip-svg text { unicode-bidi: plaintext; }
.dip-svg .lab { fill: var(--ink-2); font-size: 12px; }
.dip-svg .val { fill: var(--ink); font-weight: 600; }
.dip-svg .bar.s1, .dip-legend .sw.s1 { fill: #5b3fd1; background: #5b3fd1; }
.dip-svg .bar.s2, .dip-legend .sw.s2 { fill: #f35c00; background: #f35c00; }
.dip-svg .bar.rest, .dip-legend .sw.rest { fill: var(--line-strong); background: var(--line-strong); }
[data-theme="dark"] .dip-svg .bar.s1, [data-theme="dark"] .dip-legend .sw.s1 { fill: #9887ef; background: #9887ef; }
[data-theme="dark"] .dip-svg .bar.s2, [data-theme="dark"] .dip-legend .sw.s2 { fill: #f0702a; background: #f0702a; }
.dip-svg .bar:hover { opacity: .85; }
.dip-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.dip-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.dip-table-view { margin-top: 10px; }
.dip-table-view summary { color: var(--muted); cursor: pointer; }
.dip-panel h3 { margin: 0 0 10px; font-size: 16px; }
.dip-meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 12px; }
.dip-meter span { display: block; height: 100%; background: #5b3fd1; border-radius: 4px; }
[data-theme="dark"] .dip-meter span { background: #9887ef; }
@media (max-width: 640px) {
	.dip-charts { grid-template-columns: 1fr; }
	.dip-pop-body { position: static; width: auto; margin-top: 6px; }
	.dip-inst-acts { justify-content: flex-start; }
}

/* 2.7 diploma registration applications */
.dip-reg-link { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 16px; overflow-wrap: anywhere; }
.dip-app-status { margin: -6px 0 16px; }
.dip-app-grid { gap: 20px; align-items: start; }
.dip-app-grid > .card { margin-bottom: 0; }
.dip-app-drift { display: block; }
.dip-app-drift ul { margin: 6px 0; }
.dip-facts { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.dip-app-done h2, .dip-accept h2 { margin-top: 0; }
.dip-received { font-weight: 600; }
.dip-app-actions { display: grid; gap: 12px; margin: 16px 0; }
.dip-app-actions details summary { cursor: pointer; }
@media (max-width: 760px) { .dip-app-grid { grid-template-columns: 1fr; } }
.dip-reg-toggle { margin-inline-start: auto; }

/* A section with an open calendar is drawn above the sections after it (each section is its own layer because of
   its entrance animation, so a later section would otherwise cover the pop-up). */
.content > *:has(.dp-pop:not([hidden])), .card:has(.dp-pop:not([hidden])) { position: relative; z-index: 40; }

/* Filter bars of the diploma screens (diploma, cohort, plan, search…): one tidy panel above the content. */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0 0 22px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.filters .field { flex: 0 1 260px; min-width: 200px; margin: 0; }
.filters .field:has(input[type=search]) { flex: 1 1 280px; }
.filters .field label { margin-bottom: 6px; }
.filters > .btn { flex: none; }
@media (max-width: 640px) {
	.filters { padding: 12px 14px; }
	.filters .field, .filters .field:has(input[type=search]) { flex: 1 1 100%; min-width: 0; }
	.filters > .btn { width: 100%; }
}

/* 2.7: plan cards open the plan's details; the plan details block */
a.dip-plan-link { display: block; color: inherit; text-decoration: none; transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s; }
a.dip-plan-link:hover, a.dip-plan-link:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--brand); }
.dip-plan-of { margin: -4px 0 10px; }
.dip-plan-more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--brand); }
[data-theme="dark"] .dip-plan-more { color: #c4b3ff; }
.dip-plan-detail { margin-bottom: 18px; }
.dip-plan-detail .grid-2 { gap: 12px 28px; align-items: start; }
.dip-h3 { margin: 0 0 8px; font-size: 15px; }
.dip-plan-lines { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.dip-status-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 18px; }
.dip-plan-lists { gap: 20px; align-items: start; margin-top: 20px; }
.dip-plan-lists > .card { margin: 0; }
.table tr.is-now td { background: var(--brand-soft); font-weight: 600; }
.bad-text { color: var(--bad); }
@media (max-width: 760px) { .dip-plan-detail .grid-2, .dip-plan-lists { grid-template-columns: 1fr; } }

/* 2.7: «خطط الدفع» — one clear card per plan */
.dip-plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 20px; margin-bottom: 28px; }
.dip-plan-grid > .card { margin: 0; }
.dip-plan-card { display: flex; flex-direction: column; overflow: hidden; }
.dip-plan-card.is-archived { opacity: .75; }
.dpc-head { display: flex; gap: 12px; align-items: flex-start; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.dpc-head .dip-plan-code { flex: none; min-width: 36px; height: 36px; font-size: 16px; border-radius: 10px; margin: 0; }
.dpc-title { min-width: 0; }
.dpc-title h2 { margin: 0 0 6px; font-size: 17px; line-height: 1.45; }
.dpc-title p { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dpc-total { display: flex; align-items: baseline; gap: 8px; padding: 16px 22px 4px; }
.dpc-total span { color: var(--muted); font-size: 14px; }
.dpc-total b { font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.dpc-total small { color: var(--muted); }
.dpc-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 22px 4px; }
.dpc-figs > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2, transparent); }
.dpc-figs dt { font-size: 12px; color: var(--muted); }
.dpc-figs dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.dpc-body { padding: 14px 22px 6px; flex: 1; }
.dpc-body h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.dpc-lines { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; line-height: 1.7; color: var(--ink-2); }
.dpc-meta { margin: 12px 0 0; }
.dpc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 22px 18px; border-top: 1px solid var(--line); margin-top: 12px; }
.dpc-actions .inline-form { margin: 0; }

/* 2.7: «الفصول والمواد» — term cards in a grid, a tidy add-subject row */
.dip-terms { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 20px; margin-bottom: 28px; }
.dip-terms > .card { margin: 0; display: flex; flex-direction: column; }
.dip-term .list { flex: 1; }
.dip-term-empty { padding: 16px 20px; }
.dip-sub-add { display: grid; grid-template-columns: minmax(0, 1fr) 110px 96px auto; gap: 8px; align-items: center; margin: 0; padding: 14px 20px; border-top: 1px dashed var(--line); }
.dip-sub-add input { width: 100%; min-width: 0; }
.dip-term-edit { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.dip-term-edit summary { cursor: pointer; color: var(--muted); }
.dip-term-edit .toolbar { margin: 12px 0 0; }
@media (max-width: 560px) {
	.dip-plan-grid, .dip-terms { grid-template-columns: 1fr; }
	.dpc-figs { grid-template-columns: 1fr 1fr; }
	.dip-sub-add { grid-template-columns: 1fr 1fr; }
	.dip-sub-add input[name=name] { grid-column: 1 / -1; }
	.dip-sub-add .btn { grid-column: 1 / -1; justify-content: center; }
}

/* 2.7: registration link card (copy / open / open-close), search field with its icon, button beside it */
.dip-reg-link { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 22px; }
.dip-reg-link .field { flex: 1 1 420px; margin: 0; }
.dip-reg-link .label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.dip-reg-link .copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dip-reg-link .copy-row input { flex: 1 1 260px; min-width: 0; }
.dip-reg-toggle { margin: 0; }
.filters input[type=search] { padding-inline-start: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a84a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 18px; }
.filters > .btn { align-self: flex-end; min-height: 44px; padding-inline: 22px; }
@media (max-width: 640px) { .dip-reg-link .copy-row .btn { flex: 1 1 auto; justify-content: center; } }

/* 2.7: «المتدربون» — cohort cards */
.dip-cohort-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; margin-bottom: 28px; }
.dip-cohort-grid > .card { margin: 0; }
a.dip-cohort-card { display: flex; flex-direction: column; color: inherit; text-decoration: none; overflow: hidden; transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s; }
a.dip-cohort-card:hover, a.dip-cohort-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--brand); }
.dcc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.dcc-head h2 { margin: 0 0 6px; font-size: 17px; line-height: 1.4; }
.dcc-head p { margin: 0; display: flex; align-items: center; gap: 6px; }
.dcc-count { flex: none; display: grid; justify-items: center; padding: 8px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); line-height: 1.1; }
.dcc-count b { font-family: var(--display); font-size: 24px; }
.dcc-count span { font-size: 12px; }
[data-theme="dark"] .dcc-count { color: #c4b3ff; }
.dcc-terms { display: grid; gap: 10px; padding: 16px 22px; flex: 1; }
.dcc-term { display: grid; grid-template-columns: 64px minmax(0, 1fr) 32px; align-items: center; gap: 10px; font-size: 13px; }
.dcc-term-name { color: var(--muted); white-space: nowrap; }
.dcc-term b { text-align: end; font-variant-numeric: tabular-nums; }
.dcc-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.dcc-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--accent, #f35c00)); }
.dcc-foot { padding: 12px 22px 16px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--brand); }
[data-theme="dark"] .dcc-foot { color: #c4b3ff; }
@media (max-width: 560px) { .dip-cohort-grid { grid-template-columns: 1fr; } }

/* 2.7: «تقرير خطط الدفع» — plan tabs as a segmented bar, the trainees table */
[data-plan-tab] { height: 40px; padding: 0 16px; }
.tabs:has([data-plan-tab]) { margin: 0 0 22px; padding: 6px; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs:has([data-plan-tab]) .tab { border-color: transparent; background: transparent; }
.tabs:has([data-plan-tab]) .tab.is-active { background: var(--brand); color: #fff !important; }
.tabs:has([data-plan-tab]) .tab .count { min-width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); font-size: 12px; }
.tabs:has([data-plan-tab]) .tab.is-active .count { background: rgba(255, 255, 255, .22); color: #fff; }
.dip-plan-detail, .dip-plan-detail + .stats, .dip-status-chips { margin-bottom: 22px; }
.dip-h2 { margin: 34px 0 14px; }
.dpr-card { overflow: hidden; }
.dpr-table th { font-size: 12.5px; letter-spacing: 0; white-space: nowrap; }
.dpr-table td { vertical-align: middle; padding-top: 14px; padding-bottom: 14px; }
.dpr-table tbody tr { transition: background .15s; }
.dpr-table tbody tr:hover td { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.dpr-who { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.dpr-avatar { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .dpr-avatar { color: #c4b3ff; }
.dpr-next { display: grid; gap: 2px; }
.dpr-date { font-weight: 600; white-space: nowrap; }
.dpr-amt { font-size: 12.5px; color: var(--muted); }
.dpr-next.is-late .dpr-date { color: var(--bad); }
.dpr-paid { display: grid; gap: 6px; min-width: 170px; }
.dpr-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.dpr-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ok, #12795a), color-mix(in srgb, var(--ok, #12795a) 60%, #fff)); }
.dpr-paid-text { font-size: 12.5px; color: var(--muted); }
.dpr-paid-text b { color: var(--ink); }
.dpr-left { font-weight: 700; white-space: nowrap; }
.dpr-go { text-align: end; white-space: nowrap; }
@media (max-width: 760px) { .tabs:has([data-plan-tab]) { width: 100%; } .dpr-go .btn { padding-inline: 10px; } }
.dip-plan-stats .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dip-plan-stats .stat-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dpr-months { max-height: 440px; overflow-y: auto; }
.dpr-months thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2, var(--surface)); }
.dpr-months tfoot td { position: sticky; bottom: 0; background: var(--surface-2, var(--surface)); }
@media (max-width: 760px) { .dip-plan-stats .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 2.7: diploma reports — figures grouped: the contracts' value (wide, with the collected share), then the period and balance */
.dip-rk { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.rk { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.rk .stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.rk .stat-value { font-family: var(--display); font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.25; font-variant-numeric: tabular-nums; }
.rk-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.rk-ico { position: absolute; inset-inline-end: 16px; top: 16px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .rk-ico { color: #c4b3ff; }
.rk-ok .rk-ico { background: var(--ok-soft); color: var(--ok); }
.rk-warn .rk-ico { background: var(--warn-soft); color: var(--warn); }
.rk-bad .rk-ico { background: var(--bad-soft); color: var(--bad); }
.rk-bad .stat-value { color: var(--bad); }
.rk-hero { grid-column: span 2; grid-row: span 2; justify-content: center; gap: 8px; padding: 24px 26px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface) 70%); }
.rk-hero-val b { font-family: var(--display); font-size: 38px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.rk-hero-val small { color: var(--muted); font-size: 15px; }
.rk-hero .rk-sub .stat-value { display: inline; font-size: inherit; font-family: inherit; font-weight: 700; color: var(--ink); }
.rk-bar { height: 10px; margin-top: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rk-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 55%, #fff)); }
.rk-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.rk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rk-legend b { color: var(--ink); }
.rk-legend i { width: 10px; height: 10px; border-radius: 3px; }
.rk-legend .k-paid { background: var(--ok); }
.rk-legend .k-left { background: var(--line-strong, var(--line)); }
@media (max-width: 1100px) { .dip-rk { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .dip-rk { grid-template-columns: 1fr; } .rk-hero { grid-column: auto; grid-row: auto; } }
.dip-rk > [data-k="in_grace"], .dip-rk > [data-k="future"] { grid-column: span 2; }
.dip-filters { margin-bottom: 22px; }
.dip-filters .report-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; align-items: end; }
.dip-filters .report-row + .report-row { margin-top: 14px; }
.dip-filters .report-row .field { margin: 0; min-width: 0; }
.dip-filters .report-row .btn { height: 44px; justify-content: center; }
@media (max-width: 1100px) { .dip-rk > [data-k="in_grace"], .dip-rk > [data-k="future"] { grid-column: span 1; } }
@media (max-width: 560px) { .dip-rk > [data-k="in_grace"], .dip-rk > [data-k="future"] { grid-column: auto; } }

/* 2.7: plan cards — one type scale, lines as aligned rows (name · amount, then when) */
.dip-plan-card { font-size: 14px; }
.dpc-title h2 { font-family: var(--display); font-weight: 700; }
.dpc-total b, .dpc-figs dd, .dpc-l-amt { font-family: var(--display); }
.dpc-figs dt { font-size: 12.5px; }
.dpc-figs dd { font-size: 16px; }
.dpc-lines { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.dpc-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.dpc-line:last-child { border-bottom: 0; }
.dpc-l-name { font-weight: 600; color: var(--ink); line-height: 1.5; }
.dpc-l-amt { font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dpc-l-when { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.dpc-tag { display: inline-block; margin-inline-start: 6px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 20px; background: var(--warn-soft); color: var(--warn); vertical-align: middle; }
.dpc-meta { font-size: 12.5px; line-height: 1.7; }
