:root {
    --cm-bg: #080f14;
    --cm-panel: rgba(8, 15, 22, .86);
    --cm-panel-strong: rgba(5, 10, 16, .94);
    --cm-gold: #d4af37;
    --cm-gold-bright: #ffe49a;
    --cm-blue: #1e88ff;
    --cm-blue-bright: #70c9ff;
    --cm-green: #22c55e;
    --cm-red: #ef4444;
    --cm-text: #f7f8fa;
    --cm-muted: #a9b3c0;
    --cm-line: rgba(255, 255, 255, .14);
}

html {
    min-height: 100%;
    background: var(--cm-bg);
}

body {
    background: var(--cm-bg);
    color: var(--cm-text);
}

.app-shell {
    width: min(100%, 560px);
    min-height: 100vh;
    padding: 0 8px calc(86px + env(safe-area-inset-bottom));
}

.mini-state {
    margin-top: calc(20px + env(safe-area-inset-top));
}

.hidden {
    display: none !important;
}

.command-world {
    position: relative;
    width: 100%;
    isolation: isolate;
}

/* Keep the approved command-room artwork fixed while the dashboard content scrolls. */
.command-world::before {
    content: "";
    position: fixed;
    z-index: -2;
    top: 0;
    bottom: 0;
    left: 50%;
    width: min(calc(100vw - 16px), 544px);
    transform: translateX(-50%);
    border-radius: 22px;
    background-color: var(--cm-bg);
    background-image:
        url("/static/assets/command-center-room-user.webp?v=7-4-room-user-v2"),
        linear-gradient(180deg, #101a23 0%, #080f14 100%);
    background-position: center top, center;
    background-repeat: no-repeat, no-repeat;
    background-size: cover, cover;
    pointer-events: none;
}

.command-world::after {
    content: "";
    position: fixed;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 50%;
    width: min(calc(100vw - 16px), 544px);
    transform: translateX(-50%);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(2, 6, 11, .16) 0%, rgba(2, 6, 11, .08) 34%, rgba(2, 6, 11, .48) 63%, rgba(2, 6, 11, .94) 100%),
        linear-gradient(90deg, rgba(2, 6, 11, .32), transparent 32%, transparent 68%, rgba(2, 6, 11, .32));
    pointer-events: none;
}

.command-screen {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 8px);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, .46);
    border-radius: 22px;
    background: transparent;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .8), 0 0 60px rgba(212, 175, 55, .08);
    isolation: isolate;
}

/* Artwork and shade are rendered by the fixed command-world backdrop above. */

.dashboard-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(14px + env(safe-area-inset-top)) 14px 8px;
    opacity: 0;
    transform: translateY(-8px);
    animation: cm-dashboard-in .65s ease .45s forwards;
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.dashboard-crest {
    display: grid;
    place-items: center;
    width: 43px;
    height: 48px;
    flex: 0 0 43px;
    border: 1px solid rgba(255, 228, 154, .8);
    border-radius: 12px 12px 16px 16px;
    background: linear-gradient(145deg, rgba(212, 175, 55, .24), rgba(3, 9, 15, .72));
    color: var(--cm-gold-bright);
    font-size: 24px;
    box-shadow: 0 0 24px rgba(212, 175, 55, .18), inset 0 0 18px rgba(255, 228, 154, .08);
}

.dashboard-header .eyebrow,
.dashboard-intro .eyebrow,
.section-heading .eyebrow,
.identity-copy .eyebrow {
    color: var(--cm-gold-bright);
    font-size: 7px;
    letter-spacing: .18em;
}

.dashboard-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(18px, 5.4vw, 25px);
    line-height: 1.05;
    letter-spacing: .02em;
}

.role-badge {
    padding: 6px 8px;
    border: 1px solid rgba(212, 175, 55, .55);
    border-radius: 9px;
    background: rgba(5, 10, 16, .72);
    color: var(--cm-gold-bright);
    font-size: 7px;
    font-weight: 900;
    white-space: nowrap;
}

.dashboard-intro {
    position: relative;
    z-index: 2;
    margin: 16vh 14px 0;
    text-shadow: 0 4px 18px #000;
    opacity: 0;
    transform: translateY(12px);
    animation: cm-dashboard-in .75s ease .7s forwards;
}

.dashboard-intro h2 {
    position: relative;
    display: inline-block;
    margin: 0 0 12px;
    color: #fff1c7;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(29px, 8vw, 40px);
    font-weight: 700;
    letter-spacing: .015em;
    line-height: 1.08;
    text-shadow: 0 2px 2px rgba(0, 0, 0, .8), 0 0 22px rgba(212, 175, 55, .28);
}

.dashboard-intro h2::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -6px;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 228, 154, .9), rgba(212, 175, 55, .18) 78%, transparent);
    box-shadow: 0 0 8px rgba(212, 175, 55, .28);
}

