html, body {
    font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

img {
    max-width: 100%;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f2f4f7;
    padding: 1rem;
}

.login-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #fff;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 22rem;
}

.login-card label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.login-card input, .login-card select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 1rem;
}

.login-card button {
    margin-top: 0.5rem;
    padding: 0.6rem;
    border: none;
    border-radius: 0.25rem;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.login-error {
    background: #fdecea;
    color: #b3261e;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

/* ---- App shell ---- */

.lms-shell {
    display: flex;
    min-height: 100vh;
}

.lms-sidebar {
    position: fixed;
    /* Logical (direction-aware) offset instead of transform: translateX, which is a physical
       (not logical) axis and was sliding the panel the wrong way under dir="rtl" -- it never
       fully left the viewport and sat on top of the page content instead. */
    inset-inline-start: -17rem;
    top: 0;
    bottom: 0;
    width: 16rem;
    max-width: 80vw;
    background: #1e2530;
    color: #fff;
    padding: 1rem;
    overflow-y: auto;
    z-index: 1040;
    transition: inset-inline-start 0.2s ease-in-out;
}

.lms-sidebar.open {
    inset-inline-start: 0;
}

.lms-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1030;
}

.lms-brand {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.lms-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lms-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.25rem;
    color: #d6dbe3;
    text-decoration: none;
}

.lms-nav a.active, .lms-nav a:hover {
    background: #2c3644;
    color: #fff;
}

.lms-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.lms-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.lms-topbar-user {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lms-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.lms-logout-button {
    border: none;
    background: transparent;
    color: #b3261e;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}

.lms-content {
    padding: 1.5rem;
    overflow-x: hidden;
}

/* Sidebar becomes a static column (not an overlay) on wide screens. */
@media (min-width: 900px) {
    .lms-sidebar {
        position: sticky;
        inset-inline-start: 0;
        max-width: none;
    }

    .lms-sidebar-backdrop {
        display: none;
    }

    .lms-sidebar-toggle {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .lms-content {
        padding: 1rem 0.75rem;
    }

    .lms-topbar {
        padding: 0.6rem 0.75rem;
    }

    h1 {
        font-size: 1.4rem;
    }
}

/* Any plain <table> in the app scrolls horizontally instead of overflowing on narrow screens. */
.table-responsive-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Jalali date picker ---- */

/* Bootstrap's .form-select reserves room for the caret on the left under RTL, so each box needs
   enough width for its longest option -- "اردیبهشت" for months, a 4-digit year -- otherwise the
   text is clipped (the year showed as "405"). */
.jalali-date-picker {
    flex-wrap: nowrap;
}

.jalali-date-picker select {
    padding-inline-end: 0.5rem;
}

.jalali-date-picker .jdp-year {
    flex: 0 0 5.5rem;
}

.jalali-date-picker .jdp-month {
    flex: 1 1 8.5rem;
    min-width: 8.5rem;
}

.jalali-date-picker .jdp-day {
    flex: 0 0 4.5rem;
}

/* ---- Month calendar ---- */

.lms-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}

.lms-calendar-head {
    text-align: center;
    font-weight: bold;
    padding: 0.4rem 0.2rem;
    background: #eef1f5;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.lms-calendar-cell {
    min-height: 6.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    padding: 0.3rem;
    background: #fff;
    overflow: hidden;
}

.lms-calendar-empty {
    background: #fafbfc;
    border-style: dashed;
}

.lms-calendar-today {
    border-color: #2563eb;
    box-shadow: inset 0 0 0 1px #2563eb;
}

.lms-calendar-daynum {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.lms-calendar-event {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.lms-calendar-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .lms-calendar-cell {
        min-height: 4.5rem;
    }

    .lms-calendar-event-title {
        display: none;
    }
}

.lms-datagrid-toolbar {
    margin-bottom: 0.75rem;
}

.lms-datagrid-pager {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ===========================================================
   Meeting page (LiveKit) — docs/livekit-session-plan.md, phase 2 + UI refresh
   Full-viewport, RTL-aware layout. Class names consumed by
   wwwroot/js/livekitInterop.js (lk-tile, lk-tile-name, lk-tile-badges,
   speaking, tile-audio-only, screen-share) are preserved verbatim.
   =========================================================== */

.meeting-page {
    /* One place to retune the whole surface. */
    --mtg-bg: #0b0f16;
    --mtg-surface: rgba(24, 30, 42, .72);
    --mtg-surface-solid: #151b26;
    --mtg-border: rgba(255, 255, 255, .08);
    --mtg-border-strong: rgba(255, 255, 255, .16);
    --mtg-text: #e9edf5;
    --mtg-muted: #93a2b8;
    --mtg-accent: #4c8dff;
    --mtg-accent-2: #7b5cff;
    --mtg-live: #2ee07a;
    --mtg-danger: #ff4d5e;
    --mtg-radius: 16px;
    --mtg-shadow: 0 18px 48px rgba(0, 0, 0, .55);
    --mtg-ease: cubic-bezier(.22, .78, .3, 1);

    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    color: var(--mtg-text);
    background: var(--mtg-bg);
    z-index: 1050;
    overflow: hidden;
    font-feature-settings: "ss01";
}

/* Slow-drifting aurora behind everything: depth without touching the tiles. */
.meeting-page::before {
    content: "";
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(38% 38% at 22% 18%, rgba(76, 141, 255, .26), transparent 62%),
        radial-gradient(34% 34% at 82% 26%, rgba(123, 92, 255, .22), transparent 62%),
        radial-gradient(42% 42% at 55% 96%, rgba(46, 224, 122, .14), transparent 66%);
    filter: blur(26px);
    animation: mtg-aurora 26s var(--mtg-ease) infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes mtg-aurora {
    0% { transform: translate3d(-3%, -2%, 0) scale(1); }
    50% { transform: translate3d(3%, 2%, 0) scale(1.08); }
    100% { transform: translate3d(-2%, 3%, 0) scale(1.03); }
}

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

/* ---------- header ---------- */

.meeting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem 1rem;
    background: linear-gradient(180deg, rgba(18, 24, 35, .9), rgba(18, 24, 35, .58));
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--mtg-border);
    flex: 0 0 auto;
    animation: mtg-slide-down .5s var(--mtg-ease) both;
}

.meeting-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .95rem;
    letter-spacing: .01em;
}

.meeting-title strong {
    font-weight: 700;
    background: linear-gradient(100deg, #fff, #a9c6ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.meeting-title .text-muted {
    color: var(--mtg-muted) !important;
    font-size: .82rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--mtg-border);
}

#lk-participant-count {
    font-variant-numeric: tabular-nums;
    color: var(--mtg-text);
    font-weight: 600;
}

/* Red = not connected, green + breathing halo = live. */
.meeting-status-dot {
    width: .62rem;
    height: .62rem;
    border-radius: 50%;
    background: var(--mtg-danger);
    display: inline-block;
    flex: 0 0 auto;
    box-shadow: 0 0 0 0 rgba(255, 77, 94, .5);
    transition: background .3s var(--mtg-ease);
}

.meeting-status-dot.on {
    background: var(--mtg-live);
    animation: mtg-pulse 2.2s ease-out infinite;
}

@keyframes mtg-pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 224, 122, .55); }
    70% { box-shadow: 0 0 0 .7rem rgba(46, 224, 122, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 224, 122, 0); }
}

