:root {
    --bg: #f3efe6;
    --surface: #fffdf8;
    --surface-strong: #fffaf0;
    --ink: #1f2933;
    --muted: #52606d;
    --line: #d6d0c4;
    --accent: #0b6e4f;
    --accent-dark: #084c3a;
    --danger: #b42318;
    --shadow: 0 20px 45px rgba(31, 41, 51, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(11, 110, 79, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(215, 177, 93, 0.12), transparent 26%),
        linear-gradient(180deg, #f8f3ea 0%, var(--bg) 100%);
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }

button,
.text-link {
    cursor: pointer;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    padding: 0.8rem 1.2rem;
    font-weight: 600;
}

button:hover,
.text-link:hover { background: var(--accent-dark); }
.danger { background: var(--danger); }

.site-header,
.section-head,
.asset-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.site-header {
    align-items: center;
    padding: 1.5rem 2rem;
}

.brand-block {
    display: grid;
    gap: 0.2rem;
}

.site-header h1 { margin: 0.2rem 0 0; font-size: 1.8rem; }
.site-nav { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.site-nav form { margin: 0; }
.site-nav span {
    color: var(--muted);
    font-weight: 600;
}
.site-user {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.78rem 1.05rem;
    border-radius: 999px;
    border: 1px solid rgba(11, 110, 79, 0.12);
    background: rgba(255, 255, 255, 0.74);
    font-weight: 700;
}

.nav-link.is-active {
    border-color: rgba(11, 110, 79, 0.32);
    background: rgba(11, 110, 79, 0.1);
    color: var(--accent-dark);
}

.mobile-tabbar {
    display: none;
}

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

.page-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}
.hero-grid,
.dashboard-grid,
.stack,
.single-column,
.asset-list { display: grid; gap: 1.2rem; }
.overview-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
.overview-grid-hero { grid-template-columns: 1.45fr 0.9fr 0.9fr; }
.room-overview-grid { grid-template-columns: 1.5fr 0.8fr 1fr; }
.hero-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.2rem; }
.dashboard-grid { grid-template-columns: 1.15fr 1fr; align-items: start; }
.dashboard-grid-wide { grid-template-columns: 0.92fr 1.08fr; }
.single-column { max-width: 900px; margin: 0 auto; }

.card {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(214, 208, 196, 0.85);
    border-radius: 24px;
    padding: 1.4rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.section-head { align-items: flex-start; margin-bottom: 1rem; }
.section-head.compact { align-items: center; }
.section-head h3,
.section-head h2,
.card h2 { margin: 0.25rem 0 0; }

.spotlight-card {
    background: linear-gradient(145deg, rgba(11, 110, 79, 0.92), rgba(8, 76, 58, 0.95));
    color: white;
}

.spotlight-card .eyebrow,
.spotlight-card .spotlight-copy,
.spotlight-card .hero-stat span,
.spotlight-card .text-link {
    color: rgba(255, 255, 255, 0.82);
}

.spotlight-card .text-link {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.spotlight-card .text-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.spotlight-copy,
.summary-copy {
    margin: 0.4rem 0 0;
    line-height: 1.7;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.2rem;
}

.hero-stat,
.summary-card {
    min-height: 100%;
}

.hero-stat {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
}

.hero-stat span,
.hero-stat strong {
    display: block;
}

.hero-stat strong {
    margin-top: 0.35rem;
    font-size: 1.15rem;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.soft-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(11, 110, 79, 0.16);
    background: rgba(11, 110, 79, 0.07);
    color: var(--ink);
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.soft-pill.active {
    background: rgba(11, 110, 79, 0.14);
    border-color: rgba(11, 110, 79, 0.28);
}

.asset-row {
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.asset-row:hover,
.asset-row.active { transform: translateY(-2px); border-color: var(--accent); }
.asset-row span,
.number-block span { display: block; color: var(--muted); font-size: 0.9rem; }
.number-block { text-align: right; }

.chart-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.chart-interval { background: var(--surface-strong); color: var(--ink); border: 1px solid var(--line); }
.chart-interval.active { background: var(--accent); color: white; }
.chart-shell { min-height: 340px; }

.chart-card .chart-toolbar { margin-bottom: 0; }

.invite-banner {
    display: grid;
    gap: 0.65rem;
    margin: 1rem 0 1.2rem;
    padding: 1rem 1.1rem;
    border: 1px dashed rgba(11, 110, 79, 0.26);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(11, 110, 79, 0.06), rgba(215, 177, 93, 0.05));
}

.invite-link {
    display: block;
    color: var(--accent);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.room-switcher,
.leaderboard-grid {
    display: grid;
    gap: 0.9rem;
}

.leaderboard-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.performance-toolbar,
.performance-member-grid,
.performance-leader-list {
    display: grid;
    gap: 0.9rem;
}

.performance-toolbar {
    grid-auto-flow: column;
    justify-content: flex-start;
}

.performance-note,
.performance-generated-at {
    margin: 0.4rem 0 0;
}

.performance-generated-at {
    color: var(--muted);
}

.performance-member-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

.performance-metrics {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.performance-leaderboards {
    margin-top: 1rem;
}

.performance-leader-list {
    margin-top: 0.8rem;
}

.performance-leader-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0;
    border-top: 1px solid rgba(82, 96, 109, 0.12);
}

.performance-leader-item:first-child {
    border-top: 0;
    padding-top: 0.1rem;
}

.performance-leader-item strong,
.performance-leader-item span {
    display: block;
}

.performance-leader-item .pill-row {
    margin-top: 0.3rem;
}

.room-chip-card,
.leader-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 12px 28px rgba(31, 41, 51, 0.04);
}

.room-form-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.68);
}

.room-form-card label span {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.room-chip-card.active,
.leader-card.self {
    border-color: rgba(11, 110, 79, 0.34);
    box-shadow: inset 0 0 0 1px rgba(11, 110, 79, 0.12);
}

.room-chip-main span,
.room-chip-main strong,
.leader-head strong,
.leader-head span {
    display: block;
}

.leader-head {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: center;
}

.room-section,
.member-section,
.holdings-section {
    overflow: hidden;
}

.leader-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    margin-top: 0.9rem;
}

.leader-metrics span,
.leader-metrics strong {
    display: block;
}

.leader-metrics span {
    color: var(--muted);
    font-size: 0.82rem;
}

.leader-metrics strong {
    margin-top: 0.25rem;
    font-size: 1rem;
}

.up { color: #117a3f; }
.down { color: var(--danger); }

.table-scroll {
    overflow-x: auto;
}

.holdings-mobile-list {
    display: none;
}

.holding-mobile-card {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 245, 236, 0.88));
    box-shadow: 0 14px 30px rgba(31, 41, 51, 0.05);
}

.holding-mobile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}

