:root {
    --page-bg: #edf3f4;
    --page-ink: #142d3b;
    --page-ink-soft: #5f7280;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.95);
    --surface-muted: rgba(244, 248, 250, 0.82);
    --surface-deep: #123546;
    --line: rgba(20, 45, 59, 0.10);
    --line-strong: rgba(20, 45, 59, 0.16);
    --accent: #0f6f87;
    --accent-strong: #0a5369;
    --accent-soft: #d9eef1;
    --success: #1f7a54;
    --warning: #c07a1f;
    --danger: #a83e3e;
    --shadow-soft: 0 22px 56px rgba(13, 31, 42, 0.12);
    --shadow-panel: 0 28px 60px rgba(13, 31, 42, 0.14);
    --shadow-button: 0 16px 28px rgba(15, 111, 135, 0.20);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    text-size-adjust: 100%;
}

body.dashboard-body {
    background:
        radial-gradient(circle at 0% 0%, rgba(34, 148, 170, 0.20), transparent 30%),
        radial-gradient(circle at 100% 0%, rgba(17, 52, 77, 0.16), transparent 28%),
        radial-gradient(circle at 50% 100%, rgba(227, 183, 95, 0.12), transparent 30%),
        linear-gradient(180deg, #f8fbfb 0%, var(--page-bg) 55%, #e8eff1 100%);
    color: var(--page-ink);
    font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    position: relative;
}

body.dashboard-body::before,
body.dashboard-body::after {
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
}

body.dashboard-body::before {
    background-image:
        linear-gradient(rgba(20, 45, 59, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 45, 59, 0.035) 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.22;
}

body.dashboard-body::after {
    background:
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.32), transparent 22%),
        radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.20), transparent 16%);
}

.dashboard-shell {
    margin: 0 auto;
    max-width: 1360px;
    padding: 34px 24px 84px;
    padding:
        calc(34px + env(safe-area-inset-top))
        calc(24px + env(safe-area-inset-right))
        calc(84px + env(safe-area-inset-bottom))
        calc(24px + env(safe-area-inset-left));
    position: relative;
    z-index: 1;
}

.dashboard-body:not(.dashboard-mounted) .hero,
.dashboard-body:not(.dashboard-mounted) .panel,
.dashboard-body:not(.dashboard-mounted) .student,
.dashboard-body:not(.dashboard-mounted) .flash {
    animation: surface-in 0.45s ease both;
}

.hero,
.panel,
.student {
    background: var(--surface-strong);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-panel);
}

@supports ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
    .hero,
    .panel,
    .student {
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }
}

.hero {
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.20), transparent 34%),
        linear-gradient(135deg, #102f45 0%, #15586f 52%, #1a7d89 100%);
    color: #f4fbfd;
    margin-bottom: 24px;
    overflow: hidden;
    padding: 30px;
    position: relative;
}

.hero::after {
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.12), transparent 45%),
        radial-gradient(circle at 78% 20%, rgba(255, 255, 255, 0.14), transparent 18%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero-top {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.95fr);
    margin-bottom: 24px;
}

.hero-copy h1,
.panel h2,
.student h3 {
    font-family: "Bahnschrift", "Aptos", sans-serif;
    letter-spacing: -0.03em;
    margin: 0;
    text-wrap: balance;
}

.hero-copy h1 {
    font-size: 2.4rem;
    font-size: clamp(2.4rem, 5vw, 3.9rem);
    line-height: 1.02;
    max-width: 12ch;
}

.hero-lead {
    color: rgba(244, 251, 253, 0.88);
    font-size: 1.03rem;
    margin: 18px 0 0;
    max-width: 68ch;
}

.hero-note {
    color: rgba(244, 251, 253, 0.78);
    font-size: 0.95rem;
    margin: 16px 0 0;
}