.meeting-header-actions {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

/* Glass chips replace the default outline buttons inside the meeting shell. */
.meeting-header-actions .btn,
.meeting-whiteboard-toolbar .btn {
    border-radius: 999px;
    border: 1px solid var(--mtg-border-strong);
    background: rgba(255, 255, 255, .06);
    color: var(--mtg-text);
    padding: .3rem .85rem;
    font-size: .82rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .18s var(--mtg-ease), background .18s var(--mtg-ease), box-shadow .18s var(--mtg-ease), border-color .18s var(--mtg-ease);
}

.meeting-header-actions .btn:hover,
.meeting-whiteboard-toolbar .btn:hover {
    background: rgba(255, 255, 255, .13);
    border-color: rgba(255, 255, 255, .3);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.meeting-header-actions .btn:active,
.meeting-whiteboard-toolbar .btn:active {
    transform: translateY(0) scale(.97);
}

.meeting-header-actions .btn.active,
.meeting-header-actions .btn-active {
    background: linear-gradient(135deg, var(--mtg-accent), var(--mtg-accent-2));
    border-color: transparent;
    box-shadow: 0 6px 22px rgba(76, 141, 255, .38);
}

.meeting-header-actions .btn-danger {
    background: linear-gradient(135deg, #ff5a6a, #d61f3a);
    border-color: transparent;
    box-shadow: 0 6px 22px rgba(214, 31, 58, .35);
}

/* Recording: unmistakable, without shouting on every frame. */
.meeting-header-actions .btn.is-recording {
    animation: mtg-rec 1.6s ease-in-out infinite;
}

@keyframes mtg-rec {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, .5); }
    50% { box-shadow: 0 0 0 .55rem rgba(255, 77, 94, 0); }
}

.meeting-body {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

.meeting-grid-wrap {
    flex: 1 1 auto;
    position: relative;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

/* ---------- alerts ---------- */

.meeting-page .alert {
    border-radius: var(--mtg-radius);
    border: 1px solid var(--mtg-border-strong);
    background: var(--mtg-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--mtg-text);
    box-shadow: var(--mtg-shadow);
    animation: mtg-slide-down .35s var(--mtg-ease) both;
}

.meeting-page .alert-danger {
    border-inline-start: 3px solid var(--mtg-danger);
}

.meeting-page .alert-info {
    border-inline-start: 3px solid var(--mtg-accent);
}

/* ---------- pre-join ---------- */

.meeting-prejoin {
    margin: auto;
    padding: 1rem;
    width: min(30rem, 100%);
    animation: mtg-rise .55s var(--mtg-ease) both;
}

.meeting-prejoin .card {
    position: relative;
    border: 1px solid var(--mtg-border-strong);
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(30, 38, 54, .92), rgba(16, 21, 30, .92));
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    color: var(--mtg-text);
    box-shadow: var(--mtg-shadow);
    overflow: hidden;
}

/* Light sweep along the top edge — reads as "system is live". */
.meeting-prejoin .card::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--mtg-accent), var(--mtg-accent-2), transparent);
    background-size: 50% 100%;
    animation: mtg-sweep 3.4s linear infinite;
}

