/* Thrise Organizations — the program dashboard for schools, clubs, and
   multi-team programs. Visual language matches the coach dashboard: dark
   chrome (topbar + rail) around a light working canvas. */

:root {
    color-scheme: dark;
    --bg: #070707;
    --chrome: rgba(7, 7, 7, 0.94);
    --rail: #0d0d0d;
    --line-dark: rgba(255, 255, 255, 0.14);
    --text-on-dark: #f7f7f4;
    --muted-on-dark: #aaa9a3;
    --muted-2-on-dark: #6f6f6b;
    --blue-300: #73c8ec;
    --blue-500: #1495da;
    --blue-600: #0e78b5;
    --blue-700: #0b6092;
    --blue-800: #084b73;
    --brand: var(--blue-500);
    --brand-deep: var(--blue-800);
    --display: Anton, Impact, "Arial Narrow", sans-serif;
    --radius: 10px;
    --radius-sm: 7px;
    --topbar-h: 64px;
    --control-h: 44px;

    /* Light canvas tokens */
    --surface: #ffffff;
    --surface-2: #f7f5f0;
    --surface-3: #efede7;
    --line: rgba(12, 12, 12, 0.10);
    --line-strong: rgba(12, 12, 12, 0.19);
    --text: #111111;
    --muted: #66645f;
    --muted-2: #89867f;
    --good: #0f7a4f;
    --good-bg: rgba(15, 122, 79, 0.09);
    --warn: #8a5a00;
    --warn-bg: rgba(251, 191, 36, 0.16);
    --bad: #b42318;
    --bad-bg: rgba(180, 35, 24, 0.08);
    --shadow-sm: 0 8px 24px rgba(18, 18, 18, 0.055);
    --shadow-lg: 0 24px 56px rgba(18, 18, 18, 0.16), 0 3px 12px rgba(18, 18, 18, 0.08);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-on-dark);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

a { color: inherit; }

.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Topbar ─── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: var(--topbar-h);
    padding: 10px clamp(14px, 2.2vw, 26px);
    border-bottom: 1px solid var(--line-dark);
    background: var(--chrome);
    backdrop-filter: blur(20px) saturate(1.5);
}

.topbar-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
}

.topbar-wordmark {
    color: #fff;
    font-family: var(--display);
    font-size: 2.05rem;
    line-height: 0.9;
    letter-spacing: 0.015em;
}

.topbar-wordmark-outline {
    color: #080808;
    -webkit-text-stroke: 1.2px #fff;
    paint-order: stroke fill;
}

.topbar-wordmark-solid { color: var(--brand); }

.topbar-product {
    color: var(--muted-on-dark);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
}

.account {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-menu-trigger {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.profile-menu-trigger:hover,
.profile-menu-trigger[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.12);
}

.profile-menu-trigger:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.75);
    outline-offset: 3px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, #b8b8b2);
    color: #0a0a0a;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }

.avatar-lg { width: 40px; height: 40px; font-size: 0.82rem; }

.avatar-sm { width: 30px; height: 30px; font-size: 0.68rem; background: var(--surface-3); }

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 70;
    width: min(280px, calc(100vw - 24px));
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: #151515;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.48);
}

.profile-menu-identity {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
}

.profile-menu-copy { display: grid; gap: 2px; min-width: 0; }

.profile-menu-copy strong,
.profile-menu-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-copy strong { color: #fff; font-size: 0.9rem; }

.profile-menu-copy span { color: #9c9c97; font-size: 0.76rem; }

.profile-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 0 11px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
    background: transparent;
    color: #f2f2ee;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
}

.profile-menu-action:hover,
.profile-menu-action:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
}

/* ─── Splash (matches the coach dashboard) ─── */

.auth-splash {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    background: #080808;
}

.splash-wordmark {
    display: flex;
    align-items: baseline;
    gap: 0.035em;
    height: 1.08em;
    overflow: hidden;
    color: #fff;
    font-family: var(--display);
    font-size: clamp(4.8rem, 13vw, 9rem);
    line-height: 1;
    animation: splash-pulse 0.9s ease-in-out 0.95s infinite alternate;
}

.splash-outline {
    color: #080808;
    -webkit-text-stroke: 2px #fff;
    paint-order: stroke fill;
}

