/* =========================================================
   SDO Masbate City DTR System — design system
   ========================================================= */
:root {
    --brand-900: #0d3b1e;
    --brand-800: #124d27;
    --brand-700: #17652f;
    --brand-600: #1e7e3a;
    --brand-500: #2a9a4a;
    --brand-100: #e3f3e8;
    --brand-50:  #f2f9f4;
    --ink: #1d2733;
    --muted: #667085;
    --line: #e4e7ec;
    --surface: #ffffff;
    --bg: #f5f7f6;
    --radius: 12px;
    --sidebar-w: 264px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);

    --bs-primary: var(--brand-600);
    --bs-primary-rgb: 30, 126, 58;
    --bs-link-color: var(--brand-700);
    --bs-link-color-rgb: 23, 101, 47;
    --bs-link-hover-color: var(--brand-900);
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-border-radius: 8px;
}

body { font-family: var(--bs-body-font-family); color: var(--ink); background: var(--bg); font-size: .95rem; }
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-success {
    --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg: var(--brand-800); --bs-btn-active-border-color: var(--brand-800);
    --bs-btn-disabled-bg: var(--brand-500); --bs-btn-disabled-border-color: var(--brand-500);
}
.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--brand-700); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
}
.btn { font-weight: 500; border-radius: 8px; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink); }
.btn-icon:hover { background: var(--brand-50); }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .2rem rgba(42, 154, 74, .18); }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-label { font-weight: 500; font-size: .875rem; color: #344054; }
.text-bg-primary, .bg-primary { background-color: var(--brand-600) !important; }
.bg-success { background-color: var(--brand-600) !important; }
.text-primary { color: var(--brand-700) !important; }
.badge.bg-primary { background-color: var(--brand-600) !important; }
.page-link { color: var(--brand-700); }
.active > .page-link, .page-link.active { background-color: var(--brand-600); border-color: var(--brand-600); }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: linear-gradient(180deg, var(--brand-900), var(--brand-800));
    color: #d6eadb; display: flex; flex-direction: column;
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; overflow-y: auto; visibility: visible !important; transform: none !important; }
    .main-wrap { margin-left: var(--sidebar-w); }
}
.sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); --bs-offcanvas-bg: var(--brand-900); }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand img { background: #fff; border-radius: 10px; padding: 3px; object-fit: contain; }
.brand-title { color: #fff; font-weight: 600; line-height: 1.2; }
.brand-sub { font-size: .75rem; color: #9fc9aa; }
.sidebar-nav { padding: .75rem .65rem 1rem; flex: 1; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #84b591; padding: 1rem .7rem .35rem; font-weight: 600; }
.nav-item-link {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; margin: 2px 0; border-radius: 8px;
    color: #d6eadb; text-decoration: none; font-size: .9rem; transition: background .15s, color .15s;
}
.nav-item-link i { color: #8fc49d; width: 1.1rem; }
.nav-item-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #7ee09a; }
.nav-item-link.active i { color: #7ee09a; }
.sidebar-footer { padding: .75rem 1.1rem; font-size: .72rem; color: #84b591; border-top: 1px solid rgba(255,255,255,.08); }

.main-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; height: 64px; display: flex; align-items: center; gap: .75rem;
    padding: 0 1.5rem; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 600; color: var(--muted); }
.live-clock { align-items: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .875rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; background: none; border: 1px solid transparent; border-radius: 999px; padding: .25rem .5rem .25rem .25rem; }
.user-chip:hover { background: var(--brand-50); border-color: var(--line); }
.user-chip::after { margin-left: .25rem; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand-800); font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.user-name { display: block; font-weight: 600; font-size: .85rem; line-height: 1.1; color: var(--ink); }
.user-meta { display: block; font-size: .72rem; color: var(--muted); max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 1.75rem 1.5rem 2rem; flex: 1; width: 100%; max-width: 1400px; }
.app-footer { padding: 1rem 1.5rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }
@media (max-width: 575.98px) { .content { padding: 1.25rem .9rem; } .topbar { padding: 0 .9rem; } }

/* ---------- Public shell ---------- */
.public-shell { display: flex; flex-direction: column; min-height: 100vh; }
.public-shell main { flex: 1; }
.public-header { background: linear-gradient(135deg, var(--brand-900), var(--brand-600)); padding: .85rem 0; }
.brand-logo { background: #fff; border-radius: 10px; padding: 3px; object-fit: contain; }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.page-subtitle { margin: .25rem 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface); }
.card.shadow, .card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-header { background: var(--surface); border-bottom: 1px solid var(--line); padding: .9rem 1.25rem; font-weight: 600; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-header.bg-success, .card-header.bg-primary, .card-header.bg-info, .card-header.bg-dark, .card-header.bg-warning, .card-header.bg-danger, .card-header.bg-secondary {
    background: var(--surface) !important; color: var(--ink) !important; border-bottom: 1px solid var(--line);
}
.card-header.bg-success *, .card-header.bg-primary *, .card-header.bg-info *, .card-header.bg-dark *, .card-header.bg-secondary * { color: inherit; }
.card-header .card-title, .card-header h1, .card-header h2, .card-header h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.card-header .text-white, .card-header.text-white { color: var(--ink) !important; }
.card-header label.text-white { color: var(--muted) !important; }
.card-body { padding: 1.25rem; }
.card-title-sm { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-hint { color: var(--muted); font-size: .75rem; }
.tone-primary .stat-icon { background: var(--brand-100); color: var(--brand-700); }
.tone-success .stat-icon { background: #dcfae6; color: #067647; }
.tone-warning .stat-icon { background: #fef0c7; color: #b54708; }
.tone-danger .stat-icon  { background: #fee4e2; color: #b42318; }
.tone-info .stat-icon    { background: #e0f2fe; color: #026aa2; }
.tone-muted .stat-icon   { background: #f2f4f7; color: #475467; }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: var(--brand-50); margin-bottom: 0; vertical-align: middle; }
.table > thead th, .table thead.table-success th, .table thead.table-dark th, .table thead.table-light th {
    background: #f9fafb !important; color: #475467 !important; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; padding: .7rem .85rem;
}
.table > tbody td { padding: .65rem .85rem; border-color: #f0f2f5; }
.table-card { padding: 0; }
.table-card .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.table-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.table-search { max-width: 320px; position: relative; }
.table-search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.table-search input { padding-left: 2.1rem; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: '\f0dc'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-left: .4rem; opacity: .35; font-size: .7rem; }
th[data-sort].sort-asc::after { content: '\f0de'; opacity: .9; }
th[data-sort].sort-desc::after { content: '\f0dd'; opacity: .9; }

/* ---------- DTR screen table ---------- */
.dtr-screen td.dtr-center { text-align: center; }
.dtr-screen td.dtr-weekend { color: var(--muted); letter-spacing: .12em; font-size: .78rem; font-weight: 600; }
.dtr-screen td.dtr-special, .dtr-screen td .dtr-special { color: #93370d; background: #fffaeb; font-size: .82rem; }
.dtr-screen td { font-variant-numeric: tabular-nums; }
.page-actions .form-select-sm, .table-toolbar .form-select-sm { min-width: 120px; }

/* ---------- Misc components ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: .75rem; }
.alert { border-radius: 10px; border: 1px solid transparent; }
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.alert-danger { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-warning { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.alert-info { background: #f0f9ff; border-color: #b9e6fe; color: #026aa2; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.quick-link { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.quick-link:hover { border-color: var(--brand-500); box-shadow: var(--shadow-sm); transform: translateY(-1px); color: var(--ink); }
.quick-link i { width: 36px; height: 36px; border-radius: 9px; background: var(--brand-50); color: var(--brand-700); display: inline-flex; align-items: center; justify-content: center; }
.list-panel { max-height: 380px; overflow-y: auto; }
.progress { height: .5rem; background: #eef1f4; }
.progress-bar { background-color: var(--brand-500); }
.badge-soft-success { background: #dcfae6; color: #067647; }
.badge-soft-danger { background: #fee4e2; color: #b42318; }
.badge-soft-warning { background: #fef0c7; color: #b54708; }
.badge-soft-muted { background: #f2f4f7; color: #475467; }
.badge-soft-info { background: #e0f2fe; color: #026aa2; }
.badge { font-weight: 600; }
.notification { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.notification.success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.notification.error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.toast-container { z-index: 1090; }
code.kbd { background: #f2f4f7; padding: .1rem .35rem; border-radius: 4px; color: var(--ink); }

/* ---------- Auth pages ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-aside { background: linear-gradient(150deg, var(--brand-900) 0%, var(--brand-700) 60%, var(--brand-500) 100%); color: #e5f4e9; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(255,255,255,.05); right: -180px; bottom: -200px; }
.auth-aside h1 { color: #fff; font-size: 2.1rem; font-weight: 700; line-height: 1.2; }
.auth-aside .feature { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; }
.auth-aside .feature i { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.12); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { width: 64px; height: 64px; object-fit: contain; }
.auth-switch { display: flex; background: #f2f4f7; border-radius: 10px; padding: 4px; margin-bottom: 1.5rem; }
.auth-switch a { flex: 1; text-align: center; padding: .5rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .875rem; }
.auth-switch a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon > .form-control { padding-left: 2.5rem; height: 46px; }
.input-icon > .toggle-pass { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: .4rem .6rem; }
@media (max-width: 991.98px) { .auth-page { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ---------- Clock-in ---------- */
.clock-hero { background: linear-gradient(135deg, var(--brand-900), var(--brand-600)); color: #fff; border-radius: var(--radius); padding: 1.75rem; text-align: center; }
.clock-hero .big-time { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.clock-hero .big-date { opacity: .85; margin-top: .4rem; }
.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
@media (max-width: 575.98px) { .slot-grid { grid-template-columns: repeat(2, 1fr); } .clock-hero .big-time { font-size: 2.3rem; } }
.slot { border: 1px dashed var(--line); border-radius: 10px; padding: .85rem; text-align: center; background: #fcfcfd; }
.slot.filled { border-style: solid; border-color: #abefc6; background: #ecfdf3; }
.slot .slot-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.slot .slot-time { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .2rem; }

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .app-footer, .page-actions, .no-print, .toast-container, .public-header { display: none !important; }
    .main-wrap { margin: 0 !important; }
    .content { padding: 0 !important; max-width: none; }
    .card { box-shadow: none !important; border: 0; }
    body { background: #fff; }
}