.eyebrow {
    color: rgba(244, 251, 253, 0.78);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.section-head .eyebrow,
.student .eyebrow {
    color: var(--accent-strong);
    margin-bottom: 10px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.chip {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    color: #f4fbfd;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 14px;
}

.hero-action-stack {
    display: grid;
    gap: 14px;
}

.hero-session-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.hero-sync-card {
    position: relative;
}

.sync-row {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.sync-status {
    font-size: 1.16rem;
    margin-top: 0;
}

.sync-dot {
    background: #7fd9cf;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(127, 217, 207, 0.55);
    flex: 0 0 12px;
    height: 12px;
    width: 12px;
}

.js-sync-indicator[data-state="live"] .sync-dot {
    animation: sync-pulse 1.5s ease infinite;
    background: #7fd9cf;
}

.js-sync-indicator[data-state="syncing"] .sync-dot {
    animation: sync-pulse 0.85s ease infinite;
    background: #ffd97d;
}

.js-sync-indicator[data-state="reconnecting"] .sync-dot {
    animation: sync-pulse 1.2s ease infinite;
    background: #ff9a7d;
}

.js-sync-indicator[data-state="paused"] .sync-dot,
.js-sync-indicator[data-state="unsupported"] .sync-dot {
    animation: none;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: none;
}

.hero-actions {
    justify-content: flex-start;
    margin-top: 0;
}

.hero-grid {
    margin-top: 0;
}

.wrap,
.grid,
.live-grid,
.student-control-grid,
.filter-form {
    display: grid;
    gap: 16px;
}

.grid,
.student-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.live-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel {
    background: var(--surface);
    margin-bottom: 24px;
    padding: 28px;
    position: relative;
}

.panel::before,
.student::before {
    background: linear-gradient(90deg, rgba(15, 111, 135, 0.14), rgba(15, 111, 135, 0));
    content: "";
    height: 1px;
    left: 28px;
    position: absolute;
    right: 28px;
    top: 0;
}

.section-head {
    align-items: start;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title-block {
    max-width: 820px;
}

.section-title-block h2 {
    font-size: 1.55rem;
    font-size: clamp(1.55rem, 2vw, 2rem);
}

.section-copy {
    margin: 8px 0 0;
}

.section-tag {
    align-self: start;
    background: linear-gradient(135deg, rgba(15, 111, 135, 0.12), rgba(15, 111, 135, 0.22));
    border: 1px solid rgba(15, 111, 135, 0.16);
    border-radius: 999px;
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 14px;
    white-space: nowrap;
}

.section-tag.alert {
    background: rgba(192, 122, 31, 0.12);
    border-color: rgba(192, 122, 31, 0.18);
    color: #965b11;
}

.section-tag.success {
    background: rgba(31, 122, 84, 0.12);
    border-color: rgba(31, 122, 84, 0.18);
    color: #166241;
}

.section-tag.closed {
    background: rgba(92, 104, 118, 0.12);
    border-color: rgba(92, 104, 118, 0.18);
    color: #45525e;
}

.meta {
    color: var(--page-ink-soft);
    font-size: 0.94rem;
}

a {
    color: var(--accent-strong);
    text-decoration-color: rgba(10, 83, 105, 0.26);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: #083f52;
}

label {
    color: var(--page-ink);
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
textarea,
select {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #bfd0dc;
    border-radius: 14px;
    box-sizing: border-box;
    color: var(--page-ink);
    font: inherit;
    font-size: 16px;
    padding: 12px 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    width: 100%;
}

input[readonly] {
    background: linear-gradient(180deg, rgba(244, 248, 251, 0.96) 0%, rgba(237, 244, 248, 0.98) 100%);
    color: #214052;
}

textarea {
    min-height: 124px;
    resize: vertical;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: rgba(15, 111, 135, 0.70);
    box-shadow: 0 0 0 4px rgba(15, 111, 135, 0.14);
    outline: none;
    transform: translateY(-1px);
}

input[type="checkbox"] {
    accent-color: var(--accent);
}

.check {
    align-items: center;
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.check.compact {
    align-items: start;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-top: 0;
    padding: 12px 14px;
}

.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.inline {
    display: inline;
}

button,
.button-link {
    -webkit-appearance: none;
    background: linear-gradient(135deg, var(--accent) 0%, #1482a0 100%);
    border: 0;
    border-radius: 14px;
    box-shadow: var(--shadow-button);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 46px;
    padding: 11px 16px;
    text-align: center;
    text-decoration: none;
    touch-action: manipulation;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

button.secondary,
.button-link.secondary {
    background: linear-gradient(135deg, #4f6f82 0%, #6b8aa0 100%);
}

button.danger {
    background: linear-gradient(135deg, #923838 0%, var(--danger) 100%);
}

button.ghost,
.button-link.ghost {
    background: rgba(236, 244, 247, 0.92);
    box-shadow: none;
    color: var(--page-ink);
}

button:hover,
.button-link:hover {
    box-shadow: 0 20px 34px rgba(15, 111, 135, 0.22);
    transform: translateY(-1px);
}

button.ghost:hover,
.button-link.ghost:hover {
    background: #dcebf1;
    box-shadow: 0 10px 18px rgba(23, 51, 70, 0.08);
}

button:focus-visible,
.button-link:focus-visible,
summary:focus-visible {
    box-shadow: 0 0 0 4px rgba(15, 111, 135, 0.18);
    outline: none;
}

.button-link.disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    pointer-events: none;
}

.flash {
    border-radius: 18px;
    box-shadow: 0 14px 28px rgba(23, 51, 70, 0.08);
    margin-bottom: 14px;
    padding: 14px 16px;
}

.flash.success {
    background: #e7f8ed;
    border: 1px solid #abd9bb;
}

.flash.error {
    background: #fdecec;
    border: 1px solid #efb0b0;
}

.flash.warning {
    background: #fff6e6;
    border: 1px solid #f0cf8c;
}

.live-card {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    min-height: 100%;
    padding: 18px;
}

.live-card.light {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 250, 0.96));
    border-color: rgba(20, 45, 59, 0.08);
    color: var(--page-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.live-label,
.fact-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    opacity: 0.85;
    text-transform: uppercase;
}

.live-value,
.fact-value {
    font-family: "Bahnschrift", "Aptos", sans-serif;
    font-size: 1.28rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 10px;
}

.live-sub {
    font-size: 0.92rem;
    margin-top: 10px;
    opacity: 0.9;
}

.status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin: 0;
    padding: 7px 12px;
    text-transform: uppercase;
}

.status.ready {
    background: rgba(31, 122, 84, 0.14);
    color: #166241;
}

.status.pending {
    background: rgba(192, 122, 31, 0.14);
    color: #965b11;
}

.status.closed {
    background: rgba(92, 104, 118, 0.14);
    color: #45525e;
}

.status.not-ready {
    background: rgba(168, 62, 62, 0.12);
    color: #8d2c2c;
}

.pill {
    background: var(--accent-soft);
    border: 1px solid rgba(15, 111, 135, 0.12);
    border-radius: 999px;
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 7px 12px;
}

code {
    background: rgba(232, 241, 245, 0.95);
    border-radius: 8px;
    color: #173346;
    padding: 2px 7px;
}

pre {
    background: linear-gradient(180deg, #102634 0%, #0f2230 100%);
    border-radius: 16px;
    color: #eaf3f7;
    overflow-x: auto;
    padding: 16px;
    white-space: pre-wrap;
}

details {
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid var(--line);
    border-radius: 18px;
    margin-top: 12px;
    overflow: hidden;
}

details[open] {
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 16px 32px rgba(13, 31, 42, 0.08);
}

summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-weight: 700;
    gap: 14px;
    list-style: none;
    min-height: 56px;
    padding: 16px 18px;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    color: var(--accent-strong);
    content: "+";
    font-size: 1.2rem;
    font-weight: 800;
    margin-left: auto;
    transition: transform 0.18s ease;
}

details[open] > summary::after {
    transform: rotate(45deg);
}

details > :not(summary) {
    margin-left: 18px;
    margin-right: 18px;
}

details > :last-child {
    margin-bottom: 18px;
}

.student {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 252, 0.94));
    overflow: hidden;
    padding: 24px;
    position: relative;
}

.student::after {
    background: radial-gradient(circle at top right, rgba(15, 111, 135, 0.14), transparent 32%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.student > * {
    position: relative;
    z-index: 1;
}

.student-head {
    align-items: start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.student-head h3 {
    font-size: 1.45rem;
}

.student-badges {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.student-facts {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 18px;
}

.fact-card {
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 18px;
    min-height: 100%;
    padding: 16px;
}

.fact-card--wide {
    grid-column: span 2;
}

.student-line {
    background: rgba(15, 111, 135, 0.06);
    border: 1px solid rgba(15, 111, 135, 0.10);
    border-radius: 14px;
    margin-top: 10px;
    padding: 11px 13px;
}

.student-line--accent {
    background: rgba(192, 122, 31, 0.10);
    border-color: rgba(192, 122, 31, 0.14);
}

.student-action-menu,
.student-control-form {
    border-top: 1px solid rgba(20, 45, 59, 0.08);
    margin-top: 18px;
    padding-top: 18px;
}

.student-action-trigger {
    align-items: center;
    background: rgba(236, 244, 247, 0.96);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--page-ink);
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 800;
    min-height: 44px;
    padding: 0 16px;
}

.student-action-content {
    margin-top: 14px;
}

.student-control-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 14px;
}

.action-item {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-left: 4px solid #d7e0ea;
    border-radius: 18px;
    margin-bottom: 12px;
    padding: 16px 18px;
}

.action-item.warning {
    border-left-color: #d59718;
}

.action-item.critical {
    border-left-color: #b13b3b;
}

.filter-form {
    align-items: end;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 14px;
}

.pager {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    margin-top: 16px;
}

.inline-feedback {
    border-radius: 12px;
    margin-top: 10px;
    padding: 10px 12px;
}

.inline-feedback.success {
    background: #e7f8ed;
    border: 1px solid #abd9bb;
    color: #1e6f43;
}

.inline-feedback.error {
    background: #fdecec;
    border: 1px solid #efb0b0;
    color: #9d2d2d;
}

.empty-state {
    background: rgba(255, 255, 255, 0.62);
    border: 1px dashed rgba(20, 45, 59, 0.18);
    border-radius: 18px;
    padding: 16px 18px;
}

pre,
code,
.meta,
.live-sub,
.fact-value,
.student-line {
    overflow-wrap: anywhere;
}

@supports not ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
    .hero {
        background:
            radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 34%),
            linear-gradient(135deg, #123447 0%, #15566c 52%, #1b7b86 100%);
    }

    .panel,
    .student {
        background: rgba(255, 255, 255, 0.96);
    }
}

#action-center-results,
#message-history-results,
#dead-letter-content,
#audit-log-results {
    display: grid;
    gap: 12px;
}

@keyframes surface-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sync-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(127, 217, 207, 0.48);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(127, 217, 207, 0);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(127, 217, 207, 0);
        transform: scale(1);
    }
}

@media (max-width: 980px) {
    .hero-top {
        grid-template-columns: 1fr;
    }

    .fact-card--wide {
        grid-column: auto;
    }
}

@media (max-width: 720px) {
    .dashboard-shell {
        padding: 18px 14px 42px;
        padding:
            calc(18px + env(safe-area-inset-top))
            calc(14px + env(safe-area-inset-right))
            calc(42px + env(safe-area-inset-bottom))
            calc(14px + env(safe-area-inset-left));
    }

    .hero,
    .panel,
    .student {
        border-radius: 22px;
        padding: 20px;
    }

    .grid,
    .student-grid,
    .live-grid,
    .student-control-grid,
    .filter-form,
    .student-facts {
        grid-template-columns: 1fr;
    }

    .student-head,
    .section-head,
    .actions,
    .pager {
        align-items: stretch;
        flex-direction: column;
    }

    .student-badges {
        justify-content: flex-start;
    }

    .actions > *,
    .pager > * {
        width: 100%;
    }

    button,
    .button-link {
        width: 100%;
    }

    .hero-copy h1 {
        max-width: none;
    }
}
