/*
 * ZB School design system (2026 refresh).
 * Loaded after app.css and the scoped component styles so these tokens and
 * component rules win over the legacy hard-coded values without rewriting every page.
 */
:root {
    --zb-font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

    --zb-primary: #0f766e;
    --zb-primary-hover: #0c5f59;
    --zb-primary-strong: #0b4f4b;
    --zb-primary-soft: #e7f5f2;
    --zb-primary-ring: rgb(15 118 110 / 18%);
    --zb-accent: #f4b740;
    --zb-accent-soft: #fdf3dc;

    --zb-ink: #0f1f24;
    --zb-text: #33454b;
    --zb-muted: #66777d;
    --zb-subtle: #95a3a8;
    --zb-bg: #f4f6f8;
    --zb-surface: #ffffff;
    --zb-surface-2: #f8fafb;
    --zb-border: #e3e8ec;
    --zb-border-strong: #d2dade;

    --zb-success: #16804a;
    --zb-success-soft: #e8f6ee;
    --zb-warning: #a96a06;
    --zb-warning-soft: #fff4e0;
    --zb-danger: #c0392b;
    --zb-danger-soft: #fdeceb;
    --zb-info: #2f6fd0;
    --zb-info-soft: #eaf1fc;

    --zb-sidebar: #0b2b30;
    --zb-sidebar-2: #0f3a40;

    --zb-radius-sm: 8px;
    --zb-radius: 12px;
    --zb-radius-lg: 18px;
    --zb-shadow-xs: 0 1px 2px rgb(16 24 40 / 5%);
    --zb-shadow-sm: 0 1px 3px rgb(16 24 40 / 6%), 0 1px 2px rgb(16 24 40 / 4%);
    --zb-shadow-md: 0 8px 24px -6px rgb(16 24 40 / 10%), 0 2px 6px -2px rgb(16 24 40 / 5%);
    --zb-shadow-lg: 0 24px 48px -12px rgb(16 24 40 / 18%);
    --zb-ease: cubic-bezier(.2, .8, .2, 1);

    font-family: var(--zb-font);
    color: var(--zb-text);
    background: var(--zb-bg);
}

