/* Vedicology Foundation staff portal — theme.
   Loaded after the page's own styles (index.php), so one look applies to every screen:
   older pages (applications, verification, inbox, forms, settings) and the MIS modules alike.
   Mobile first: every tap target is at least 44px, form text 16px (no zoom on phones),
   and lists become cards below 768px. */

:root {
    --brand: #e0530e;
    --brand-2: #f4761f;
    --brand-deep: #b8420a;
    --brand-soft: #fff3ea;
    --brand-line: #f6d2bb;
    --bg: #f6f3ef;
    --surface: #ffffff;
    --surface-2: #faf8f5;
    --line: #ebe4dc;
    --line-2: #f3eee8;
    --ink-900: #1f1a17;
    --ink-700: #3d3631;
    --ink-500: #6e655e;
    --ink-400: #8f857d;
    --ok: #15803d;
    --ok-soft: #e8f7ee;
    --warn: #b45309;
    --warn-soft: #fef6e4;
    --bad: #b91c1c;
    --bad-soft: #fdecec;
    --info: #1d4ed8;
    --info-soft: #eaf1fe;
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(40, 28, 16, 0.05), 0 1px 1px rgba(40, 28, 16, 0.03);
    --shadow: 0 2px 6px rgba(40, 28, 16, 0.05), 0 8px 24px rgba(40, 28, 16, 0.05);
    --shadow-lg: 0 18px 50px rgba(40, 28, 16, 0.18);
    --ring: 0 0 0 3px rgba(224, 83, 14, 0.22);
    /* Names the older styles use */
    --primary: var(--brand);
    --saffron: var(--brand-2);
    --ink: var(--ink-700);
    --ink-light: var(--ink-500);
    --border: var(--line);
    --cream: var(--brand-soft);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--ink-700);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1 { font-family: 'Merriweather', Georgia, serif; font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); line-height: 1.25; color: var(--ink-900); letter-spacing: -0.01em; }
h2 { font-family: 'Inter', sans-serif; font-size: 1.08rem; font-weight: 700; color: var(--ink-900); letter-spacing: -0.005em; }
h3, h4 { font-family: 'Inter', sans-serif; color: var(--ink-900); }
a { color: var(--brand-deep); }
::selection { background: #ffd9c2; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.container { padding: clamp(1rem, 0.6rem + 1.6vw, 2rem); }
/* The page always starts to the right of the sidebar, whatever comes between them in the page code
   (the older rule needed the content to follow the sidebar directly). */
header.sidebar ~ .container { margin-left: 248px; width: auto; }
body:has(.hv-app) header.sidebar ~ .container, body.mis-bare header.sidebar ~ .container { margin-left: 0; }
@media (max-width: 1024px) and (min-width: 769px) { header.sidebar ~ .container { margin-left: 208px; } }
@media (max-width: 768px) { header.sidebar ~ .container { margin-left: 0; } }
header.sidebar ~ .container > * { max-width: 1320px; margin-left: auto; margin-right: auto; }
header.sidebar ~ .container > .ib { max-width: none; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
/* Defaults only (zero specificity via :where): every button with its own class keeps its own look. */
:where(button) {
    min-height: 44px;
    border-radius: var(--r-sm);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.15s, border-color 0.15s, color 0.15s;
}
:where(button):hover { transform: translateY(-1px); }
.btn-small, .pl-btn:not(.pl-btn-ghost), .filter-btn {
    min-height: 44px;
    border-radius: var(--r-sm);
    font-weight: 600;
    background: linear-gradient(180deg, #ea5e17 0%, var(--brand) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(150, 50, 0, 0.25);
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.btn-small:hover, .pl-btn:hover, .filter-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(224, 83, 14, 0.25); }
.btn-small:active, .pl-btn:active { transform: translateY(0); }
button:disabled, .pl-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-small { display: inline-flex; align-items: center; justify-content: center; padding: 0 1rem; font-size: 0.85rem; }
.pl-btn-ghost, .filter-reset, .vcard-cancel, .fs-btn-ghost, .wiz-back, .modal-btn-cancel {
    background: var(--surface) !important;
    color: var(--ink-700) !important;
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow-sm) !important;
}
.pl-btn-ghost:hover, .filter-reset:hover, .vcard-cancel:hover, .fs-btn-ghost:hover { background: var(--surface-2) !important; border-color: #dcd2c7 !important; transform: none; }
.pl-btn-danger, .fs-btn-danger { color: var(--bad) !important; border-color: #f4c7c7 !important; }
.pl-btn-danger:hover, .fs-btn-danger:hover { background: var(--bad-soft) !important; }
.delete-btn, .modal-btn-delete { background: var(--bad) !important; min-height: 40px; border-radius: var(--r-sm); }
.wa-send, .ib-send { background: #1faa59 !important; }
.vcard-save { background: linear-gradient(180deg, #19a24f, var(--ok)) !important; }
.vcard-btn, .vcard-cancel, .vcard-next { min-height: 44px; height: auto; }

/* ── Form fields ──────────────────────────────────────────────────────── */
/* Plain fields get these defaults at zero specificity, so the home visit form, the inbox composer and
   the verification table keep their own sizes. The MIS screens' fields (.pl-field, filters) get them fully. */
:where(input[type="text"], input[type="password"], input[type="search"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="month"], select, textarea),
.pl-field input, .pl-field select, .pl-field textarea, .mis-filters input, .mis-filters select, .pl-filters select, .ms-toggle {
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background-color: var(--surface);
    color: var(--ink-900);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
:where(textarea) { min-height: 88px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-400); }
:where(input, select, textarea):focus, .ms-toggle:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.pl-field input[type="file"] { min-height: 0; border: 0; padding: 0; font-size: 0.9rem; background: none; }
label, .pl-field { color: var(--ink-700); }
.pl-field { font-size: 0.86rem; font-weight: 600; }
.pl-field small { font-weight: 400; }
@media (min-width: 769px) {
    :where(input, select, textarea), .pl-field input, .pl-field select, .pl-field textarea { font-size: 0.95rem; }
}

/* ── Surfaces: one card style everywhere ──────────────────────────────── */
.pl-panel, .db-panel, .wa-settings, .table-wrap, .vdecide, .vcard, .visit-panel, .mis-box, .fs-card,
.pl-case, .wa-history, .fs-empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.pl-panel { padding: clamp(1rem, 0.8rem + 0.8vw, 1.4rem); margin-bottom: 1.1rem; }
.pl-panel h2 { margin-bottom: 0.85rem; }
.wa-settings { padding: clamp(1.1rem, 0.8rem + 1vw, 1.75rem); margin-top: 1.25rem; }
.wa-settings h2 { font-family: 'Inter', sans-serif; font-size: 1.1rem; }
.error { border-radius: var(--r); border-left-width: 4px; background: var(--bad-soft); color: var(--bad); }
.success { border-radius: var(--r); background: var(--ok-soft); color: var(--ok); }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
header.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: none;
    gap: 1rem;
}
header.sidebar::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2), #f9c22e);
}
.logo-tag { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-deep); letter-spacing: 0.04em; }
.sidebar .nav { gap: 2px; }
.sidebar .nav a, .sidebar .nav-user a { min-height: 42px; border-radius: 10px; font-size: 0.92rem; color: var(--ink-700); }
.sidebar .nav a:hover { background: var(--surface-2); color: var(--ink-900); }
.sidebar .nav a.is-active { background: var(--brand-soft); color: var(--brand-deep); box-shadow: inset 3px 0 0 var(--brand); }
.sidebar .nav a svg { opacity: 0.7; }
.nav-badge { min-width: 1.35rem; height: 1.35rem; padding: 0 0.4rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-user { border-top-color: var(--line); }
.nav-user > span { color: var(--ink-500); }
.mis-search input { background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f857d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M21 21l-4.3-4.3M10.5 18a7.5 7.5 0 100-15 7.5 7.5 0 000 15z'/%3E%3C/svg%3E") no-repeat 0.7rem center / 16px; padding-left: 2.2rem; }

/* ── Dashboard header: a warm banner ──────────────────────────────────── */
.pl-dash-head {
    position: relative;
    overflow: hidden;
    padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
    border-radius: var(--r-lg);
    color: #fff;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(249, 194, 46, 0.45) 0%, rgba(249, 194, 46, 0) 55%),
        linear-gradient(135deg, #c2410c 0%, var(--brand) 45%, var(--brand-2) 100%);
    box-shadow: 0 10px 30px rgba(224, 83, 14, 0.22);
}
.pl-dash-head::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 28px solid rgba(255, 255, 255, 0.08);
}
.pl-dash-head h1 { color: #fff; font-size: clamp(1.3rem, 1rem + 1.2vw, 1.9rem); }
.pl-dash-date { color: rgba(255, 255, 255, 0.85) !important; }
.pl-dash-sub { font-family: 'Merriweather', serif; font-size: 1.2rem; margin: 2rem auto 1rem; }

/* To-do lines */
.pl-tasks { gap: 0.55rem; }
.pl-task {
    min-height: 56px;
    border-radius: var(--r);
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.pl-task:hover { background: var(--brand-soft); border-color: var(--brand-line); transform: translateY(-1px); }
.pl-task strong {
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--brand-deep);
    font-size: 1.1rem;
}
.pl-task.is-zero { opacity: 0.75; }
.pl-task.is-zero strong { color: var(--ink-400); }
.pl-task.is-urgent { background: var(--bad-soft); border-color: #f6caca; }
.pl-task.is-urgent strong { background: var(--bad); border-color: var(--bad); color: #fff; }
.pl-task.is-urgent.is-zero { background: var(--surface-2); border-color: var(--line-2); }
.pl-task.is-urgent.is-zero strong { background: var(--surface); border-color: var(--line); color: var(--ink-400); }

/* Stats */
.pl-stats div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 0.9rem 1rem; }
.pl-stats strong { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.75rem); color: var(--ink-900); }

/* Pipeline tiles */
.pl-pipe { gap: 0.55rem; }
.pl-pipe-stage {
    min-height: 100px;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--brand);
    transition: transform 0.15s, box-shadow 0.15s;
}
.pl-pipe-stage:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-line); border-top-color: var(--brand); }
.pl-pipe-stage.is-zero { background: var(--surface-2); border-top-color: var(--line); box-shadow: none; }
.pl-pipe-over { display: inline-block; justify-self: start; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--bad-soft); }

/* ── Pipeline as a flow (administrator's dashboard) ───────────────────── */
/* Filters folded under one button */
.pl-filter-box { margin-left: auto; }
.pl-filter-box > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0 0.9rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-700); font-size: 0.88rem; font-weight: 600;
}
.pl-filter-box > summary::-webkit-details-marker { display: none; }
.pl-filter-box > summary::before { content: ''; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 5h18M6 12h12M10 19h4'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 5h18M6 12h12M10 19h4'/%3E%3C/svg%3E") center / contain no-repeat; }
.pl-filter-box[open] { flex-basis: 100%; }
.pl-filter-box[open] > summary { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-deep); }
.pl-filter-box .pl-filters { margin-top: 0.75rem; }
.pl-filter-clear { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.5rem; font-weight: 600; }