.splash-rise {
    color: var(--brand);
    opacity: 0;
    filter: blur(4px);
    transform: translateY(125%);
    animation: splash-rise 0.42s cubic-bezier(0.2, 0.78, 0.24, 1.16) forwards;
}

.splash-rise:nth-child(3) { animation-delay: 0.08s; }
.splash-rise:nth-child(4) { animation-delay: 0.185s; }
.splash-rise:nth-child(5) { animation-delay: 0.29s; }
.splash-rise:nth-child(6) { animation-delay: 0.395s; }

@keyframes splash-rise { to { opacity: 1; filter: blur(0); transform: translateY(0); } }
@keyframes splash-pulse { to { opacity: 0.88; transform: scale(1.018); } }

@media (prefers-reduced-motion: reduce) {
    .splash-wordmark, .splash-rise { animation: none; opacity: 1; filter: none; transform: none; }
}

/* ─── Signed-out landing (mirrors the coach dashboard) ─── */

.org-auth-landing {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
    height: calc(100svh - var(--topbar-h));
    min-height: 0;
    overflow: hidden;
    background: #080808;
    color: var(--text-on-dark);
}

.org-auth-pitch {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    padding: clamp(22px, 3vh, 34px) clamp(28px, 4vw, 64px);
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        #080808;
    background-size: 48px 48px;
}

.org-auth-pitch .eyebrow {
    margin-bottom: clamp(10px, 1.5vh, 16px);
    color: var(--brand);
    border-color: rgba(20, 149, 218, 0.38);
    background: rgba(20, 149, 218, 0.08);
}

.org-auth-pitch h1 {
    max-width: 780px;
    margin: 0;
    font-family: var(--display);
    font-size: clamp(3.4rem, 5.4vw, 6rem);
    font-weight: 400;
    line-height: 0.94;
    letter-spacing: 0.005em;
    text-transform: uppercase;
}

.org-auth-pitch h1 span {
    display: inline-block;
    margin-top: 0.075em;
    color: var(--brand);
}

.org-auth-copy {
    max-width: 650px;
    margin: clamp(16px, 2vh, 22px) 0 0;
    color: #c9c8c2;
    font-size: clamp(0.94rem, 1.2vw, 1.08rem);
    line-height: 1.5;
}

.org-auth-actions {
    display: grid;
    justify-items: start;
    width: min(100%, 440px);
    margin-top: clamp(18px, 2.5vh, 24px);
    gap: 10px;
}

.org-auth-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    min-height: 60px;
    padding: 0 22px;
    border: 0;
    border-radius: 4px;
    background: var(--brand);
    color: #090909;
    box-shadow: 0 18px 44px rgba(20, 149, 218, 0.18);
    cursor: pointer;
    font-family: var(--display);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 400;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    transition: background-color 160ms ease, box-shadow 160ms ease;
}

.org-auth-cta b {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid rgba(9, 9, 9, 0.35);
    border-radius: 50%;
    font-family: Inter, sans-serif;
    font-size: 1.25rem;
}

.org-auth-cta:hover,
.org-auth-cta:focus-visible {
    outline: none;
    background: #addef5;
    box-shadow: 0 22px 56px rgba(20, 149, 218, 0.27);
}

.org-auth-cta:disabled {
    opacity: 0.5;
    cursor: default;
}

.org-auth-register {
    margin: 2px 0 -2px;
    color: var(--muted-on-dark);
    font-size: 0.82rem;
    line-height: 1.4;
}

.org-auth-contact { min-height: 42px; justify-self: start; }

.org-auth-pitch > .auth-error {
    max-width: 440px;
    margin-top: 11px;
    font-size: 0.78rem;
}

.org-auth-visual {
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #171717;
}

.org-auth-visual > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 30%;
    filter: grayscale(1) contrast(1.08) brightness(0.76);
    transform: scale(1.015);
}

.org-auth-visual-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, #080808 0%, rgba(8, 8, 8, 0.1) 18%, transparent 45%),
        linear-gradient(180deg, rgba(8, 8, 8, 0.04), rgba(8, 8, 8, 0.66));
    pointer-events: none;
}

.org-auth-card {
    position: absolute;
    right: clamp(20px, 4vw, 56px);
    bottom: clamp(42px, 5vw, 64px);
    width: min(360px, calc(100% - 40px));
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background: rgba(242, 240, 235, 0.94);
    color: #111;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(12px);
}