.dashboard-summary-strip {
    position: relative;
    width: 100%;
    margin-top: 2px;
    padding: 9px 12px 9px 14px;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, .28);
    border-left: 2px solid rgba(255, 228, 154, .82);
    border-radius: 5px;
    background: linear-gradient(100deg, rgba(3, 8, 14, .94), rgba(7, 14, 21, .88) 72%, rgba(3, 8, 14, .94));
    box-shadow: inset 0 1px rgba(255, 255, 255, .055), 0 8px 20px rgba(0, 0, 0, .28);
}

.dashboard-summary-strip p {
    margin: 0;
    color: #f4f6f8;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .01em;
    text-shadow: 0 1px 5px #000;
}

.dashboard-grid {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 18px 12px 0;
    opacity: 0;
    transform: translateY(22px) scale(.985);
    animation: cm-buttons-in .72s cubic-bezier(.2, .8, .2, 1) 1s forwards;
}

.dashboard-card {
    position: relative;
    display: grid;
    grid-template-columns: 39px 1fr 16px;
    align-items: center;
    gap: 8px;
    min-height: 76px;
    padding: 9px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(7, 16, 25, .88), rgba(3, 8, 14, .94));
    color: #fff;
    text-align: left;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .48), inset 0 1px rgba(255, 255, 255, .08);
    transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s ease, border-color .16s ease, filter .16s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.dashboard-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, .07) 48%, transparent 70%);
    opacity: 0;
    transform: translateX(-120%);
    pointer-events: none;
}

.dashboard-card:active::before,
.dashboard-card.is-pressed::before {
    opacity: 1;
    animation: cm-card-sheen .48s ease-out 1;
}

.dashboard-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 12px;
    border: 1px solid transparent;
    opacity: 0;
    transform: scale(.94);
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
}

.dashboard-card:disabled {
    opacity: 1;
}

.dashboard-card:active {
    transform: translateY(2px) scale(.985);
    filter: brightness(1.16);
}

.dashboard-card:active::after {
    opacity: 1;
    transform: scale(1);
}

.card-gold::after {
    border-color: rgba(255, 228, 154, .72);
    box-shadow: inset 0 0 22px rgba(212, 175, 55, .18), 0 0 24px rgba(212, 175, 55, .28);
}

.card-blue::after {
    border-color: rgba(112, 201, 255, .72);
    box-shadow: inset 0 0 22px rgba(30, 136, 255, .18), 0 0 24px rgba(30, 136, 255, .28);
}

.card-red::after {
    border-color: rgba(255, 154, 154, .74);
    box-shadow: inset 0 0 22px rgba(239, 68, 68, .18), 0 0 24px rgba(239, 68, 68, .28);
}

.card-gold {
    border-color: rgba(212, 175, 55, .66);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .48), 0 0 18px rgba(212, 175, 55, .08), inset 0 0 22px rgba(212, 175, 55, .04);
}

.card-blue {
    border-color: rgba(30, 136, 255, .64);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .48), 0 0 18px rgba(30, 136, 255, .08), inset 0 0 22px rgba(30, 136, 255, .04);
}

.card-red {
    border-color: rgba(239, 68, 68, .64);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .48), 0 0 18px rgba(239, 68, 68, .08), inset 0 0 22px rgba(239, 68, 68, .04);
}

.card-icon {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border: 1px solid rgba(212, 175, 55, .56);
    border-radius: 10px;
    background: rgba(212, 175, 55, .07);
    color: var(--cm-gold-bright);
    font-size: 20px;
    text-shadow: 0 0 12px currentColor;
    transition: transform .16s cubic-bezier(.2, .8, .2, 1), filter .16s ease;
}

.dashboard-card:active .card-icon {
    transform: scale(.9) rotate(-4deg);
    filter: brightness(1.3);
}

.card-blue .card-icon {
    border-color: rgba(30, 136, 255, .56);
    background: rgba(30, 136, 255, .08);
    color: var(--cm-blue-bright);
}

.card-red .card-icon {
    border-color: rgba(239, 68, 68, .58);
    background: rgba(239, 68, 68, .08);
    color: #ff9a9a;
}

.card-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.card-copy strong {
    font-size: 11px;
    line-height: 1.1;
}

.card-copy small {
    overflow: hidden;
    color: #aeb8c5;
    font-size: 7px;
    line-height: 1.2;
    text-overflow: ellipsis;
}

.card-arrow {
    color: var(--cm-gold-bright);
    font-size: 21px;
    font-weight: 300;
    transition: transform .16s cubic-bezier(.2, .8, .2, 1), filter .16s ease;
}

.dashboard-card:active .card-arrow {
    transform: translateX(3px);
    filter: brightness(1.35);
}

.events-panel {
    position: relative;
    z-index: 3;
    margin: 12px 12px 0;
    padding: 11px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 13px;
    background: rgba(4, 9, 15, .82);
    backdrop-filter: blur(10px);
    box-shadow: 0 16px 38px rgba(0, 0, 0, .48);
    opacity: 0;
    transform: translateY(16px);
    animation: cm-dashboard-in .7s ease 1.22s forwards;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.section-heading h3 {
    margin: 0;
    color: #fff;
    font-size: 13px;
}

.live-dot {
    color: var(--cm-green);
    font-size: 9px;
    text-shadow: 0 0 9px var(--cm-green);
}

.event-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 0;
}