/* One sentence + one action */
.pl-flow-sum { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 1.4rem; font-size: 0.95rem; color: var(--ink-500); }
.pl-flow-sum strong { font-size: 1.35rem; color: var(--ink-900); margin-right: 0.15rem; }
.pl-flow-alert {
    display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0 1rem; border-radius: 999px;
    background: var(--bad-soft); border: 1px solid #f6caca; color: var(--bad); font-weight: 700; text-decoration: none;
}
.pl-flow-alert:hover { background: #fbdcdc; }
.pl-flow-alert b { font-size: 1.05rem; }
.pl-flow-fine { color: var(--ok); font-weight: 700; }

/* The track: five coloured phases, stages as circles on one line */
.pl-flow-track { display: flex; align-items: stretch; overflow-x: auto; padding: 0.2rem 0 0.4rem; scrollbar-width: thin; }
.pl-flow-phase { flex: var(--n) 1 0; min-width: calc(var(--n) * 86px); display: flex; flex-direction: column; }
.pl-flow-phase > header {
    margin: 0 0.4rem 0.9rem; padding-bottom: 0.35rem; border-bottom: 3px solid var(--c);
    color: var(--c); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.pl-flow-phase ol { position: relative; flex: 1; list-style: none; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
/* The pipe, through the centre of the circles */
.pl-flow-phase ol::before {
    content: ''; position: absolute; left: 0; right: 0; top: 30px; height: 4px; border-radius: 4px;
    background: color-mix(in srgb, var(--c) 25%, #fff);
}
.pl-flow-step a {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.55rem; height: 100%;
    padding: 0 0.25rem 0.5rem; border-radius: 14px; text-align: center; color: var(--ink-700); text-decoration: none;
}
.pl-flow-step a:hover .pl-flow-node { transform: translateY(-2px); box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 35%, transparent); }
.pl-flow-step a:hover .pl-flow-name { color: var(--c); }
/* The count, inside the circle */
.pl-flow-node {
    position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 64px; height: 64px; border-radius: 50%; border: 3px solid #e4ddd5; background: #fff;
    color: #c4bbb1; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums;
    transition: transform 0.15s, box-shadow 0.15s;
}
.pl-flow-step.has-cases .pl-flow-node { border-color: var(--c); background: var(--c); color: #fff; font-size: 1.5rem; }
.pl-flow-step.is-late .pl-flow-node { box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--bad); }
/* Sits on the top-right of the circle (the circle is 64px wide and centred in the step). */
.pl-flow-badge {
    position: absolute; z-index: 2; top: -10px; left: calc(50% + 14px); padding: 0.1rem 0.45rem; border-radius: 999px; white-space: nowrap;
    background: var(--bad); color: #fff; font-size: 0.66rem; font-weight: 800; border: 2px solid #fff;
}
.pl-flow-name { font-size: 0.82rem; font-weight: 600; line-height: 1.25; color: var(--ink-700); }
.pl-flow-step:not(.has-cases) .pl-flow-name { color: var(--ink-400); font-weight: 500; }
.pl-flow-step.has-cases .pl-flow-name { color: var(--ink-900); font-weight: 700; }
/* Chevron between phases */
.pl-flow-arrow { flex: 0 0 14px; align-self: flex-start; margin-top: 4.15rem; height: 12px; position: relative; }
.pl-flow-arrow::before {
    content: ''; position: absolute; left: 0; top: 0; width: 8px; height: 8px;
    border-top: 3px solid #d3c9be; border-right: 3px solid #d3c9be; transform: rotate(45deg);
}
/* Closed cases */
.pl-flow-closed { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.pl-flow-closed a {
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 40px; padding: 0 0.85rem; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-700); font-size: 0.86rem; font-weight: 600; text-decoration: none;
}
.pl-flow-closed a:hover { border-color: #d8cec3; }
.pl-flow-closed i { font-style: normal; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 0.72rem; }
.pl-flow-closed .is-rejected i { background: var(--bad-soft); color: var(--bad); }
.pl-flow-closed .is-withdrawn i { background: var(--warn-soft); color: var(--warn); }
.pl-flow-closed .is-completed i { background: var(--ok-soft); color: var(--ok); }

/* Phones and narrow screens: the flow runs downwards, like a timeline */
@media (max-width: 900px) {
    .pl-flow-track { flex-direction: column; overflow: visible; }
    .pl-flow-phase { min-width: 0; margin-bottom: 0.4rem; }
    .pl-flow-phase > header { margin: 0.4rem 0 0.3rem; }
    .pl-flow-arrow { display: none; }
    .pl-flow-phase ol { display: block; }
    .pl-flow-phase ol::before { left: 23px; right: auto; top: 8px; bottom: 8px; width: 4px; height: auto; }
    .pl-flow-step a { flex-direction: row; gap: 0.9rem; min-height: 60px; padding: 0.3rem 0.5rem 0.3rem 0; text-align: left; }
    .pl-flow-node { width: 50px; height: 50px; font-size: 1.1rem; }
    .pl-flow-step.has-cases .pl-flow-node { font-size: 1.2rem; }
    .pl-flow-name { font-size: 0.95rem; }
    .pl-flow-badge { position: static; margin-left: auto; border: 0; font-size: 0.75rem; padding: 0.15rem 0.55rem; }
}
/* Cards (lists of cases, colleges, batches) */
.pl-cards { gap: 0.5rem; }
.pl-cards a { border-radius: var(--r); border-color: var(--line); box-shadow: var(--shadow-sm); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.pl-cards a:hover { border-color: var(--brand-line); transform: translateY(-1px); box-shadow: var(--shadow); }
.pl-team a { border-radius: var(--r); background: var(--surface-2); }

/* Pills */
.pl-pill, .db-pill, .badge, .fs-type, .wa-tpl-status, .mis-tag {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.76rem;
    padding: 0.18rem 0.6rem;
    line-height: 1.4;
}
.pl-pill-open { background: var(--info-soft); color: var(--info); }
.pl-pill-hold { background: var(--warn-soft); color: var(--warn); }
.pl-pill-done { background: var(--ok-soft); color: var(--ok); }
.pl-pill-closed { background: #f1efec; color: var(--ink-500); }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow: hidden; }
th {
    background: var(--surface-2);
    padding: 0.85rem 1rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--ink-500);
    border-bottom: 1px solid var(--line);
}
td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line-2); font-size: 0.92rem; }
tbody tr:hover { background: #fffaf6; box-shadow: inset 3px 0 0 var(--brand); }
.hvr-table { border-radius: var(--r); border: 1px solid var(--line); overflow-x: auto; background: var(--surface); }
.hv-list th, .hv-list td { padding: 0.7rem 0.9rem; }
.hv-list input, .hv-list select { min-height: 40px; }

/* Filter bar on All Applications */
.filter-bar { gap: 0.85rem 1rem; align-items: flex-end; }
.filter-field > label { font-size: 0.78rem; font-weight: 600; color: var(--ink-500); text-transform: none; letter-spacing: 0; }
.filter-check { min-height: 44px; }
.pl-filter-note { background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--r); padding: 0.6rem 0.85rem; color: var(--ink-700); }

/* ── Case page ────────────────────────────────────────────────────────── */
.stages {
    max-width: 100%;
    justify-content: flex-start;
    justify-content: safe center;   /* centred when the tabs fit, scrolls from the start when they don't */
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    background: var(--surface);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}
.stages::-webkit-scrollbar { display: none; }
.stage { flex: none; scroll-snap-align: start; min-height: 52px; }
.stage-line { flex: 0 0 18px; min-width: 18px; }
.stage.is-current { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.pl-case { padding: clamp(1rem, 0.8rem + 0.8vw, 1.4rem); border-left: 4px solid var(--brand); }
.pl-case-stage { font-family: 'Merriweather', serif; }
.vcard, .vdecide { border-radius: var(--r-lg); }
.section-head h2 { font-family: 'Merriweather', serif; font-size: 1.1rem; }
.detail-table th { background: var(--surface-2); }
.detail-table tr.is-correct td { background: #f6fcf8; }
.visit-panel { padding: clamp(1rem, 0.8rem + 1vw, 1.75rem); }
.mis-case-panel { animation: misFade 0.18s ease-out; }
@keyframes misFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Documents, timeline */
.mis-doc { border-radius: var(--r); border-color: var(--line); box-shadow: var(--shadow-sm); }
.mis-doc-system { box-shadow: none; }
.mis-upload { background: var(--brand-soft); border-color: var(--brand-line); border-style: dashed; }
.mis-upload:hover { border-color: var(--brand); }
.mis-timeline li { box-shadow: var(--shadow-sm); }
.mis-rows > li { border-color: var(--line); box-shadow: var(--shadow-sm); display: block; }
.mis-rows > li > div + div { margin-top: 0.2rem; }

/* Tabs on the college page */
.mis-tab-bar { border-bottom-color: var(--line); gap: 0.15rem; }
.mis-tab-bar button { min-height: 46px; color: var(--ink-500); }
.mis-tab-bar button.is-active { color: var(--brand-deep); }

/* ── Login ────────────────────────────────────────────────────────────── */
.login-page {
    padding: 1.25rem;
    background:
        radial-gradient(80% 60% at 85% 10%, rgba(249, 194, 46, 0.5) 0%, rgba(249, 194, 46, 0) 60%),
        radial-gradient(70% 70% at 0% 100%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(135deg, #b8420a 0%, var(--brand) 50%, var(--brand-2) 100%);
}
.login-box { border-radius: 22px; padding: clamp(1.5rem, 1rem + 2vw, 2.5rem); box-shadow: var(--shadow-lg); max-width: 420px; }
.login-box p { color: var(--ink-500); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.78rem; }
.login-box input { min-height: 48px; }
.login-box button { min-height: 48px; font-size: 1rem; margin-top: 0.4rem; }

/* ── Modals: bottom sheets on phones ──────────────────────────────────── */
.modal-content, .wa-box, .wiz-box { border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.modal-overlay, .wa-modal, .wiz { background: rgba(31, 26, 23, 0.45); backdrop-filter: blur(2px); }

/* ── Tablet ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 769px) {
    .pl-pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Phones ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body { font-size: 15px; }
    /* The menu opens over the page (a drawer), instead of pushing the page down. */
    header.sidebar { position: sticky; top: 0; z-index: 80; padding: 0.6rem 1rem; }
    header.sidebar .mis-search { display: none; }
    header.sidebar.menu-open { position: fixed; inset: 0; bottom: 0; max-height: none; height: 100dvh; overflow-y: auto; padding-bottom: 6rem; }
    header.sidebar.menu-open .mis-search { display: block; margin-top: 0.75rem; }
    header.sidebar.menu-open .nav a { min-height: 48px; font-size: 1rem; }
    .menu-toggle { min-height: 44px; min-width: 44px; border-color: var(--line); }

    /* Readable text and real tap targets, whatever the older styles said. */
    table { font-size: 0.9rem; }
    th, td { padding: 0.7rem 0.75rem; }
    .btn-small { min-height: 44px; padding: 0 1rem; font-size: 0.88rem; }
    button { min-height: 44px; }
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.05rem; }

    /* Lists are cards */
    table.rt tbody tr { border-radius: var(--r); border-color: var(--line); box-shadow: var(--shadow-sm); padding: 0.9rem 1rem; }
    table.rt td[data-label] { font-size: 0.9rem; min-height: 32px; }
    table.rt td.rt-action .btn-small { display: flex; }
    tbody tr:hover { box-shadow: none; }

    .pl-dash-head { border-radius: var(--r); }
    .pl-dash-head::after { width: 140px; height: 140px; border-width: 20px; }
    .pl-tasks { grid-template-columns: minmax(0, 1fr); }
    .pl-pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pl-pipe-stage { min-height: 88px; }
    .stages { border-radius: var(--r); padding: 0.35rem; }
    .stage { min-width: 76px; }
    .pl-case { border-left-width: 3px; }

    /* Pop-ups slide up from the bottom */
    .modal-overlay.show, .wa-modal:not([hidden]) { align-items: flex-end; }
    .modal-content, .wa-box { width: 100%; max-width: none; border-radius: 20px 20px 0 0; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; }
    .modal-actions, .wa-actions { flex-direction: column-reverse; }
    .modal-btn, .wa-actions button { width: 100%; min-height: 48px; }
}

@media (max-width: 480px) {
    body { font-size: 15px; }
    table { font-size: 0.9rem; }
    th, td { padding: 0.6rem 0.5rem; }
    .btn-small { font-size: 0.88rem; padding: 0 0.9rem; }
    button, input, select { font-size: 16px; }
    .container { padding: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
    body { background: #fff; }
    .pl-dash-head { background: none; color: var(--ink-900); box-shadow: none; }
    .pl-dash-head h1 { color: var(--ink-900); }
}

/* ─── Admin dashboard: compact layout ───────────────────────────────────── */
/* One row of key numbers at the top; each opens its list. */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); gap: 0.6rem; margin-bottom: 1.1rem; }
.dash-kpi { display: grid; gap: 0.1rem; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink-700); text-decoration: none; transition: border-color 0.15s; }
.dash-kpi:hover { border-color: var(--brand-line); }
.dash-kpi strong { font-size: 1.55rem; line-height: 1.15; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.dash-kpi span { font-size: 0.82rem; font-weight: 600; }
.dash-kpi small { font-size: 0.75rem; color: var(--ink-500); }
.dash-kpi.is-alert { border-color: var(--brand-line); background: var(--brand-soft); }
.dash-kpi.is-alert strong { color: var(--brand-deep); }

/* A section folded to one line: title on the left, key figures on the right, opens on click. */
.dash-fold > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; cursor: pointer; list-style: none; }
.dash-fold > summary::-webkit-details-marker { display: none; }
.dash-fold > summary h2 { margin: 0; font-size: 1.05rem; }
.dash-fold > summary h2::before { content: '▸'; display: inline-block; width: 1.1em; color: var(--ink-400); transition: transform 0.15s; }
.dash-fold[open] > summary h2::before { transform: rotate(90deg); }
.dash-fold > summary span { font-size: 0.85rem; color: var(--ink-500); }
.dash-fold:not([open]) { padding-top: 0.8rem; padding-bottom: 0.8rem; margin-bottom: 0.6rem; }
.dash-fold-body { margin-top: 1rem; }

/* ─── New look: navy sidebar, white top bar, coloured cards, charts ─────── */
:root { --bg: #f2f4f8; --navy: #0f1b3d; --navy-2: #0a1430; }

/* Sidebar: dark navy, the brand colour marks the page you are on */
header.sidebar {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    border-right: 0;
    box-shadow: 4px 0 24px rgba(10, 20, 48, 0.18);
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
header.sidebar .logo img { background: #fff; padding: 6px 10px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); box-sizing: content-box; }
header.sidebar .logo-tag { background: rgba(244, 118, 31, 0.16); border-color: rgba(244, 118, 31, 0.4); color: #ffb98a; }
header.sidebar .nav a, header.sidebar .nav-user a { color: #c3cbe0; }
header.sidebar .nav a svg { opacity: 0.85; }
header.sidebar .nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
header.sidebar .nav a.is-active {
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    box-shadow: 0 8px 18px -6px rgba(224, 83, 14, 0.6);
}
header.sidebar .nav a.is-active svg { opacity: 1; }
header.sidebar .nav-user { border-top-color: rgba(255, 255, 255, 0.09); }
header.sidebar .nav-user > span { color: #8f9bbd; }
header.sidebar .nav-user > span strong { color: #fff; }
header.sidebar .nav-user a { color: #ff9a8a; }
header.sidebar .nav-user a:hover { background: rgba(255, 90, 70, 0.12); color: #ffb3a7; }
header.sidebar .mis-search input { background-color: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); color: #fff; }
header.sidebar .mis-search input::placeholder { color: #8f9bbd; }
header.sidebar .mis-search input:focus { border-color: var(--brand-2); background-color: rgba(255, 255, 255, 0.1); }
header.sidebar .menu-toggle { color: #fff; border-color: rgba(255, 255, 255, 0.22); }
/* Close the menu down to its icons (computers only; phones keep the ☰ menu) */
.sb-collapse {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; min-height: 34px; padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: #c3cbe0; cursor: pointer;
}
.sb-collapse:hover { background: rgba(255, 255, 255, 0.14); color: #fff; transform: none; }
.sb-collapse svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
@media (min-width: 769px) {
    header.sidebar, header.sidebar ~ .container { transition: width 0.2s, margin-left 0.2s; }
    /* Open: the button sits on the right, on the same line as the role tag */
    header.sidebar .sb-top { position: relative; }
    html:not(.sb-collapsed) header.sidebar .sb-collapse { position: absolute; right: 0.4rem; bottom: -2px; }
    html.sb-collapsed header.sidebar { width: 76px; padding-left: 0.6rem; padding-right: 0.6rem; }
    html.sb-collapsed body:not(:has(.hv-app)):not(.mis-bare) header.sidebar ~ .container { margin-left: 76px; }
    html.sb-collapsed .sb-top { flex-direction: column; align-items: center; padding: 0; }
    html.sb-collapsed .sb-collapse svg { transform: rotate(180deg); }
    /* Only the emblem on the left of the logo */
    html.sb-collapsed header.sidebar .logo img { width: 34px; height: 34px; padding: 5px; object-fit: cover; object-position: left center; }
    html.sb-collapsed header.sidebar .logo-tag,
    html.sb-collapsed header.sidebar .mis-search,
    html.sb-collapsed header.sidebar .nav-label,
    html.sb-collapsed header.sidebar .nav-user > span { display: none; }
    html.sb-collapsed header.sidebar .nav a, html.sb-collapsed header.sidebar .nav-user a { position: relative; justify-content: center; padding: 0.5rem 0; }
    html.sb-collapsed header.sidebar .nav-badge { position: absolute; top: 2px; right: 4px; min-width: 1.1rem; height: 1.1rem; padding: 0 0.25rem; font-size: 0.62rem; }
}
/* Menu sections that open and close */
.nav-group { display: flex; flex-direction: column; }
.sidebar .nav .nav-group-head {
    display: flex; align-items: center; gap: 0.7rem; width: 100%; min-height: 42px; padding: 0.5rem 0.75rem; border: 0; border-radius: 10px;
    background: none; color: #c3cbe0; font: 600 0.92rem 'Inter', sans-serif; text-align: left; cursor: pointer; box-shadow: none;
}
.sidebar .nav .nav-group-head:hover { background: rgba(255, 255, 255, 0.07); color: #fff; transform: none; }
.nav-group-head svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.nav-group-head .nav-label { flex: 1; min-width: 0; }
.nav-group-head .nav-chev { width: 16px; height: 16px; margin-left: auto; opacity: 0.6; transition: transform 0.2s; }
.nav-group.is-open > .nav-group-head .nav-chev { transform: rotate(90deg); }
.nav-group.is-open > .nav-group-head .nav-group-count { display: none; }
.nav-group.has-active > .nav-group-head { color: #fff; }
.nav-group-items { display: none; flex-direction: column; gap: 2px; margin: 2px 0 4px 1.1rem; padding-left: 0.55rem; border-left: 1px solid rgba(255, 255, 255, 0.1); }
.nav-group.is-open > .nav-group-items { display: flex; }
.sidebar .nav .nav-group-items a { min-height: 38px; font-size: 0.88rem; }
@media (min-width: 769px) {
    /* Menu closed down to icons: no section headings, every item shows as an icon */
    html.sb-collapsed .nav-group-head { display: none !important; }
    html.sb-collapsed .nav-group-items { display: flex !important; margin: 0; padding: 0; border: 0; }
    html.sb-collapsed .nav-group + .nav-group, html.sb-collapsed .nav-group:first-of-type { padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
}

@media (max-width: 768px) {
    .sb-collapse { display: none; }
    header.sidebar { border-bottom: 0; }
    header.sidebar.menu-open .nav { border-top-color: rgba(255, 255, 255, 0.09); }
}

/* Dashboard top bar: greeting on the left; date, notifications, settings and who is signed in on the right */
.pl-dash-head {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1rem;
    padding: 0.85rem 1.25rem; color: var(--ink-900); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: visible;
}
.pl-dash-head::after { display: none; }
.pl-dash-head h1 { color: var(--ink-900); font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); margin: 0.1rem 0 0; }
.pl-dash-head .pl-dash-date { color: var(--brand-deep) !important; font-size: 0.74rem; }
.pl-dash-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0.55rem; }
.pl-dash-chip, .pl-dash-icon {
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 42px; padding: 0 0.85rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-700);
    font-size: 0.86rem; font-weight: 600; text-decoration: none;
}
.pl-dash-icon { position: relative; justify-content: center; width: 42px; padding: 0; cursor: pointer; list-style: none; }
.pl-dash-icon::-webkit-details-marker { display: none; }
.pl-dash-icon:hover { background: var(--surface-2); color: var(--ink-900); }
.pl-dash-head svg, .pl-dash-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pl-dash-icon b {
    position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: 0.68rem; line-height: 16px; text-align: center; border: 2px solid #fff;
}
.pl-dash-bell { position: relative; }
.pl-dash-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 260px; padding: 0.4rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.pl-dash-menu a { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0 0.7rem; border-radius: 8px; color: var(--ink-700); text-decoration: none; font-size: 0.9rem; }
.pl-dash-menu a:hover { background: var(--surface-2); }
.pl-dash-menu span { flex: 1; }
.pl-dash-menu strong { min-width: 1.6rem; padding: 0 0.4rem; border-radius: 999px; background: var(--line-2); color: var(--ink-500); text-align: center; font-size: 0.8rem; }
.pl-dash-menu strong.is-new { background: #ef4444; color: #fff; }
.pl-dash-user { display: inline-flex; align-items: center; gap: 0.55rem; padding-left: 0.35rem; }
.pl-dash-user > i {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-style: normal; font-weight: 800;
}
.pl-dash-user > span { display: grid; line-height: 1.2; }
.pl-dash-user strong { font-size: 0.9rem; color: var(--ink-900); }
.pl-dash-user small { font-size: 0.74rem; color: var(--ok); font-weight: 600; }
@media (max-width: 600px) {
    .pl-dash-tools { width: 100%; }
    .pl-dash-user { margin-left: auto; }
    .pl-dash-user > span { display: none; }
    .pl-dash-menu { right: auto; left: 0; }
}

/* Key numbers: one row of coloured cards */
.dash-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr)); gap: 0.9rem; }
@media (min-width: 1281px) { .dash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 480px) { .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; } }
.dash-kpi, .dash-kpi.is-alert {
    position: relative; overflow: hidden; align-content: start; gap: 0.2rem; min-height: 122px; padding: 1rem 1.1rem 1.05rem;
    border: 0; border-radius: 16px; color: #fff; background: var(--g); box-shadow: 0 12px 24px -12px var(--gs);
    transition: transform 0.15s, box-shadow 0.15s;
}
.dash-kpi::after {
    content: ''; position: absolute; right: -34px; bottom: -44px; width: 120px; height: 120px; border-radius: 50%;
    border: 18px solid rgba(255, 255, 255, 0.1); pointer-events: none;
}
.dash-kpi:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -12px var(--gs); }
.dash-kpi > span { padding-right: 46px; font-size: 0.86rem; font-weight: 600; color: rgba(255, 255, 255, 0.95); }
.dash-kpi strong, .dash-kpi.is-alert strong { color: #fff; font-size: clamp(1.5rem, 1.2rem + 0.9vw, 1.95rem); margin-top: 0.15rem; }
.dash-kpi small { color: rgba(255, 255, 255, 0.92); font-weight: 600; font-size: 0.76rem; }
.dash-kpi-ico {
    position: absolute; top: 0.9rem; right: 0.9rem; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.2);
}
.dash-kpi-ico svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Something is waiting: a white dot on the icon */
.dash-kpi.is-alert .dash-kpi-ico::after {
    content: ''; position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%;
    background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); animation: dashPulse 1.8s ease-in-out infinite;
}
@keyframes dashPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); } }
.dash-kpi:nth-child(6n + 1) { --g: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%); --gs: rgba(79, 70, 229, 0.75); }
.dash-kpi:nth-child(6n + 2) { --g: linear-gradient(135deg, #15803d 0%, #22c55e 100%); --gs: rgba(22, 163, 74, 0.75); }
.dash-kpi:nth-child(6n + 3) { --g: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%); --gs: rgba(234, 88, 12, 0.75); }
.dash-kpi:nth-child(6n + 4) { --g: linear-gradient(135deg, #0369a1 0%, #2563eb 100%); --gs: rgba(37, 99, 235, 0.75); }
.dash-kpi:nth-child(6n + 5) { --g: linear-gradient(135deg, #be185d 0%, #ec4899 100%); --gs: rgba(219, 39, 119, 0.75); }
.dash-kpi:nth-child(6n + 6) { --g: linear-gradient(135deg, #0f766e 0%, #06b6d4 100%); --gs: rgba(13, 148, 136, 0.75); }

/* Rows of cards */
.dash-row { display: grid; gap: 1.1rem; margin-bottom: 1.1rem; align-items: stretch; }
.dash-row > * { min-width: 0; margin-bottom: 0 !important; }
.dash-row-3 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
.dash-row-3b { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-row-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1280px) {
    .dash-row-3, .dash-row-3b { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-row-3 > :first-child, .dash-row-3b > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    .dash-row-3, .dash-row-3b, .dash-row-2, .dash-row-21 { grid-template-columns: minmax(0, 1fr); }
}
.pl-panel.dash-card {
    --pad-y: 1.1rem; --pad-x: 1.25rem; display: flex; flex-direction: column;
    padding: var(--pad-y) var(--pad-x); border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 27, 61, 0.04), 0 6px 20px rgba(15, 27, 61, 0.05);
}
/* Short lists inside a card: plain rows instead of boxed cards */
.dash-card .mis-two { gap: 0.4rem 1rem; }
.dash-card .mis-rows > li { padding: 0.4rem 0; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; box-shadow: none; background: none; font-size: 0.84rem; }
.dash-card .pl-panel-head { margin-bottom: 0.9rem; }
.dash-card h2 { display: flex; align-items: center; gap: 0.45rem; font-size: 1rem; }
.dash-muted { color: var(--ink-500); font-size: 0.8rem; font-weight: 600; }
.dash-link, .dash-foot a { color: var(--info); font-size: 0.84rem; font-weight: 700; text-decoration: none; }
.dash-link:hover, .dash-foot a:hover { text-decoration: underline; }
.dash-foot { margin-top: auto; padding-top: 0.9rem; text-align: center; }
/* The chart fills the card's height; the canvas is taken out of the flow so it never pushes the card taller. */
.dash-chart { position: relative; flex: 1 1 auto; min-height: 270px; }
.dash-chart canvas { position: absolute; inset: 0; }
@media (max-width: 600px) { .dash-chart { min-height: 230px; } }

/* By programme: doughnut with the total in the middle, and its legend */
.dash-donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.dash-donut { position: relative; height: 190px; }
.dash-donut > span {
    position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none;
    font-size: 1.35rem; font-weight: 800; color: var(--ink-900); line-height: 1.1;
}
.dash-donut > span small { font-size: 0.72rem; font-weight: 600; color: var(--ink-500); }
.dash-legend { list-style: none; display: grid; gap: 0.5rem; }
.dash-legend li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.86rem; }
.dash-legend i { flex: none; width: 12px; height: 12px; border-radius: 4px; }
.dash-legend span { flex: 1; min-width: 0; display: grid; font-weight: 600; color: var(--ink-900); }
.dash-legend span, .dash-legend span small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-legend span small { font-weight: 500; color: var(--ink-500); font-size: 0.74rem; }
.dash-legend strong { color: var(--ink-900); font-variant-numeric: tabular-nums; }

/* Money: rows with a coloured icon, amount and share of the approved total */
.dash-sum { list-style: none; display: grid; }
.dash-sum li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid var(--line-2); }
.dash-sum li span { display: grid; line-height: 1.3; }
.dash-sum li span strong { font-size: 1.05rem; }
.dash-sum li > i { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--t-soft); color: var(--t); }
.dash-sum li > i svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dash-sum li span { font-size: 0.9rem; font-weight: 600; color: var(--ink-700); }
.dash-sum li strong { color: var(--ink-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-sum li em { font-style: normal; text-align: right; font-size: 0.82rem; font-weight: 700; color: var(--ink-500); }
.dash-sum .is-blue { --t: #2563eb; --t-soft: #eaf1fe; }
.dash-sum .is-green { --t: #16a34a; --t-soft: #e8f7ee; }
.dash-sum .is-amber { --t: #d97706; --t-soft: #fef6e4; }
.dash-sum-total {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.85rem; padding: 0.75rem 1rem;
    border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 700;
}
.dash-sum-total strong { font-size: 1.15rem; }

/* Top colleges table */
.dash-table { overflow-x: auto; }
.dash-table table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dash-table th { padding: 0.6rem 0.5rem; font-size: 0.7rem; text-transform: uppercase; text-align: left; }
.dash-table td { padding: 0.65rem 0.5rem; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-table th:first-child, .dash-table td:first-child { width: 1.8rem; color: var(--ink-400); }
.dash-table th:nth-child(3), .dash-table td:nth-child(3) { width: 6.2rem; text-align: right; }
.dash-table th:nth-child(4), .dash-table td:nth-child(4) { width: 3.6rem; text-align: right; color: var(--ink-500); }
.dash-table tbody tr:hover { box-shadow: none; background: var(--surface-2); }
/* A bar under the college name, its length against the top college */
.dash-share { display: block; height: 5px; margin-top: 0.35rem; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.dash-share i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb, #7c3aed); }

/* To-do lines inside the narrow cards: one column, a little tighter */
.dash-compact .pl-tasks { grid-template-columns: minmax(0, 1fr); gap: 0.45rem; }
.dash-compact .pl-task { min-height: 46px; padding: 0.45rem 0.6rem 0.45rem 0.85rem; font-size: 0.88rem; }
.dash-compact .pl-task strong { min-width: 2.1rem; height: 2.1rem; font-size: 0.95rem; }
.dash-compact .mis-gap { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--line); }

/* Project Officer: Today card, small doughnut, stacked cards */
.dash-today { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 0.9rem; border-radius: 12px; background: var(--warn-soft); border: 1px solid #f7dfae; }
.dash-today > i { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 10px; background: #fff; color: var(--warn); }
.dash-today > i svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dash-today > span { display: grid; font-size: 0.82rem; color: var(--ink-500); line-height: 1.3; }
.dash-today strong { font-size: 1.05rem; color: var(--warn); }
.dash-today.is-done { background: var(--ok-soft); border-color: #c9ecd6; }
.dash-today.is-done > i, .dash-today.is-done strong { color: var(--ok); }
.dash-btn { display: flex; align-items: center; justify-content: center; margin-top: 0.7rem; text-decoration: none; color: #fff; }
.dash-sub { margin: 1.1rem 0 0.55rem; font-size: 0.8rem; font-weight: 700; color: var(--ink-500); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-donut-sm { height: 150px; margin-bottom: 0.9rem; }
.dash-card .pl-lead { margin: -0.5rem 0 0.8rem; }
.dash-stack { display: grid; gap: 1.1rem; align-content: start; min-width: 0; }
.dash-stack > .pl-panel { margin-bottom: 0; }

/* Birthdays: an animated cake, balloons and sparkles; confetti on a day with a birthday */
.dash-bday-art { margin-bottom: 0.9rem; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #fff4e8 0%, #fde7f3 100%); }
.dash-bday-art svg { display: block; width: 100%; height: auto; max-height: 150px; }
.dash-bday-art .fl, .dash-bday-art .bl, .dash-bday-art .sp, .dash-bday-art .cf { transform-box: fill-box; }
.dash-bday-art .fl { transform-origin: 50% 100%; animation: bdFlicker 0.9s ease-in-out infinite alternate; }
.dash-bday-art .fl2 { animation-delay: 0.3s; animation-duration: 0.75s; }
.dash-bday-art .fl3 { animation-delay: 0.55s; animation-duration: 1s; }
.dash-bday-art .bl { transform-origin: 50% 100%; animation: bdFloat 4s ease-in-out infinite; }
.dash-bday-art .bl2 { animation-delay: -1.3s; animation-duration: 4.6s; }
.dash-bday-art .bl3 { animation-delay: -2.4s; animation-duration: 3.8s; }
.dash-bday-art .sp { transform-origin: center; animation: bdTwinkle 2.2s ease-in-out infinite; }
.dash-bday-art .sp2 { animation-delay: 0.7s; }
.dash-bday-art .sp3 { animation-delay: 1.4s; }
.dash-bday-art .cf { animation: bdFall 3.5s linear infinite; }
.dash-bday-art .hb { font: 800 15px 'Inter', sans-serif; fill: #db2777; animation: bdPop 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bdFlicker { 0% { transform: scale(1, 1) rotate(-3deg); opacity: 1; } 100% { transform: scale(0.85, 1.15) rotate(3deg); opacity: 0.85; } }
@keyframes bdFloat { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes bdTwinkle { 0%, 100% { transform: scale(0.6) rotate(0deg); opacity: 0.4; } 50% { transform: scale(1.15) rotate(45deg); opacity: 1; } }
@keyframes bdFall { 0% { transform: translateY(0) rotate(0deg); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(130px) rotate(360deg); opacity: 0; } }
@keyframes bdPop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .dash-bday-art * { animation: none !important; } }

/* Needs my action: a red header strip, like an alert */
.dash-alert > .pl-panel-head {
    margin: calc(-1 * var(--pad-y)) calc(-1 * var(--pad-x)) 1rem; padding: 0.85rem var(--pad-x);
    background: linear-gradient(90deg, #fdecec 0%, #fff6f6 100%); border-bottom: 1px solid #f6caca; border-radius: 16px 16px 0 0;
}
.dash-alert h2 { color: var(--bad); }
.dash-alert h2 svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dash-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5rem; height: 1.5rem; padding: 0 0.4rem; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.75rem; }
.dash-alert.is-clear > .pl-panel-head { background: linear-gradient(90deg, var(--ok-soft) 0%, #f5fcf8 100%); border-bottom-color: #c9ecd6; }
.dash-alert.is-clear h2 { color: var(--ok); }

/* ─── All Applications / Verified: the dashboard look ─────────────────────── */
.app-head { margin-bottom: 1.1rem; }
.app-head h1 { margin: 0.1rem 0 0.15rem; }
.app-lead { margin: 0; max-width: 70ch; color: var(--ink-500); font-size: 0.9rem; }
.app-tools { flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.app-tools small { color: var(--ink-500); font-size: 0.74rem; }
.app-excel {
    display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 1.1rem; border-radius: 12px;
    background: linear-gradient(135deg, #15803d 0%, #22c55e 100%); color: #fff; font-size: 0.9rem; font-weight: 700; text-decoration: none;
    box-shadow: 0 10px 20px -10px rgba(22, 163, 74, 0.8); transition: transform 0.15s, box-shadow 0.15s;
}
.app-excel:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 14px 24px -10px rgba(22, 163, 74, 0.85); }
.app-excel svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Filters: one tidy grid */
.app-filters { margin-bottom: 1.1rem; }
.app-filters .filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 0.9rem 1rem; align-items: end; }
.app-filters .filter-field > label { margin-bottom: 0.35rem; }
.app-filters .filter-check {
    display: flex; align-items: center; gap: 0.5rem; min-height: 46px; padding: 0 0.85rem;
    border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.app-filters .filter-actions { display: flex; gap: 0.6rem; }
.app-filters .filter-btn, .app-filters .filter-reset { flex: 1; height: 46px; padding: 0 1.2rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.app-filters .pl-filter-note { margin: 0.9rem 0 0; }

/* Results table in a card */
.app-results { border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 27, 61, 0.04), 0 6px 20px rgba(15, 27, 61, 0.05); }
.app-results-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1rem; padding: 1.1rem 1.25rem 0.9rem; }
.app-results-head h2 { margin: 0; font-size: 1rem; }
.app-table th { white-space: nowrap; }
.app-table td { vertical-align: middle; }
.app-id {
    display: inline-block; padding: 0.2rem 0.5rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2);
    color: var(--ink-500); font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; white-space: nowrap;
}
.app-college { display: block; max-width: 18rem; color: var(--ink-700); line-height: 1.4; }
.app-prog { display: inline-block; max-width: 11rem; border-radius: 10px; white-space: normal; line-height: 1.3; }
.app-owner { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink-700); font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.app-owner i {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-style: normal; font-size: 0.72rem; font-weight: 800;
}
.app-date { display: grid; color: var(--ink-700); font-size: 0.86rem; line-height: 1.3; white-space: nowrap; }
.app-date small { color: var(--ink-500); font-size: 0.74rem; }
.app-view { min-height: 38px; padding: 0 0.95rem; border-radius: 10px; white-space: nowrap; }
/* Verified: one card per student, one column */
.vf-results-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.4rem 0 0.8rem; scroll-margin-top: 1rem; }
.vf-results-head h2 { margin: 0; font-size: 1.05rem; }
.vf-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.vf-empty, .vf-list > .error { grid-column: 1 / -1; }
.vf-empty { padding: 2rem; text-align: center; color: var(--ink-500); background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }
.vf-card {
    --t1: #4338ca; --t2: #7c3aed;
    position: relative; overflow: hidden; display: grid; gap: 0.9rem; padding: 1.15rem 1.25rem 1.1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 27, 61, 0.04), 0 6px 20px rgba(15, 27, 61, 0.05); transition: transform 0.15s, box-shadow 0.15s;
}
.vf-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--t1), var(--t2)); }
.vf-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15, 27, 61, 0.05), 0 14px 30px rgba(15, 27, 61, 0.09); }
.vf-tone-1 { --t1: #15803d; --t2: #22c55e; }
.vf-tone-2 { --t1: #ea580c; --t2: #f59e0b; }
.vf-tone-3 { --t1: #0369a1; --t2: #2563eb; }
.vf-tone-4 { --t1: #be185d; --t2: #ec4899; }
.vf-tone-5 { --t1: #0f766e; --t2: #06b6d4; }
.vf-head { display: flex; gap: 0.9rem; align-items: flex-start; }
.vf-avatar {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px;
    background: linear-gradient(135deg, var(--t1), var(--t2)); color: #fff; font-weight: 800; font-size: 1rem; letter-spacing: 0.02em;
    box-shadow: 0 8px 16px -8px var(--t1);
}
.vf-title { min-width: 0; flex: 1; }
.vf-card .vf-name { display: block; color: var(--ink-900); font-size: 1.05rem; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.vf-card .vf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.45rem; }
.vf-college { display: flex; align-items: flex-start; gap: 0.4rem; margin-top: 0.55rem; color: var(--ink-500); font-size: 0.86rem; line-height: 1.4; }
.vf-college svg { flex: none; width: 16px; height: 16px; margin-top: 0.1rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.vf-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding-top: 0.85rem; border-top: 1px dashed var(--line); }
.vf-by { display: flex; align-items: center; gap: 0.55rem; min-width: 0; color: var(--ink-500); font-size: 0.82rem; }
.vf-by > i {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--ok-soft); color: var(--ok); font-style: normal; font-weight: 800; font-size: 0.78rem;
}
.vf-by > span { display: grid; line-height: 1.3; }
.vf-by strong { color: var(--ink-900); }
.vf-by small { font-size: 0.74rem; }
.vf-open { min-height: 40px; padding: 0 1rem; border-radius: 10px; white-space: nowrap; }
.vf-more > summary {
    display: inline-flex; align-items: center; gap: 0.4rem; min-height: 34px; padding: 0 0.85rem; border-radius: 999px;
    background: #fef3c7; border: 1px solid #fde68a; color: #92400e; font-size: 0.82rem; font-weight: 700; list-style: none; cursor: pointer; user-select: none;
}
.vf-more > summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.vf-more > summary::-webkit-details-marker { display: none; }
.vf-more > summary::after { content: '▾'; transition: transform 0.15s; }
.vf-more[open] > summary::after { transform: rotate(180deg); }
.vf-more > summary:hover { background: #fde68a; }
.vf-changes { width: 100%; margin-top: 0.75rem; border-collapse: separate; border-spacing: 0; font-size: 0.86rem; table-layout: fixed; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.vf-changes th { padding: 0.55rem 0.75rem; background: var(--surface-2); color: var(--ink-500); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-align: left; text-transform: uppercase; }
.vf-changes td { padding: 0.55rem 0.75rem; border-top: 1px solid var(--line-2); vertical-align: top; overflow-wrap: anywhere; }
.vf-changes tbody tr:hover { box-shadow: none; background: transparent; }
.vf-changes th:first-child, .vf-changes td:first-child { width: 30%; }
.vf-changes td:first-child { color: var(--ink-500); font-weight: 600; }
.vf-changes .was { padding: 0.05rem 0.35rem; border-radius: 5px; background: var(--bad-soft); color: #b91c1c; text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, 0.45); }
.vf-changes .now { padding: 0.05rem 0.35rem; border-radius: 5px; background: var(--ok-soft); color: #047857; font-weight: 700; }

@media (max-width: 768px) {
    .vf-foot { flex-direction: column; align-items: stretch; }
    .vf-open { justify-content: center; }
    .vf-changes th:first-child, .vf-changes td:first-child { width: 34%; }
    .app-tools { width: 100%; align-items: stretch; }
    .app-excel { justify-content: center; }
    .app-tools small { display: none; }
    .app-results-head { padding: 0.2rem 0.2rem 0.8rem; }
    .app-college { max-width: none; text-align: right; }
    .app-prog { max-width: none; }
    .app-filters .filter-actions { grid-column: 1 / -1; }
}

/* ─── Every other page: the same cards, headers and tables as the dashboard ── */
/* Page headers from mis_head() (Colleges, Committee, Payment batches, Files to check, Daily reports, Claims, Reports, Search) */
.mis-head .mis-back {
    display: inline-flex; align-items: center; min-height: 28px; margin-bottom: 0.1rem;
    color: var(--brand-deep); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
}
.mis-head .mis-back:hover { text-decoration: underline; }
.mis-head .mis-title { margin: 0.1rem 0 0.15rem; font-size: clamp(1.2rem, 1rem + 0.7vw, 1.55rem); }
.mis-head .mis-lead { margin: 0; }
.fs-head.pl-dash-head { margin-bottom: 1.1rem; }

/* Home visit pages: the title and its line join into one header card */
.hv-page > h1:first-child {
    margin: 0; padding: 1rem 1.25rem 0.2rem; background: var(--surface);
    border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; font-size: clamp(1.2rem, 1rem + 0.7vw, 1.45rem);
}
.hv-page > h1:first-child + .hv-lead {
    margin: 0 0 1.1rem; padding: 0 1.25rem 1rem; background: var(--surface); color: var(--ink-500); font-size: 0.9rem;
    border: 1px solid var(--line); border-top: 0; border-radius: 0 0 16px 16px; box-shadow: var(--shadow-sm);
}

/* Cards everywhere: rounder, with the dashboard's soft shadow */
.pl-panel, .db-panel, .wa-settings, .table-wrap, .mis-box, .fs-card, .pl-case, .visit-panel, .vcard, .vdecide {
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 27, 61, 0.04), 0 6px 20px rgba(15, 27, 61, 0.05);
}
.wa-settings h2, .mis-box h3 { display: flex; align-items: center; gap: 0.5rem; }
.wa-settings h2::before, .mis-box h3::before {
    content: ''; flex: none; width: 4px; height: 1.05em; border-radius: 4px; background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

/* Filter bars on the module pages sit in a card */
.mis-filters { padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 27, 61, 0.04); }

/* Tabs: pill buttons instead of underlines */
.mis-tab-bar { gap: 0.35rem; padding: 0.35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.mis-tab-bar button { min-height: 40px; border: 0; border-radius: 10px; }
.mis-tab-bar button:hover { background: var(--surface-2); }
.mis-tab-bar button.is-active { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 14px -6px rgba(224, 83, 14, 0.6); }
.fs-tabs a.is-active { box-shadow: 0 6px 14px -6px rgba(224, 83, 14, 0.5); }

/* Tables: the dashboard's header row and row hover */
.table-wrap { overflow: hidden; }
.table-wrap th { background: #f7f8fb; color: var(--ink-500); }
.table-wrap tbody tr:hover { background: #f8f9fc; box-shadow: inset 3px 0 0 var(--brand); }
.btn-small { border-radius: 10px; white-space: nowrap; }

/* Lists of cases, colleges and batches */
.pl-cards a { border-radius: 14px; background: var(--surface); }
.mis-rows > li { border-radius: 12px; }

/* ─── Staff chat and meetings (staffchat.php) ───────────────────────────── */
.sc-avatar {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-style: normal; font-weight: 800; font-size: 0.95rem;
}
.sc-avatar.sm { width: 26px; height: 26px; font-size: 0.72rem; }
.sc-error { margin: 0.6rem 0 0; padding: 0.55rem 0.8rem; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 0.88rem; font-weight: 600; }
.sc-error.is-ok { background: var(--ok-soft); color: var(--ok); }
.sc-hint { margin: 0.7rem 0 0; color: var(--ink-500); font-size: 0.84rem; }

/* Chat: list of officers on the left (administrators), the conversation on the right */
.sc-chat {
    display: grid; grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 15rem); min-height: 460px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 27, 61, 0.04), 0 6px 20px rgba(15, 27, 61, 0.05);
}
.sc-chat.is-admin { grid-template-columns: 300px minmax(0, 1fr); }
.sc-threads { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: #fbfcfe; }
.sc-threads-head { padding: 0.8rem; border-bottom: 1px solid var(--line-2); }
.sc-threads-head input { width: 100%; }
.sc-threads ul { flex: 1; overflow-y: auto; list-style: none; padding: 0.4rem; }
.sc-threads li a { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.65rem; border-radius: 12px; color: var(--ink-700); text-decoration: none; }
.sc-threads li a:hover { background: #f1f4f9; }
.sc-threads li a.is-active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.sc-t-main { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.sc-t-main strong { color: var(--ink-900); font-size: 0.92rem; }
.sc-t-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-500); font-size: 0.78rem; }
.sc-threads a.has-unread .sc-t-main small { color: var(--ink-900); font-weight: 600; }
.sc-t-side { display: grid; justify-items: end; gap: 0.2rem; }
.sc-t-side small { color: var(--ink-400); font-size: 0.7rem; white-space: nowrap; }
.sc-t-side b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 0.7rem; line-height: 20px; text-align: center; }
.sc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sc-main-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line-2); }
.sc-main-head > div { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.sc-main-head strong { color: var(--ink-900); }
.sc-main-head small { color: var(--ok); font-size: 0.76rem; font-weight: 600; }
.sc-back { display: none; }
.sc-head-btn {
    display: inline-flex; align-items: center; gap: 0.4rem; min-height: 38px; padding: 0 0.8rem; border: 1px solid var(--line); border-radius: 999px;
    color: var(--ink-700); font-size: 0.84rem; font-weight: 600; text-decoration: none;
}
.sc-head-btn svg, .sc-dash h2 svg, .sc-dash-chat svg, .sc-stage-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sc-next { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.55rem 1rem; border-bottom: 1px solid var(--line-2); background: #fffaf5; }
.sc-next a { flex: none; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.7rem; border: 1px solid var(--brand-line); border-radius: 999px; background: #fff; color: var(--ink-700); font-size: 0.8rem; text-decoration: none; }
.sc-next a span:last-child { color: var(--ink-500); }
.sc-msgs { flex: 1; overflow-y: auto; padding: 1rem; background: #f6f8fb radial-gradient(circle at 1px 1px, rgba(15, 27, 61, 0.05) 1px, transparent 0) 0 0 / 18px 18px; }
.sc-empty { margin: auto; padding: 2rem 1rem; text-align: center; color: var(--ink-500); }
.sc-day { display: flex; justify-content: center; margin: 0.6rem 0; }
.sc-day span { padding: 0.2rem 0.7rem; border-radius: 999px; background: #e9edf5; color: var(--ink-500); font-size: 0.72rem; font-weight: 700; }
.sc-msg { display: flex; margin: 0.3rem 0; }
.sc-msg.is-mine { justify-content: flex-end; }
.sc-bubble {
    max-width: min(75%, 34rem); padding: 0.55rem 0.8rem 0.4rem; border-radius: 16px 16px 16px 4px; background: #fff;
    box-shadow: 0 1px 2px rgba(15, 27, 61, 0.08); overflow-wrap: anywhere;
}
.sc-msg.is-mine .sc-bubble { border-radius: 16px 16px 4px 16px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.sc-bubble p { margin: 0; font-size: 0.92rem; line-height: 1.45; }
.sc-bubble p a { color: inherit; text-decoration: underline; }
.sc-from { display: block; margin-bottom: 0.1rem; color: #4f46e5; font-size: 0.72rem; font-weight: 700; }
.sc-bubble time { display: block; margin-top: 0.15rem; text-align: right; font-size: 0.68rem; opacity: 0.7; }
.sc-meet { display: grid; gap: 0.1rem; margin-top: 0.45rem; padding: 0.55rem 0.7rem; border-radius: 10px; background: #eef2ff; color: #312e81; text-decoration: none; border-left: 3px solid #4f46e5; }
.sc-msg.is-mine .sc-meet { background: rgba(255, 255, 255, 0.18); color: #fff; border-left-color: #fff; }
.sc-meet span { font-size: 0.76rem; opacity: 0.85; }
.sc-meet em { font-style: normal; font-size: 0.78rem; font-weight: 700; }
.sc-meet.is-live em { color: #dc2626; }
.sc-msg.is-mine .sc-meet.is-live em { color: #fff; }
.sc-compose { display: flex; align-items: flex-end; gap: 0.6rem; padding: 0.7rem 0.8rem; border-top: 1px solid var(--line-2); background: var(--surface); }
.sc-compose textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: 0.65rem 1rem; line-height: 1.4; }
.sc-send {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; min-height: 46px; padding: 0; border: 0; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; cursor: pointer; box-shadow: 0 8px 16px -8px rgba(224, 83, 14, 0.8);
}
.sc-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sc-main > .sc-error { margin: 0 0.8rem 0.7rem; }
@media (max-width: 768px) {
    .sc-chat { height: calc(100dvh - 13rem); min-height: 420px; }
    .sc-chat.is-admin { grid-template-columns: minmax(0, 1fr); }
    .sc-chat.is-admin .sc-main { display: none; }
    .sc-chat.is-admin.is-open .sc-threads { display: none; }
    .sc-chat.is-admin.is-open .sc-main { display: flex; }
    .sc-back { display: inline-flex; align-items: center; justify-content: center; width: 36px; min-height: 36px; padding: 0; border: 0; background: none; font-size: 1.6rem; color: var(--ink-700); }
    .sc-head-btn span { display: none; }
    .sc-bubble { max-width: 85%; }
}

/* Meetings list */
.sc-toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.sc-mlist { list-style: none; display: grid; gap: 0.6rem; }
.sc-mcard { display: flex; align-items: center; gap: 0.9rem; padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.sc-mcard.is-live { border-color: #fecaca; background: linear-gradient(90deg, #fff5f5, #fff); }
.sc-mcard.is-cancelled, .sc-mcard.is-ended { opacity: 0.8; }
.sc-date { flex: none; display: grid; place-items: center; width: 52px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, #4338ca, #7c3aed); color: #fff; line-height: 1.05; }
.sc-mcard.is-live .sc-date { background: linear-gradient(135deg, #dc2626, #f97316); }
.sc-mcard.is-ended .sc-date, .sc-mcard.is-cancelled .sc-date { background: #cbd2df; }
.sc-date strong { font-size: 1.3rem; }
.sc-date span { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.sc-minfo { flex: 1; min-width: 0; display: grid; gap: 0.15rem; }
.sc-minfo a { color: var(--ink-900); text-decoration: none; }
.sc-minfo strong { color: var(--ink-900); overflow-wrap: anywhere; }
.sc-minfo > span { color: var(--ink-500); font-size: 0.84rem; }
.sc-mmeta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sc-mmeta small { color: var(--ink-500); }
.sc-mact .pl-btn { min-height: 40px; padding: 0 1rem; display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.sc-state { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; }
.sc-state.is-live { background: #fee2e2; color: #b91c1c; }
.sc-state.is-live i { width: 8px; height: 8px; border-radius: 50%; background: #dc2626; animation: scBlink 1.2s ease-in-out infinite; }
.sc-state.is-upcoming { background: var(--info-soft); color: var(--info); }
.sc-state.is-ended { background: #eef1f5; color: var(--ink-500); }
.sc-state.is-cancelled { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
@keyframes scBlink { 50% { opacity: 0.25; } }
.pl-btn.sc-join { background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 8px 18px -8px rgba(22, 163, 74, 0.8); color: #fff; }

/* Schedule form */
.sc-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem 1rem; }
.sc-span { grid-column: 1 / -1; }
.sc-form .pl-field { display: grid; gap: 0.35rem; }
.sc-choice { border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 0.9rem 0.9rem; display: grid; gap: 0.55rem; }
.sc-choice legend { padding: 0 0.35rem; font-size: 0.86rem; font-weight: 700; color: var(--ink-700); }
.sc-radio { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.75rem; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; }
.sc-radio:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); }
.sc-radio input { margin-top: 0.25rem; }
.sc-radio span { display: grid; }
.sc-radio small { color: var(--ink-500); font-size: 0.8rem; }
.sc-check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 40px; font-size: 0.9rem; cursor: pointer; }
.sc-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 0.2rem 0.8rem; padding-left: 0.3rem; }
.sc-form-foot { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }
@media (max-width: 768px) {
    .sc-form { grid-template-columns: minmax(0, 1fr); }
    .sc-mcard { flex-wrap: wrap; }
    .sc-mact { width: 100%; }
    .sc-mact .pl-btn { width: 100%; justify-content: center; }
}

/* Meeting room */
.sc-room { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.sc-room > * { margin-bottom: 0 !important; }
.sc-stage { position: relative; overflow: hidden; }
.sc-stage::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, #4338ca, #7c3aed); }
.sc-stage.is-live::before { background: linear-gradient(90deg, #dc2626, #f97316); }
.sc-stage-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.9rem; }
.sc-count { color: var(--ink-700); font-size: 0.88rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-stage-body { display: flex; gap: 0.9rem; align-items: flex-start; }
.sc-stage-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, #4338ca, #7c3aed); color: #fff; }
.sc-stage-ico svg { width: 26px; height: 26px; }
.sc-stage-body h2 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.sc-stage-body p { margin: 0; color: var(--ink-500); font-size: 0.88rem; }
.sc-room-type { margin-top: 0.25rem !important; font-weight: 600; color: var(--ink-700) !important; }
.sc-agenda { margin-top: 1rem; padding: 0.8rem 0.95rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.sc-agenda h3 { margin: 0 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-500); }
.sc-agenda p { margin: 0; font-size: 0.92rem; }
.sc-stage-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.1rem; }
.sc-stage-actions .pl-btn { min-height: 46px; padding: 0 1.2rem; }
.sc-stage-actions .sc-join { font-size: 1rem; padding: 0 1.6rem; }
.sc-plist { list-style: none; display: grid; gap: 0.45rem; }
.sc-plist li { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.6rem; border-radius: 12px; background: var(--surface-2); }
.sc-plist li > span:nth-child(2) { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.sc-plist small { color: var(--ink-500); font-size: 0.74rem; }
.sc-plist em { font-style: normal; font-size: 0.76rem; color: var(--ink-400); white-space: nowrap; }
.sc-plist li.is-in { background: var(--ok-soft); }
.sc-plist li.is-in em { color: var(--ok); font-weight: 700; }
.sc-plist li:not(.is-in) .sc-avatar { background: #cbd2df; }
@media (max-width: 900px) { .sc-room { grid-template-columns: minmax(0, 1fr); } }

/* Dashboard card */
.sc-dash h2 { color: #4338ca; }
.sc-mlist.is-compact { margin-bottom: 0.7rem; }
.sc-dash-chat {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2);
    color: var(--ink-700); text-decoration: none; font-size: 0.9rem;
}
.sc-dash-chat span { flex: 1; }
.sc-dash-chat b { color: var(--brand-deep); font-size: 0.84rem; }
.sc-dash-chat.has-unread { background: var(--brand-soft); border-color: var(--brand-line); color: var(--ink-900); font-weight: 600; }

/* "Meeting live now" pop-up on every page */
.sc-toast {
    position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 200; display: flex; align-items: center; gap: 0.75rem; max-width: min(360px, calc(100vw - 2rem));
    padding: 0.8rem 1rem; border-radius: 16px; background: #0f1b3d; color: #fff; text-decoration: none; box-shadow: 0 18px 40px rgba(10, 20, 48, 0.35);
    animation: scToast 0.3s ease-out;
}
.sc-toast i { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #ef4444; animation: scBlink 1.2s ease-in-out infinite; }
.sc-toast span { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.sc-toast small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c3cbe0; }
.sc-toast b { padding: 0.35rem 0.8rem; border-radius: 999px; background: linear-gradient(135deg, #16a34a, #22c55e); font-size: 0.84rem; }
@keyframes scToast { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) { .sc-toast { bottom: 5.2rem; right: 1rem; } }
.sc-plist li.was-in em { color: var(--ink-500); }
/* The portal's older styles make every button full width (index.php: button { width: 100% }); not here. */
:where(.rtc, .sc-chat, .sc-room, .sc-form-foot, .sc-toolbar) button { width: auto; }
.rtc .rtc-enter, .rtc .rtc-text-btn { width: 100%; }
/* Anything the chat, meetings and room scripts hide stays hidden, whatever display its class gives it. */
.rtc [hidden], .sc-chat [hidden], .sc-room [hidden], .sc-form [hidden], .sc-form-card[hidden], .sc-stage [hidden] { display: none !important; }

/* ─── Our meeting room (meeting.js): a full-screen dark layer ───────────── */
body.rtc-open { overflow: hidden; }
.rtc { position: fixed; inset: 0; z-index: 400; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, #1b2a55 0%, #0a1226 60%, #060b18 100%); color: #e8ecf6; }
.rtc[hidden] { display: none; }
.rtc svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Before joining */
.rtc-pre { height: 100%; display: grid; place-items: center; padding: 1.25rem; overflow-y: auto; }
.rtc-pre-card { width: min(980px, 100%); display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
.rtc-preview { position: relative; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; background: #111a33; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45); }
.rtc-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.rtc-pre-btns { position: absolute; left: 0; right: 0; bottom: 1rem; display: flex; justify-content: center; gap: 0.8rem; }
.rtc-pre-side h2 { margin: 0.3rem 0 0.4rem; color: #fff; font-family: 'Merriweather', serif; font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem); }
.rtc-pre-side p { margin: 0; color: #a9b4d0; }
.rtc-eyebrow { color: #ffb98a; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.rtc-note { margin-top: 1rem !important; padding: 0.7rem 0.9rem; border-radius: 12px; background: rgba(245, 158, 11, 0.14); color: #fcd34d !important; font-size: 0.88rem; }
.rtc-enter { display: flex; width: 100%; justify-content: center; margin-top: 1.4rem; min-height: 52px; border-radius: 14px; font-size: 1.05rem; }
.rtc-text-btn { display: block; width: 100%; margin-top: 0.6rem; min-height: 44px; border: 0; background: none; color: #a9b4d0; font-weight: 600; cursor: pointer; }
.rtc-text-btn:hover { color: #fff; transform: none; }

/* Who is not showing video: their initial in a circle */
.rtc-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 0.6rem; background: #141f3d; }
.rtc-off[hidden] { display: none; }
.rtc-off p { margin: 0; color: #a9b4d0; font-size: 0.9rem; }
.rtc-face {
    display: inline-flex; align-items: center; justify-content: center; width: 96px; height: 96px; border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-size: 2.4rem; font-weight: 800; line-height: 1;
}

/* Round buttons */
.rtc-btn {
    position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
    min-width: 64px; min-height: 58px; padding: 0.35rem 0.6rem; border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.1); color: #fff;
    font: 600 0.7rem 'Inter', sans-serif; cursor: pointer; transition: background 0.15s;
}
.rtc-btn:hover { background: rgba(255, 255, 255, 0.18); transform: none; }
.rtc-btn .i-off { display: none; }
.rtc-btn.is-off { background: #ef4444; }
.rtc-btn.is-off .i-on { display: none; }
.rtc-btn.is-off .i-off { display: block; }
.rtc-btn.is-off:not(:has(.i-off)) { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.rtc-btn[data-unread]::after {
    content: attr(data-unread); position: absolute; top: 4px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: 0.66rem; line-height: 18px;
}
.rtc-leave { background: #dc2626; min-width: 78px; }
.rtc-leave:hover { background: #b91c1c; }
.rtc-leave svg { transform: rotate(135deg); }
.rtc-end { background: rgba(220, 38, 38, 0.18); color: #fca5a5; }
.rtc-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer; }
.rtc-icon:hover { background: rgba(255, 255, 255, 0.16); transform: none; }
.rtc-icon svg { width: 18px; height: 18px; }

/* The call */
.rtc-call { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.rtc-call[hidden] { display: none; }
.rtc-top { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 1rem; }
.rtc-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.rtc-live { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.rtc-live i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: scBlink 1.2s ease-in-out infinite; }
.rtc-timer { color: #a9b4d0; font-variant-numeric: tabular-nums; font-weight: 700; }
.rtc-net { padding: 0.2rem 0.6rem; border-radius: 999px; background: rgba(245, 158, 11, 0.2); color: #fcd34d; font-size: 0.78rem; font-weight: 700; }
.rtc-body { display: flex; min-height: 0; gap: 0.8rem; padding: 0 0.8rem; overflow: hidden; }
/* The video tiles fill the space: columns and rows follow the number of people */
.rtc-grid { flex: 1; min-width: 0; height: 100%; display: grid; gap: 0.6rem; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.rtc-grid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rtc-grid[data-n="3"], .rtc-grid[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.rtc-grid[data-n="5"], .rtc-grid[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.rtc-grid[data-n="7"], .rtc-grid[data-n="8"], .rtc-grid[data-n="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
/* Someone is sharing a screen: it fills the top, the others line up below */
.rtc-grid.has-screen { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) 110px; }
.rtc-grid.has-screen .rtc-tile.is-screen { grid-column: 1 / -1; grid-row: 1; }
.rtc-grid.has-screen .rtc-tile:not(.is-screen) { grid-row: 2; }
.rtc-tile { position: relative; min-width: 0; min-height: 0; border-radius: 16px; overflow: hidden; background: #111a33; box-shadow: 0 0 0 2px transparent; transition: box-shadow 0.15s; }
.rtc-tile video { width: 100%; height: 100%; object-fit: cover; background: #0b1226; }
.rtc-tile.is-mirror video { transform: scaleX(-1); }
.rtc-tile.is-screen video { object-fit: contain; }
.rtc-tile.is-speaking { box-shadow: 0 0 0 3px #22c55e, 0 0 24px rgba(34, 197, 94, 0.35); }
.rtc-label {
    position: absolute; left: 0.6rem; bottom: 0.6rem; max-width: calc(100% - 1.2rem); display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem 0.6rem; border-radius: 999px; background: rgba(6, 11, 24, 0.7); color: #fff; font-size: 0.8rem; font-weight: 600; backdrop-filter: blur(4px);
}
.rtc-label .rtc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtc-mic-off { display: inline-flex; color: #f87171; }
.rtc-mic-off svg { width: 15px; height: 15px; }
.rtc-host { padding: 0 0.4rem; border-radius: 999px; background: var(--brand); font-size: 0.66rem; font-weight: 800; }
.rtc-conn { position: absolute; top: 0.6rem; left: 0.6rem; padding: 0.2rem 0.55rem; border-radius: 999px; background: rgba(245, 158, 11, 0.9); color: #111; font-size: 0.72rem; font-weight: 700; }
.rtc-hand-badge { position: absolute; top: 0.5rem; right: 0.6rem; font-size: 1.6rem; animation: rtcWave 1s ease-in-out infinite; }
@keyframes rtcWave { 50% { transform: rotate(14deg); } }

/* Chat and people */
.rtc-side { width: 330px; flex: none; display: flex; flex-direction: column; min-height: 0; border-radius: 16px; background: #f8fafc; color: var(--ink-700); overflow: hidden; }
.rtc-side[hidden] { display: none; }
.rtc-tabs { display: flex; align-items: center; gap: 0.3rem; padding: 0.5rem; border-bottom: 1px solid var(--line); }
.rtc-tabs [data-tab] { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: none; color: var(--ink-500); font-weight: 700; font-size: 0.86rem; cursor: pointer; }
.rtc-tabs [data-tab].is-active { background: #fff; color: var(--ink-900); box-shadow: var(--shadow-sm); }
.rtc-tabs [data-tab] b { margin-left: 0.2rem; color: var(--brand-deep); }
.rtc-tabs .rtc-icon { background: none; color: var(--ink-500); }
.rtc-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rtc-pane[hidden] { display: none; }
.rtc-chat { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.rtc-chat-empty { margin: auto 0; color: var(--ink-500); font-size: 0.86rem; text-align: center; }
.rtc-msg { max-width: 88%; padding: 0.45rem 0.7rem; border-radius: 12px 12px 12px 4px; background: #fff; box-shadow: var(--shadow-sm); }
.rtc-msg.is-mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--brand-soft); }
.rtc-msg small { display: block; color: var(--ink-500); font-size: 0.7rem; font-weight: 700; }
.rtc-msg p { margin: 0.1rem 0 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.rtc-chat-form { display: flex; gap: 0.4rem; padding: 0.6rem; border-top: 1px solid var(--line); }
.rtc-chat-form input { flex: 1; min-width: 0; border-radius: 999px; }
.rtc-chat-form button { width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.rtc-chat-form svg { width: 18px; height: 18px; }
.rtc-people { list-style: none; overflow-y: auto; padding: 0.6rem; display: grid; gap: 0.35rem; align-content: start; }
.rtc-people li { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.6rem; border-radius: 12px; background: #fff; }
.rtc-p-name { flex: 1; min-width: 0; font-weight: 600; font-size: 0.88rem; color: var(--ink-900); }
.rtc-p-name em { margin-left: 0.25rem; padding: 0 0.4rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep); font-style: normal; font-size: 0.68rem; }
.rtc-p-ico { display: inline-flex; font-size: 0.95rem; }
.rtc-p-ico.is-off { color: #dc2626; }
.rtc-p-ico svg { width: 16px; height: 16px; }

/* Controls */
.rtc-bar { display: flex; justify-content: center; align-items: center; gap: 0.55rem; padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.rtc-toast {
    position: absolute; left: 50%; bottom: 6.5rem; transform: translateX(-50%); max-width: min(480px, calc(100vw - 2rem));
    padding: 0.6rem 1rem; border-radius: 999px; background: rgba(15, 27, 61, 0.92); color: #fff; font-size: 0.88rem; font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); text-align: center;
}
.rtc-toast.is-in { animation: scToast 0.25s ease-out; }

@media (max-width: 900px) {
    .rtc-pre-card { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
    .rtc-side { position: absolute; inset: 3.4rem 0.6rem 5.5rem; width: auto; z-index: 2; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
}
@media (max-width: 640px) {
    .rtc-grid[data-n="2"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
    .rtc-grid[data-n="5"], .rtc-grid[data-n="6"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
    .rtc-grid.has-screen { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) 90px; }
    .rtc-grid { gap: 0.4rem; }
    .rtc-tile { border-radius: 12px; }
    .rtc-tile .rtc-face { width: 64px; height: 64px; font-size: 1.6rem; }
    .rtc-hide-sm { display: none !important; }
    .rtc-bar { flex-wrap: nowrap; gap: 0.35rem; padding-left: 0.5rem; padding-right: 0.5rem; }
    .rtc-btn { min-width: 0; flex: 1 1 0; max-width: 72px; min-height: 54px; padding: 0.3rem 0.2rem; }
    .rtc-btn span { font-size: 0.62rem; white-space: nowrap; }
    .rtc-top { padding: 0.6rem 0.7rem; gap: 0.5rem; }
    .rtc-body { padding: 0 0.4rem; }
}
