/* Staff Attendance Intelligence System — NMTC Korle-Bu */
:root {
  --sa-navy: #0c2d48;
  --sa-navy-2: #123d60;
  --sa-accent: #0f8b8d;
  --sa-accent-2: #14b8a6;
  --sa-bg: #f3f6f9;
  --sa-border: #e3e8ee;
  --sa-text: #1f2d3d;
  --sa-muted: #6b7a8c;
  --sidebar-w: 256px;
  --bs-primary: #0f6e8d;
  --bs-primary-rgb: 15, 110, 141;
  --bs-link-color: #0f6e8d;
  --bs-link-color-rgb: 15, 110, 141;
  --bs-body-font-size: .92rem;
}
body { background: var(--sa-bg); color: var(--sa-text); }
.btn-primary { --bs-btn-bg: #0f6e8d; --bs-btn-border-color: #0f6e8d; --bs-btn-hover-bg: #0c5a74; --bs-btn-hover-border-color: #0c5a74; --bs-btn-active-bg: #0a4c62; --bs-btn-disabled-bg:#0f6e8d; --bs-btn-disabled-border-color:#0f6e8d; }
.btn-outline-primary { --bs-btn-color: #0f6e8d; --bs-btn-border-color: #0f6e8d; --bs-btn-hover-bg: #0f6e8d; --bs-btn-hover-border-color: #0f6e8d; --bs-btn-active-bg:#0c5a74; }
.text-primary { color: #0f6e8d !important; }
.bg-primary { background-color: #0f6e8d !important; }
.page-link { color: #0f6e8d; }
.active > .page-link, .page-link.active { background-color: #0f6e8d; border-color: #0f6e8d; }
.form-control:focus, .form-select:focus { border-color: #6fb3c9; box-shadow: 0 0 0 .2rem rgba(15,110,141,.15); }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, var(--sa-navy) 0%, #0a2238 100%);
  color: #cfdbe7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1040;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sa-accent), var(--sa-accent-2)); font-size: 1.25rem; color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: #8fb3cf; font-size: .72rem; letter-spacing: .03em; }
.side-nav { padding: .75rem .6rem; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .58rem .8rem; border-radius: 8px; color: #cfdbe7;
  text-decoration: none; background: none; border: 0; font-size: .9rem; text-align: left; margin-bottom: 2px;
}
.side-link i:first-child { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: rgba(20,184,166,.18); color: #fff; box-shadow: inset 3px 0 0 var(--sa-accent-2); }
.side-toggle .caret { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.side-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.nav-sub { display: block; padding: .42rem .8rem .42rem 2.7rem; color: #a9bdd0; text-decoration: none; font-size: .86rem; border-radius: 8px; margin-bottom: 1px; }
.nav-sub:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-sub.active { color: #fff; background: rgba(20,184,166,.15); }
.sidebar-foot { padding: .9rem 1.1rem; border-top: 1px solid rgba(255,255,255,.07); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem; padding: .6rem 1.4rem; background: #fff; border-bottom: 1px solid var(--sa-border); }
.content { padding: 1.4rem; flex: 1; }
.footer { padding: .8rem 1.4rem; border-top: 1px solid var(--sa-border); background: #fff; }
.btn-icon { font-size: 1.4rem; padding: .1rem .4rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sa-accent); color: #fff; font-weight: 600; font-size: .85rem; }

.global-search { position: relative; flex: 1; max-width: 560px; }
.global-search > .bi-search { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--sa-muted); }
.global-search input { padding-left: 2.2rem; border-radius: 999px; background: var(--sa-bg); border-color: transparent; }
.global-search input:focus { background: #fff; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--sa-border); border-radius: 12px; max-height: 420px; overflow-y: auto; z-index: 1050; }
.search-results a { display: flex; gap: .75rem; align-items: center; padding: .6rem .9rem; text-decoration: none; color: inherit; border-bottom: 1px solid #f0f3f6; }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: #eef7f9; }
.sr-avatar { width: 34px; height: 34px; border-radius: 50%; background: #e6f2f5; color: #0f6e8d; display: grid; place-items: center; font-weight: 700; flex: 0 0 34px; }
.sr-avatar.unknown { background: #f1f1f1; color: #888; }
.sr-empty { padding: .9rem; color: var(--sa-muted); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--sa-muted); font-size: .88rem; }
.card { border: 1px solid var(--sa-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--sa-border); font-weight: 600; border-radius: 12px 12px 0 0 !important; }
.stat { padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; height: 100%; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex: 0 0 44px; }
.stat .val { font-size: 1.35rem; font-weight: 700; line-height: 1.15; }
.stat .lbl { color: var(--sa-muted); font-size: .8rem; }
.ico-teal { background: #e0f4f3; color: #0f8b8d; } .ico-blue { background: #e4eefb; color: #2563eb; }
.ico-amber { background: #fdf3dc; color: #b7791f; } .ico-red { background: #fde8e8; color: #c53030; }
.ico-purple { background: #efe9fb; color: #6b46c1; } .ico-slate { background: #edf1f5; color: #475569; }
.ico-green { background: #e3f5e8; color: #2f855a; } .ico-pink { background: #fce7f3; color: #be185d; }

.filter-bar { background: #fff; border: 1px solid var(--sa-border); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; }
.filter-bar .form-label { font-size: .75rem; color: var(--sa-muted); margin-bottom: .2rem; text-transform: uppercase; letter-spacing: .03em; }

.table-sa { margin: 0; }
.table-sa thead th { background: #f7f9fb; color: #4a5a6b; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--sa-border); white-space: nowrap; }
.table-sa td { vertical-align: middle; }
.table-sa tbody tr:hover { background: #f8fbfc; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: #0f6e8d; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
.clickable-row { cursor: pointer; }

.profile-head { background: linear-gradient(120deg, var(--sa-navy) 0%, #0f5b75 100%); color: #fff; border-radius: 14px; padding: 1.3rem 1.5rem; margin-bottom: 1.1rem; }
.profile-head .big-avatar { width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; }
.profile-head .meta { color: #c9dcea; font-size: .88rem; }
.profile-head .btn-light { color: var(--sa-navy); }

.nav-tabs .nav-link { color: var(--sa-muted); font-weight: 500; }
.nav-tabs .nav-link.active { color: #0f6e8d; font-weight: 600; }

.calendar { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.calendar th { text-align: center; font-size: .75rem; color: var(--sa-muted); font-weight: 600; text-transform: uppercase; }
.calendar td { height: 74px; vertical-align: top; border-radius: 10px; background: #fff; border: 1px solid var(--sa-border); padding: 6px 7px; font-size: .78rem; position: relative; }
.calendar td.empty { background: transparent; border: 0; }
.calendar td .dnum { font-weight: 700; font-size: .85rem; }
.calendar td .cal-mark { position: absolute; right: 7px; top: 5px; font-size: 1rem; }
.calendar td .times { margin-top: 6px; line-height: 1.25; color: #3b4b5c; }
.calendar td.present { background: #eefaf3; border-color: #bfe6cc; }
.calendar td.review { background: #fff8e8; border-color: #f3d58c; }
.calendar td.norecord { background: #fafbfc; }
.calendar td.norecord .times { color: #9aa7b5; }
.calendar td.weekend { background: #f5f6f8; }
.calendar td.holiday { background: #f3effc; border-color: #d9ccf5; }
.calendar td.today { outline: 2px solid #0f6e8d; }
.calendar td a { color: inherit; text-decoration: none; display: block; height: 100%; }
.cal-legend span { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; font-size: .8rem; color: var(--sa-muted); }
.cal-legend i.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--sa-border); }

.punch-list .punch { display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem; border-bottom: 1px solid #f0f3f6; }
.punch-list .punch:last-child { border-bottom: 0; }
.punch-list .punch.repeat { background: #f4fafe; color: #5b6b7c; }
.punch-list .punch .time { font-weight: 700; font-size: 1.05rem; min-width: 90px; }
.punch-list .punch.repeat .time { font-weight: 500; text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }

.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

.observed { border-left: 4px solid #0f8b8d; background: #f3fbfb; }
.interpret { border-left: 4px solid #b7791f; background: #fffaf0; }
.ai-box { white-space: pre-wrap; }

.drop-zone { border: 2px dashed #b9c7d4; border-radius: 14px; padding: 2rem; text-align: center; background: #fbfcfd; transition: .15s; }
.drop-zone.drag { border-color: #0f6e8d; background: #eef7f9; }
.drop-zone .bi { font-size: 2.4rem; color: #0f6e8d; }
.preview-grid .item { padding: .8rem 1rem; border: 1px solid var(--sa-border); border-radius: 10px; background: #fff; height: 100%; }
.preview-grid .item .k { font-size: .75rem; text-transform: uppercase; color: var(--sa-muted); letter-spacing: .03em; }
.preview-grid .item .v { font-size: 1.2rem; font-weight: 700; }

.guest { background: radial-gradient(1200px 600px at 10% 10%, #145a7a 0%, transparent 60%), linear-gradient(135deg, #0a2238 0%, #0c2d48 100%); min-height: 100vh; }
.guest-wrap { max-width: 420px; margin: 0 auto; padding: 8vh 16px 32px; }
.guest-card { background: #fff; border-radius: 16px; padding: 2rem 1.8rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.guest-logo { width: 60px; height: 60px; margin: 0 auto .8rem; border-radius: 16px; background: linear-gradient(135deg, var(--sa-accent), var(--sa-accent-2)); color: #fff; display: grid; place-items: center; font-size: 1.9rem; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.show { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }
  .content { padding: 1rem; }
  .topbar { padding: .5rem .8rem; }
  .calendar td { height: 58px; font-size: .7rem; padding: 4px; }
  .calendar td .times { display: none; }
}

@media print {
  .sidebar, .topbar, .footer, .no-print, .pager, .filter-bar { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; font-size: 11px; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block !important; }
  a { color: inherit; text-decoration: none; }
}
.print-only { display: none; }

.brand-logo { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 2px; object-fit: contain; flex: 0 0 42px; }
.guest-logo-img { display: block; width: 104px; height: 104px; margin: 0 auto .8rem; object-fit: contain; }
