:root {
    color-scheme: light;
    --bg-start: #f6efe4;
    --bg-end: #eadfcf;
    --surface: rgba(255, 250, 243, 0.82);
    --panel: rgba(255, 255, 255, 0.54);
    --surface-strong: #fffdf9;
    --ink: #201914;
    --muted: #6f6359;
    --accent: #b85c38;
    --accent-dark: #8f4022;
    --button-ink: #ffffff;
    --speaker-highlight: #ffd36a;
    --stage-start: #2f2622;
    --stage-end: #55463f;
    --accent-soft: rgba(184, 92, 56, 0.12);
    --success-soft: rgba(63, 143, 98, 0.14);
    --warning-soft: rgba(216, 152, 26, 0.18);
    --danger-soft: rgba(176, 67, 67, 0.14);
    --border: rgba(32, 25, 20, 0.11);
    --border-strong: rgba(32, 25, 20, 0.18);
    --shadow: 0 28px 80px rgba(74, 43, 21, 0.12);
    --shadow-soft: 0 16px 40px rgba(74, 43, 21, 0.08);
    --body-font: Georgia, "Times New Roman", serif;
    --heading-font: Georgia, "Times New Roman", serif;
    --ui-font: Georgia, "Times New Roman", serif;
    --base-font-size: 16px;
    --small-font-size: 13px;
    --button-font-size: 15px;
    --admin-tab-font-size: 15px;
    --admin-subtab-font-size: 15px;
    --hero-title-size: 76px;
    --card-title-size: 26px;
    --room-title-size: 64px;
    --participant-tile-min-width: 240px;
    --radius-lg: 30px;
    --radius-md: 22px;
    --radius-sm: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--body-font);
    font-size: var(--base-font-size);
    color: var(--ink);
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 14%, rgba(184, 92, 56, 0.16), transparent 24%),
        radial-gradient(circle at 88% 10%, rgba(40, 94, 78, 0.12), transparent 22%),
        linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    pointer-events: none;
    z-index: 0;
    border-radius: 999px;
    filter: blur(10px);
}

body::before {
    width: 18rem;
    height: 18rem;
    top: 5rem;
    right: -5rem;
    background: rgba(184, 92, 56, 0.08);
}

body::after {
    width: 14rem;
    height: 14rem;
    bottom: 3rem;
    left: -4rem;
    background: rgba(50, 111, 94, 0.08);
}

main,
header,
section,
article,
div,
table {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

img {
    max-width: 100%;
}

button,
.button,
input,
select,
textarea {
    font-family: var(--ui-font);
    font-size: var(--button-font-size);
}

button,
.button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.95rem 1.25rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--button-ink);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    letter-spacing: 0.01em;
    box-shadow: 0 14px 30px rgba(143, 64, 34, 0.2);
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease, background 160ms ease;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(143, 64, 34, 0.24);
    filter: saturate(1.04);
}

button.ghost,
.button.ghost {
    background: rgba(255, 255, 255, 0.52);
    color: var(--ink);
    border: 1px solid var(--border);
    box-shadow: none;
}

button.small {
    padding: 0.55rem 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(184, 92, 56, 0.45);
    box-shadow: 0 0 0 4px rgba(184, 92, 56, 0.12);
    background: #fff;
}

textarea {
    min-height: 5.5rem;
    resize: vertical;
}

input[type="color"] {
    min-height: 3.35rem;
    padding: 0.35rem;
}

input[type="range"] {
    padding-inline: 0;
}

label {
    display: block;
    font-family: var(--ui-font);
    font-size: var(--small-font-size);
    color: var(--muted);
}

.shell,
.meeting-shell {
    width: min(1180px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3.5rem;
}

.slim-shell {
    width: min(760px, calc(100vw - 2rem));
}

.hero {
    padding: 2.25rem 0 1.6rem;
}

.branded-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.7fr);
    align-items: end;
    gap: 1.6rem;
    margin-bottom: 1rem;
}

.brand-logo {
    width: 112px;
    height: 112px;
    object-fit: contain;
    justify-self: end;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.72);
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-soft);
}

.eyebrow {
    margin: 0 0 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.74rem;
    color: var(--muted);
}

.hero h1,
.meeting-meta h1 {
    margin: 0;
    font-family: var(--heading-font);
    font-size: clamp(2.5rem, 5vw, var(--hero-title-size));
    line-height: 0.93;
    max-width: 12ch;
}

.lede,
.meeting-meta p,
.card-copy {
    max-width: 50rem;
    color: var(--muted);
    font-size: 1.04rem;
    line-height: 1.65;
}