@keyframes mtg-sweep {
    0% { background-position: -100% 0; }
    100% { background-position: 200% 0; }
}

.meeting-prejoin h5 {
    font-weight: 700;
    margin-bottom: .5rem;
}

.meeting-prejoin .text-muted {
    color: var(--mtg-muted) !important;
    line-height: 1.9;
    font-size: .9rem;
}

.meeting-prejoin .btn-success {
    background: linear-gradient(135deg, #22c977, #0f9e6a);
    border: none;
    border-radius: 999px;
    padding: .55rem 1.6rem;
    font-weight: 600;
    box-shadow: 0 10px 26px rgba(15, 158, 106, .38);
    transition: transform .18s var(--mtg-ease), box-shadow .18s var(--mtg-ease), filter .18s var(--mtg-ease);
}

.meeting-prejoin .btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(15, 158, 106, .5);
    filter: brightness(1.06);
}

.meeting-prejoin .btn-success:disabled {
    opacity: .75;
}

.meeting-prejoin .btn-outline-secondary {
    border-radius: 999px;
    padding: .55rem 1.3rem;
    color: var(--mtg-muted);
    border-color: var(--mtg-border-strong);
    background: transparent;
}

.meeting-prejoin .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-color: rgba(255, 255, 255, .3);
}

/* ---------- video tiles ---------- */

.lk-grid {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .85rem;
    align-content: center;
    justify-content: center;
    overflow: auto;
}

