:root {
    --sidebar-width: 270px;
    --page-bg: #f5f7fb;
    --card-border: #e7eaf0;
    --text-muted: #6b7280;
    --brand-accent: #111827;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page-bg);
    color: #111827;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell { min-height: 100vh; display: flex; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--card-border);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark,
.brand-logo-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.brand-mark {
    background: var(--brand-accent);
    color: #fff;
    font-weight: 800;
}

.brand-logo-wrap {
    background: #fff;
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.brand-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.brand small, .sidebar-user small { display: block; color: var(--text-muted); }

.app-sidebar .nav-link {
    color: #374151;
    border-radius: 10px;
    padding: 11px 12px;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
    background: #f1f3f7;
    color: #111827;
}

.sidebar-user {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-user a {
    font-size: 18px;
    text-decoration: none;
    color: #6b7280;
}

.app-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 32px;
}

.page-card, .stat-card, .form-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 16px;
}

.page-card { padding: 22px; }
.form-card { padding: 24px; }

.stat-card {
    padding: 20px;
    height: 100%;
}

.stat-card .label { color: var(--text-muted); font-size: 14px; }
.stat-card .value { font-size: 30px; font-weight: 800; margin-top: 4px; }

.table-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
}

.table-card .table { margin-bottom: 0; }
.table-card .table > :not(caption) > * > * { padding: 14px 16px; vertical-align: middle; }

.avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #eef0f4;
    font-weight: 700;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    background: #22c55e;
}
.status-dot.off { background: #9ca3af; }

.permission-group {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
    height: 100%;
}

/* SETTINGS */
.settings-tabs {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .03);
}

.settings-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 15px;
    border-radius: 9px;
    text-decoration: none !important;
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease;
}

.settings-tabs a:hover {
    color: #111827;
    background: #f4f5f7;
}

.settings-tabs a.active {
    color: #fff !important;
    background: var(--brand-accent);
}

.settings-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eef0f3;
}

.settings-section-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: #f1f3f6;
    color: #374151;
    font-size: 18px;
}

.branding-upload-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 110px;
    padding: 14px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: #fafbfc;
}

.brand-preview {
    width: 84px;
    height: 84px;
    border: 1px solid var(--card-border);
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: #fff;
    overflow: hidden;
    flex: 0 0 auto;
}

.brand-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 7px;
}

.brand-preview.empty {
    color: #9ca3af;
    font-size: 24px;
}

.favicon-preview { width: 64px; height: 64px; }

/* ATHLETES */
.athlete-list-photo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    flex: 0 0 auto;
}

.athlete-photo-placeholder {
    display: grid;
    place-items: center;
    background: #eef1f5;
    color: #4b5563;
    font-weight: 800;
}

.athlete-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 22px;
}

.athlete-profile-photo {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    object-fit: cover;
    flex: 0 0 auto;
}

.profile-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 14px;
}

.profile-tabs a,
.profile-tabs span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 13px;
    border-radius: 9px;
    font-size: 14px;
    text-decoration: none;
    color: #4b5563;
}

.profile-tabs a:hover { background: #f3f4f6; color: #111827; }

.profile-tabs a.active {
    background: var(--brand-accent);
    color: #fff;
}

.profile-tabs span {
    color: #9ca3af;
    cursor: default;
}

.profile-tabs small {
    font-size: 10px;
    text-transform: uppercase;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 28px;
}

.profile-info-grid > div,
.profile-info-stack > div {
    min-width: 0;
}

.profile-info-grid span,
.profile-info-stack span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 3px;
}

.profile-info-grid strong,
.profile-info-stack strong {
    font-size: 14px;
    font-weight: 600;
}

.profile-info-stack {
    display: grid;
    gap: 17px;
}

.guardian-card {
    height: 100%;
    padding: 18px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: #fafbfc;
}

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.login-card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 16px 50px rgba(17,24,39,.08);
}

.btn-dark {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
}

@media (max-width: 900px) {
    .app-sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }

    .app-shell { display: block; }

    .app-main {
        width: 100%;
        margin-left: 0;
        padding: 20px;
    }

    .settings-tabs {
        width: 100%;
        display: flex;
    }

    .settings-tabs a {
        flex: 1 1 auto;
        justify-content: center;
    }

    .athlete-profile-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-info-grid {
        grid-template-columns: 1fr;
    }
}