.grid {
    display: grid;
    gap: 1.25rem;
}

.two-up,
.auth-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

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

.admin-settings-card {
    grid-column: 1 / -1;
}

.admin-workspace {
    padding: 1.2rem;
}

.admin-panel-block {
    margin-top: 1rem;
}

.admin-section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.admin-section-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.1rem;
    font-size: var(--admin-tab-font-size);
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink);
    text-decoration: none;
    box-shadow: none;
}

.admin-section-tab.is-active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--button-ink);
    box-shadow: 0 14px 30px rgba(143, 64, 34, 0.16);
}

.admin-settings-form {
    width: min(100%, 880px);
    margin: 0 auto;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-bottom: 0.2rem;
}

.settings-tab {
    background: rgba(255, 255, 255, 0.56);
    color: var(--ink);
    border: 1px solid var(--border);
    box-shadow: none;
    font-size: var(--admin-subtab-font-size);
}

.settings-tab.is-active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--button-ink);
    box-shadow: 0 14px 30px rgba(143, 64, 34, 0.16);
}

.settings-panel {
    display: none;
    gap: 1rem;
}

.settings-panel.is-active {
    display: grid;
}

.settings-submit-row {
    display: flex;
    justify-content: center;
    padding-top: 0.25rem;
}

.card,
.notice,
.toolbar,
.meeting-meta,
.stat-card {
    background: var(--surface);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow);
}

.card,
.meeting-meta,
.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.55rem;
}

.card {
    overflow: hidden;
}

.card::before,
.stat-card::before,
.meeting-meta::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0));
    position: absolute;
    top: 0;
    left: 0;
}

.card h2,
.meeting-meta h1,
.stat-card strong {
    margin-top: 0;
}

.card h2 {
    margin-bottom: 0.55rem;
    font-family: var(--heading-font);
    font-size: var(--card-title-size);
}

.stack {
    display: grid;
    gap: 1rem;
}

.notice,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: 22px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.25rem;
}

.notice {
    background: rgba(255, 248, 234, 0.9);
    border: 1px solid rgba(184, 92, 56, 0.18);
}

.toolbar {
    background: rgba(255, 253, 249, 0.72);
}

.toolbar strong {
    font-family: var(--heading-font);
    font-size: 1.02rem;
}

.toolbar-subtle {
    display: block;
    color: var(--muted);
    margin-top: 0.18rem;
    font-size: var(--small-font-size);
}

.toolbar-actions,
.action-row,
.inline-form {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.meta-link {
    margin-top: 1rem;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    min-height: 8.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: var(--small-font-size);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-card strong {
    font-size: 2.5rem;
    line-height: 1;
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-md);
    overflow: hidden;
}

thead th {
    font-size: var(--small-font-size);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.42);
}

th,
td {
    text-align: left;
    padding: 0.95rem 0.8rem;
    border-bottom: 1px solid rgba(32, 25, 20, 0.08);
    vertical-align: top;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.35);
}

.pill {
    display: inline-block;
    padding: 0.34rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(32, 25, 20, 0.08);
}

.pill.pending {
    background: var(--warning-soft);
}

.pill.approved {
    background: var(--success-soft);
}

.pill.rejected {
    background: var(--danger-soft);
}

.meeting-body {
    background:
        radial-gradient(circle at top left, rgba(184, 92, 56, 0.12), transparent 20%),
        linear-gradient(180deg, #f6efe4 0%, #efe4d3 100%);
}

.meeting-shell {
    padding-top: 1.6rem;
}

.meeting-meta {
    margin-bottom: 1.2rem;
}

.meeting-meta h1 {
    font-size: clamp(2.4rem, 6vw, var(--room-title-size));
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    color: var(--accent-dark);
    text-decoration: none;
}

.back-link::before {
    content: "←";
}

#meeting-root {
    min-height: 74vh;
    background: var(--surface-strong);
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.session-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.42);
}

.session-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
}

.session-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.session-card-head,
.session-card-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.session-card-meta {
    margin: 0.85rem 0 1rem;
    color: var(--muted);
    font-size: var(--small-font-size);
    flex-wrap: wrap;
}

.feature-list {
    margin-top: 1rem;
}

.feature-row {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.35);
}

.feature-row strong,
.feature-row span {
    display: block;
}

.feature-row span {
    margin-top: 0.25rem;
    color: var(--muted);
}

.livekit-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 74vh;
    overflow: hidden;
}

