:root {
    --font-ui: "Segoe UI", "Tahoma", sans-serif;
    --bg-page: #f1f4f9;
    --bg-muted: #e8edf4;
    --text: #1d3047;
    --text-muted: #5d6f85;
    --border: #d3dde8;
    --border-soft: #e2e9f1;
    --white: #ffffff;

    --primary-950: #0b1e36;
    --primary-900: #102743;
    --primary-800: #17375d;
    --primary-700: #285481;
    --primary-500: #3b6fa2;
    --gold-500: #c89b3c;
    --gold-600: #b4872f;
    --silver-100: #f6f8fb;
    --silver-300: #dbe3ee;

    --success: #207d60;
    --danger: #b74046;
    --warning: #b7771f;
    --info: #2f6aa3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-ui);
    color: var(--text);
    background:
        radial-gradient(circle at top right, #e0e8f4 0, transparent 38%),
        radial-gradient(circle at bottom left, #e8edf6 0, transparent 44%),
        var(--bg-page);
}

a {
    text-decoration: none;
}

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

.sidebar {
    width: 290px;
    padding: 1.35rem 1.1rem;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 40%),
        linear-gradient(180deg, var(--primary-800) 0%, var(--primary-950) 100%);
    color: #ecf5ff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.brand {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 10px;
    padding: 0.28rem;
    box-shadow: 0 8px 16px rgba(7, 20, 35, 0.22);
}

.brand-title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 0.2rem;
}

.brand-subtitle {
    color: #bed3e8;
    font-size: 0.83rem;
}

.brand::after {
    content: "";
    display: block;
    height: 2px;
    width: 84px;
    margin-top: 0.6rem;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--gold-500), rgba(200, 155, 60, 0.15));
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    color: #9bb5cd;
    text-transform: uppercase;
    font-size: 0.73rem;
    letter-spacing: 0.08em;
    margin: 0.8rem 0 0.45rem;
    padding: 0 0.55rem;
}

.sidebar .nav-link {
    color: #d7e7f7;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.62rem 0.78rem;
    margin-bottom: 0.28rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.94rem;
    transition: all 0.18s ease;
}

.sidebar .nav-link i {
    width: 15px;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
}

.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(200, 155, 60, 0.28), rgba(255, 255, 255, 0.08));
    border-color: rgba(205, 169, 92, 0.38);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.sidebar .nav-link.disabled {
    color: #88a2ba;
    background: transparent;
}

.main-content {
    flex: 1;
    padding: 1.2rem 1.5rem 2rem;
    min-width: 0;
}

.topbar {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 18px rgba(28, 49, 73, 0.06);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.topbar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
    background: #fff;
    border-radius: 10px;
    padding: 0.22rem;
    border: 1px solid #d7e2ee;
}

.topbar::after {
    content: "";
    display: block;
    height: 2px;
    width: 110px;
    margin-top: 0.8rem;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--gold-500), rgba(200, 155, 60, 0.25));
}

.page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #17324d;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-pill {
    border: 1px solid #cfdae8;
    color: #334a63;
    background: #f2f7fc;
    border-radius: 999px;
    padding: 0.38rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.content-wrapper {
    padding-bottom: 2rem;
}

.section-stack > * + * {
    margin-top: 1rem;
}

.surface-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--white);
    box-shadow: 0 4px 16px rgba(19, 35, 56, 0.05);
    overflow: hidden;
}

.surface-header {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.surface-header h2,
.surface-header h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 650;
    color: #1e3955;
}

.surface-card::before,
.filter-bar::before,
.page-intro::before,
.form-shell::before,
.detail-hero::before,
.session-header::before {
    content: "";
    display: block;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--gold-500), var(--primary-500), rgba(59, 111, 162, 0.22));
}

.surface-body {
    padding: 1rem;
}

.filter-bar {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #fcfdff 0%, #f5f8fc 100%);
    padding: 1rem;
}