.lk-tile {
    position: relative;
    background: radial-gradient(120% 120% at 50% 0%, #1b2231, #080b11);
    border: 1px solid var(--mtg-border);
    border-radius: var(--mtg-radius);
    overflow: hidden;
    flex: 1 1 320px;
    max-width: 640px;
    aspect-ratio: 16 / 9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    transition: transform .28s var(--mtg-ease), box-shadow .28s var(--mtg-ease), border-color .28s var(--mtg-ease);
    animation: mtg-tile-in .42s var(--mtg-ease) both;
}

@keyframes mtg-tile-in {
    from { opacity: 0; transform: scale(.94) translateY(10px); }
    to { opacity: 1; transform: none; }
}

.lk-tile:hover {
    transform: translateY(-3px);
    border-color: var(--mtg-border-strong);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .6);
}

.lk-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Active speaker: animated gradient ring instead of a flat outline. */
.lk-tile.speaking {
    border-color: transparent;
    box-shadow:
        0 0 0 2px var(--mtg-live),
        0 0 26px rgba(46, 224, 122, .45),
        0 18px 42px rgba(0, 0, 0, .55);
    animation: mtg-speak 1.5s ease-in-out infinite;
}

@keyframes mtg-speak {
    0%, 100% { box-shadow: 0 0 0 2px var(--mtg-live), 0 0 18px rgba(46, 224, 122, .35), 0 18px 42px rgba(0, 0, 0, .55); }
    50% { box-shadow: 0 0 0 2px var(--mtg-live), 0 0 34px rgba(46, 224, 122, .6), 0 18px 42px rgba(0, 0, 0, .55); }
}

/* Camera off / audio-only: show an identity mark instead of a black hole. */
.lk-tile.tile-audio-only video {
    opacity: 0;
}

.lk-tile.tile-audio-only::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mtg-accent), var(--mtg-accent-2));
    opacity: .85;
    filter: blur(.5px);
    animation: mtg-breathe 3.4s ease-in-out infinite;
}

@keyframes mtg-breathe {
    0%, 100% { transform: scale(1); opacity: .78; }
    50% { transform: scale(1.07); opacity: .95; }
}

.lk-tile-name {
    position: absolute;
    bottom: .5rem;
    right: .6rem;
    background: rgba(8, 11, 17, .62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--mtg-border);
    color: #fff;
    padding: .15rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    pointer-events: none;
    z-index: 2;
}

.lk-tile-badges {
    position: absolute;
    top: .45rem;
    right: .6rem;
    font-size: .8rem;
    display: none;
    gap: .25rem;
    z-index: 2;
}

.lk-tile-badges:not(:empty) {
    display: flex;
}

.lk-tile-badges > * {
    background: rgba(8, 11, 17, .62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--mtg-border);
    border-radius: 999px;
    padding: .05rem .4rem;
    line-height: 1.5;
}

.lk-tile.screen-share {
    flex: 3 1 640px;
    aspect-ratio: auto;
    height: 100%;
    max-width: none;
}

.lk-tile.screen-share video {
    object-fit: contain;
    background: #000;
}

/* ---------- side panels (chat / participants) ---------- */

.meeting-side-panel {
    flex: 0 0 320px;
    background: linear-gradient(180deg, rgba(21, 27, 38, .92), rgba(15, 19, 27, .92));
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-inline-start: 1px solid var(--mtg-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: mtg-slide-in .34s var(--mtg-ease) both;
}

@keyframes mtg-slide-in {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: none; }
}

.meeting-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.meeting-chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    scroll-behavior: smooth;
}

.meeting-chat-msg {
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--mtg-border);
    border-radius: 14px 14px 14px 4px;
    padding: .4rem .7rem;
    font-size: .86rem;
    line-height: 1.7;
    word-break: break-word;
    max-width: 92%;
    align-self: flex-start;
    animation: mtg-msg-in .26s var(--mtg-ease) both;
}