.org-auth-card > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #5f5d57;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.org-auth-card > div:first-child b {
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--brand);
    color: #111;
    font-size: 0.62rem;
}

.org-auth-card > strong {
    display: block;
    margin-top: 14px;
    font-family: var(--display);
    font-size: clamp(4rem, 6vw, 6rem);
    font-weight: 400;
    line-height: 0.8;
}

.org-auth-card > p {
    margin: 8px 0 14px;
    color: #66635c;
    font-size: 0.86rem;
}

.org-auth-progress {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.1);
}

.org-auth-progress span {
    display: block;
    width: 81%;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.org-auth-card ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid rgba(17, 17, 17, 0.12);
    list-style: none;
    color: #66635c;
    font-size: 0.72rem;
}

.org-auth-card li { display: grid; gap: 3px; }

.org-auth-card li span {
    color: #111;
    font-family: var(--display);
    font-size: 1.5rem;
}

.org-auth-photo-note {
    position: absolute;
    right: 20px;
    bottom: 18px;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
}

@media (max-width: 980px) {
    .org-auth-landing { grid-template-columns: minmax(0, 1fr); }
    .org-auth-pitch { height: 100%; min-height: 0; }
    .org-auth-visual { display: none; }
}

@media (max-width: 620px) {
    .org-auth-pitch { min-height: 0; padding: clamp(22px, 5vh, 40px) 20px; }
    .org-auth-pitch h1 { font-size: clamp(3.1rem, 16vw, 4.6rem); }
    .org-auth-cta { min-height: 58px; padding-inline: 18px; font-size: 1.16rem; }
}

/* ─── Empty states (dark) ─── */

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.state-panel .helper a { color: var(--blue-300); }

.state-panel {
    width: min(calc(100% - 32px), 640px);
    margin: clamp(32px, 8vh, 96px) auto;
    display: grid;
    gap: 18px;
    padding: 32px;
    border: 1px solid var(--line-dark);
    border-radius: var(--radius);
    background: #101010;
    position: relative;
    overflow: hidden;
}

.state-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, var(--brand), var(--blue-600));
}

.state-panel h1 {
    margin: 0;
    font-family: var(--display);
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 400;
    line-height: 1;
}

.state-panel p { margin: 0; color: var(--muted-on-dark); line-height: 1.6; }

.state-panel a:not(.primary-button):not(.ghost-button) { color: var(--blue-300); }

.eyebrow {
    display: inline-flex;
    width: fit-content;
    padding: 4px 10px;
    border: 1px solid rgba(20, 149, 218, 0.3);
    border-radius: 999px;
    color: var(--blue-300);
    background: rgba(20, 149, 218, 0.1);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-error { margin: 0; color: #fb7185; }

.helper { margin: 0; color: var(--muted-on-dark); font-size: 0.88rem; }

/* ─── Buttons ─── */

.primary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-h);
    padding: 0 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.primary-button {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #0b0b0b;
    box-shadow: 0 2px 12px rgba(20, 149, 218, 0.16);
}

.primary-button:hover,
.primary-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(20, 149, 218, 0.27);
    outline: none;
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: transparent;
    color: var(--text-on-dark);
}

.ghost-button:hover,
.ghost-button:focus-visible {
    border-color: rgba(20, 149, 218, 0.5);
    background: rgba(20, 149, 218, 0.1);
    outline: none;
}

.org-main .ghost-button,
.modal .ghost-button {
    border-color: var(--line-strong);
    background: #fff;
    color: var(--text);
}

.org-main .ghost-button:hover,
.org-main .ghost-button:focus-visible,
.modal .ghost-button:hover,
.modal .ghost-button:focus-visible {
    border-color: rgba(12, 12, 12, 0.36);
    background: rgba(12, 12, 12, 0.05);
}

.danger-button {
    border: 1px solid rgba(180, 35, 24, 0.35);
    background: #fff;
    color: var(--bad);
}

.danger-button:hover,
.danger-button:focus-visible {
    border-color: var(--bad);
    background: var(--bad-bg);
    outline: none;
}

.small-button { min-height: 32px; padding: 0 11px; font-size: 0.8rem; }

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--blue-700);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ─── Dashboard shell ─── */

