/* ── SchoolMaster ERP — Global Stylesheet ── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
--sm-primary: #1A6B4A;
--sm-primary-light: #22884F;
--sm-primary-soft: #DCF0E8;
--sm-primary-dark: #113E2B;
--sm-accent: #C4882A;
--sm-accent-soft: #FBF1DF;
--sm-sidebar-w: 258px;
--sm-topbar-h: 66px;
--sm-gold: #C4882A;
--sm-gold-soft: #FDF2DC;
--sm-radius: 12px;
--sm-radius-sm: 9px;
--sm-shadow: 0 1px 2px rgba(14,28,47,.05), 0 4px 12px rgba(14,28,47,.04);
--sm-shadow-lg: 0 12px 32px rgba(14,28,47,.12);
--sm-shadow-hover: 0 10px 28px rgba(14,28,47,.10);
--sm-ink: #15202B;
--sm-muted: #6B7C8C;
--sm-border: #E7EAEE;
}

/* ── RESET / BASE ── */
body {
margin: 0;
font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
background: #F5F6F8;
color: var(--sm-ink);
-webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--sm-primary); }
::selection { background: var(--sm-primary-soft); color: var(--sm-primary); }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }
.font-serif, .serif { font-family: 'Fraunces', Georgia, serif; }

/* Slim, tasteful scrollbars everywhere */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(16,25,43,.15); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(16,25,43,.28); }

