:root {
    --bg: #f3f7f4;
    --surface: #ffffff;
    --surface-soft: #eaf3ed;
    --text: #17251c;
    --muted: #68786d;
    --primary: #2f7d4a;
    --primary-dark: #1f5e36;
    --accent: #6fd08c;
    --border: #dbe7df;
    --danger: #a83b3b;
    --warning: #8a641d;
    --shadow: 0 18px 46px rgba(28, 70, 43, 0.09);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

button {
    cursor: pointer;
}

.boot-screen,
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 24px;
}

.boot-screen span {
    color: var(--muted);
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: var(--accent);
    color: #142319;
    font-weight: 900;
}

.login-card {
    width: min(100%, 440px);
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 28px;
}

.login-brand h1 {
    margin: 0;
    font-size: 24px;
}

.login-brand small {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 13px;
    background: white;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(47, 125, 74, 0.14);
    border-color: var(--primary);
}

textarea {
    resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 800;
}

.primary-button {
    background: var(--primary);
    color: white;
}

.secondary-button {
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.danger-button {
    background: #f6e8e8;
    color: var(--danger);
}

.icon-button {
    padding: 9px 12px;
    background: transparent;
    color: inherit;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.alert {
    margin: 14px 0;
    padding: 13px 15px;
    border-radius: 12px;
}

.alert.error {
    background: #faeaea;
    color: var(--danger);
}

.alert.success {
    background: #e4f4e9;
    color: var(--primary-dark);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 25px 18px;
    overflow-y: auto;
    background: #17251c;
    color: white;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 6px 28px;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.58);
}

.nav {
    display: grid;
    gap: 7px;
}

.nav button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: 12px;
    padding: 12px 13px;
    background: transparent;
    color: rgba(255,255,255,0.74);
    text-align: left;
}

.nav button:hover,
.nav button.active {
    background: rgba(255,255,255,0.11);
    color: white;
}

.nav-icon {
    width: 25px;
    text-align: center;
}

.sidebar-footer {
    margin-top: 28px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.65);
    font-size: 12px;
    line-height: 1.55;
}

.main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(243,247,244,0.94);
    backdrop-filter: blur(12px);
}

.topbar h1 {
    margin: 0;
    font-size: 23px;
}

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

.topbar-actions {
    display: flex;
    gap: 8px;
}

.content {
    padding: 28px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.page-header h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

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

.grid {
    display: grid;
    gap: 16px;
}

.grid.cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card {
    padding: 20px;
}

.card-label {
    color: var(--muted);
    font-size: 13px;
}

.card-value {
    display: block;
    margin: 9px 0 4px;
    color: var(--primary-dark);
    font-size: 28px;
    font-weight: 900;
}

.card-note {
    color: var(--muted);
    font-size: 13px;
}

.hero {
    margin-bottom: 18px;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: center;
    border-radius: 24px;
    background:
        linear-gradient(135deg, #e6f5ea, #d4efdc);
    box-shadow: var(--shadow);
}

.hero h2 {
    margin: 0 0 7px;
    font-size: 27px;
}

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

.score-badge {
    min-width: 145px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255,255,255,0.78);
    text-align: center;
}

.score-badge strong {
    display: block;
    margin-top: 4px;
    font-size: 31px;
    color: var(--primary-dark);
}

.panel {
    padding: 22px;
}

.panel + .panel {
    margin-top: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.panel-header h3 {
    margin: 0;
}

.progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe9e2;
}

.progress > span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    background: var(--primary);
}

.metric-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
    border-bottom: 0;
}

.metric-row span {
    color: var(--muted);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 11px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.empty {
    padding: 26px;
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
    text-align: center;
}

.list {
    display: grid;
    gap: 11px;
}

.list-item {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: white;
}

.list-item-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.list-item h4 {
    margin: 0 0 4px;
}

.list-item p {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}

.coach-score {
    font-size: 44px;
    font-weight: 900;
    color: var(--primary-dark);
}

.insight {
    border-left: 5px solid var(--primary);
}

.insight.attention {
    border-left-color: #d79b2d;
}

.insight.success {
    border-left-color: #3f9d5f;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}

.toolbar > * {
    flex: 1 1 170px;
}

.toolbar .fit {
    flex: 0 0 auto;
}

.mobile-nav-button {
    display: none;
}

.loading {
    min-height: 220px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.spinner {
    width: 34px;
    height: 34px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

    .grid.three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 850px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 30;
        left: 0;
        top: 0;
        width: 270px;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-nav-button {
        display: inline-block;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .content {
        padding: 17px;
    }

    .topbar {
        padding: 12px 15px;
    }

    .grid.cards {
        grid-template-columns: 1fr;
    }

    .hero,
    .page-header,
    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .score-badge {
        width: 100%;
    }
}
