/* Maldivian Emerald & Warm Gold visual theme + elevated header & surface polish */

:root {
    --bg: #f5f8f6;
    --side: #eef3f0;
    --side-line: #d6e2dc;
    --surface: #ffffff;
    --ink: #0f2421;
    --muted: #506662;
    --line: #d8e3de;
    --subtle: #edf3f0;
    --hover: #e1ece7;
    --brand: #0d5c4d;
    --brand-dark: #09453a;
    --accent: #c58b2a;
    --accent-soft: #fdf6e7;
    --ring: #0f766e;
    --active-surface: #e0f2ec;
    --active-ink: #0a5244;
    --shadow: 0 2px 8px rgba(15, 36, 33, 0.05), 0 1px 2px rgba(15, 36, 33, 0.04);
    --shadow-md: 0 6px 20px rgba(15, 36, 33, 0.08), 0 2px 6px rgba(15, 36, 33, 0.04);
    --chart-primary: #0d6e5c;
    --chart-secondary: #d49b38;
    --chart-neutral: #8ea39e;
    --chart-coral: #c85250;
    --chart-teal: #2a8a78;
}

/* Dark / Auditorium Mode: Deep Midnight Emerald & Luminous Teal/Gold */
html[data-theme="dark"] {
    --bg: #081210;
    --side: #0c1917;
    --side-line: #1d3530;
    --surface: #11221f;
    --ink: #edf6f4;
    --muted: #8fb0a9;
    --line: #213d37;
    --subtle: #172d29;
    --hover: #1f3b35;
    --brand: #14b8a6;
    --brand-dark: #2dd4bf;
    --accent: #eab308;
    --accent-soft: rgba(234, 179, 8, 0.14);
    --ring: #2dd4bf;
    --active-surface: #143a33;
    --active-ink: #5eead4;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* Signature Emerald-to-Gold brand mark */
.logo-mark {
    background: linear-gradient(135deg, #0d5c4d 0%, #157a67 65%, #1d8f79 100%);
    box-shadow:
        inset 0 0 0 1px rgba(212, 155, 56, 0.42),
        0 2px 6px rgba(13, 92, 77, 0.24);
}

/* Elevated Sticky Workspace Header */
.topbar {
    height: 64px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 12px rgba(15, 36, 33, 0.045);
    position: sticky;
    top: 0;
}

.topbar::before,
.public-top::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d5c4d 0%, #168772 58%, #c58b2a 100%);
    pointer-events: none;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .public-top {
    background: rgba(17, 34, 31, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .snapshot-count {
    background: rgba(244, 63, 94, 0.18);
    color: #fda4af;
}

.readiness-details summary .numeric,
.readiness-details summary .tag {
    white-space: nowrap;
    flex: none;
}

/* Breadcrumbs polish */
.breadcrumb-trail a {
    color: var(--muted);
    font-weight: 550;
}

.breadcrumb-trail b {
    color: var(--ink);
    font-weight: 700;
}

/* Pill-grouped header utility capsule */
.header-utilities {
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--subtle);
    border: 1px solid var(--line);
}

.header-utilities > button {
    min-height: 31px;
    border-radius: 7px;
    border-color: transparent;
    background: transparent;
}

.header-utilities > button:hover {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(15, 36, 33, 0.08);
}

/* Jump-to-page pill */
.jump-trigger {
    min-height: 38px;
    padding-inline: 11px 7px;
    border-radius: 10px;
    background: var(--subtle);
    border-color: var(--line);
    transition: background-color 140ms ease, border-color 140ms ease;
}

.jump-trigger:hover {
    background: var(--surface);
    border-color: #b4cac2;
}

/* Account pill in topbar */
.header-account {
    min-height: 38px;
    padding-inline: 5px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    transition: border-color 140ms ease, background-color 140ms ease;
}

.header-account:hover {
    border-color: #b4cac2;
    background: var(--subtle);
}

.header-account .avatar {
    background: linear-gradient(135deg, #0d5c4d, #168772);
    box-shadow: inset 0 0 0 1px rgba(212, 155, 56, 0.35);
}

/* Elevated Public Header */
.public-top {
    position: sticky;
    top: 0;
    z-index: 4;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-block-end: 1px solid var(--line);
    box-shadow: 0 2px 14px rgba(15, 36, 33, 0.05);
    padding-block: 13px 11px;
}

.public-nav {
    gap: 4px;
}

.public-nav a {
    padding: 7px 12px;
    border-radius: 9px;
    font-weight: 560;
    transition: background-color 130ms ease, color 130ms ease;
}

.public-nav a[aria-current="page"] {
    background: var(--active-surface);
    color: var(--active-ink);
    font-weight: 680;
    box-shadow: inset 0 0 0 1px rgba(13, 92, 77, 0.14);
}

/* Event Heading Hero Banner */
.event-heading {
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, var(--surface) 0%, #edf6f3 100%);
    box-shadow: var(--shadow);
    margin-block-end: 20px;
}

html[data-theme="dark"] .event-heading {
    background: linear-gradient(135deg, #11221f 0%, #152e29 100%);
}

.public-heading {
    padding: 20px 22px;
    border: 1px solid var(--line);
}

/* Primary Buttons with rich emerald gradient & subtle depth */
.btn:not(.secondary):not(.ghost):not(.danger) {
    background: linear-gradient(180deg, #0f6b59 0%, #0b5345 100%);
    border-color: #09453a;
    color: #fff;
    box-shadow: 0 1px 3px rgba(13, 92, 77, 0.25);
}

.btn:not(.secondary):not(.ghost):not(.danger):hover:not(:disabled) {
    background: linear-gradient(180deg, #0d5e4e 0%, #084237 100%);
    box-shadow: 0 3px 10px rgba(13, 92, 77, 0.28);
}

html[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.danger) {
    background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
    border-color: #0f766e;
    color: #05201c;
    font-weight: 700;
}

/* Sidebar active indicator with gold-emerald accent */
:root {
    --side-width: 262px;
}

.sidebar {
    background: linear-gradient(180deg, #f2f7f4 0%, #e9f1ed 100%);
    border-inline-end: 1px solid var(--side-line);
    padding: 10px 11px 10px;
}

html[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0d1c19 0%, #091412 100%);
}

.sidebar .brand {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    margin: 0 0 8px;
    box-shadow: 0 1px 4px rgba(15, 36, 33, 0.05);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.sidebar .brand:hover {
    border-color: #b4cac2;
    box-shadow: 0 3px 10px rgba(13, 92, 77, 0.08);
}

.sidebar .brand .logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.sidebar .brand .logo-mark svg {
    width: 19px;
    height: 19px;
}

.sidebar-section {
    margin-block-start: 8px;
    padding-block-start: 8px;
    border-block-start: 1px solid var(--side-line);
}

.nav-caption {
    margin: 0 10px 4px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    opacity: 0.85;
}

html[lang="dv"] .nav-caption {
    font-size: 0.82rem;
    margin-block: 0 3px;
}

.sidebar .nav-list {
    gap: 2px;
}

.sidebar .nav-item,
html[lang="dv"] .sidebar .nav-item {
    min-height: 36px;
    padding: 5px 10px;
    border-radius: 9px;
    gap: 9px;
    color: #3a524d;
    transition:
        background-color 140ms ease,
        color 140ms ease,
        box-shadow 140ms ease;
}

html[data-theme="dark"] .sidebar .nav-item {
    color: var(--muted);
}

.sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
}

html[data-theme="dark"] .sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
}

.sidebar .nav-item svg {
    width: 17px;
    height: 17px;
    color: #5b7570;
    transition: color 140ms ease;
}

.sidebar .nav-item:hover svg {
    color: var(--brand);
}

.sidebar .nav-item.active {
    background: var(--surface);
    color: var(--brand);
    font-weight: 700;
    box-shadow:
        0 2px 8px rgba(13, 92, 77, 0.1),
        inset 0 0 0 1px rgba(13, 92, 77, 0.16);
}

html[data-theme="dark"] .sidebar .nav-item.active {
    background: var(--active-surface);
    color: var(--active-ink);
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.22);
}

.sidebar .nav-item.active svg {
    color: var(--brand);
}

html[data-theme="dark"] .sidebar .nav-item.active svg {
    color: var(--active-ink);
}

.sidebar .nav-item.active::before {
    background: linear-gradient(180deg, #0d5c4d, #c58b2a);
    inline-size: 3.5px;
    inset-block: 8px;
}

/* Sidebar live badges */
.nav-badge {
    margin-inline-start: auto;
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding-inline: 6px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.nav-badge.warn {
    background: #fdf3dc;
    color: #9a6209;
    border: 1px solid #f0d599;
}

html[data-theme="dark"] .nav-badge.warn {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.35);
}

.nav-live-dot {
    margin-inline-start: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22);
    flex: none;
}

.sidebar-collapsed .nav-badge,
.sidebar-collapsed .nav-live-dot {
    display: none;
}

/* Sidebar bottom utility group & floating profile card */
.side-bottom {
    margin-top: auto;
    padding-top: 8px;
    border-block-start: 1px solid var(--side-line);
}

.side-bottom .nav-list {
    margin-bottom: 8px;
}

.sidebar .profile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 10px 10px;
    gap: 9px;
    box-shadow: 0 1px 4px rgba(15, 36, 33, 0.05);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.sidebar .profile:hover {
    border-color: #b4cac2;
    box-shadow: 0 3px 10px rgba(13, 92, 77, 0.09);
}

.sidebar .profile .avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #0d5c4d, #168772);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(212, 155, 56, 0.35);
}

.sidebar .profile b {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.84rem;
    line-height: 1.3;
    direction: ltr;
    unicode-bidi: plaintext;
}

.sidebar .profile small {
    font-size: 0.78rem;
    line-height: 1.5;
    margin-top: 1px;
}

@media (min-width: 901px) {
    .sidebar-collapsed .sidebar .brand,
    .sidebar-collapsed .sidebar .profile {
        padding: 6px;
        justify-content: center;
    }
    .sidebar-collapsed .sidebar-section {
        padding-block-start: 8px;
        margin-block-start: 8px;
    }
}

/* Refined Stat Tiles & Panels */
.panel {
    border-radius: 14px;
}

.stat {
    border-radius: 14px;
}

.tile-icon.teal {
    background: #dff3ed;
    color: #0d6655;
}
.tile-icon.blue {
    background: #e3effa;
    color: #1f5f99;
}
.tile-icon.amber {
    background: #fdf3dc;
    color: #9e6a11;
}
.tile-icon.rose {
    background: #fce8ee;
    color: #a63459;
}

/* Table headers tinted gently with theme sage */
th {
    background: #f0f5f3;
    color: #354c48;
}

tbody tr:hover {
    background: #f5faf8;
}

@media (max-width: 650px) {
    .topbar {
        height: 56px;
    }

    .event-heading,
    .public-heading {
        padding: 14px 15px;
        border-radius: 13px;
    }

    .header-utilities {
        padding: 2px;
    }
}

/* Registration Review & Edit Drawer UI Polish */
dialog.drawer {
    background: var(--bg);
}

dialog.drawer .dialog-head {
    background: var(--surface);
    border-block-end: 1px solid var(--line);
    padding: 14px 20px;
}

dialog.drawer .dialog-head h2 {
    font-size: 1.15rem;
}

dialog.drawer .dialog-body {
    display: flex;
    flex-direction: column;
    padding: 16px 20px 0;
}

dialog.drawer .dialog-body > form {
    flex: 1 1 auto;
    display: grid;
    align-content: start;
    gap: 14px;
}

dialog.drawer .entry-photo-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    box-shadow: var(--shadow);
}

dialog.drawer .entry-photo-preview {
    width: 56px;
    height: 56px;
    border-radius: 12px;
}

dialog.drawer .summary {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 14px;
    gap: 0;
    box-shadow: var(--shadow);
}

dialog.drawer .summary > div {
    padding-block: 10px;
    align-items: center;
    border-block-end: 1px solid var(--line);
}

dialog.drawer .summary > div > span:first-child {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.88rem;
}

dialog.drawer .summary > div:last-child {
    border-block-end: 0;
}

dialog.drawer section[aria-labelledby="review-members-title"] {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px 6px;
    box-shadow: var(--shadow);
}

dialog.drawer .review-members {
    counter-reset: member-num;
    border-block-start: 1px solid var(--line);
    margin-block-start: 6px;
}

dialog.drawer .review-members li {
    counter-increment: member-num;
    align-items: center;
    padding-block: 9px;
}

dialog.drawer .review-members li::before {
    content: counter(member-num);
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--active-surface);
    color: var(--active-ink);
    font: 700 0.76rem var(--ui-font);
    flex: none;
}

dialog.drawer .form-actions {
    position: sticky;
    bottom: 0;
    margin-block: 10px 0;
    margin-inline: -20px;
    padding: 12px 20px 14px;
    background: var(--surface);
    border-block-start: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] dialog.drawer .form-actions {
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
}

dialog.drawer .member-edit {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
}

/* Color-Coded Overview Stat Tiles for Instant Scannability (Clean Uniform Borders) */
.workspace .stat {
    position: relative;
    overflow: hidden;
}

.workspace .stat-teal strong {
    color: #0a5c4d;
}

.workspace .stat-blue strong {
    color: #1d4ed8;
}

.workspace .stat-amber strong {
    color: #b45309;
}

.workspace .stat-rose strong {
    color: #9d174d;
}

.workspace .stat .tile-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
}

.workspace .stat .tile-icon svg {
    color: currentColor;
}

html[data-theme="dark"] .workspace .stat-teal strong { color: #5eead4; }
html[data-theme="dark"] .workspace .stat-blue strong { color: #93c5fd; }
html[data-theme="dark"] .workspace .stat-amber strong { color: #fcd34d; }
html[data-theme="dark"] .workspace .stat-rose strong { color: #fda4af; }

/* Manager Work Queue: Highlight Active Items vs Calm Zeros */
.manager-task-list .list-row.task-active {
    background: #fffbeb;
    border-inline-start: 3px solid #d97706;
}

.manager-task-list .list-row.task-active svg:first-child {
    color: #b45309;
}

.manager-task-list .task-count {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 24px;
    padding-inline: 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    background: var(--subtle);
    color: var(--muted);
}

.manager-task-list .task-active .task-count {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f5cb75;
}

.manager-task-list .task-zero {
    opacity: 0.82;
}

html[data-theme="dark"] .manager-task-list .list-row.task-active {
    background: rgba(245, 158, 11, 0.1);
}

html[data-theme="dark"] .manager-task-list .task-active .task-count {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

/* Readiness Checks: Color-Coded Status Icons & Summary Pill */
.readiness-list .check-ok svg {
    color: #0d8a6f;
}

.readiness-list .check-warn {
    background: #fffdf5;
}

.readiness-list .check-warn svg {
    color: #d97706;
}

html[data-theme="dark"] .readiness-list .check-warn {
    background: rgba(245, 158, 11, 0.08);
}

.readiness-ratio {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
}

.readiness-ratio.all-ready {
    background: #dff3ed;
    color: #0a5c4d;
}

.readiness-ratio.has-pending {
    background: #fef3c7;
    color: #92400e;
}

html[data-theme="dark"] .readiness-ratio.all-ready {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
}

html[data-theme="dark"] .readiness-ratio.has-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

/* Stage Snapshot: Vibrant Progress & Live Accent */
.snapshot-progress {
    background: linear-gradient(135deg, #eef7f4 0%, #e4f2ed 100%);
    border: 1px solid #cde4dc;
}

.snapshot-progress strong {
    color: #0a5c4d;
}

.snapshot-progress .progress span {
    background: linear-gradient(90deg, #0d6e5c, #18a388);
}

html[data-theme="dark"] .snapshot-progress {
    background: linear-gradient(135deg, #132824 0%, #17332d 100%);
    border-color: #21453d;
}

html[data-theme="dark"] .snapshot-progress strong {
    color: #5eead4;
}

/* Display Font (Thundu) for Very Big Main Headings */
html[lang="dv"] :is(.page-head, .event-heading) h1,
html[lang="dv"] .cert-title,
html[lang="dv"] .display-card h1 {
    font-family: var(--thaana-display);
    font-weight: 400;
    font-synthesis: none;
    letter-spacing: 0;
}

html[lang="dv"] .event-heading h1 {
    font-size: clamp(2.45rem, 4.4vw, 3.4rem);
    line-height: 1.48;
}

html[lang="dv"] .page-head h1 {
    font-size: clamp(2.2rem, 3.8vw, 3rem);
    line-height: 1.48;
}

html[lang="dv"] .cert-title {
    font-size: clamp(2.4rem, 4vw, 3.1rem);
    line-height: 1.45;
}

@media print {
    .topbar::before,
    .public-top::before {
        display: none;
    }
    .event-heading {
        background: #fff !important;
        box-shadow: none !important;
    }
}