.livekit-sidebar {
    padding: 1rem;
    background: rgba(255, 252, 247, 0.92);
    border-right: 1px solid var(--border);
    display: grid;
    gap: 1rem;
    align-content: start;
    max-height: 74vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    z-index: 2;
}

.livekit-panel {
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--panel);
}

.livekit-panel h2,
.livekit-panel p {
    margin: 0;
}

.livekit-panel p {
    margin-top: 0.4rem;
    color: var(--muted);
    line-height: 1.55;
}

.livekit-controls {
    display: grid;
    gap: 0.75rem;
}

.chat-panel {
    gap: 0.75rem;
    min-height: 29rem;
}

.chat-log {
    height: 18rem;
    min-height: 18rem;
    overflow-y: auto;
    display: grid;
    gap: 0.75rem;
    align-content: start;
    padding-right: 0.35rem;
}

.chat-feedback {
    margin: 0;
    color: var(--muted);
    font-size: var(--small-font-size);
}

.chat-feedback.is-error {
    color: #9d2e32;
}

.chat-message {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
    background: rgba(255, 255, 255, 0.7);
}

.chat-message header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: baseline;
    margin-bottom: 0.35rem;
}

.chat-message-title,
.participant-title {
    color: var(--accent-dark);
    font-size: var(--small-font-size);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.chat-message time {
    color: var(--muted);
    font-size: var(--small-font-size);
}

.chat-message p,
.chat-empty {
    margin: 0;
    color: var(--ink);
}

.chat-form {
    display: grid;
    gap: 0.75rem;
}

.chat-form textarea {
    resize: vertical;
    min-height: 5.5rem;
    max-height: 10rem;
}

.waiting-panel[hidden] {
    display: none;
}

.moderation-grid {
    display: grid;
    gap: 0.75rem;
}

.moderation-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.78);
    display: grid;
    gap: 0.65rem;
}

.moderation-card header {
    display: grid;
    gap: 0.2rem;
}

.moderation-card header span:last-child {
    color: var(--muted);
    font-size: var(--small-font-size);
}

.livekit-stage {
    padding: 1rem;
    background: linear-gradient(180deg, rgba(40, 31, 25, 0.06), rgba(255, 255, 255, 0.25));
    min-width: 0;
    overflow: hidden;
}

.participant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--participant-tile-min-width), 1fr));
    gap: 1rem;
    width: 100%;
    align-content: start;
}

.participant-card {
    min-height: 260px;
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    display: grid;
    grid-template-rows: 1fr auto;
}

.participant-media {
    background: linear-gradient(180deg, var(--stage-start) 0%, var(--stage-end) 100%);
    position: relative;
    min-height: 190px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.participant-media::before {
    content: "Waiting for media";
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    margin: auto;
}

.participant-card.has-media .participant-media::before {
    display: none;
}

.track-slot,
.track-slot video,
.track-slot audio {
    width: 100%;
    height: 100%;
}

.participant-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #1d1714;
}

.participant-audio {
    display: none;
}

.participant-card.active-speaker {
    border-color: var(--speaker-highlight);
    box-shadow: 0 0 0 3px var(--speaker-highlight), var(--shadow-soft);
    transform: translateY(-2px);
}

.participant-card.hidden-card {
    display: none;
}

.participant-label {
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.96);
}

.participant-label strong,
.participant-label span {
    display: block;
}

.participant-label span {
    margin-top: 0.18rem;
    color: var(--muted);
    font-size: var(--small-font-size);
}

.form-section {
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
}

.form-section h3 {
    margin: 0;
    font-family: var(--heading-font);
    font-size: calc(var(--card-title-size) * 0.7);
}

@media (max-width: 960px) {
    .branded-hero {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .brand-logo {
        justify-self: start;
    }

    .livekit-shell {
        grid-template-columns: 1fr;
    }

    .livekit-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        max-height: none;
        overflow: visible;
        position: static;
    }
}

@media (max-width: 860px) {
    .toolbar,
    .notice,
    .toolbar-actions,
    .action-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .shell,
    .meeting-shell {
        width: min(100vw - 1rem, 1180px);
    }

    .card,
    .meeting-meta,
    .stat-card {
        padding: 1.2rem;
    }

    .hero h1,
    .meeting-meta h1 {
        max-width: none;
        font-size: clamp(2rem, 9vw, 3.2rem);
    }

    .session-card-head,
    .session-card-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-tabs {
        flex-direction: column;
    }

    .admin-section-tabs {
        flex-direction: column;
    }

    .admin-section-tab,
    .settings-tab,
    .settings-submit-row button {
        width: 100%;
    }
}