@keyframes mtg-msg-in {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.meeting-chat-msg.self {
    align-self: flex-end;
    border-radius: 14px 14px 4px 14px;
    background: linear-gradient(135deg, rgba(76, 141, 255, .3), rgba(123, 92, 255, .26));
    border-color: rgba(124, 158, 255, .4);
}

.meeting-chat-msg .name {
    display: block;
    font-size: .7rem;
    color: var(--mtg-muted);
    margin-bottom: .1rem;
}

.meeting-chat-input {
    display: flex;
    gap: .4rem;
    padding: .6rem;
    border-top: 1px solid var(--mtg-border);
}

.meeting-chat-input .form-control {
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--mtg-border-strong);
    border-radius: 999px;
    color: var(--mtg-text);
    padding: .4rem .9rem;
    transition: border-color .18s var(--mtg-ease), box-shadow .18s var(--mtg-ease), background .18s var(--mtg-ease);
}

.meeting-chat-input .form-control::placeholder {
    color: rgba(147, 162, 184, .75);
}

.meeting-chat-input .form-control:focus {
    background: rgba(255, 255, 255, .1);
    border-color: var(--mtg-accent);
    box-shadow: 0 0 0 .2rem rgba(76, 141, 255, .22);
    color: #fff;
}

.meeting-chat-input .btn-primary {
    border-radius: 999px;
    border: none;
    padding: .35rem 1.05rem;
    background: linear-gradient(135deg, var(--mtg-accent), var(--mtg-accent-2));
    box-shadow: 0 6px 18px rgba(76, 141, 255, .35);
    transition: transform .18s var(--mtg-ease), box-shadow .18s var(--mtg-ease);
}

.meeting-chat-input .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(76, 141, 255, .48);
}

.meeting-participants {
    overflow-y: auto;
    padding: .6rem;
    gap: .4rem;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.meeting-participants .list-group-item {
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--mtg-border);
    border-radius: 12px;
    color: var(--mtg-text);
    font-size: .87rem;
    padding: .5rem .7rem;
    transition: background .18s var(--mtg-ease), transform .18s var(--mtg-ease), border-color .18s var(--mtg-ease);
    animation: mtg-msg-in .26s var(--mtg-ease) both;
}

.meeting-participants .list-group-item:hover {
    background: rgba(255, 255, 255, .1);
    border-color: var(--mtg-border-strong);
    transform: translateX(-2px);
}

.meeting-participants .btn {
    border-radius: 999px;
    font-size: .75rem;
    padding: .15rem .55rem;
    transition: transform .18s var(--mtg-ease);
}

.meeting-participants .btn:hover {
    transform: scale(1.08);
}

/* Custom scrollbars so the panels don't break the dark surface. */
.meeting-chat-messages::-webkit-scrollbar,
.meeting-participants::-webkit-scrollbar,
.lk-grid::-webkit-scrollbar {
    width: 8px;
}

.meeting-chat-messages::-webkit-scrollbar-thumb,
.meeting-participants::-webkit-scrollbar-thumb,
.lk-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .14);
    border-radius: 999px;
}

.meeting-chat-messages::-webkit-scrollbar-thumb:hover,
.meeting-participants::-webkit-scrollbar-thumb:hover,
.lk-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .26);
}

/* ---------- bottom toolbar ---------- */

.meeting-toolbar {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: .6rem;
    padding: .75rem .6rem 1rem;
    background: linear-gradient(0deg, rgba(11, 15, 22, .96), rgba(11, 15, 22, 0));
    animation: mtg-slide-up .5s var(--mtg-ease) both;
}

/* Floating control pill. */
.meeting-toolbar > .btn-round:first-child {
    margin-inline-start: 0;
}

.btn-round {
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 50%;
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mtg-border-strong);
    background: rgba(255, 255, 255, .08);
    color: var(--mtg-text);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
    transition: transform .2s var(--mtg-ease), box-shadow .2s var(--mtg-ease), background .2s var(--mtg-ease), border-color .2s var(--mtg-ease);
    position: relative;
}

.btn-round:hover {
    transform: translateY(-4px) scale(1.05);
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .32);
    box-shadow: 0 16px 34px rgba(0, 0, 0, .55);
}

.btn-round:active {
    transform: translateY(-1px) scale(.96);
}