.dash-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: calc(100vh - var(--topbar-h));
}

.side-rail {
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 18px 12px 28px;
    border-right: 1px solid var(--line-dark);
    background: var(--rail);
}

.rail-org {
    display: grid;
    gap: 6px;
    margin: 0 4px 12px;
    padding: 12px;
    border: 1px solid var(--line-dark);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.rail-org strong {
    color: var(--text-on-dark);
    font-size: 0.95rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.rail-org select {
    appearance: none;
    width: 100%;
    height: 38px;
    min-height: 38px;
    padding: 0 32px 0 10px;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    background-color: #151515;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted-on-dark) 50%),
        linear-gradient(135deg, var(--muted-on-dark) 50%, transparent 50%);
    background-position:
        calc(100% - 15px) 50%,
        calc(100% - 10px) 50%;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
    color: var(--text-on-dark);
    cursor: pointer;
}

.rail-org select:hover { border-color: rgba(255, 255, 255, 0.3); }

.rail-org select:focus-visible {
    outline: none;
    border-color: var(--blue-300);
    box-shadow: 0 0 0 3px rgba(20, 149, 218, 0.18);
}

.rail-label {
    margin: 2px 8px 6px;
    color: var(--muted-2-on-dark);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.page-nav { display: flex; flex-direction: column; gap: 3px; }

.page-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted-on-dark);
    cursor: pointer;
    font-family: var(--display);
    font-size: 1rem;
    letter-spacing: 0.025em;
    text-align: left;
    text-decoration: none;
}

.page-tab svg { flex-shrink: 0; opacity: 0.7; }

.page-tab:hover,
.page-tab:focus-visible {
    outline: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.page-tab.is-active {
    color: var(--brand);
    background: rgba(20, 149, 218, 0.11);
}

.page-tab.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 20px;
    transform: translateY(-50%);
    border-radius: 0 3px 3px 0;
    background: var(--brand);
}

.page-tab.is-active svg { opacity: 1; }

/* ─── Light working canvas ─── */

.org-main {
    color-scheme: light;
    min-width: 0;
    min-height: calc(100vh - var(--topbar-h));
    padding: 0 clamp(16px, 2.4vw, 34px) 72px;
    background: #fff;
    color: var(--text);
}

.page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 clamp(-34px, -2.4vw, -16px) 22px;
    padding: 26px clamp(16px, 2.4vw, 34px) 22px;
    border-bottom: 1px solid var(--line-strong);
}

.page-heading-copy { display: grid; gap: 8px; min-width: 0; }

.page-heading h1 {
    margin: 0;
    font-family: var(--display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.01em;
    overflow-wrap: anywhere;
}

.page-heading p { margin: 0; color: var(--muted); }

.org-main .eyebrow {
    border-color: rgba(14, 120, 181, 0.34);
    color: var(--brand-deep);
    background: rgba(20, 149, 218, 0.11);
}

.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.dashboard-page { display: none; }

.dashboard-page.is-active { display: grid; gap: 18px; }

.panel {
    display: grid;
    align-content: start;
    gap: 16px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: 0.015em;
}

.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 18px;
}

.muted { color: var(--muted); }

.notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid rgba(14, 120, 181, 0.3);
    border-radius: var(--radius);
    background: rgba(20, 149, 218, 0.07);
}

.notice.is-warn { border-color: rgba(138, 90, 0, 0.3); background: var(--warn-bg); }

.notice.is-good { border-color: rgba(15, 122, 79, 0.3); background: var(--good-bg); }

.notice-copy { display: grid; gap: 4px; min-width: 0; max-width: 720px; }

.notice-copy strong { font-size: 1rem; }