.event-row + .event-row {
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.event-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(212, 175, 55, .52);
    border-radius: 8px;
    color: var(--cm-gold-bright);
    background: rgba(212, 175, 55, .08);
    font-size: 15px;
}

.event-blue {
    border-color: rgba(30, 136, 255, .5);
    color: var(--cm-blue-bright);
    background: rgba(30, 136, 255, .07);
}

.event-row span:not(.event-icon) {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.event-row strong {
    overflow: hidden;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-row small {
    color: #9da9b7;
    color: #c4ced9;
    font-size: 10px;
    line-height: 1.3;
}

.event-row b {
    color: var(--cm-gold-bright);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.identity-panel {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 10px 12px 12px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 12px;
    background: rgba(3, 8, 14, .82);
    backdrop-filter: blur(10px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .48);
    opacity: 0;
    transform: translateY(14px);
    animation: cm-dashboard-in .7s ease 1.35s forwards;
}

.identity-art {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid rgba(212, 175, 55, .55);
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(212, 175, 55, .17), rgba(30, 136, 255, .06));
    color: var(--cm-gold-bright);
    font-size: 9px;
    font-weight: 900;
}

.identity-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.identity-copy strong {
    overflow: hidden;
    color: #fff;
    font-size: 10px;
    text-overflow: ellipsis;
}

.identity-copy span {
    font-size: 7px;
}

.button-compact {
    width: auto;
    min-height: 32px;
    margin: 0;
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 8px;
}

.bottom-nav {
    position: fixed;
    right: 7px;
    bottom: calc(7px + env(safe-area-inset-bottom));
    left: 7px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(212, 175, 55, .35);
    border-radius: 15px;
    background: rgba(4, 9, 15, .92);
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .68), 0 0 24px rgba(212, 175, 55, .05);
    opacity: 0;
    animation: cm-dashboard-in .7s ease 1.4s forwards;
}

.nav-item {
    min-height: 54px;
    padding: 5px 2px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #aeb8c5;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform .16s ease, color .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.nav-item:active:not(:disabled),
.nav-item.is-pressed:not(:disabled) {
    transform: translateY(2px) scale(.94);
    color: #fff;
    border-color: rgba(212, 175, 55, .72);
    background: rgba(212, 175, 55, .16);
    box-shadow: inset 0 0 14px rgba(212, 175, 55, .16), 0 0 12px rgba(212, 175, 55, .12);
}

.nav-item:disabled {
    cursor: default;
    opacity: .62;
}

.nav-item span {
    display: block;
    font-size: 19px;
    line-height: 21px;
}

.nav-item small {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: .01em;
}

.nav-item-active {
    border-color: rgba(212, 175, 55, .56);
    background: linear-gradient(180deg, rgba(212, 175, 55, .18), rgba(212, 175, 55, .045));
    color: var(--cm-gold-bright);
    box-shadow: inset 0 1px rgba(255, 228, 154, .12);
}

.button:focus-visible,
.nav-item:focus-visible,
.dashboard-card:focus-visible {
    outline: 2px solid var(--cm-blue);
    outline-offset: 2px;
}

@keyframes cm-dashboard-in {
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes cm-buttons-in {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(.985);
    }
    60% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cm-card-sheen {
    0%, 65% {
        transform: translateX(-120%);
    }
    82%, 100% {
        transform: translateX(120%);
    }
}

@media (min-width: 700px) {
    .app-shell {
        width: min(100%, 620px);
        padding-right: 16px;
        padding-left: 16px;
    }

    .command-screen {
        min-height: calc(100vh - 16px);
    }

    .dashboard-intro {
        margin-top: 17vh;
    }

    .dashboard-grid,
    .events-panel,
    .identity-panel {
        margin-left: 20px;
        margin-right: 20px;
    }

    .bottom-nav {
        left: 50%;
        width: min(580px, calc(100% - 32px));
        transform: translateX(-50%);
    }
}

@media (max-width: 390px) {
    .dashboard-intro {
        margin-top: 12vh;
    }

    .dashboard-grid {
        gap: 6px;
    }

    .dashboard-card {
        grid-template-columns: 34px 1fr 12px;
        min-height: 68px;
        gap: 6px;
        padding: 7px;
    }

    .card-icon {
        width: 34px;
        height: 34px;
        font-size: 17px;
    }

    .card-copy strong {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-header,
    .dashboard-intro,
    .dashboard-grid,
    .events-panel,
    .identity-panel,
    .bottom-nav,
    .dashboard-card::before {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
    }

    .dashboard-header,
    .dashboard-intro,
    .dashboard-grid,
    .events-panel,
    .identity-panel,
    .bottom-nav {
        opacity: 1;
        transform: none;
    }

    .dashboard-card::before {
        display: none;
    }

    .dashboard-card,
    .dashboard-card::after,
    .card-icon,
    .card-arrow {
        transition: none !important;
    }
}