/* ── SIDEBAR ── */
#sidebar {
position: fixed; top: 0; left: 0; height: 100vh; width: var(--sm-sidebar-w);
background: var(--sm-primary-dark);
overflow-y: auto; z-index: 1000;
transition: transform .28s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column;
box-shadow: 2px 0 18px rgba(0,0,0,.10);
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-header { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; }
.brand-icon {
width: 40px; height: 40px;
background: var(--sm-gold);
border-radius: 50%; display: flex; align-items: center; justify-content: center;
font-size: .92rem; color: var(--sm-primary-dark); font-family: 'Fraunces', serif; font-weight: 700;
flex-shrink: 0; letter-spacing: -.01em;
}
.brand-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,.25); flex-shrink: 0; }
.brand-name { color: #fff; font-weight: 600; font-size: .95rem; letter-spacing: -.01em; font-family: 'Fraunces', serif; line-height: 1.25; }
.brand-sub { color: rgba(255,255,255,.42); font-size: .66rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }

.sidebar-menu { padding: 8px 10px 32px; flex: 1; }
.menu-section {
font-size: .63rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
color: rgba(255,255,255,.30); padding: 16px 12px 6px;
}
.menu-item {
display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
color: rgba(255,255,255,.66); text-decoration: none; font-size: .86rem; font-weight: 500;
transition: all .16s ease; margin-bottom: 1px; position: relative; border-left: 3px solid transparent;
}
.menu-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.menu-item.active {
background: rgba(255,255,255,.08);
color: #fff; font-weight: 600; border-left-color: var(--sm-gold);
}
.menu-item i { font-size: .98rem; width: 18px; text-align: center; opacity: .92; }

/* ── MAIN WRAPPER ── */
#main-wrapper { margin-left: var(--sm-sidebar-w); min-height: 100vh; transition: margin .28s ease; }
body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
body.sidebar-collapsed #main-wrapper { margin-left: 0; }

/* ── TOPBAR ── */
#topbar {
position: sticky; top: 0; z-index: 900; height: var(--sm-topbar-h);
background: #fff;
border-bottom: 1px solid var(--sm-border);
display: flex; align-items: center; justify-content: space-between;
padding: 0 26px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-icon {
border: none; background: none; padding: 9px; border-radius: var(--sm-radius-sm); cursor: pointer;
color: var(--sm-muted); transition: all .16s; font-size: 1rem;
}
.btn-icon:hover { background: #F1F3F5; color: var(--sm-ink); }

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #a0aab8; font-size: .88rem; }
.search-input {
border: 1px solid transparent; border-radius: 50px; padding: .5rem 1rem .5rem 2.4rem;
font-size: .875rem; width: 260px; outline: none; transition: all .2s; background: #EEF1F5;
}
.search-input:focus { border-color: var(--sm-primary); background: #fff; width: 300px; box-shadow: 0 0 0 3px var(--sm-primary-soft); }
.search-dropdown {
position: absolute; top: calc(100% + 10px); left: 0; right: 0; background: #fff;
border-radius: 12px; box-shadow: var(--sm-shadow-lg); display: none; max-height: 320px; overflow-y: auto;
border: 1px solid var(--sm-border); z-index: 9999; padding: 6px;
}
.search-dropdown.show { display: block; }
.search-result-item {
padding: 10px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px;
font-size: .875rem; transition: background .15s; border-radius: 8px;
}
.search-result-item:hover { background: #F5F7FA; }

.notif-badge {
position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; background: #D64545;
border-radius: 50%; box-shadow: 0 0 0 2px #fff;
}
.notif-badge:empty { display: none; }
.btn-user {
display: flex; align-items: center; gap: 9px; border: none; background: none;
padding: 6px 12px 6px 6px; border-radius: 50px; cursor: pointer; transition: background .18s;
}
.btn-user:hover { background: #F5F7FA; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--sm-primary-soft); }
.user-initials {
width: 36px; height: 36px; border-radius: 50%;
background: var(--sm-primary-soft);
color: var(--sm-primary); display: flex; align-items: center; justify-content: center;
font-weight: 700; font-size: .82rem;
}
.user-name { font-size: .85rem; font-weight: 700; color: var(--sm-ink); line-height: 1.2; }
.user-role { font-size: .72rem; color: var(--sm-muted); }

/* ── PAGE CONTENT ── */
#page-content { padding: 24px 26px; max-width: 1600px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between;
margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.4rem; font-weight: 600; color: var(--sm-ink); margin: 0; letter-spacing: -.01em; font-family: 'Fraunces', serif; }
.page-sub { color: var(--sm-muted); font-size: .875rem; margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── DASHBOARD WELCOME CARD (compact, classic — not a gradient banner) ── */
.dash-hero, .dash-welcome {
position: relative; overflow: hidden; border-radius: var(--sm-radius); padding: 20px 22px;
background: var(--sm-primary-dark);
color: #fff; margin-bottom: 0; box-shadow: var(--sm-shadow);
display: flex; align-items: center; gap: 16px; height: 100%;
}
.dash-hero::after, .dash-welcome::after {
content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px;
border-radius: 50%; background: rgba(255,255,255,.04); pointer-events: none;
}
.dash-hero::before, .dash-welcome::before {
content: ''; position: absolute; right: 16px; bottom: -36px; width: 80px; height: 80px;
border-radius: 50%; background: rgba(196,136,42,.14); pointer-events: none;
}
.dash-hero-avatar, .w-avatar {
width: 54px; height: 54px; border-radius: 50%; background: var(--sm-gold); color: var(--sm-primary-dark);
display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif;
font-weight: 700; font-size: 1.2rem; flex-shrink: 0; z-index: 1; object-fit: cover;
}
.dash-hero-avatar img, .w-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.dash-hero-body, .w-text { z-index: 1; min-width: 0; }
.dash-hero-greeting, .w-text .greet { font-family: 'Fraunces', serif; font-size: 1.05rem; font-weight: 600; margin: 0 0 3px; }
.dash-hero-sub { font-size: .8rem; color: rgba(255,255,255,.82); margin: 0; }
.dash-hero-meta, .w-text .meta { font-size: .74rem; color: rgba(255,255,255,.68); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px; }
.dash-hero-meta span, .w-text .meta span { display: flex; align-items: center; gap: 5px; }
.dash-hero-date {
background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22);
border-radius: 50px; padding: 6px 14px; font-size: .76rem; font-weight: 600;
white-space: nowrap;
}

/* ── CARDS ── */
.card { border: 1px solid var(--sm-border); border-radius: var(--sm-radius); box-shadow: var(--sm-shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--sm-border);
padding: 14px 20px; border-radius: var(--sm-radius) var(--sm-radius) 0 0 !important; font-weight: 700; font-size: .86rem; }
.card-header.serif-header { font-family: 'Fraunces', serif; font-size: .95rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-view-all { font-size: .74rem; color: var(--sm-primary); font-weight: 600; text-decoration: none; }

/* ── STAT TILES (compact 2x2 dashboard grid) ── */
.stat-tile { background: #fff; border: 1px solid var(--sm-border); border-radius: var(--sm-radius); padding: 15px; height: 100%; box-shadow: var(--sm-shadow); }
.stat-tile .stat-ic { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .9rem; margin-bottom: 10px; }
.stat-tile .stat-val { font-family: 'Fraunces', serif; font-size: 1.35rem; font-weight: 600; line-height: 1; color: var(--sm-ink); }
.stat-tile .stat-lbl { color: var(--sm-muted); font-size: .72rem; margin-top: 4px; font-weight: 500; }

/* ── KPI CARDS (legacy, kept for other pages) ── */
.kpi-card {
background: #fff; border: 1px solid var(--sm-border); border-radius: var(--sm-radius);
padding: 20px; display: flex; align-items: center; gap: 15px;
box-shadow: var(--sm-shadow); transition: box-shadow .2s;
}
.kpi-card:hover { box-shadow: var(--sm-shadow-hover); }
.kpi-icon {
width: 50px; height: 50px; border-radius: 13px; display: flex; align-items: center;
justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.kpi-body { flex: 1; min-width: 0; }
.kpi-value { font-size: 1.4rem; font-weight: 700; color: var(--sm-ink); line-height: 1.2; letter-spacing: -.01em; font-family: 'Fraunces', serif; }
.kpi-label { font-size: .76rem; color: var(--sm-muted); font-weight: 600; margin-top: 2px; }
.kpi-link { color: #cdd3da; font-size: 1rem; transition: transform .18s; }
.kpi-card:hover .kpi-link { color: var(--sm-primary); transform: translateX(3px); }

/* ── EVENTS / ACTIVITY / NOTICE / MESSAGE LIST ROWS ── */
.event-row, .activity-row, .notice-row, .message-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--sm-border); }
.event-row:last-child, .activity-row:last-child, .notice-row:last-child, .message-row:last-child { border-bottom: none; }
.event-date-badge {
width: 38px; height: 38px; border-radius: 8px; background: var(--sm-gold-soft); color: var(--sm-gold);
display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .58rem;
font-weight: 700; line-height: 1.1; flex-shrink: 0; text-transform: uppercase;
}
.event-date-badge b { font-size: .82rem; }
.row-icon-circle {
width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
font-size: .72rem; font-weight: 700; flex-shrink: 0; color: var(--sm-primary); background: var(--sm-primary-soft);
}
.row-icon-square {
width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
font-size: .82rem; flex-shrink: 0; color: var(--sm-primary); background: var(--sm-primary-soft);
}
.row-title { font-size: .82rem; font-weight: 600; color: var(--sm-ink); margin: 0; }
.row-sub { font-size: .74rem; color: var(--sm-muted); margin: 2px 0 0; }
.row-time { font-size: .68rem; color: #A6B0BA; white-space: nowrap; margin-left: auto; padding-left: 8px; }
.row-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sm-accent); flex-shrink: 0; margin-top: 4px; }
.empty-row { padding: 24px 0; text-align: center; color: var(--sm-muted); font-size: .82rem; }

/* legend */
.chart-legend { display: flex; gap: 16px; padding: 0 20px 12px; flex-wrap: wrap; }
.chart-legend .li { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--sm-muted); }
.chart-legend .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ── QUICK ACTIONS ── */
.quick-action { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--sm-border);
border-radius: var(--sm-radius-sm); font-size: .78rem; font-weight: 600; color: var(--sm-ink); text-decoration: none;
transition: all .16s; height: 100%; }
.quick-action:hover { border-color: var(--sm-primary); background: var(--sm-primary-soft); }
.quick-action .qa-ic { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .82rem; flex-shrink: 0; }

/* ── SOFT COLOR UTILITIES ── */
.bg-primary-soft { background: var(--sm-primary-soft) !important; }
.text-primary { color: var(--sm-primary) !important; }
.bg-success-soft { background: #16a34a1a !important; }
.bg-warning-soft { background: var(--sm-gold-soft) !important; }
.bg-danger-soft { background: #dc26261a !important; }
.bg-info-soft { background: #2563eb1a !important; }
.bg-accent-soft { background: var(--sm-accent-soft) !important; }
.text-accent { color: var(--sm-accent) !important; }

/* ── AVATARS ── */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; display: inline-flex;
align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; overflow: hidden; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; display: flex;
align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; overflow: hidden; }
.avatar-sm img, .avatar-lg img, .avatar-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ── TABLES ── */
.table th { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
color: var(--sm-muted); border-bottom-width: 1px; padding: 11px 14px; }
.table td { padding: 12px 14px; vertical-align: middle; font-size: .86rem; }
.table-hover tbody tr { transition: background .15s; }

/* ── FORMS ── */
.form-control, .form-select { border-radius: var(--sm-radius-sm); border-color: #e2e8f0; font-size: .875rem; }
.form-control:focus, .form-select:focus { border-color: var(--sm-primary); box-shadow: 0 0 0 3px var(--sm-primary-soft); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--sm-muted); margin-bottom: .4rem; }

/* ── BUTTONS ── */
.btn-primary {
background: var(--sm-primary);
border-color: var(--sm-primary);
}
.btn-primary:hover { background: var(--sm-primary-light); border-color: var(--sm-primary-light); }
.btn { border-radius: var(--sm-radius-sm); font-size: .875rem; font-weight: 600; transition: all .16s; }

/* ── ATTENDANCE STATS ── */
.att-stat span { font-size: 1.5rem; font-weight: 700; display: block; font-family: 'Fraunces', serif; }
.att-stat small { font-size: .75rem; color: var(--sm-muted); }

/* ── AUTH ── */
.auth-body { background: linear-gradient(135deg, #0E1C2F 0%, #1A3A2A 100%); min-height: 100vh;
display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-bg { position: fixed; inset: 0; opacity: .03;
background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-rule='evenodd'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E"); }
.auth-container { position: relative; width: 100%; max-width: 440px; }
.auth-card { background: #fff; border-radius: 22px; padding: 40px; box-shadow: 0 24px 64px rgba(0,0,0,.3); }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo {
width: 64px; height: 64px; background: linear-gradient(135deg, var(--sm-primary), var(--sm-primary-light));
border-radius: 20px; display: flex; align-items: center; justify-content: center;
font-size: 1.8rem; color: #fff; margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(26,107,74,.35);
}
.auth-title { font-size: 1.4rem; font-weight: 800; color: var(--sm-ink); margin: 0 0 4px; }
.auth-sub { font-size: .875rem; color: var(--sm-muted); margin: 0; }
.auth-footer { text-align: center; color: rgba(255,255,255,.4); font-size: .8rem; margin-top: 20px; }

/* ── CBT EXAM ── */
.cbt-timer { font-size: 2rem; font-weight: 700; font-family: monospace; color: var(--sm-primary); }
.cbt-timer.danger { color: #dc3545; animation: pulse 1s infinite; }
.question-card { border: 2px solid #e2e8f0; border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.question-card.answered { border-color: var(--sm-primary); background: #f8fdfb; }
.option-label { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
border: 1.5px solid #e2e8f0; border-radius: 10px; cursor: pointer; margin-bottom: 8px;
transition: all .15s; font-size: .9rem; }
.option-label:hover { border-color: var(--sm-primary); background: var(--sm-primary-soft); }
input[type="radio"]:checked + .option-label { border-color: var(--sm-primary); background: var(--sm-primary-soft); }

/* ── DARK MODE ── */
[data-bs-theme="dark"] body { background: #0b1220; color: #e2e8f0; }
[data-bs-theme="dark"] .card { background: #141d2f; border-color: rgba(255,255,255,.07); }
[data-bs-theme="dark"] .card-header { background: #141d2f; border-color: rgba(255,255,255,.07); color: #e2e8f0; }
[data-bs-theme="dark"] #topbar { background: #141d2f; border-color: rgba(255,255,255,.07); }
[data-bs-theme="dark"] .kpi-card { background: #141d2f; border-color: rgba(255,255,255,.07); }
[data-bs-theme="dark"] .stat-tile { background: #141d2f; border-color: rgba(255,255,255,.07); }
[data-bs-theme="dark"] .stat-tile .stat-val { color: #e2e8f0; }
[data-bs-theme="dark"] .page-title { color: #e2e8f0; }
[data-bs-theme="dark"] .kpi-value { color: #e2e8f0; }
[data-bs-theme="dark"] .user-name { color: #e2e8f0; }
[data-bs-theme="dark"] .btn-icon:hover { color: #e2e8f0; }
[data-bs-theme="dark"] .card-body, [data-bs-theme="dark"] .card-header h6 { color: #e2e8f0; }
[data-bs-theme="dark"] .row-title { color: #e2e8f0; }
[data-bs-theme="dark"] .fw-600.text-dark, [data-bs-theme="dark"] .text-dark { color: #e2e8f0 !important; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background: #0f1826; border-color: rgba(255,255,255,.1); color: #e2e8f0; }
[data-bs-theme="dark"] .table { color: #e2e8f0; }
[data-bs-theme="dark"] .table-light { background: #0f1826 !important; }
[data-bs-theme="dark"] .search-input { background: #0f1826; color: #e2e8f0; }
[data-bs-theme="dark"] .btn-icon:hover { background: #1c2740; }
[data-bs-theme="dark"] .btn-user:hover { background: #1c2740; }
[data-bs-theme="dark"] .quick-action { border-color: rgba(255,255,255,.1); color: #e2e8f0; }
[data-bs-theme="dark"] .event-row, [data-bs-theme="dark"] .activity-row,
[data-bs-theme="dark"] .notice-row, [data-bs-theme="dark"] .message-row { border-color: rgba(255,255,255,.07); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
#sidebar { transform: translateX(-100%); }
#main-wrapper { margin-left: 0; }
body.sidebar-open #sidebar { transform: translateX(0); }
body.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }
.search-input { width: 150px; }
.search-input:focus { width: 170px; }
#page-content { padding: 14px; }
.dash-hero, .dash-welcome { padding: 16px; border-radius: var(--sm-radius); gap: 12px; }
.dash-hero-avatar, .w-avatar { width: 46px; height: 46px; font-size: 1rem; }
.dash-hero-greeting, .w-text .greet { font-size: .92rem; }
.dash-hero-meta, .w-text .meta { font-size: .68rem; gap: 10px; }
.page-title { font-size: 1.15rem; }
.card-body { padding: 15px; }
.card-header { padding: 12px 15px; }
.stat-tile { padding: 12px; }
.stat-tile .stat-val { font-size: 1.15rem; }
.quick-action { padding: 9px 10px; font-size: .72rem; }
}

@media (max-width: 480px) {
.topbar-left .search-wrap { display: none; }
#topbar { padding: 0 14px; }
.user-info { display: none; }
.dash-hero, .dash-welcome { flex-direction: column; align-items: flex-start; text-align: left; }
.dash-hero-date { align-self: flex-start; }
.row-time { display: none; }
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.notif-menu .dropdown-item { padding: 12px 16px; font-size: .85rem; }
.scanner-frame { border: 3px solid var(--sm-primary); border-radius: 16px; position: relative; overflow: hidden; }
