:root {
    color-scheme: dark;
    --canvas: #06111d;
    --sidebar: #071724;
    --surface: #0b1b28;
    --surface-raised: #0e2231;
    --line: #193445;
    --line-soft: #132b3a;
    --text: #edf4f2;
    --muted: #91a5ae;
    --lime: #99d62f;
    --lime-bright: #ade63e;
    --lime-soft: rgba(153, 214, 47, .12);
    --danger: #ff5664;
    --success: #63d392;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
a { color: inherit; }
button, input, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .4rem; font-size: clamp(1.8rem, 3vw, 2.75rem); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin-bottom: .65rem; font-size: 1.45rem; letter-spacing: -.025em; }

.app-frame { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px 14px; display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); background: linear-gradient(180deg, #071827, #06131f); }
.brand { display: inline-flex; align-items: baseline; gap: 4px; color: white; font-size: 1rem; font-weight: 900; letter-spacing: .055em; text-decoration: none; }
.brand span { color: var(--lime); font-size: .86em; font-weight: 700; }
.sidebar .brand { margin: 2px 10px 26px; }
.primary-nav { display: grid; gap: 5px; }
.nav-section { margin-bottom: 8px; border: 1px solid transparent; border-radius: 7px; }
.nav-section[open] { padding-bottom: 5px; border-color: var(--line-soft); background: rgba(8, 27, 40, .54); }
.nav-section summary { min-height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border-radius: 7px; color: #d1dde1; cursor: pointer; font-size: .74rem; font-weight: 800; letter-spacing: .06em; list-style: none; text-transform: uppercase; }
.nav-section summary::-webkit-details-marker { display: none; }
.nav-section summary::after { margin-left: auto; color: #68818c; content: "▸"; transition: transform .15s ease; }
.nav-section[open] summary::after { transform: rotate(90deg); }
.nav-section summary > span { width: 18px; color: var(--lime); text-align: center; }
.nav-section .nav-item { margin: 1px 5px; min-height: 35px; font-size: .78rem; }
.team-selector { margin: 2px 8px 7px; }
.team-selector label { display: block; margin: 0 3px 5px; color: #718995; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.team-selector select { min-height: 34px; padding-right: 26px; color: var(--lime-bright); font-size: .75rem; font-weight: 750; }
.create-team-link { margin-top: 6px !important; padding-top: 5px; border-top: 1px solid var(--line-soft); color: #8da1aa; }
.admin-section { margin-top: 6px; }
.nav-item, .team-item { min-height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border-radius: 7px; color: #bdcbd0; text-decoration: none; }
.nav-item > span, .team-item > span { width: 18px; color: #aebfc5; text-align: center; }
.nav-item.active, .team-item.active { color: var(--lime-bright); background: linear-gradient(90deg, rgba(153, 214, 47, .13), rgba(153, 214, 47, .05)); }
.nav-item.active > span, .team-item.active > span { color: var(--lime); }
.nav-item.unavailable { cursor: default; opacity: .64; }
.team-navigation { margin-top: 32px; }
.team-navigation > p { margin: 0 12px 8px; color: #748b96; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.team-item { font-size: .85rem; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.user-card { margin-top: 10px; padding: 12px 8px 2px; display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(153, 214, 47, .45); border-radius: 50%; color: #07131d; background: var(--lime); font-weight: 900; }
.user-card div { min-width: 0; display: grid; }
.user-card strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.user-card small { color: #718995; font-size: .7rem; }

.workspace { min-width: 0; }
.workspace-header { min-height: 62px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(5, 16, 28, .92); }
.workspace-header > div { display: flex; align-items: center; gap: 12px; }
.workspace-header strong { font-size: 1rem; }
.environment-label, .panel-status { padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: #7f96a0; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.workspace-content { padding: 20px 22px 36px; }
.outline-button, .toolbar-button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; color: #b9c8ce; background: #091825; }
.outline-button { cursor: pointer; }
.outline-button:hover { color: var(--lime); border-color: rgba(153, 214, 47, .45); }
.toolbar-button:disabled { opacity: .82; cursor: default; }

.dashboard-titlebar { min-height: 56px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.dashboard-titlebar h1 { font-size: 1.55rem; letter-spacing: -.02em; }
.dashboard-titlebar p { margin-bottom: 0; color: var(--muted); font-size: .82rem; }
.dashboard-titlebar p span { padding: 0 6px; color: #58707b; }
.toolbar { display: flex; gap: 8px; }
.dashboard-tabs { min-height: 43px; margin: 0 -22px 14px; padding: 0 22px; display: flex; align-items: end; gap: 30px; border-bottom: 1px solid var(--line); }
.dashboard-tabs span { height: 43px; display: flex; align-items: center; border-bottom: 2px solid transparent; color: #8ca0a9; font-size: .74rem; letter-spacing: .02em; text-transform: uppercase; }
.dashboard-tabs span.active { color: white; border-color: var(--lime); }
.dashboard-empty-state { min-height: 470px; padding: 54px; display: flex; align-items: center; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 7px; background: radial-gradient(circle at 50% 20%, rgba(25, 61, 77, .25), transparent 48%), var(--surface); text-align: center; }
.empty-state-icon { width: 54px; height: 54px; margin-bottom: 20px; display: grid; place-items: center; border: 1px solid rgba(153, 214, 47, .4); border-radius: 50%; color: var(--lime); background: var(--lime-soft); font-size: 1.5rem; }
.eyebrow { margin-bottom: .7rem; color: var(--lime); font-size: .7rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.dashboard-empty-state > p:not(.eyebrow) { max-width: 680px; color: var(--muted); line-height: 1.65; }
.release-boundaries { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.release-boundaries span { padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; color: #8fa3ac; background: #081824; font-size: .76rem; }
.release-boundaries strong { margin-right: 5px; color: var(--lime); font-size: .95rem; }

.data-panel, .content-card { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.panel-heading { min-height: 46px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #0c1e2c; text-transform: uppercase; }
.panel-heading > div { display: flex; align-items: center; gap: 5px; font-size: .77rem; letter-spacing: .03em; }
.panel-number { color: var(--lime); }
.search-form { padding: 18px 14px; border-bottom: 1px solid var(--line); }
.search-form label { display: block; margin-bottom: 7px; color: #a8bac1; font-size: .72rem; font-weight: 750; text-transform: uppercase; }
.search-row { display: flex; gap: 8px; }
input, select { width: 100%; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: #081824; }
input::placeholder { color: #5e7681; }
input:focus, select:focus { outline: 2px solid rgba(153, 214, 47, .15); border-color: rgba(153, 214, 47, .65); }
.primary-button, .small-button { border: 1px solid transparent; border-radius: 5px; color: #07131c; background: var(--lime); cursor: pointer; font-weight: 850; }
.primary-button { min-width: 120px; min-height: 38px; padding: 0 18px; }
.primary-button:hover, .small-button:hover { background: var(--lime-bright); }
.small-button { min-height: 29px; padding: 0 9px; font-size: .7rem; }
.small-button.secondary { color: #a6bac2; border-color: var(--line); background: #0b202e; }
.small-button.secondary:hover { color: white; border-color: #315164; }
button:disabled { opacity: .42; cursor: not-allowed; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 13px; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: #718994; background: #091a27; font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
td { color: #cfdbdf; font-size: .78rem; }
td strong { color: white; }
td span { display: block; margin-top: 3px; color: #708893; font-size: .71rem; }
.action-cell { display: flex; flex-wrap: wrap; gap: 6px; }
.action-cell form { margin: 0; }
.alert { margin-bottom: 12px; padding: 11px 13px; border: 1px solid; border-radius: 5px; font-size: .78rem; font-weight: 700; }
.alert.success { color: var(--success); border-color: rgba(99, 211, 146, .25); background: rgba(99, 211, 146, .08); }
.alert.error, .validation { color: var(--danger); }
.alert.error { border-color: rgba(255, 86, 100, .25); background: rgba(255, 86, 100, .08); }
.empty-state { padding: 42px; color: var(--muted); text-align: center; }

.coach-dialog { width: min(850px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 48px)); padding: 0; overflow: auto; border: 1px solid #29495b; border-radius: 9px; color: var(--text); background: var(--surface); box-shadow: 0 28px 90px rgba(0, 0, 0, .62); }
.coach-dialog::backdrop { background: rgba(1, 9, 16, .78); backdrop-filter: blur(3px); }
.dialog-heading { padding: 20px 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #102738, #0c1f2d); }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.dialog-heading h2 { margin-bottom: 5px; }
.dialog-heading p { margin-bottom: 0; color: var(--muted); font-size: .78rem; }
.dialog-close { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 5px; color: #9eb0b7; background: #091925; cursor: pointer; font-size: 1.35rem; line-height: 1; }
.dialog-close:hover { color: white; border-color: #3b5d6f; }
.coach-dialog .primary-button { white-space: nowrap; }
.dialog-results { max-height: 430px; }

.auth-body { background: radial-gradient(circle at 70% 20%, #102a39 0, transparent 36%), linear-gradient(135deg, #06111d, #081925 58%, #06121b); }
.public-header { min-height: 64px; padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(5, 16, 27, .88); }
.public-header > span { color: #6f8792; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.auth-shell { min-height: calc(100vh - 64px); padding: 50px 20px; display: grid; place-items: center; }
.auth-card { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, #0d2130, #0a1a27); box-shadow: 0 30px 90px rgba(0, 0, 0, .32); }
.auth-mark { width: 44px; height: 44px; margin-bottom: 22px; display: grid; place-items: center; border: 1px solid rgba(153, 214, 47, .4); border-radius: 50%; color: var(--lime); background: var(--lime-soft); font-size: .75rem; font-weight: 900; }
.auth-card h1 { font-size: 2.15rem; }
.muted { color: var(--muted); }
.stacked-form { margin-top: 26px; display: grid; gap: 9px; }
.stacked-form label { margin-top: 5px; color: #b8c7cd; font-size: .75rem; font-weight: 750; }
.stacked-form input { min-height: 44px; }
.full-width { width: 100%; margin-top: 12px; }
.narrow-card { max-width: 680px; margin: 8vh auto; padding: 32px; }
.form-card { max-width: 680px; margin-top: 18px; padding: 24px; }
.form-card .primary-button { margin-top: 12px; justify-self: start; }

@media (max-width: 900px) {
    .app-frame { grid-template-columns: 74px minmax(0, 1fr); }
    .sidebar { padding-inline: 9px; }
    .sidebar .brand { margin-inline: 4px; font-size: .68rem; }
    .nav-item, .team-item { justify-content: center; padding-inline: 0; }
    .nav-item > span, .team-item > span { width: auto; }
    .nav-item { font-size: 0; }
    .nav-item > span { font-size: .9rem; }
    .team-navigation > p, .team-item:not(.active), .user-card div { display: none; }
    .nav-section summary { justify-content: center; padding-inline: 0; font-size: 0; }
    .nav-section summary > span { width: auto; font-size: .9rem; }
    .nav-section summary::after, .team-selector, .create-team-link { display: none; }
    .team-item.active { font-size: 0; }
    .user-card { justify-content: center; padding-inline: 0; }
}

@media (max-width: 680px) {
    .workspace-content { padding: 16px; }
    .workspace-header { padding-inline: 16px; }
    .dashboard-titlebar { align-items: stretch; flex-direction: column; }
    .toolbar { overflow-x: auto; }
    .dashboard-tabs { margin-inline: -16px; padding-inline: 16px; gap: 18px; overflow-x: auto; }
    .dashboard-empty-state { min-height: 420px; padding: 30px 18px; }
    .search-row { flex-direction: column; }
    .primary-button { width: 100%; }
    .public-header > span { display: none; }
}