.holding-mobile-head strong,
.holding-mobile-head small {
    display: block;
}

.holding-mobile-head small {
    margin-top: 0.2rem;
    color: var(--muted);
}

.holding-mobile-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.holding-mobile-metrics span,
.holding-mobile-metrics strong {
    display: block;
}

.holding-mobile-metrics span {
    color: var(--muted);
    font-size: 0.8rem;
}

.holding-mobile-metrics strong {
    margin-top: 0.2rem;
    font-size: 0.98rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.holding-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.holding-mobile-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font-weight: 700;
}

.room-chip-card .actions form,
.leader-card form {
    margin: 0;
}

.room-chip-card .actions button,
.leader-card button,
.holding-mobile-actions a {
    width: 100%;
}

.chart-card canvas {
    width: 100% !important;
}

.holdings-card .text-link,
.spotlight-card .text-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-nav a,
.site-nav button {
    min-height: 44px;
}

.room-chip-card.active {
    background: linear-gradient(180deg, rgba(11, 110, 79, 0.08), rgba(255, 255, 255, 0.85));
}

.holdings-table {
    min-width: 860px;
}

.holdings-table th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.holdings-table td strong,
.holdings-table td small {
    display: block;
}

.holdings-table td small {
    margin-top: 0.22rem;
    color: var(--muted);
}

.table-actions {
    white-space: nowrap;
}

.table-button {
    min-height: 40px;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    font-size: 0.88rem;
}

.table-actions a + a {
    margin-left: 0.65rem;
}

.empty-state,
.empty-state-cell {
    color: var(--muted);
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.toggle-row input[type="checkbox"] {
    width: auto;
    margin-top: 0;
}

.notification-feed {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.ops-inline-notice {
    padding: 0.85rem 1rem;
    border: 1px solid rgba(11, 110, 79, 0.2);
    background: rgba(11, 110, 79, 0.08);
    border-radius: 16px;
}

.ops-preview-card .grid-form {
    margin-top: 0.8rem;
}

.ops-preview-output,
.ops-test-output {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.76);
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92rem;
}

.notification-item {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.72);
}