.notice-copy span { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.feedback { min-height: 1.2em; margin: 0; color: var(--muted); font-size: 0.88rem; }

.feedback.is-error { color: var(--bad); }

.feedback.is-good { color: var(--good); }

/* ─── Stat tiles ─── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.stat-tile {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 118px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.stat-label { color: var(--muted-2); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.stat-value {
    color: var(--text);
    font-size: 1.85rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-foot { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }

.delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
}

.delta.is-up { color: var(--good); background: var(--good-bg); }

.delta.is-down { color: var(--bad); background: var(--bad-bg); }

.delta.is-flat { color: var(--muted); background: var(--surface-2); }

/* ─── Charts ─── */

.chart-wrap { position: relative; min-width: 0; }

.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-svg .grid-line { stroke: rgba(12, 12, 12, 0.08); stroke-width: 1; }

.chart-svg .axis-label {
    fill: var(--muted-2);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-svg .bar { fill: var(--brand); transition: opacity 120ms ease; }

.chart-svg .bar.is-partial { fill: var(--blue-300); }

.chart-svg .hit { fill: transparent; cursor: default; outline: none; }

.chart-svg .hit:hover + .bar,
.chart-svg .hit:focus-visible + .bar,
.chart-svg .bar.is-hover { opacity: 0.78; }

.chart-svg .value-label { fill: var(--text); font-size: 12px; font-weight: 700; }

.chart-tooltip {
    position: absolute;
    z-index: 5;
    min-width: 150px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    font-size: 0.8rem;
}

.chart-tooltip .tt-title { color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; }

.chart-tooltip .tt-row + .tt-row { margin-top: 3px; }

.chart-tooltip .tt-key { width: 12px; height: 3px; border-radius: 2px; background: var(--brand); flex: 0 0 auto; }

.chart-tooltip .tt-key.is-none { background: transparent; }

.chart-tooltip .tt-value { color: var(--text); font-weight: 800; }

.chart-tooltip .tt-name { color: var(--muted); }

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 0.8rem;
}

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.chart-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--brand); }

.chart-legend i.is-partial { background: var(--blue-300); }

.table-toggle {
    justify-self: start;
    font-size: 0.82rem;
}

.participation-list { display: grid; gap: 4px; }

.participation-row {
    display: grid;
    grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 46px;
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
    border-radius: 6px;
    outline: none;
}

.participation-row:hover,
.participation-row:focus-visible { background: var(--surface-2); }

