/* =====================================================================
   SMS — Centralised Design System
   Merges the legacy shared layout (was assets/css/style.css) with the
   modern Dashboard design language (was dashboard/dashboard.css) into one
   common stylesheet so every page shares the same look & feel.
   ===================================================================== */

:root {
  --sms-primary: #1f5c4e;      /* deep school green */
  --sms-primary-dark: #163f36;
  --sms-accent: #d99a2b;       /* muted gold */
  --sms-bg: #f3f5f9;
  --sms-sidebar-w: 252px;
  --sms-topbar: #1a2a6c;       /* app top header gradient start */
  --sms-sidebar-bg: #ffffff;   /* app sidebar background */
  --sms-login: #1a2a6c;        /* login panel logo area + button */

  /* modern design tokens */
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #eef0f4;
  --border-strong: #e2e6ee;
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(20, 40, 80, .05);
  --shadow-md: 0 4px 14px rgba(20, 40, 80, .07);
  --shadow-lg: 0 12px 30px rgba(20, 40, 80, .14);
  --radius: .9rem;
  --radius-sm: .6rem;
  --radius-pill: 999px;
  --header-h: 66px;

  /* sidebar contrast tokens (re-emitted by theme_vars() per saved theme) */
  --sms-on-sidebar: #334155;
  --sms-on-sidebar-muted: #64748b;
  --sms-sidebar-hover: #f5f7fa;
  --sms-sidebar-border: #eef0f4;
  --sms-sidebar-active-bg: linear-gradient(120deg, rgba(31,92,78,.10), rgba(34,160,107,.10));
  --sms-sidebar-active-fg: var(--sms-primary-dark);
  --sms-sidebar-focus: #eef2f7;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--sms-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text-2);
  min-height: 100vh;
  overflow-x: hidden;
}

/* =====================================================================
   APP HEADER  (single gradient header, dashboard-banner design as standard)
   ===================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1040;
  height: var(--header-h);
  background: linear-gradient(120deg, var(--sms-topbar, #1a2a6c) 0%, var(--sms-primary, #1f5c4e) 55%, #22a06b 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(20, 40, 80, .22);
}
.app-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.app-header-burger {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border: 0; border-radius: .65rem;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .16s ease, transform .16s ease;
}
.app-header-burger:hover { background: rgba(255, 255, 255, .24); }
.app-header-burger:active { transform: scale(.94); }

.app-brand {
  display: flex; align-items: center; gap: .65rem;
  color: #fff; text-decoration: none; min-width: 0;
}
.app-brand:hover { color: #fff; }
.app-brand-logo {
  width: 38px; height: 38px; border-radius: .6rem;
  object-fit: contain; background: rgba(255,255,255,.16);
  padding: 3px; flex-shrink: 0;
}
.app-brand-name {
  font-weight: 700; font-size: 1.04rem; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-brand .app-brand-sub { display: block; font-size: .68rem; font-weight: 500; opacity: .8; letter-spacing: .12em; text-transform: uppercase; }

.app-header-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: .55rem;
}
.app-header-date {
  color: rgba(255,255,255,.9); font-size: .8rem; font-weight: 500;
  padding: .3rem .7rem; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.1);
  white-space: nowrap;
}
.app-role-pill {
  color: #fff; font-size: .74rem; font-weight: 600;
  padding: .28rem .75rem; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.16);
  white-space: nowrap;
}
.app-notif {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff; font-size: 1.15rem;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; flex-shrink: 0;
  transition: background .16s ease;
}
.app-notif:hover { background: rgba(255,255,255,.26); color: #fff; }
.app-notif .badge-dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill);
  background: #ffcc57; color: #1a2a6c;
  font-size: .64rem; font-weight: 700; line-height: 17px; text-align: center;
}
.app-avatar {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.16);
  color: #fff; border: 0; border-radius: var(--radius-pill);
  padding: .34rem .9rem .34rem .5rem;
  font-weight: 600; font-size: .86rem;
  max-width: 220px;
  transition: background .16s ease;
}
.app-avatar:hover { background: rgba(255,255,255,.26); color: #fff; }
.app-avatar .av-ic {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.24);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.app-avatar .av-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-avatar .av-role { display: block; font-size: .66rem; font-weight: 500; opacity: .85; }

.app-header .dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .45rem;
  margin-top: .5rem;
}
.app-header .dropdown-item { border-radius: var(--radius-sm); padding: .5rem .8rem; font-size: .88rem; }
.app-header .dropdown-item:hover { background: var(--surface-2); }
.app-header .dropdown-divider { margin: .3rem 0; }

/* =====================================================================
   BODY + SIDEBAR
   ===================================================================== */