.page-intro {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    background: linear-gradient(140deg, #ffffff 0%, #f6f9fd 100%);
    box-shadow: 0 4px 14px rgba(17, 33, 55, 0.05);
}

.page-intro-title {
    margin: 0 0 0.2rem;
    font-size: 1.02rem;
    color: #1b3553;
    font-weight: 700;
}

.page-intro-subtitle {
    margin: 0;
    color: #5f7389;
    font-size: 0.86rem;
}

.ops-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.ops-chip {
    border: 1px solid var(--silver-300);
    background: var(--silver-100);
    color: #2e4a66;
    border-radius: 999px;
    padding: 0.28rem 0.6rem;
    font-size: 0.76rem;
    font-weight: 650;
}

.ops-chip strong {
    color: #17324d;
}

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

.table-wrap .table {
    margin-bottom: 0;
}

.table-wrap .table thead th {
    background: linear-gradient(180deg, #edf3fb 0%, #f5f8fd 100%);
    color: #3a536d;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.85rem 0.95rem;
}

.table-wrap .table tbody td {
    padding: 0.85rem 0.95rem;
    color: #274059;
    border-color: #e7eef5;
}

.table-wrap .table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.table-wrap .table tbody tr:hover {
    background: #edf5fe;
}

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

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
}

.metric-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(27, 48, 76, 0.05);
    padding: 1rem 1.05rem;
    min-height: 122px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(26, 51, 81, 0.09);
}

.metric-label {
    font-size: 0.82rem;
    color: #657b90;
    margin-bottom: 0.55rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #173550;
    line-height: 1;
}

.metric-card.primary {
    border-top: 4px solid var(--primary-500);
}

.metric-card.success {
    border-top: 4px solid var(--success);
}

.metric-card.warning {
    border-top: 4px solid var(--warning);
}

.metric-card.danger {
    border-top: 4px solid var(--danger);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.7rem;
}

.summary-box {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(25, 46, 72, 0.04);
}

.summary-box .title {
    font-size: 0.79rem;
    color: #70859a;
}

.summary-box .value {
    font-size: 1.2rem;
    font-weight: 650;
    color: #1e3955;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.action-tile {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbff;
    padding: 0.75rem 0.8rem;
    color: #274766;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.16s ease;
}

.action-tile:hover {
    color: #193653;
    border-color: #b6cae0;
    background: #eef5fd;
    transform: translateY(-1px);
}

.action-tile i {
    color: var(--primary-500);
}

.form-shell {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(26, 42, 65, 0.05);
}

.form-shell .form-body {
    padding: 1rem;
}

.form-section-title {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #637c95;
}

.form-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: #385470;
    margin-bottom: 0.32rem;
}