.participation-name {
    overflow: hidden;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participation-track { position: relative; height: 18px; }

.participation-fill {
    position: absolute;
    inset: 0 auto 0 0;
    max-width: 100%;
    min-width: 0;
    height: 18px;
    border-radius: 0 4px 4px 0;
    background: var(--brand);
}

.participation-baseline {
    position: absolute;
    inset: 0 auto 0 0;
    width: 1px;
    background: rgba(12, 12, 12, 0.2);
}

.participation-value {
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 800;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.empty-chart {
    display: grid;
    place-items: center;
    min-height: 160px;
    padding: 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

/* ─── Tables ─── */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

table.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.data-table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--muted-2);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

.person-cell .person-copy { display: grid; gap: 1px; min-width: 0; }

.person-cell strong { font-weight: 700; }

.person-cell span { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.pill.is-good { border-color: rgba(15, 122, 79, 0.25); background: var(--good-bg); color: var(--good); }

.pill.is-warn { border-color: rgba(138, 90, 0, 0.25); background: var(--warn-bg); color: var(--warn); }

.pill.is-bad { border-color: rgba(180, 35, 24, 0.25); background: var(--bad-bg); color: var(--bad); }

.pill.is-brand { border-color: rgba(14, 120, 181, 0.3); background: rgba(20, 149, 218, 0.1); color: var(--brand-deep); }

.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* ─── Teams ─── */

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* Column flex so every card's action row sits on its bottom edge. */
.team-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.team-card-head { display: flex; justify-content: space-between; gap: 10px; }

.team-card h3 {
    margin: 0;
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: 0.015em;
    overflow-wrap: anywhere;
}

.invite-code {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.invite-code span { color: var(--muted-2); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.invite-code strong { font-family: var(--display); font-size: 1.1rem; font-weight: 400; letter-spacing: 0.06em; }

.invite-code .link-button { font-size: 0.8rem; }

.team-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.team-metric { display: grid; gap: 3px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); }

.team-metric span { color: var(--muted-2); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }

.team-metric strong { font-size: 1.15rem; font-weight: 800; }

.coach-chips { display: grid; gap: 8px; }

.coach-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.coach-chip-copy { display: grid; min-width: 0; }

.coach-chip-copy strong { font-size: 0.88rem; overflow-wrap: anywhere; }

.coach-chip-copy span { color: var(--muted); font-size: 0.76rem; }

.team-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.empty-block {
    display: grid;
    justify-items: start;
    gap: 10px;
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
}

.empty-block strong { color: var(--text); font-size: 1.05rem; }

/* ─── Billing ─── */

.plan-card {
    display: grid;
    gap: 18px;
    padding: 22px;
    border: 1px solid rgba(14, 120, 181, 0.32);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(20, 149, 218, 0.07), #fff 58%);
}

.plan-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; }

.plan-card h3 {
    margin: 0;
    font-family: var(--display);
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1;
}

.plan-price { display: flex; align-items: baseline; gap: 6px; }

.plan-price strong { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }

.plan-price span { color: var(--muted); font-weight: 600; }

.plan-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-benefits li { display: flex; gap: 8px; font-size: 0.9rem; }

.plan-benefits li::before { content: "✓"; color: var(--blue-700); font-weight: 900; }

.detail-list { display: grid; gap: 0; margin: 0; }

.detail-list > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.detail-list > div:last-child { border-bottom: 0; }

.detail-list dt { flex: 0 0 auto; color: var(--muted); }

.detail-list dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* ─── Forms ─── */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 18px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-field {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
}

.form-field label,
.form-field .label {
    color: var(--muted-2);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.form-field input,
.form-field select,
.form-field textarea {
    color-scheme: light;
    display: block;
    width: 100%;
    height: var(--control-h);
    min-height: var(--control-h);
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    line-height: 1.25;
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.form-field select {
    appearance: none;
    padding-right: 40px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
}

.form-field textarea {
    height: auto;
    min-height: 112px;
    padding-block: 11px;
    resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--muted-2);
    opacity: 1;
}

.form-field input:hover:not(:disabled),
.form-field select:hover:not(:disabled),
.form-field textarea:hover:not(:disabled) {
    border-color: rgba(12, 12, 12, 0.32);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: rgba(14, 120, 181, 0.6);
    box-shadow: 0 0 0 3px rgba(20, 149, 218, 0.14);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
    background-color: var(--surface-2);
    color: var(--muted);
    cursor: not-allowed;
}

.form-field small { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }

.stacked-form { display: grid; justify-items: start; gap: 14px; }

.stacked-form .form-field { width: 100%; }

.banner-stack { display: grid; gap: 12px; }

.inline-form .form-field { flex: 1 1 240px; }

/* ─── Modal ─── */

.modal {
    width: min(calc(100% - 32px), 560px);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.modal::backdrop { background: rgba(7, 7, 7, 0.55); backdrop-filter: blur(2px); }

.modal form {
    display: grid;
    gap: 20px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px;
}

.modal-head { display: flex; justify-content: space-between; gap: 12px; }

.modal-head h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.05;
}

.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

.modal-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.modal-actions .spacer { flex: 1 1 auto; }

/* ─── Toast ─── */

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 120;
    max-width: min(420px, calc(100vw - 36px));
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: #111;
    color: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    font-size: 0.88rem;
    font-weight: 600;
}

.toast.is-error { background: var(--bad); }

/* ─── Responsive ─── */

@media (max-width: 1100px) {
    .two-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    /* The rail becomes a tab strip; the canvas takes the rest of the height. */
    .dash-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }

    .side-rail {
        position: sticky;
        top: var(--topbar-h);
        z-index: 20;
        height: auto;
        overflow: visible;
        padding: 10px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line-dark);
    }

    .rail-org, .rail-label { display: none; }

    .page-nav { flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; }

    .page-nav::-webkit-scrollbar { display: none; }

    .page-tab { width: auto; min-height: 38px; padding: 0 12px; white-space: nowrap; }

    .page-tab.is-active::before { display: none; }

    .org-main { min-height: 0; }
}

@media (max-width: 560px) {
    .topbar-product { display: none; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .team-grid { grid-template-columns: minmax(0, 1fr); }
    .team-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-value { font-size: 1.5rem; }
    .participation-row { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) 42px; gap: 8px; }
    .state-panel { padding: 24px 18px; }
    .page-heading { align-items: flex-start; }
    .modal { width: min(calc(100% - 24px), 520px); max-height: calc(100svh - 24px); }
    .modal form { max-height: calc(100svh - 24px); padding: 20px; }
}

@media (max-width: 380px) {
    .modal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modal-actions .spacer { display: none; }
    .modal-actions [data-extra] { grid-column: 1 / -1; justify-self: start; }
}
