:root {
    --sidebar-width: 260px;
    --brand: #0f4c5c;
    --brand-dark: #0a3440;
    --accent: #e36414;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #0f766e;
    --danger: #b91c1c;
}

* {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 1rem 0.75rem;
}

.sidebar-nav a {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.7rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar-nav form {
    margin: 0;
}

.sidebar-nav button.linkish {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.7rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

.sidebar-nav button.linkish:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.topbar-title {
    font-weight: 600;
    margin: 0;
    font-size: 1.05rem;
}

.topbar-user {
    color: var(--muted);
    font-size: 0.95rem;
}

.content {
    padding: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    height: 100%;
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.badge-status {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status.active {
    background: #ccfbf1;
    color: #115e59;
}

.badge-status.inactive {
    background: #f3f4f6;
    color: #4b5563;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top right, rgba(227, 100, 20, 0.12), transparent 40%),
        linear-gradient(160deg, #0f4c5c 0%, #082630 55%, #0a3440 100%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.auth-card h1 {
    font-size: 1.4rem;
    margin-bottom: 0.35rem;
}

.auth-card .subtitle {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-brand:hover,
.btn-brand:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.placeholder-note {
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    color: var(--muted);
}

.score-tile {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fff;
    height: 100%;
}

.score-tile .score-num {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--brand);
}

.score-spark {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 72px;
}

.score-spark span {
    flex: 1;
    background: var(--brand);
    opacity: 0.75;
    min-height: 4px;
    border-radius: 2px 2px 0 0;
}

.mobile-toggle {
    display: none;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 0.4rem;
    padding: 0.35rem 0.6rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: inline-block;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1030;
    }

    .sidebar-backdrop.show {
        display: block;
    }
}