.notification-item p,
.notification-item small {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.chart-empty {
    margin-top: 1rem;
}

.empty-state-cell {
    text-align: center;
    padding: 1.4rem;
}

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 0.9rem 0.65rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.grid-form label { display: block; margin-bottom: 0.45rem; font-weight: 600; }
.grid-form .actions,
.grid-form .error-box { grid-column: 1 / -1; }

.input-with-unit {
    position: relative;
}

.input-with-unit input {
    padding-right: 4.8rem;
}

.unit-pill {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    pointer-events: none;
}

.form-helper,
.field-hint {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.autocomplete-field {
    position: relative;
}

.autocomplete-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% - 0.2rem);
    left: 0;
    right: 0;
    display: grid;
    gap: 0.35rem;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.98);
    box-shadow: var(--shadow);
}

.autocomplete-option {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    padding: 0.75rem 0.85rem;
    text-align: left;
}

.autocomplete-option span,
.autocomplete-option small {
    display: block;
}

.autocomplete-option span {
    margin-top: 0.15rem;
    font-weight: 600;
}

.autocomplete-option small {
    margin-top: 0.15rem;
    color: var(--muted);
}

.autocomplete-option:hover,
.autocomplete-option.active {
    background: var(--surface-strong);
    border-color: var(--accent);
}

.form-control,
input,
select {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(11, 110, 79, 0.55);
    box-shadow: 0 0 0 4px rgba(11, 110, 79, 0.1);
}

.auth-card {
    min-height: calc(100vh - 110px);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, 520px);
    gap: 2rem;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 8% 40% 12% 2%;
    border-radius: 36px;
    background: linear-gradient(135deg, rgba(11, 110, 79, 0.1), rgba(215, 177, 93, 0.04));
    filter: blur(6px);
    z-index: 0;
}

.auth-panel,
.form-card {
    display: grid;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.auth-panel {
    padding: 3rem;
    min-height: 420px;
    align-content: center;
    background: linear-gradient(145deg, rgba(255, 253, 248, 0.94), rgba(250, 244, 231, 0.9));
}

.auth-panel h2 {
    font-size: clamp(2rem, 3vw, 3.2rem);
    line-height: 1.05;
    max-width: 10ch;
}

.auth-panel p:not(.eyebrow) {
    max-width: 34rem;
    font-size: 1.02rem;
    line-height: 1.8;
}

.auth-points {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.auth-point {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-point::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #d7b15d);
    box-shadow: 0 0 0 6px rgba(11, 110, 79, 0.08);
}

.form-card {
    padding: 2rem;
    align-content: start;
}

.form-card h3 {
    margin: 0;
    font-size: 1.6rem;
}

.form-card > p {
    margin: 0;
    color: var(--muted);
}

.form-card label {
    display: block;
    font-weight: 600;
}

.form-card ul {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
    color: var(--danger);
}

.auth-hint {
    margin: 0;
    color: var(--muted);
}

.auth-hint a {
    color: var(--accent);
    font-weight: 600;
}

.auth-submit {
    margin-top: 0.4rem;
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(31, 41, 51, 0.12);
}

.auth-divider span {
    white-space: nowrap;
}

.google-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
    padding: 1rem 1.2rem;
    border-radius: 18px;
    border: 1px solid rgba(31, 41, 51, 0.12);
    background: #ffffff;
    color: var(--ink);
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.google-button:hover {
    transform: translateY(-1px);
    border-color: rgba(11, 110, 79, 0.24);
    box-shadow: 0 16px 34px rgba(31, 41, 51, 0.12);
}

.google-mark {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    font-weight: 800;
    font-size: 1rem;
}

.wide { width: 100%; }
.actions { display: flex; gap: 0.8rem; align-items: center; }

.room-form-grid,
.member-grid {
    display: grid;
    gap: 1rem;
}

.room-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.room-code-card,
.member-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
}

.member-holding-groups {
    display: grid;
    gap: 1rem;
}

.member-holding-card {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 242, 233, 0.85));
}

.member-holding-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.member-holding-head h4 {
    margin: 0.25rem 0 0;
    font-size: 1.2rem;
}

.member-holdings-table {
    min-width: 980px;
}

.member-holdings-mobile-list {
    display: none;
}

.room-code-card strong,
.member-card strong,
.member-card span,
.member-card small {
    display: block;
}

.member-card .actions,
.member-card form {
    margin-top: 0.6rem;
}

.room-code-card span,
.room-code-card small,
.member-card span,
.member-card small {
    margin-top: 0.25rem;
    color: var(--muted);
}