.btn-round:focus-visible {
    outline: none;
    box-shadow: 0 0 0 .22rem rgba(76, 141, 255, .4), 0 8px 22px rgba(0, 0, 0, .45);
}

.btn-round.btn-primary {
    background: linear-gradient(135deg, var(--mtg-accent), var(--mtg-accent-2));
    border-color: transparent;
    box-shadow: 0 10px 26px rgba(76, 141, 255, .42);
}

.btn-round.btn-secondary {
    background: rgba(255, 255, 255, .08);
    border-color: var(--mtg-border-strong);
}

.btn-round.btn-danger {
    background: linear-gradient(135deg, #ff5a6a, #d61f3a);
    border-color: transparent;
    box-shadow: 0 10px 26px rgba(214, 31, 58, .4);
}

.btn-round.btn-warning {
    background: linear-gradient(135deg, #ffc453, #f59300);
    border-color: transparent;
    color: #21160a;
    box-shadow: 0 10px 26px rgba(245, 147, 0, .4);
    animation: mtg-hand 1.8s ease-in-out infinite;
}

@keyframes mtg-hand {
    0%, 100% { transform: rotate(0deg); }
    35% { transform: rotate(-9deg); }
    65% { transform: rotate(9deg); }
}

/* Native-feeling tooltips on the round controls (title is already set). */
.btn-round[title]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + .5rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(8, 11, 17, .92);
    border: 1px solid var(--mtg-border-strong);
    color: var(--mtg-text);
    font-size: .72rem;
    white-space: nowrap;
    padding: .18rem .55rem;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s var(--mtg-ease), transform .18s var(--mtg-ease);
}

.btn-round[title]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- whiteboard panel (phase 3) ---------- */

.meeting-whiteboard-panel {
    flex: 0 0 46%;
    min-width: 320px;
    background: #fff;
    border-inline-start: 1px solid var(--mtg-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: -10px 0 40px rgba(0, 0, 0, .45);
    animation: mtg-slide-in .34s var(--mtg-ease) both;
}

.meeting-whiteboard-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .7rem;
    background: linear-gradient(180deg, rgba(21, 27, 38, .96), rgba(15, 19, 27, .96));
    color: var(--mtg-text);
    border-bottom: 1px solid var(--mtg-border);
    flex: 0 0 auto;
}

.meeting-whiteboard-toolbar .badge {
    border-radius: 999px;
    background: rgba(255, 255, 255, .1) !important;
    border: 1px solid var(--mtg-border-strong);
    color: var(--mtg-muted);
    font-weight: 500;
}

.meeting-whiteboard-host {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

/* tldraw needs a sized, positioned parent or it renders at zero height. */
.wb-canvas {
    position: absolute;
    inset: 0;
}

/* ---------- shared animations ---------- */

@keyframes mtg-slide-down {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: none; }
}

@keyframes mtg-slide-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes mtg-rise {
    from { opacity: 0; transform: translateY(18px) scale(.97); }
    to { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 768px) {
    .meeting-header {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }

    .meeting-header-actions {
        justify-content: center;
    }

    /* Panels overlay instead of shrinking the grid. */
    .meeting-side-panel {
        position: absolute;
        inset-block: 0;
        inset-inline-end: 0;
        z-index: 10;
        flex-basis: min(21rem, 86vw);
        box-shadow: -12px 0 40px rgba(0, 0, 0, .6);
    }

    .meeting-whiteboard-panel {
        position: absolute;
        inset-block: 0;
        inset-inline: 0;
        z-index: 11;
        flex-basis: auto;
        min-width: 0;
    }

    .btn-round {
        width: 2.8rem;
        height: 2.8rem;
        font-size: 1.05rem;
    }

    .btn-round[title]::after {
        display: none;
    }
}

/* Respect the OS-level motion preference: keep the design, drop the movement. */
@media (prefers-reduced-motion: reduce) {
    .meeting-page *,
    .meeting-page *::before,
    .meeting-page *::after {
        animation: none !important;
        transition-duration: .01ms !important;
    }
}