body {
    background: var(--zb-bg);
    color: var(--zb-text);
    font-family: var(--zb-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection { background: #0f766e2e; }

:focus-visible { outline: 3px solid var(--zb-primary-ring); outline-offset: 2px; }

/* ---------- Page headers ---------- */
.page-header h1,
.dashboard-hero h1 {
    color: var(--zb-ink);
    font-weight: 750;
    letter-spacing: -.025em;
}
.page-header p { color: var(--zb-muted); font-size: 14px; }
.eyebrow,
.dashboard-hero .eyebrow {
    color: var(--zb-primary);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .08em;
}

/* ---------- Buttons ---------- */
.button {
    min-height: 40px;
    gap: 8px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    transition: background-color .15s var(--zb-ease), border-color .15s var(--zb-ease), box-shadow .15s var(--zb-ease), transform .1s var(--zb-ease);
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary {
    background: var(--zb-primary);
    color: #fff;
    box-shadow: var(--zb-shadow-xs), inset 0 1px 0 rgb(255 255 255 / 12%);
}
.button-primary:hover:not(:disabled) { background: var(--zb-primary-hover); }
.button-secondary {
    border-color: var(--zb-border-strong);
    background: var(--zb-surface);
    color: var(--zb-text);
    box-shadow: var(--zb-shadow-xs);
}
.button-secondary:hover:not(:disabled) { border-color: #bfcace; background: var(--zb-surface-2); }
.button-danger { border-color: #f3c9c4; background: var(--zb-danger-soft); color: var(--zb-danger); }
.icon-button {
    min-height: 32px;
    padding: 0 10px;
    border-color: var(--zb-border-strong);
    border-radius: 8px;
    color: var(--zb-primary-strong);
    font-size: 12px;
    transition: background-color .15s var(--zb-ease), border-color .15s var(--zb-ease);
}
.icon-button:hover { border-color: #b9c6ca; background: var(--zb-surface-2); }
.icon-button.danger-action { border-color: #f3c9c4; background: var(--zb-danger-soft); color: var(--zb-danger); }
.icon-button.success-action { border-color: #bfe3cd; background: var(--zb-success-soft); color: var(--zb-success); }

/* ---------- Cards and panels ---------- */
.panel,
.dashboard-card,
.dashboard-metric-card {
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-lg);
    background: var(--zb-surface);
    box-shadow: var(--zb-shadow-sm);
}
.panel-heading { padding: 18px 20px; border-bottom-color: var(--zb-border); }
.panel-heading h2,
.dashboard-card-heading h2,
.form-panel h2 { color: var(--zb-ink); font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.panel-heading p,
.dashboard-card-heading p,
.form-panel > p { color: var(--zb-muted); font-size: 12px; }
.form-panel { padding: 22px; }

.dashboard-metric-card:hover { border-color: #c6d6d3; box-shadow: var(--zb-shadow-md); }
.dashboard-metric-card .metric-label { color: var(--zb-muted); font-size: 13px; }
.dashboard-metric-card .metric-value { color: var(--zb-ink); font-weight: 750; }
.dashboard-metric-card .metric-foot { color: var(--zb-subtle); font-size: 12px; }
.dashboard-metric-card .dashboard-metric-icon { border-radius: 14px; }
.dashboard-card-heading > a,
.dashboard-chat-link { color: var(--zb-primary); }
.attendance-chart-line { stroke: var(--zb-primary); }
.attendance-chart-point { stroke: var(--zb-primary); }
.attendance-chart-area { fill: #d7f0eb; }

/* ---------- Tables ---------- */
th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--zb-border);
    background: var(--zb-surface-2);
    color: var(--zb-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
}
td {
    padding: 14px 16px;
    border-top-color: #eef1f4;
    color: var(--zb-text);
    font-size: 13px;
}
tbody tr { transition: background-color .12s var(--zb-ease); }
tbody tr:hover { background: #f7faf9; }
td a { color: var(--zb-primary-strong); font-weight: 600; text-decoration-color: #0f766e55; text-underline-offset: 3px; }
td a:hover { color: var(--zb-primary); }
.primary-cell { color: var(--zb-ink); }
.secondary-cell { color: var(--zb-subtle); font-size: 12px; }

/* ---------- Status badges ---------- */
.status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--zb-success-soft);
    color: var(--zb-success);
    font-size: 11px;
    font-weight: 650;
}
.status-badge.status-success { background: var(--zb-success-soft); color: var(--zb-success); }
.status-badge.status-warning { background: var(--zb-warning-soft); color: var(--zb-warning); }
.status-badge.status-error { background: var(--zb-danger-soft); color: var(--zb-danger); }
.status-badge.status-muted { background: #eef1f3; color: var(--zb-muted); }

/* ---------- Forms ---------- */
.form-field { gap: 6px; color: var(--zb-text); font-size: 12px; font-weight: 600; }
.form-control,
.search-input {
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--zb-border-strong);
    border-radius: 10px;
    background: var(--zb-surface);
    color: var(--zb-ink);
    font-size: 13px;
    box-shadow: var(--zb-shadow-xs);
    transition: border-color .15s var(--zb-ease), box-shadow .15s var(--zb-ease);
}
.form-control::placeholder,
.search-input::placeholder { color: var(--zb-subtle); }
.search-input:focus,
.form-control:focus {
    border-color: var(--zb-primary);
    box-shadow: 0 0 0 4px var(--zb-primary-ring);
}
select.form-control {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366777d' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
}

/* ---------- Empty states and modals ---------- */
.empty-state { color: var(--zb-muted); }
.empty-state strong { color: var(--zb-ink); }
.message-modal,
.chat-modal { border-color: var(--zb-border); border-radius: var(--zb-radius-lg); box-shadow: var(--zb-shadow-lg); }
.message-modal-backdrop,
.chat-modal-backdrop { background: rgb(15 31 36 / 45%); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

/* ---------- Data grid helpers and pagers ---------- */
.portal-list-grid-toolbar { border-bottom-color: var(--zb-border); }
.portal-list-grid-field { color: var(--zb-muted); font-size: 11px; font-weight: 650; }
.portal-list-grid-summary,
.portal-list-grid-pagination,
.pagination-controls { color: var(--zb-muted); font-size: 12px; }
.portal-list-grid-pagination,
.panel > .pagination-controls { border-top-color: var(--zb-border); }
.pagination-controls select { border-color: var(--zb-border-strong); border-radius: 10px; }

/* ---------- Authentication ---------- */
.auth-shell {
    background:
        radial-gradient(1100px 520px at 10% -10%, #d8f0ea 0%, transparent 60%),
        radial-gradient(900px 480px at 110% 110%, #fdf0d3 0%, transparent 55%),
        var(--zb-bg);
}
.auth-card { border-color: var(--zb-border); border-radius: 22px; box-shadow: var(--zb-shadow-lg); }
.auth-card h1 { color: var(--zb-ink); font-weight: 750; letter-spacing: -.02em; }
.auth-card .form-control { border-radius: 12px; }
.login-recaptcha { display: flex; min-height: 78px; justify-content: center; }
.login-recaptcha[hidden], .login-challenge[hidden] { display: none; }
@media (max-width: 340px) { .login-recaptcha { transform: scale(.9); transform-origin: center; } }
.auth-submit { min-height: 48px; border-radius: 12px; font-size: 14px; }
.auth-brand .brand-mark,
.brand-mark { background: linear-gradient(135deg, #f8c75a, var(--zb-accent)); color: var(--zb-sidebar); box-shadow: 0 6px 16px -6px rgb(244 183 64 / 70%); }

/* ---------- Chat ---------- */
.chat-dock-launcher { background: var(--zb-primary); box-shadow: 0 12px 28px -8px rgb(15 118 110 / 60%); }
.chat-dock-launcher:hover { background: var(--zb-primary-hover); }
.chat-dock-window { border-color: var(--zb-border); border-radius: 20px; box-shadow: var(--zb-shadow-lg); }
.chat-dock-header { background: linear-gradient(135deg, var(--zb-sidebar-2), var(--zb-primary-strong)); }
.chat-message { border-color: var(--zb-border); border-radius: 16px; border-bottom-left-radius: 6px; box-shadow: var(--zb-shadow-xs); }
.chat-message.mine { border-color: transparent; border-radius: 16px; border-bottom-right-radius: 6px; background: var(--zb-primary); }
.chat-message.mine p { color: #fff; }
.chat-message.mine small { color: #d3efe9; }
.chat-messages { background: var(--zb-surface-2); }
.chat-person:hover,
.chat-person.selected { background: var(--zb-primary-soft); }
.chat-unread { background: var(--zb-primary); box-shadow: 0 0 0 3px var(--zb-primary-ring); }

/* =====================================================================
   Announcement bell, drop-down and side pop-ups
   ===================================================================== */
.notify { position: relative; }
.notify-bell {
    position: relative;
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--zb-border);
    border-radius: 12px;
    background: var(--zb-surface);
    color: var(--zb-text);
    cursor: pointer;
    box-shadow: var(--zb-shadow-xs);
}
.notify-bell:hover { background: var(--zb-surface-2); }
.notify-bell svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transform-origin: 50% 4px; }
.notify-bell.has-unread { color: var(--zb-primary-strong); }
.notify-count {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--zb-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}
.notify-bell.is-ringing svg { animation: zb-bell-ring 1s var(--zb-ease); }
.notify-bell.is-ringing .notify-count { animation: zb-count-pop .5s var(--zb-ease); }
@keyframes zb-bell-ring {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50% { transform: rotate(16deg); }
    20%, 40%, 60% { transform: rotate(-16deg); }
    70% { transform: rotate(8deg); }
    80% { transform: rotate(-6deg); }
}
@keyframes zb-count-pop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.notify-backdrop { position: fixed; z-index: 1290; inset: 0; }
.notify-panel {
    position: absolute;
    z-index: 1300;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: min(480px, 70dvh);
    overflow: auto;
    border: 1px solid var(--zb-border);
    border-radius: 18px;
    background: var(--zb-surface);
    box-shadow: var(--zb-shadow-lg);
}
.notify-panel header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--zb-border); background: var(--zb-surface); }
.notify-panel header strong { color: var(--zb-ink); font-size: 15px; }
.notify-panel header a { color: var(--zb-primary); font-size: 13px; font-weight: 700; text-decoration: none; }
.notify-panel ul { margin: 0; padding: 6px; list-style: none; }
.notify-panel li { display: grid; gap: 3px; padding: 10px 12px 10px 18px; border-radius: 12px; position: relative; }
.notify-panel li + li { margin-top: 2px; }
.notify-panel li.is-unread { background: var(--zb-primary-soft); }
.notify-panel li.is-unread::before { position: absolute; top: 16px; left: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--zb-primary); content: ""; }
.notify-panel li strong { color: var(--zb-ink); font-size: 14px; }
.notify-panel li p { margin: 0; color: var(--zb-muted); font-size: 13px; line-height: 1.45; }
.notify-panel li time { color: var(--zb-subtle); font-size: 11px; }
.notify-kind { color: var(--zb-primary); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.notify-kind.staff { color: var(--zb-info); }
.notify-kind.urgent { color: var(--zb-danger); }
.notify-empty { margin: 0; padding: 22px 18px; color: var(--zb-muted); font-size: 13px; text-align: center; }

.notify-toasts {
    position: fixed;
    z-index: 1350;
    top: 76px;
    right: max(16px, env(safe-area-inset-right));
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.notify-toast {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--zb-border);
    border-left: 4px solid var(--zb-primary);
    border-radius: 16px;
    background: var(--zb-surface);
    box-shadow: var(--zb-shadow-lg);
    pointer-events: auto;
    animation: zb-toast-in .35s var(--zb-ease);
}
.notify-toast.urgent { border-left-color: var(--zb-danger); }
.notify-toast-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--zb-primary-soft); color: var(--zb-primary-strong); }
.notify-toast.urgent .notify-toast-icon { background: var(--zb-danger-soft); color: var(--zb-danger); }
.notify-toast-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notify-toast small { color: var(--zb-primary); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.notify-toast.urgent small { color: var(--zb-danger); }
.notify-toast strong { display: block; margin-top: 2px; color: var(--zb-ink); font-size: 14px; }
.notify-toast p { margin: 3px 0 0; color: var(--zb-muted); font-size: 13px; line-height: 1.45; }
.notify-toast a { display: inline-block; margin-top: 8px; color: var(--zb-primary); font-size: 13px; font-weight: 700; text-decoration: none; }
.notify-toast-close { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--zb-muted); font-size: 20px; line-height: 1; cursor: pointer; }
.notify-toast-close:hover { background: var(--zb-surface-2); }
@keyframes zb-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.portal-shell .notify-toasts { top: calc(70px + env(safe-area-inset-top)); }
@media (max-width: 640px) {
    .notify-toasts { right: 12px; left: 12px; width: auto; }
    .notify-panel { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .notify-bell.is-ringing svg, .notify-bell.is-ringing .notify-count, .notify-toast { animation: none; }
}

/* Unread announcements: light tint, stronger edge and a "New" tag */
.announcement-card.is-unread { border-color: #bfe3da; background: #f0faf7; box-shadow: 0 0 0 1px #d4eee7, var(--zb-shadow-sm); }
.announcement-card.is-unread::before { background: var(--zb-primary); }
.announcement-card.is-unread h2 { font-weight: 800; }
.announcement-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.announcement-badges { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.unread-pill { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: var(--zb-primary); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.announcement-badges .unread-pill { margin-left: 0; }

/* Status pages (404 and other errors) */
.status-card { text-align: center; }
.status-card-code { display: inline-block; margin-bottom: 8px; color: var(--zb-accent); font-size: 56px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.status-card p { color: var(--zb-muted); }
.status-card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

/* Fee currency editor (Settings and super-admin Schools list) */
.currency-editor .form-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.field-optional { color: var(--zb-subtle); font-weight: 500; }
.currency-preview { margin: 12px 0 0; color: var(--zb-muted); font-size: 13px; }
.currency-preview strong { color: var(--zb-ink); }
.currency-saved { margin: 10px 0 0; color: var(--zb-success); font-size: 13px; font-weight: 600; }
@media (max-width: 640px) { .currency-editor .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* =====================================================================
   Live demo: role picker on /demo and the in-app demo bar
   ===================================================================== */
.live-demo { margin-bottom: 40px; padding: clamp(20px, 4vw, 36px); border: 1px solid var(--zb-border); border-radius: 24px; background: var(--zb-surface); box-shadow: var(--zb-shadow-md); }
.live-demo-intro { max-width: 760px; margin-bottom: 22px; }
.live-demo-intro h1 { margin: 6px 0 10px; color: var(--zb-ink); font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.live-demo-intro .public-lead { margin-bottom: 0; }
.live-demo-alert, .live-demo-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.live-demo-alert { background: var(--zb-danger-soft); color: var(--zb-danger); }
.live-demo-note { background: var(--zb-success-soft); color: var(--zb-success); }
.live-demo-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.live-demo-role { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--zb-border); border-radius: 18px; background: var(--zb-surface-2); transition: border-color .15s var(--zb-ease), box-shadow .15s var(--zb-ease), transform .15s var(--zb-ease); }
.live-demo-role:hover { border-color: #b9d3cf; background: var(--zb-surface); box-shadow: var(--zb-shadow-md); transform: translateY(-2px); }
.live-demo-role-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; background: var(--zb-primary-soft); color: var(--zb-primary-strong); font-size: 20px; }
.live-demo-role strong { color: var(--zb-ink); font-size: 16px; }
.live-demo-role p { flex: 1; margin: 0; color: var(--zb-muted); font-size: 13px; line-height: 1.55; }
.live-demo-role .button { width: 100%; margin-top: 6px; }
.live-demo-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px 20px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--zb-muted); font-size: 13px; line-height: 1.55; }
.live-demo-facts li { padding-left: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") left 3px no-repeat; }
.live-demo-facts strong { color: var(--zb-ink); }
.live-demo-tour-title { margin: 0 0 18px; color: var(--zb-ink); font-size: 20px; font-weight: 750; }
.demo-tour-heading { max-width: 680px; margin: 0 0 12px; color: var(--zb-ink); font-size: clamp(26px, 3vw, 36px); letter-spacing: -.03em; line-height: 1.1; }

.demo-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    border-bottom: 1px solid #f3dfae;
    background: linear-gradient(90deg, #fff7e3, #fdf3dc);
    color: #6b4a07;
    font-size: 12px;
}
.demo-bar form { margin: 0; }
.demo-bar-badge { padding: 3px 8px; border-radius: 999px; background: var(--zb-accent); color: var(--zb-sidebar); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.demo-bar-copy { flex: 1 1 260px; }
.demo-bar-roles { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 12px; background: rgb(255 255 255 / 70%); }
.demo-bar-role, .demo-bar-end { min-height: 30px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #6b4a07; font: inherit; font-weight: 650; cursor: pointer; }
.demo-bar-role:hover { background: #fff; }
.demo-bar-role.active { background: var(--zb-primary); color: #fff; }
.demo-bar-end { border: 1px solid #e9cf8f; background: #fff; }
.demo-bar-end:hover { background: #fffaf0; }
@media (max-width: 640px) {
    .demo-bar-copy { display: none; }
    .demo-bar-roles { flex: 1; justify-content: space-between; }
    .demo-bar-role { flex: 1; padding: 0 6px; }
}

/* =====================================================================
   Family portal: app-style mobile experience for parents and guardians
   ===================================================================== */
.portal-shell {
    min-height: 100dvh;
    background: var(--zb-bg);
}

.portal-header {
    min-height: 60px;
    border-bottom: 1px solid rgb(227 232 236 / 70%);
    background: rgb(255 255 255 / 86%);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.portal-brand { color: var(--zb-ink); }
.portal-brand img,
.portal-brand .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
.portal-brand strong { font-size: 14px; font-weight: 700; }
.portal-brand small { color: var(--zb-muted); font-size: 11px; }
.portal-header-actions { display: flex; align-items: center; gap: 8px; }
.portal-header-actions .logout-form { margin: 0; }
.portal-icon-button {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--zb-border);
    border-radius: 12px;
    background: var(--zb-surface);
    color: var(--zb-text);
    cursor: pointer;
    box-shadow: var(--zb-shadow-xs);
}
.portal-icon-button:hover { background: var(--zb-surface-2); }
.portal-icon-button svg,
.portal-bottom-nav svg,
.portal-stat svg,
.portal-tab-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.portal-install-button[hidden] { display: none; }
.portal-install-button { min-height: 40px; padding: 0 12px; border-radius: 12px; font-size: 12px; white-space: nowrap; }

.portal-content {
    width: min(100%, 760px);
    padding: 18px max(16px, env(safe-area-inset-right)) calc(104px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* Greeting hero */
.portal-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
    padding: 22px 20px;
    border-radius: 24px;
    background:
        radial-gradient(420px 220px at 105% -20%, rgb(244 183 64 / 38%), transparent 65%),
        linear-gradient(140deg, var(--zb-sidebar) 0%, var(--zb-primary-strong) 55%, var(--zb-primary) 100%);
    color: #fff;
    box-shadow: 0 18px 40px -18px rgb(11 79 75 / 70%);
}
.portal-hero::after {
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgb(255 255 255 / 6%);
    content: "";
}
.portal-hero .eyebrow { margin: 0 0 6px; color: #ffe1a3; }
.portal-hero h1 { margin: 0; color: #fff; font-size: clamp(24px, 6.5vw, 30px); font-weight: 750; letter-spacing: -.025em; line-height: 1.2; }
.portal-hero p { position: relative; z-index: 1; margin: 8px 0 0; color: #cfe7e2; font-size: 14px; }
.portal-hero-chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.portal-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 999px;
    background: rgb(255 255 255 / 10%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.portal-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 2px 12px; }
.portal-section-title h2 { margin: 0; color: var(--zb-ink); font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.portal-section-title span { color: var(--zb-muted); font-size: 12px; }

/* Learner cards */
.portal-learner-list { gap: 12px; }
.portal-learner-card {
    min-height: 88px;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--zb-border);
    border-radius: 20px;
    background: var(--zb-surface);
    box-shadow: var(--zb-shadow-sm);
    transition: transform .15s var(--zb-ease), box-shadow .15s var(--zb-ease), border-color .15s var(--zb-ease);
}
.portal-learner-card:hover { border-color: #c5d6d3; box-shadow: var(--zb-shadow-md); }
.portal-learner-card:active { transform: scale(.985); }
.portal-avatar {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, #d6f1ea, #b9e3d9);
    color: var(--zb-primary-strong);
    font-size: 16px;
    font-weight: 750;
}
.portal-learner-copy { gap: 4px; }
.portal-learner-copy strong { color: var(--zb-ink); font-size: 16px; font-weight: 700; }
.portal-learner-copy small { color: var(--zb-muted); font-size: 12px; }
.portal-learner-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.portal-tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: var(--zb-primary-soft); color: var(--zb-primary-strong); font-size: 11px; font-weight: 650; }
.portal-tag.muted { background: #eef1f3; color: var(--zb-muted); }
.portal-card-arrow {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 12px;
    background: var(--zb-surface-2);
    color: var(--zb-muted);
    font-size: 22px;
    line-height: 1;
}

/* Announcements */
.portal-announcements { gap: 12px; margin-top: 0; scroll-margin-top: 80px; }
.announcement-card {
    position: relative;
    padding: 16px 16px 16px 20px;
    border-radius: 18px;
}
.announcement-card::before {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--zb-accent);
    content: "";
}
.announcement-card h2 { color: var(--zb-ink); font-size: 15px; font-weight: 700; }
.announcement-card .eyebrow { color: var(--zb-muted); letter-spacing: .04em; text-transform: none; }
.announcement-body { color: var(--zb-text); font-size: 14px; line-height: 1.6; }

/* Learner overview */
.portal-back {
    gap: 6px;
    min-height: 40px;
    margin: -4px 0 10px;
    padding: 0 12px 0 8px;
    border-radius: 12px;
    color: var(--zb-primary-strong);
    font-size: 13px;
}
.portal-back:hover { background: var(--zb-primary-soft); }
.portal-child-heading {
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
    padding: 18px;
    border-radius: 24px;
    background:
        radial-gradient(360px 200px at 110% -30%, rgb(244 183 64 / 35%), transparent 65%),
        linear-gradient(140deg, var(--zb-sidebar) 0%, var(--zb-primary-strong) 60%, var(--zb-primary) 100%);
    color: #fff;
    box-shadow: 0 18px 40px -18px rgb(11 79 75 / 70%);
}
.portal-child-heading > div { min-width: 0; flex: 1 1 160px; }
.portal-child-heading .portal-avatar { width: 56px; height: 56px; flex-basis: 56px; background: rgb(255 255 255 / 16%); color: #fff; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 22%); }
.portal-child-heading h1 { color: #fff; font-size: clamp(22px, 6vw, 28px); font-weight: 750; letter-spacing: -.02em; }
.portal-child-heading p { color: #cfe7e2; font-size: 13px; }
.portal-child-heading .eyebrow { color: #ffe1a3; letter-spacing: .05em; text-transform: none; }
.portal-chat-link,
.portal-child-heading .portal-chat-link {
    width: 100%;
    min-height: 46px;
    margin: 0;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: var(--zb-primary-strong);
    font-size: 14px;
    box-shadow: none;
}
.portal-child-heading .portal-chat-link:hover { background: #f1faf8; }

.portal-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.portal-stat {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 4px 10px;
    padding: 14px;
    border: 1px solid var(--zb-border);
    border-radius: 18px;
    background: var(--zb-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    box-shadow: var(--zb-shadow-xs);
    cursor: pointer;
}
.portal-stat:hover { border-color: #c5d6d3; }
.portal-stat-icon { display: grid; width: 36px; height: 36px; grid-row: 1 / span 2; place-items: center; border-radius: 12px; }
.portal-stat-icon.mint { background: var(--zb-success-soft); color: var(--zb-success); }
.portal-stat-icon.blue { background: var(--zb-info-soft); color: var(--zb-info); }
.portal-stat-icon.gold { background: var(--zb-accent-soft); color: var(--zb-warning); }
.portal-stat-icon.rose { background: var(--zb-danger-soft); color: var(--zb-danger); }
.portal-stat strong { overflow: hidden; color: var(--zb-ink); font-size: 18px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.portal-stat small { overflow: hidden; color: var(--zb-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.portal-tabs {
    top: calc(60px + env(safe-area-inset-top));
    gap: 4px;
    margin: 0 0 16px;
    padding: 5px;
    border: 1px solid var(--zb-border);
    border-radius: 16px;
    background: rgb(255 255 255 / 92%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--zb-shadow-sm);
}
.portal-tabs button {
    display: inline-flex;
    min-height: 40px;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--zb-muted);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: background-color .15s var(--zb-ease), color .15s var(--zb-ease);
}
.portal-tabs button:hover { color: var(--zb-ink); }
.portal-tabs button.active { border: 0; background: var(--zb-primary); color: #fff; box-shadow: 0 6px 14px -6px rgb(15 118 110 / 70%); }

.portal-card-list { gap: 10px; }
.portal-record-card { padding: 16px; border-radius: 18px; }
.portal-record-card h2 { color: var(--zb-ink); font-size: 15px; font-weight: 700; }
.portal-record-card p { color: var(--zb-muted); font-size: 13px; }
.portal-record-card .eyebrow { color: var(--zb-muted); letter-spacing: .03em; text-transform: none; }
.portal-record-card .status-badge { margin-top: 10px; }
.portal-score {
    display: grid;
    min-width: 64px;
    align-self: center;
    justify-items: center;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--zb-primary-soft);
    color: var(--zb-primary-strong);
    font-size: 18px;
    font-weight: 750;
}
.portal-score small { color: var(--zb-muted); font-size: 11px; }
.portal-record-note { border-top-color: var(--zb-border); color: var(--zb-text) !important; }
.portal-list-row { min-height: 64px; padding: 14px 16px; border-top-color: var(--zb-border); }
.portal-card-list > .portal-list-row { border-top: 1px solid var(--zb-border); border-radius: 16px; }
.portal-list-row strong { color: var(--zb-ink); font-size: 14px; font-weight: 650; }
.portal-list-row small { color: var(--zb-muted); font-size: 12px; }
.portal-balance { color: var(--zb-ink); font-size: 15px; }
.portal-balance small { color: var(--zb-muted); font-size: 11px; }
.portal-balance.is-due { color: var(--zb-danger); }

/* Bottom navigation (thumb zone) */
.portal-bottom-nav {
    right: 0;
    left: 0;
    justify-content: space-around;
    gap: 4px;
    padding: 6px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    border-top: 1px solid rgb(227 232 236 / 80%);
    background: rgb(255 255 255 / 92%);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 -8px 24px -12px rgb(16 24 40 / 14%);
}
.portal-bottom-nav a,
.portal-bottom-nav button {
    display: grid;
    min-width: 72px;
    min-height: 54px;
    flex: 1 1 0;
    max-width: 140px;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--zb-subtle);
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
}
.portal-bottom-nav a span,
.portal-bottom-nav button span { display: grid; width: 48px; height: 28px; place-items: center; border-radius: 999px; font-size: 0; transition: background-color .15s var(--zb-ease); }
.portal-bottom-nav a.active { background: transparent; color: var(--zb-primary-strong); box-shadow: none; }
.portal-bottom-nav a.active span { background: var(--zb-primary-soft); }

/* Keep the chat launcher above the bottom navigation in the family portal. */
.portal-shell .chat-dock { right: max(14px, env(safe-area-inset-right)); bottom: calc(80px + env(safe-area-inset-bottom)); }

@media (min-width: 720px) {
    .portal-content { padding-top: 28px; }
    .portal-hero { padding: 30px 28px; }
    .portal-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .portal-child-heading { padding: 22px 24px; }
    .portal-child-heading .portal-chat-link { width: auto; padding: 0 20px; }
}

@media (max-width: 480px) {
    .portal-brand small { display: none; }
    .portal-install-button span { display: none; }
    .portal-record-card { grid-template-columns: minmax(0, 1fr) auto; }
    .portal-score { justify-self: end; }
    .portal-chat-link { width: 100%; margin-left: 0; }
    .portal-tabs { top: calc(60px + env(safe-area-inset-top)); }
    .portal-tabs button { padding: 0 10px; font-size: 12px; }
}

/* Installed app (standalone) polish */
@media (display-mode: standalone) {
    body { overscroll-behavior-y: none; }
    .portal-header { padding-top: max(10px, env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
    .portal-learner-card,
    .button,
    .portal-tabs button { transition: none; }
}

/* ---------- Parent engagement: fees, events, absence reports, settings, weekly summary ---------- */
.portal-bottom-nav a, .portal-bottom-nav button { min-width: 56px; }
.portal-page-heading { margin: 4px 0 18px; }
.portal-page-heading h1 { margin: 2px 0 6px; color: var(--zb-ink); font-size: 24px; font-weight: 750; letter-spacing: -.01em; }
.portal-page-heading p { margin: 0; color: var(--zb-muted); }
.portal-page-heading a, .digest-card a { color: var(--zb-primary); font-weight: 650; }
.link-button { padding: 0; border: 0; background: none; color: var(--zb-primary); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.link-button:disabled { color: var(--zb-subtle); cursor: progress; }
.check-option { display: flex; align-items: center; gap: 10px; color: var(--zb-text); font-weight: 600; }
.check-option input { width: 18px; height: 18px; accent-color: var(--zb-primary); }
.settings-note { margin: 8px 0 0; color: var(--zb-muted); font-size: 13px; line-height: 1.5; }

.translate-text { display: grid; gap: 4px; margin-top: 6px; justify-items: start; }
.translate-result { margin: 0; padding: 8px 12px; border-left: 3px solid var(--zb-primary); border-radius: 0 var(--zb-radius-sm) var(--zb-radius-sm) 0; background: var(--zb-primary-soft); color: var(--zb-ink); white-space: pre-wrap; }
.translate-error { color: var(--zb-warning); font-size: 12px; }
.chat-message .translate-text { margin: 2px 0 4px; }

/* Absence reports */
.absence-report-button { width: 100%; min-height: 48px; }
.absence-form h2 { margin: 0 0 12px; font-size: 17px; }
.absence-form .rsvp-choices { margin-bottom: 14px; }
.absence-report-list { display: grid; gap: 10px; }
.absence-report { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--zb-border); border-radius: var(--zb-radius); background: var(--zb-surface); }
.absence-report.is-pending { border-color: var(--zb-accent); background: var(--zb-accent-soft); }
.absence-report > div:first-child { display: grid; gap: 4px; min-width: 0; flex: 1 1 280px; }
.absence-report strong { color: var(--zb-ink); }
.absence-report small { color: var(--zb-muted); }
.absence-report p { margin: 2px 0 0; color: var(--zb-text); }
.absence-report .status-badge { justify-self: start; }
.absence-report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.absence-report-actions .form-control { min-width: 200px; }

/* Events and RSVP */
.event-month { margin: 10px 2px 0; color: var(--zb-muted); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.event-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding: 16px; }
.event-date { display: grid; height: 60px; place-content: center; border-radius: var(--zb-radius); background: var(--zb-primary-soft); color: var(--zb-primary-strong); text-align: center; }
.event-date strong { font-size: 22px; line-height: 1; }
.event-date small { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.event-copy h3 { margin: 0 0 2px; color: var(--zb-ink); font-size: 16px; }
.event-copy .eyebrow { margin: 0 0 6px; }
.rsvp { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--zb-border); }
.rsvp > span { color: var(--zb-text); font-size: 13px; font-weight: 650; }
.rsvp-choices { display: flex; gap: 8px; }
.rsvp-choice { flex: 1 1 0; min-height: 42px; padding: 0 12px; border: 1px solid var(--zb-border-strong); border-radius: 999px; background: var(--zb-surface); color: var(--zb-text); font: inherit; font-weight: 650; cursor: pointer; }
.rsvp-choice.is-selected { border-color: var(--zb-primary); background: var(--zb-primary); color: #fff; }
.rsvp-people { display: flex; align-items: center; gap: 10px; color: var(--zb-muted); font-size: 13px; }
.rsvp-people .form-control { width: 80px; }

/* Family fees */
.portal-fee-hero h1 { font-size: 34px; }
.fee-row { cursor: pointer; }
.fee-row input[type="checkbox"] { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--zb-primary); }
.fee-row > div { flex: 1 1 auto; }
.fee-pay-panel { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 4; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; box-shadow: var(--zb-shadow-md); }
.fee-pay-panel > div { display: grid; gap: 2px; }
.fee-pay-panel strong { color: var(--zb-ink); font-size: 18px; }
.fee-pay-panel small { color: var(--zb-muted); }
.fee-pay-panel .button { min-height: 46px; }
.fee-pay-note { flex-basis: 100%; }

/* Notification settings */
.settings-card .panel-heading { margin-bottom: 8px; }
.push-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.push-status small { color: var(--zb-muted); }
.toggle-list { display: grid; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--zb-border); cursor: pointer; }
.toggle-row:first-child { border-top: 0; }
.toggle-row > span { display: grid; gap: 2px; }
.toggle-row strong { color: var(--zb-ink); font-size: 14px; }
.toggle-row small { color: var(--zb-muted); font-size: 12px; }
.toggle-row input[type="checkbox"] { position: relative; flex: 0 0 auto; width: 44px; height: 26px; margin: 0; border-radius: 999px; background: var(--zb-border-strong); appearance: none; -webkit-appearance: none; cursor: pointer; transition: background-color .15s var(--zb-ease); }
.toggle-row input[type="checkbox"]::after { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--zb-shadow-sm); content: ""; transition: transform .15s var(--zb-ease); }
.toggle-row input[type="checkbox"]:checked { background: var(--zb-primary); }
.toggle-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.toggle-row input[type="checkbox"]:focus-visible { outline: 3px solid var(--zb-primary-ring); outline-offset: 2px; }

/* Weekly summary */
.digest-card h2 a { color: var(--zb-ink); text-decoration: none; }
.digest-card p { margin: 4px 0; color: var(--zb-text); }
.digest-card small { color: var(--zb-muted); }
.digest-grid { display: grid; gap: 14px; }
.digest-grid h3 { margin: 0 0 4px; color: var(--zb-muted); font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
@media (min-width: 720px) { .digest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) {
    .absence-report-actions { width: 100%; }
    .absence-report-actions .form-control { flex-basis: 100%; min-width: 0; }
    .absence-report-actions .button { flex: 1 1 0; }
    .fee-pay-panel .button { width: 100%; }
}

/* ZB School Academy (academy/academy.css): brand tokens */
:root { --ac-brand: var(--zb-primary); --ac-brand-strong: var(--zb-primary-strong); --ac-brand-soft: var(--zb-primary-soft); --ac-ink: var(--zb-ink); --ac-muted: var(--zb-muted); --ac-line: var(--zb-border); --ac-font: var(--zb-font); }
/* Keep the Academy tab above the family app's bottom menu. */
@media (max-width: 760px) { html:has(.portal-shell) .ac-tab { bottom: calc(96px + env(safe-area-inset-bottom)); } }
.platform-onboarding-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.platform-onboarding-stats h2 { margin: 4px 0; font-size: 20px; }
.login-forgot { margin: -6px 0 12px; text-align: right; font-size: 13px; }
.login-forgot a { color: var(--zb-primary); font-weight: 650; }