.error-box {
    padding: 0.85rem 1rem;
    border: 1px solid #f7b2ab;
    background: #fff0ee;
    border-radius: 16px;
    color: #8a1c10;
}

@media (max-width: 980px) {
    .overview-grid,
    .hero-grid,
    .dashboard-grid,
    .dashboard-grid-wide,
    .auth-card,
    .grid-form { grid-template-columns: 1fr; }
    .hero-stats,
    .leader-metrics,
    .room-form-grid,
    .performance-member-grid,
    .performance-metrics { grid-template-columns: 1fr; }
    .leaderboard-grid-wide { grid-template-columns: 1fr; }
    .site-header,
    .section-head,
    .asset-row { align-items: flex-start; flex-direction: column; }
    .page-shell,
    .site-header { padding-left: 1rem; padding-right: 1rem; }
    .auth-card {
        min-height: auto;
        gap: 1rem;
    }
    .auth-card::before { display: none; }
    .auth-panel,
    .form-card {
        padding: 1.4rem;
        min-height: auto;
    }
    .auth-panel h2 { max-width: none; }
}

@media (max-width: 760px) {
    body {
        background:
            radial-gradient(circle at top, rgba(11, 110, 79, 0.11), transparent 34%),
            radial-gradient(circle at 100% 12%, rgba(215, 177, 93, 0.12), transparent 28%),
            linear-gradient(180deg, #faf5eb 0%, #f2ebe0 100%);
    }

    button,
    .text-link {
        min-height: 46px;
        padding: 0.9rem 1rem;
        border-radius: 16px;
        box-shadow: 0 10px 22px rgba(11, 110, 79, 0.14);
    }

    .site-header {
        position: sticky;
        top: 0;
        z-index: 30;
        gap: 1rem;
        padding-top: calc(0.9rem + env(safe-area-inset-top, 0px));
        padding-bottom: 0.9rem;
        background: rgba(248, 243, 234, 0.78);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(214, 208, 196, 0.75);
    }

    .card {
        padding: 1rem;
        border-radius: 20px;
        box-shadow: 0 18px 34px rgba(31, 41, 51, 0.07);
    }

    .overview-grid {
        gap: 0.9rem;
    }

    .summary-card {
        padding: 1rem;
        background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(250, 245, 236, 0.92));
    }

    .spotlight-card {
        padding: 1.1rem;
        border: none;
        box-shadow: 0 18px 36px rgba(8, 76, 58, 0.2);
    }

    .spotlight-copy,
    .summary-copy {
        font-size: 0.94rem;
        line-height: 1.6;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .hero-stat {
        padding: 0.85rem 0.9rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .section-head.compact {
        align-items: stretch;
    }

    .section-head h2,
    .section-head h3,
    .summary-card h3 {
        line-height: 1.25;
    }

    .section-head.compact .text-link,
    .section-head.compact button,
    .section-head.compact .chart-toolbar {
        width: 100%;
    }

    .chart-toolbar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
        padding: 0.35rem;
        border-radius: 16px;
        background: rgba(11, 110, 79, 0.05);
    }

    .chart-interval {
        justify-content: center;
        min-height: 42px;
        padding: 0.75rem 0.5rem;
    }

    .performance-toolbar {
        grid-auto-flow: row;
        width: 100%;
    }

    .chart-shell {
        min-height: 260px;
        margin-top: 0.4rem;
        padding: 0.35rem;
        border-radius: 18px;
        background: linear-gradient(180deg, rgba(11, 110, 79, 0.04), rgba(255, 255, 255, 0.32));
    }

    .room-switcher,
    .leaderboard-grid,
    .notification-feed,
    .holdings-mobile-list {
        gap: 0.75rem;
    }

    .room-chip-card,
    .leader-card,
    .notification-item,
    .holding-mobile-card {
        border-radius: 18px;
    }

    .room-chip-card {
        padding: 0.9rem;
        background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(248, 242, 232, 0.84));
    }

    .room-chip-main strong {
        font-size: 1.05rem;
    }

    .actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actions form,
    .actions button {
        width: 100%;
    }

    .invite-banner {
        padding: 0.9rem;
        border-style: solid;
        border-color: rgba(11, 110, 79, 0.16);
    }

    .invite-link {
        font-size: 0.9rem;
    }

    .leader-head {
        align-items: flex-start;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid rgba(214, 208, 196, 0.75);
    }

    .leader-head strong {
        font-size: 1.02rem;
        line-height: 1.3;
    }

    .leader-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .leader-metrics > div,
    .summary-card {
        padding: 0.8rem;
        border-radius: 16px;
        background: rgba(11, 110, 79, 0.04);
    }

    .leader-metrics strong {
        font-size: 0.96rem;
        overflow-wrap: anywhere;
    }

    .holdings-card .table-scroll {
        display: none;
    }

    .holdings-mobile-list {
        display: grid;
        margin-top: 0.75rem;
    }

    .holding-mobile-head {
        flex-direction: column;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid rgba(214, 208, 196, 0.78);
    }

    .holding-mobile-head .soft-pill {
        align-self: flex-start;
    }

    .holding-mobile-metrics {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .holding-mobile-metrics > div {
        padding: 0.75rem 0.85rem;
        border-radius: 14px;
        background: rgba(11, 110, 79, 0.045);
    }

    .site-header h1 {
        font-size: 1.45rem;
    }

    .site-nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .site-nav span {
        grid-column: 1 / -1;
        padding: 0.15rem 0.1rem 0.35rem;
    }

    .site-nav a,
    .site-nav form {
        width: 100%;
    }

    .nav-secondary,
    .nav-utility {
        display: none !important;
    }

    .nav-primary,
    .nav-cta {
        min-height: 48px;
    }

    .site-nav a,
    .site-nav button {
        width: 100%;
        justify-content: center;
    }

    .site-nav form button {
        min-height: 46px;
    }

    .room-form-grid {
        gap: 0.9rem;
    }

    .member-holding-head {
        flex-direction: column;
    }

    .member-holding-card .table-scroll {
        display: none;
    }

    .member-holdings-mobile-list {
        display: grid;
    }

    .room-form-grid form,
    .notification-item {
        padding: 0.95rem;
        border: 1px solid rgba(214, 208, 196, 0.75);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.62);
    }

    .toggle-row {
        align-items: flex-start;
    }

    .toggle-row input[type="checkbox"] {
        width: 1.15rem;
        height: 1.15rem;
        margin-top: 0.15rem;
    }

    input,
    select,
    .form-control {
        min-height: 48px;
        font-size: 16px;
    }

    .auth-card {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px) + 5rem);
    }

    .page-shell {
        padding-bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px) + 5.5rem);
    }

    .mobile-tabbar {
        position: fixed;
        left: 0.85rem;
        right: 0.85rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        z-index: 40;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.55rem;
        padding: 0.55rem;
        border-radius: 22px;
        background: rgba(255, 253, 248, 0.9);
        border: 1px solid rgba(214, 208, 196, 0.82);
        box-shadow: 0 18px 36px rgba(31, 41, 51, 0.14);
        backdrop-filter: blur(18px);
    }

    .mobile-tabbar-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 48px;
        padding: 0.75rem 0.45rem;
        border-radius: 16px;
        background: rgba(11, 110, 79, 0.04);
        color: var(--muted);
        font-weight: 800;
    }

    .mobile-tabbar-link.is-active {
        background: rgba(11, 110, 79, 0.12);
        color: var(--accent-dark);
    }

    .mobile-tabbar-link-accent {
        background: linear-gradient(145deg, rgba(11, 110, 79, 0.92), rgba(8, 76, 58, 0.95));
        color: white;
    }
}

@media (max-width: 520px) {
    .page-shell {
        padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px) + 5.8rem);
    }

    .site-header,
    .page-shell {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .overview-grid,
    .stack,
    .dashboard-grid,
    .dashboard-grid-wide {
        gap: 0.8rem;
    }

    .card,
    .spotlight-card,
    .summary-card {
        border-radius: 18px;
    }

    .hero-stat strong,
    .summary-card h3 {
        font-size: 1.05rem;
    }

    .leader-metrics {
        grid-template-columns: 1fr;
    }

    .actions,
    .holding-mobile-actions,
    .chart-toolbar {
        grid-template-columns: 1fr;
    }

    .chart-shell {
        min-height: 220px;
    }

    .mobile-tabbar {
        left: 0.6rem;
        right: 0.6rem;
        gap: 0.4rem;
        padding: 0.45rem;
        border-radius: 18px;
    }

    .mobile-tabbar-link {
        min-height: 46px;
        font-size: 0.88rem;
        border-radius: 14px;
    }
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.status-up {
    background: rgba(16, 185, 129, 0.14);
    color: #0f766e;
}

.status-down {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.status-warn {
    background: rgba(217, 119, 6, 0.14);
    color: #b45309;
}