.app-body { display: flex; min-height: calc(100vh - var(--header-h)); }

.app-sidebar {
  width: var(--sms-sidebar-w);
  background: var(--sms-sidebar-bg);
  border-right: 1px solid var(--sms-sidebar-border, var(--border));
  flex-shrink: 0;
  padding: .8rem .7rem;
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
}
.app-sidebar .nav { gap: 2px; }
.app-sidebar .nav-link {
  color: var(--sms-on-sidebar, #334155);
  padding: .6rem .85rem;
  border-radius: .7rem;
  display: flex; align-items: center; gap: .65rem;
  font-size: .9rem; font-weight: 500;
  transition: background .14s ease, color .14s ease, transform .14s ease;
  position: relative;
}
.app-sidebar .nav-link i { font-size: 1.08rem; color: var(--sms-on-sidebar-muted, #64748b); width: 22px; text-align: center; flex-shrink: 0; transition: color .14s ease; }
.app-sidebar .nav-link:hover { background: var(--sms-sidebar-hover, var(--surface-2)); color: var(--sms-on-sidebar, var(--text)); }
.app-sidebar .nav-link:hover i { color: var(--sms-primary); }
.app-sidebar .nav-link.active {
  background: var(--sms-sidebar-active-bg, linear-gradient(120deg, rgba(31,92,78,.10), rgba(34,160,107,.10)));
  border: 1px solid var(--sms-sidebar-border, transparent);
  color: var(--sms-sidebar-active-fg, var(--sms-primary-dark));
  font-weight: 650;
}
.app-sidebar .nav-link.active i { color: var(--sms-sidebar-active-fg, var(--sms-primary)); }
.app-sidebar .nav-link:active { background: var(--sms-sidebar-focus, var(--surface-2)); }
.app-sidebar .nav-link.active::before {
  content: "";
  position: absolute; left: .4rem; top: 50%; transform: translateY(-50%);
  width: 5px; height: 22px; border-radius: var(--radius-pill);
  background: linear-gradient(var(--sms-primary), #22a06b);
}
.app-sidebar .nav-link.chevron-open i.bi-chevron-down { transform: rotate(180deg); }
.app-sidebar .nav-link i.bi-chevron-down { transition: transform .18s ease; }
.app-sidebar .nav-link.sub {
  padding: .38rem .85rem .38rem 2.15rem;
  font-size: .84rem; font-weight: 450;
}
.app-sidebar .nav-link.sub i { font-size: .8rem; width: 16px; opacity: .7; }
.app-sidebar.collapsed .nav-item .collapse,
.app-sidebar.collapsed .nav-link[data-bs-toggle="collapse"] { display: none; }
.app-sidebar .sidebar-brand-mobile { display: none; }

/* desktop icon-only collapse */
.app-sidebar.collapsed { width: 76px; padding: .8rem .55rem; }
.app-sidebar.collapsed .nav-link { justify-content: center; padding: .6rem; }
.app-sidebar.collapsed .nav-link span { display: none; }
.app-sidebar.collapsed .nav-link::before { left: .15rem; }

/* sidebar scrollbar */
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.app-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1041;
}
.app-sidebar-backdrop.show { display: block; }

/* =====================================================================
   PAGE CONTENT
   ===================================================================== */
.app-content {
  flex-grow: 1;
  padding: 1.35rem 1.5rem 2.5rem;
  max-width: 100%;
  overflow-x: hidden;
}
.app-content > h4,
.app-content > h3,
.app-content h5.app-page-title { font-weight: 700; color: var(--text); }

/* Page title block used consistently */
.page-title-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .7rem; margin-bottom: 1.1rem;
}
.page-title-row h1, .page-title-row h2, .page-title-row h3, .page-title-row h4 {
  margin: 0; font-weight: 750; color: var(--text);
  display: flex; align-items: center; gap: .5rem;
}
.page-breadcrumb {
  font-size: .78rem; color: var(--text-4); margin-bottom: 1.1rem;
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.page-breadcrumb a { color: var(--text-3); text-decoration: none; }
.page-breadcrumb a:hover { color: var(--sms-primary); }
.page-breadcrumb .sep { opacity: .5; }

/* =====================================================================
   CARDS / PANELS  (dashboard design language applied to Bootstrap .card)
   ===================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.card > .card-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: .9rem 1.2rem;
  font-weight: 700; color: var(--text);
}
.card.shadow-sm, .card.shadow, .card.shadow-lg { box-shadow: var(--shadow-md); }
.border-start { border-left: 4px solid var(--border-strong) !important; }

.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.15rem;
}
.dash-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.dash-panel-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }
.dash-panel-title i { margin-right: .45rem; }
.dash-panel .text-muted-sm { color: var(--text-4); font-size: .8rem; }

/* =====================================================================
   TEACHER'S TODAY TIMETABLE — rectangle tiles (one per bell period)
   ===================================================================== */
.tt-grid { margin-top: .25rem; }
.tt-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .72rem; color: var(--text-3); margin-bottom: .9rem; }
.tt-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.tt-dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.tt-card {
  --tt-accent: #3b82f6;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tt-accent);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: var(--shadow-sm);
  padding: .75rem .85rem;
  min-height: 132px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tt-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tt-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tt-pname { font-weight: 700; font-size: .95rem; color: var(--text); }
.tt-card-time { font-size: .72rem; color: var(--text-4); font-weight: 600; }
.tt-card-body { margin-top: .3rem; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; }
.tt-subj { font-weight: 600; font-size: .88rem; color: var(--text); line-height: 1.25; }
.tt-cls { font-size: .78rem; color: var(--text-3); }
.tt-free { color: var(--text-4); font-style: italic; font-size: .82rem; display: inline-flex; align-items: center; gap: .4rem; margin-top: .45rem; }
.tt-badge-relief { background: var(--tt-accent); color: #fff; font-weight: 600; margin-top: .25rem; }
.tt-badge-cover { background: var(--tt-accent); color: #3b2500; font-weight: 600; margin-top: .25rem; }

/* status colouring */
.tt-card.tt-duty    { --tt-accent: #7c3aed; background: #fcf9ff; border-right: 1px solid #e9d5ff; border-bottom: 1px solid #e9d5ff; }
.tt-card.tt-covered { --tt-accent: #f59e0b; background: #fffbf0; border-right: 1px solid #fedf89; border-bottom: 1px solid #fedf89; }
.tt-card.tt-free    { --tt-accent: #fca5a5; background: #fef2f2; border-style: dashed; }
.tt-card.tt-free .tt-pname, .tt-card.tt-free .tt-card-time { color: #dc2626; }
.tt-card.tt-now { border-left-color: #10b981; box-shadow: 0 0 0 2.5px rgba(16, 185, 129, .16), var(--shadow-md); }

/* =====================================================================
   STAT CARDS (dashboard cards)
   ===================================================================== */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.dash-card {
  --acc: #3b82f6;
  --acc-soft: #eff6ff;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-md);
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex; gap: .85rem; align-items: center;
  overflow: hidden;
  min-height: 82px;
}
.dash-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--acc);
}
.dash-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.dash-card .dash-card-ic {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: .85rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--acc); background: var(--acc-soft);
}
.dash-card .dash-card-val { font-size: 1.55rem; font-weight: 750; line-height: 1.1; color: var(--text); }
.dash-card .dash-card-lbl { font-size: .8rem; color: var(--text-3); font-weight: 550; }
.dash-card .dash-card-sub { font-size: .71rem; color: var(--text-4); }
.dash-card .dash-card-sub2 { font-size: .65rem; color: var(--text-4); }
a.dash-card { color: inherit; text-decoration: none; }

/* accent palette */
.card-blue   { --acc: #3b82f6; --acc-soft: #eff6ff; }
.card-purple { --acc: #8b5cf6; --acc-soft: #f3efff; }
.card-green  { --acc: #10b981; --acc-soft: #ecfdf5; }
.card-orange { --acc: #f59e0b; --acc-soft: #fffbeb; }
.card-red    { --acc: #ef4444; --acc-soft: #fef2f2; }
.card-yellow { --acc: #eab308; --acc-soft: #fefce8; }
.card-cyan   { --acc: #06b6d4; --acc-soft: #ecfeff; }
.card-pink   { --acc: #ec4899; --acc-soft: #fdf2f8; }
.card-slate  { --acc: #64748b; --acc-soft: #f1f5f9; }

/* =====================================================================
   TABLES
   ===================================================================== */
.table-responsive-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive-wrap::-webkit-scrollbar { height: 8px; }
.table-responsive-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.table {
  --bs-table-bg: transparent;
  color: var(--text-2);
  font-size: .9rem;
}
.table > :not(caption) > * > * { padding: .68rem .8rem; }
.table thead th {
  background: var(--surface-2);
  color: var(--text-3);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 650;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td { border-bottom: 1px solid #f3f5f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-light { background: var(--surface-2) !important; --bs-table-bg: var(--surface-2); color: var(--text-3); }
.table-sm > :not(caption) > * > * { padding: .45rem .55rem; }
.table .tbl-strong { font-weight: 600; color: var(--text); }
.period-badge {
  display: inline-block; min-width: 30px; text-align: center;
  background: var(--surface-2); border-radius: .5rem; padding: .15rem .4rem;
  font-weight: 700; color: var(--text-2); border: 1px solid var(--border);
}

.dash-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.dash-table th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-4); font-weight: 650; padding: .45rem .6rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.dash-table td { padding: .55rem .6rem; border-bottom: 1px solid #f3f5f9; color: var(--text-2); vertical-align: top; }
.dash-table tr:last-child td { border-bottom: none; }

/* =====================================================================
   BADGES / PILLS
   ===================================================================== */
.badge { font-weight: 600; border-radius: var(--radius-pill); padding: .4em .7em; }
.text-bg-success, .badge.bg-success { background: #10b981 !important; }
.text-bg-danger, .badge.bg-danger { background: #ef4444 !important; }
.text-bg-warning, .badge.bg-warning { background: #f59e0b !important; color: #fff !important; }
.text-bg-info, .badge.bg-info { background: #06b6d4 !important; }
.text-bg-secondary, .badge.bg-secondary { background: #94a3b8 !important; }
.text-bg-dark, .badge.bg-dark { background: #334155 !important; }
.text-bg-primary, .badge.bg-primary { background: var(--sms-primary) !important; }
.badge.badge-darkred { background: #8b0000 !important; color: #fff !important; }

.pill { display: inline-block; padding: .18rem .6rem; border-radius: var(--radius-pill); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pill-green  { background: #ecfdf5; color: #047857; }
.pill-red    { background: #fef2f2; color: #b91c1c; }
.pill-yellow { background: #fefce8; color: #a16207; }
.pill-blue   { background: #eff6ff; color: #1d4ed8; }
.pill-orange { background: #fffbeb; color: #b45309; }
.pill-gray   { background: #f1f5f9; color: #475569; }
.pill-slate  { background: #f8fafc; color: #64748b; }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn { border-radius: .6rem; font-weight: 600; letter-spacing: .01em; transition: all .15s ease; }
.btn-sm { border-radius: .5rem; }
.btn-lg { border-radius: .7rem; }
.btn-primary {
  background: linear-gradient(120deg, var(--sms-primary, #1f5c4e), #22a06b);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(31, 92, 78, .25);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--sms-primary-dark);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(31, 92, 78, .3);
}
.btn-outline-primary { color: var(--sms-primary); border-color: rgba(31,92,78,.4); }
.btn-outline-primary:hover { background: var(--sms-primary); border-color: var(--sms-primary); color: #fff; }
.btn-outline-secondary { border-color: var(--border-strong); color: var(--text-2); }
.btn-outline-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-info { color: #fff; }
.btn-success { background: #10b981; border-color: transparent; }
.btn-success:hover { background: #059669; border-color: transparent; }
.btn-danger { background: #ef4444; border-color: transparent; }
.btn-danger:hover { background: #dc2626; border-color: transparent; }
.btn-outline-danger { color: #dc2626; border-color: rgba(239,68,68,.4); }
.btn-outline-danger:hover { background: #ef4444; border-color: #ef4444; color: #fff; }

/* =====================================================================
   FORMS
   ===================================================================== */
.form-control, .form-select {
  border: 1px solid var(--border-strong);
  border-radius: .6rem;
  padding: .52rem .8rem;
  color: var(--text-2);
  background-color: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: rgba(31, 92, 78, .55);
  box-shadow: 0 0 0 .2rem rgba(31, 92, 78, .12);
  color: var(--text-2);
}
.form-control-sm, .form-select-sm { border-radius: .5rem; padding: .4rem .65rem; font-size: .85rem; }
.form-label { font-weight: 600; color: var(--text-2); font-size: .86rem; }
.form-text { color: var(--text-4); font-size: .78rem; }
.form-check-input:checked { background-color: var(--sms-primary); border-color: var(--sms-primary); }
input[type="file"].form-control { padding: .42rem .65rem; }
form.card { padding: 1.35rem 1.5rem; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); border-radius: .6rem 0 0 .6rem; }

/* =====================================================================
   ALERTS
   ===================================================================== */
.alert {
  border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .8rem 1rem;
}
.alert-success { background: #ecfdf5; color: #047857; }
.alert-danger  { background: #fef2f2; color: #b91c1c; }
.alert-warning { background: #fffbeb; color: #a16207; }
.alert-info    { background: #ecfeff; color: #0e7490; }
.alert-dismissible .btn-close { padding: 1.1rem; }

/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination { gap: .3rem; }
.pagination .page-link {
  border-radius: .55rem !important;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 600;
  padding: .42rem .8rem;
  transition: all .14s ease;
}
.pagination .page-link:hover { background: var(--surface-2); color: var(--sms-primary); }
.pagination .page-item.active .page-link {
  background: linear-gradient(120deg, var(--sms-primary), #22a06b);
  border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px rgba(31, 92, 78, .25);
}
.pagination .page-item.disabled .page-link { background: var(--surface-2); color: var(--text-4); }

/* =====================================================================
   NAV TABS
   ===================================================================== */
.nav-tabs { border-bottom: 1px solid var(--border); gap: .35rem; }
.nav-tabs .nav-link {
  border: 0; border-radius: .6rem .6rem 0 0;
  color: var(--text-3); font-weight: 600; padding: .55rem 1rem;
  transition: all .14s ease;
}
.nav-tabs .nav-link:hover { color: var(--sms-primary); background: var(--surface-2); }
.nav-tabs .nav-link.active {
  color: var(--sms-primary-dark);
  background: var(--surface);
  border-bottom: 2px solid var(--sms-primary);
}

/* =====================================================================
   MODALS / DROPDOWNS / MISC BOOTSTRAP
   ===================================================================== */
.modal-content { border: 0; border-radius: 1rem; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .4rem;
}
.dropdown-item { border-radius: var(--radius-sm); padding: .5rem .85rem; font-size: .88rem; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }

.progress { border-radius: var(--radius-pill); background: var(--surface-2); }
.progress-bar { background: linear-gradient(120deg, var(--sms-primary), #22a06b); }

/* =====================================================================
   DASHBOARD-SPECIFIC COMPONENTS (kept available for all pages)
   ===================================================================== */
.dash-wrap { display: flex; flex-direction: column; gap: 1.15rem; }

/* welcome banner (used on dashboard are welcome strip) */
.dash-banner {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background: linear-gradient(120deg, var(--sms-topbar, #1a2a6c) 0%, var(--sms-primary, #1f5c4e) 55%, #22a06b 100%);
  color: #fff;
  padding: 1.35rem 1.75rem;
  box-shadow: 0 10px 24px rgba(26, 42, 108, .22);
}
.dash-banner::after {
  content: "";
  position: absolute; right: -70px; top: -70px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.dash-banner .dash-greet { font-size: 1.05rem; opacity: .92; margin-bottom: .15rem; }
.dash-banner h3 { font-weight: 700; margin: 0 0 .2rem; }
.dash-banner .dash-role {
  display: inline-block; background: rgba(255,255,255,.16);
  padding: .2rem .75rem; border-radius: var(--radius-pill);
  font-size: .78rem; letter-spacing: .02em;
}
.dash-banner .dash-date { font-size: .85rem; opacity: .9; }
.dash-banner .dash-notif {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff; font-size: 1.25rem;
  position: relative; text-decoration: none;
}
.dash-banner .dash-notif .badge-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill); background: #ffcc57; color: #1a2a6c;
  font-size: .66rem; font-weight: 700; line-height: 17px; text-align: center;
}

.chart-box { position: relative; height: 300px; }
.chart-box.chart-sm { height: 250px; }
.chart-box.chart-lg { height: 320px; }
.chart-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--text-4); font-size: .92rem;
  flex-direction: column; gap: .4rem; background: rgba(255,255,255,.9);
  border-radius: .7rem; z-index: 2;
}
.chart-overlay.skel { background: linear-gradient(90deg,#eef1f6 25%,#f7f9fc 50%,#eef1f6 75%); background-size:200% 100%; animation: dash-shimmer 1.3s infinite; }
.chart-overlay i { font-size: 2rem; opacity: .5; }

/* events / notices / activity / quick actions */
.dash-event { display: flex; gap: .85rem; align-items: center; padding: .55rem 0; }
.dash-event + .dash-event { border-top: 1px dashed var(--border); }
.dash-event .ev-date {
  flex-shrink: 0; width: 50px; height: 50px; border-radius: .8rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #ecfeff; color: #0e7490; line-height: 1.1;
}
.dash-event .ev-date .d { font-weight: 800; font-size: 1.25rem; }
.dash-event .ev-date .m { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.dash-event .ev-body .ev-title { font-weight: 650; color: var(--text); }
.dash-event .ev-body .ev-meta { font-size: .76rem; color: var(--text-4); }

.dash-notice { display: flex; gap: .85rem; padding: .6rem 0; }
.dash-notice + .dash-notice { border-top: 1px dashed var(--border); }
.dash-notice .n-ic {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: .7rem;
  display: flex; align-items: center; justify-content: center;
  background: #fffbeb; color: #b45309; font-size: 1.1rem;
}
.dash-notice .n-title { font-weight: 650; color: var(--text); font-size: .9rem; }
.dash-notice .n-meta { font-size: .75rem; color: var(--text-4); }
.dash-notice .n-preview { font-size: .83rem; color: var(--text-2); margin-top: .15rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.dash-qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: .7rem; }
.dash-qa {
  --acc: #3b82f6; --acc-soft: #eff6ff;
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: .85rem .5rem; border-radius: .9rem;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: .8rem; font-weight: 600;
  text-align: center;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.dash-qa:hover { transform: translateY(-2px); color: var(--acc); background: var(--acc-soft); box-shadow: 0 6px 16px rgba(20,40,80,.08); }
.dash-qa i { font-size: 1.4rem; color: var(--acc); }

.dash-activity { list-style: none; margin: 0; padding: 0; }
.dash-activity li { display: flex; gap: .8rem; padding: .5rem 0; }
.dash-activity li + li { border-top: 1px dashed var(--border); }
.dash-activity .a-dot {
  flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%;
  margin-top: .45rem; background: #cbd5e1;
}
.dash-activity .a-act { font-weight: 650; color: var(--text); font-size: .86rem; }
.dash-activity .a-desc { font-size: .82rem; color: var(--text-2); }
.dash-activity .a-when { font-size: .72rem; color: var(--text-4); }

.dash-mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.dash-mini { background: var(--surface-2); border: 1px solid var(--border); border-radius: .8rem; padding: .7rem .85rem; text-align: center; }
.dash-mini .v { font-size: 1.3rem; font-weight: 750; color: var(--text); }
.dash-mini .l { font-size: .72rem; color: var(--text-4); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* skeleton */
.skel {
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: dash-shimmer 1.3s infinite;
  border-radius: .55rem;
}
@keyframes dash-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel-line { height: .75rem; margin: .45rem 0; }
.skel-block { height: 100%; }

.dash-err {
  display: flex; align-items: center; gap: .6rem;
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: .7rem; padding: .7rem .9rem; font-size: .85rem;
}
.dash-err i { font-size: 1.1rem; }

.dash-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; padding: 1.6rem 1rem; text-align: center; color: var(--text-4);
}
.dash-empty i { font-size: 2rem; opacity: .45; }
.dash-empty .dash-empty-t { font-weight: 600; color: var(--text-3); font-size: .9rem; }

/* =====================================================================
   LOGIN / AUTH PAGES
   ===================================================================== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--sms-primary-dark, #163f36), var(--sms-topbar, #1a2a6c));
  padding: 1rem;
}
.login-card { max-width: 400px; width: 100%; border-radius: 1rem; overflow: hidden; }
.login-home-link { color: var(--sms-primary, #0d6efd); text-decoration: none; font-weight: 600; }
.login-home-link:hover { text-decoration: underline; }
.login-brand {
  background: linear-gradient(120deg, var(--sms-topbar, #1a2a6c), var(--sms-primary, #1f5c4e));
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -1.25rem -1.25rem 1.1rem;
  padding: 1.35rem 1rem;
}
.login-brand h4, .login-brand .text-muted { color: #fff !important; }
.btn-login {
  background: linear-gradient(120deg, var(--sms-primary, #1f5c4e), #22a06b);
  border-color: transparent; color: #fff; font-weight: 600;
}
.btn-login:hover, .btn-login:focus {
  background: var(--sms-primary-dark); border-color: transparent; color: #fff;
}

/* =====================================================================
   PRINT
   ===================================================================== */
@media print {
  .app-header, .app-sidebar, .app-sidebar-backdrop, .btn, .pagination, .nav-tabs { display: none !important; }
  .app-body { display: block; }
  .app-content { padding: 0; }
  .card, .dash-panel { box-shadow: none !important; border: 1px solid #d6d9e0; }
  body { background: #fff; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1199.98px) {
  .app-content { padding: 1.2rem 1.1rem 2.2rem; }
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    z-index: 1042;
    top: 0; left: 0;
    height: 100%;
    width: min(290px, 82vw);
    transform: translateX(-105%);
    transition: transform .24s ease;
    padding-top: 1rem;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-sidebar .sidebar-brand-mobile {
    display: flex; align-items: center; gap: .6rem;
    padding: .4rem .85rem 1rem; border-bottom: 1px solid var(--sms-sidebar-border, var(--border));
    margin: 0 .2rem 1rem; font-weight: 700; color: var(--sms-on-sidebar, var(--text));
  }
  .app-sidebar .sidebar-brand-mobile img { width: 34px; height: 34px; border-radius: .5rem; object-fit: contain; }
  .app-sidebar .sidebar-brand-mobile .app-brand-name { font-size: .95rem; }
  .app-sidebar-close {
    margin-left: auto;
    width: 30px; height: 30px; border: 0; border-radius: .5rem;
    background: var(--surface-2); color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center;
  }
  .app-role-pill, .app-header-date { display: none; }
}

@media (max-width: 575.98px) {
  .app-header-inner { padding: 0 .65rem; gap: .5rem; }
  .app-brand-name { font-size: .92rem; max-width: 120px; }
  .app-brand-sub { display: none !important; }
  .app-brand-logo { width: 32px; height: 32px; }
  .app-avatar { max-width: 150px; padding-right: .6rem; }
  .app-avatar .av-role { display: none; }
  .app-content { padding: 1rem .85rem 2rem; }
  .dash-banner { padding: 1.1rem 1.15rem; }
  .dash-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-card .dash-card-ic { width: 44px; height: 44px; font-size: 1.2rem; }
  .dash-card .dash-card-val { font-size: 1.3rem; }
  .chart-box { height: 250px; }
  .card-body { padding: 1rem; }
}

/* =====================================================================
   THEME PRESET SWATCHES  (System Settings > Theme & Colours)
   ===================================================================== */
.theme-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .9rem; }
.theme-swatch { cursor: pointer; }
.theme-swatch .ts-preview {
  border: 2px solid var(--border-strong);
  border-radius: .8rem;
  overflow: hidden;
  background: #fff;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.theme-swatch:hover .ts-preview { border-color: var(--sms-primary); transform: translateY(-2px); }
.theme-swatch input[type="radio"]:checked + .ts-preview {
  border-color: var(--sms-primary);
  box-shadow: 0 0 0 3px rgba(31, 92, 78, .18);
}
.theme-swatch input[type="radio"]:focus-visible + .ts-preview { outline: 2px solid var(--sms-primary); outline-offset: 2px; }
.theme-swatch .ts-top { height: 34px; }
.theme-swatch .ts-body {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px; min-height: 46px;
}
.theme-swatch .ts-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.theme-swatch .ts-bar { height: 8px; flex: 1 1 auto; border-radius: 99px; opacity: .92; }
.theme-swatch .ts-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .45rem; padding: 0 .1rem; }
.theme-swatch .ts-name { font-size: .83rem; font-weight: 650; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-swatch .ts-mode {
  font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .16rem .5rem; border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}
.ts-mode-light { background: #eef2f7; color: #334155; }
.ts-mode-dark { background: #1e293b; color: #dbe4ee; }
.theme-current-chip { font-size: .78rem; }
@media (max-width: 575.98px) {
  .theme-swatches { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
}