.form-control,
.form-select {
    border: 1px solid #cbd7e5;
    border-radius: 10px;
    min-height: 42px;
    font-size: 0.93rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #7396bf;
    box-shadow: 0 0 0 0.16rem rgba(59, 111, 162, 0.17);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding-top: 0.65rem;
    border-top: 1px dashed #dae4ef;
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(180deg, #2d5b8a, #214a74);
    border-color: #214a74;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(180deg, #2a547f, #1b4269);
    border-color: #1b4269;
}

.btn-success {
    background: linear-gradient(180deg, #c89b3c, #ad7f27);
    border-color: #ad7f27;
    color: #fff;
}

.btn-success:hover,
.btn-success:focus {
    background: linear-gradient(180deg, #bd9033, #9f7525);
    border-color: #9f7525;
    color: #fff;
}

.btn-sm {
    border-radius: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 650;
    border: 1px solid transparent;
}

.status-present,
.status-active,
.status-finalized {
    background: #e7f6ef;
    color: #1f7a57;
    border-color: #c2e7d8;
}

.status-absent,
.status-inactive {
    background: #fdeced;
    color: #b13d43;
    border-color: #f0c1c5;
}

.status-late,
.status-draft {
    background: #fff4df;
    color: #976116;
    border-color: #efd7a6;
}

.status-excused,
.status-not-started,
.status-info {
    background: #eaf4ff;
    color: #24639f;
    border-color: #c9ddf3;
}

.empty-state {
    text-align: center;
    border: 1px dashed #c8d7e7;
    border-radius: 12px;
    padding: 1.4rem 1rem;
    color: #627c95;
    background: #f9fcff;
}

.empty-state i {
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
    color: #8ea7be;
}

.detail-hero {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(25, 46, 72, 0.05);
    padding: 1rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.65rem;
    margin-top: 0.85rem;
}

.meta-item {
    background: var(--bg-muted);
    border: 1px solid #dae5f0;
    border-radius: 10px;
    padding: 0.6rem 0.72rem;
}

.meta-item .label {
    display: block;
    color: #647f98;
    font-size: 0.76rem;
    margin-bottom: 0.12rem;
}

.meta-item .value {
    color: #1f3a55;
    font-size: 0.9rem;
    font-weight: 600;
}

.attendance-toolbar {
    position: sticky;
    bottom: 10px;
    z-index: 6;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(20, 41, 64, 0.1);
    padding: 0.8rem;
}

.attendance-status-btn {
    min-height: 42px;
    min-width: 95px;
    border-radius: 10px;
    font-weight: 650;
}

.attendance-row {
    min-height: 58px;
}

.session-header {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f7fc 100%);
    padding: 1rem;
    overflow: hidden;
}

.session-header.session-finalized {
    border-color: #b8c8da;
    box-shadow: inset 0 0 0 2px rgba(44, 87, 131, 0.12);
}

.session-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.session-meta {
    background: #f1f6fc;
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}

.session-meta .label {
    display: block;
    font-size: 0.75rem;
    color: #6f869d;
}

.session-meta .value {
    display: block;
    font-size: 0.88rem;
    font-weight: 650;
    color: #1f3d59;
}

.status-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.status-selector .status-btn {
    min-height: 40px;
    min-width: 92px;
    border-radius: 9px;
    border: 1px solid #ccd8e7;
    background: #fff;
    color: #35526f;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.55rem;
}

.status-selector .status-btn:hover:not(:disabled) {
    border-color: #97b1cc;
    background: #f4f8fc;
}

.status-selector .status-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-selector .status-btn.active[data-status="Present"] {
    background: #dff3ea;
    border-color: #83c7aa;
    color: #1d7052;
    box-shadow: 0 0 0 1px rgba(32, 125, 96, 0.18);
}

.status-selector .status-btn.active[data-status="Absent"] {
    background: #fae4e5;
    border-color: #e39da4;
    color: #9d333b;
    box-shadow: 0 0 0 1px rgba(183, 64, 70, 0.18);
}

.status-selector .status-btn.active[data-status="Late"] {
    background: #fff1dc;
    border-color: #e4bf8a;
    color: #996115;
    box-shadow: 0 0 0 1px rgba(183, 119, 31, 0.18);
}

.status-selector .status-btn.active[data-status="Excused"] {
    background: #e6f0fb;
    border-color: #96b6d8;
    color: #255989;
    box-shadow: 0 0 0 1px rgba(47, 106, 163, 0.16);
}

.status-selector .status-btn.active[data-status="On Leave"] {
    background: #e6f0fb;
    border-color: #96b6d8;
    color: #255989;
    box-shadow: 0 0 0 1px rgba(47, 106, 163, 0.16);
}

.status-selector .status-btn.active[data-status="Substitute"] {
    background: #e6f0fb;
    border-color: #96b6d8;
    color: #255989;
    box-shadow: 0 0 0 1px rgba(47, 106, 163, 0.16);
}

.sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 8;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(23, 43, 68, 0.12);
    padding: 0.7rem 0.75rem;
}

.attendance-row.is-selected td {
    background: #f4f9ff;
}

.attendance-row.is-selected td:first-child {
    box-shadow: inset 3px 0 0 #355f8a;
}

.attendance-note {
    min-width: 200px;
}

.person-subtext {
    color: #7b8fa2;
    font-size: 0.77rem;
}

.gold-divider {
    width: 92px;
    height: 2px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--gold-500), rgba(200, 155, 60, 0.2));
}

.settings-note-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    background: linear-gradient(180deg, #fbfdff, #f2f7fc);
    min-height: 100%;
}

.settings-note-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1c3a57;
    margin-bottom: 0.35rem;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #dce9f8 0%, #eaf2fb 45%, #f6f9fd 100%);
}

.login-card {
    width: min(430px, 92vw);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 0.35rem;
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(19, 35, 56, 0.08);
}

@media (max-width: 1200px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 246px;
    }
}

@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    .brand-logo {
        width: 48px;
        height: 48px;
    }

    .main-content {
        padding: 0.95rem 0.85rem 1.5rem;
    }

    .topbar {
        padding: 0.85rem;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .topbar-brand {
        width: 100%;
        align-items: flex-start;
    }

    .topbar-logo {
        width: 42px;
        height: 42px;
    }

    .user-pill {
        white-space: normal;
    }

    .form-actions,
    .sticky-actions,
    .table-actions {
        flex-direction: column;
        align-items: stretch !important;
    }

    .sticky-actions .d-flex,
    .filter-bar .d-flex {
        width: 100%;
        flex-wrap: wrap;
    }
}
