:root {
  --bg-1: #f2f5f7;
  --bg-2: #e8eff2;
  --surface: #ffffff;
  --surface-soft: #f3f7f8;
  --ink: #1d2a30;
  --muted: #5f6e73;
  --line: #d4dee2;
  --brand: #056a61;
  --brand-2: #0b9282;
  --accent: #d69e2e;
  --danger: #c23a3a;
  --radius-lg: 10px;
  --radius-md: 8px;
  --shadow-1: 0 4px 16px rgba(11, 38, 45, 0.10);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.ams-v2 {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 88% 8%, #dcecf0 0%, #f2f5f7 34%, #ebf1f4 100%);
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
}

.v2-shell {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
}

.v2-sidebar {
  width: 260px;
  background: linear-gradient(180deg, #044441 0%, #0a5752 60%, #083634 100%);
  color: #dce9e6;
  padding: 18px 12px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
  z-index: 30;
}

.v2-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.v2-brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f9a87, #0a6f62);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(5, 11, 12, 0.35);
}

.v2-brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  color: #ffffff;
}

.v2-brand-sub {
  font-size: 11px;
  color: #9cc2bd;
}

.v2-user {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 4px 14px;
  background: linear-gradient(145deg, rgba(10, 49, 46, 0.6), rgba(6, 43, 41, 0.3));
}

.v2-user-name {
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
}

.v2-user-role {
  font-size: 11.5px;
  color: #98b8b2;
}

.v2-nav {
  display: grid;
  gap: 4px;
  padding: 0 6px;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.v2-nav::-webkit-scrollbar {
  width: 4px;
}

.v2-nav::-webkit-scrollbar-track {
  background: transparent;
}

.v2-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.v2-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.28);
}

.v2-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.65);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0.15px;
  border: 1px solid transparent;
  transition: all 0.22s ease;
  position: relative;
}

.v2-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
}

.v2-nav a.active {
  background: rgba(0, 137, 123, 0.3);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.v2-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #4fd1c5;
}

.v2-nav i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.v2-nav a:hover i,
.v2-nav a.active i {
  opacity: 1;
}

/* Sign Out pinned at sidebar bottom */
.v2-sidebar-footer {
  flex-shrink: 0;
  padding: 8px 6px 16px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.v2-signout {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.55);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0.15px;
  border: 1px solid transparent;
  transition: all 0.22s ease;
}

.v2-signout:hover {
  background: rgba(220, 80, 80, 0.15);
  border-color: rgba(220, 80, 80, 0.2);
  color: #fca5a5;
}

.v2-signout i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  opacity: 0.7;
}

.v2-signout:hover i {
  opacity: 1;
}

.v2-main {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-left: 260px;
}

.v2-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(17, 43, 49, 0.05);
}

.v2-topbar h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
}

.v2-topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.v2-toggle {
  border: 1px solid var(--line);
  background: #fff;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2e474d;
  cursor: pointer;
}

.v2-side-toggle {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  color: #e8f3f1;
  cursor: pointer;
}

.v2-side-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.v2-content {
  flex: 1 1 auto;
  padding: 18px;
}

.v2-content-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid #dce6ea;
  box-shadow: var(--shadow-1);
  padding: 20px;
  animation: liftIn 0.3s ease;
}

/* Attendance status colors */
.status-latecomer {
  color: #c62828;
  font-weight: 600;
}

.status-left-early {
  color: #8d5524;
  font-weight: 600;
}

#page-flash-messages .alert,
.alert {
  border-radius: 10px;
  border: 1px solid transparent;
}

.panel,
.well,
.card,
.box {
  border-radius: 8px !important;
  box-shadow: 0 3px 10px rgba(8, 28, 31, 0.07);
  border-color: #e2eaee !important;
}

.btn-primary,
.btn-success {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.btn-primary:hover,
.btn-success:hover {
  filter: brightness(0.95);
}

.btn-danger {
  background: #c23a3a;
  border-color: #c23a3a;
}

.table {
  background: #fff;
}

.table > thead > tr > th {
  background: linear-gradient(135deg, #056a61, #0b9282);
  color: #fff;
  border-bottom-width: 2px;
  font-size: 11px;
  padding: 9px 10px;
}

.v2-footer {
  margin: 14px 20px 16px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
  clear: both;
  margin-top: auto;
}

.v2-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(8, 25, 27, 0.35);
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 991px) {
  .v2-sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    z-index: 30;
    transition: left 0.2s ease;
    width: 260px;
  }

  .v2-main {
    margin-left: 0;
  }

  body.ams-v2.nav-open .v2-sidebar {
    left: 0;
  }

  body.ams-v2.nav-open .v2-overlay {
    display: block;
  }

  .v2-content {
    padding: 14px;
  }

  .v2-content-card {
    padding: 12px;
  }

  .v2-side-toggle {
    display: none !important;
  }
}

/* Desktop sidebar: smooth collapse when toggle is clicked */
@media (min-width: 992px) {
  .v2-sidebar {
    transition: width 0.25s ease, padding 0.25s ease, transform 0.25s ease;
  }

  .v2-main {
    transition: margin-left 0.25s ease;
  }

  body.ams-v2.sidebar-collapsed .v2-sidebar {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
    transform: translateX(-260px);
  }

  body.ams-v2.sidebar-collapsed .v2-main {
    margin-left: 0;
  }

  body.ams-v2.sidebar-collapsed .v2-toggle {
    display: inline-flex;
  }

  body.ams-v2:not(.sidebar-collapsed) .v2-toggle {
    display: none;
  }

  body.ams-v2:not(.sidebar-collapsed) .v2-side-toggle {
    display: inline-flex;
  }
}

/* ════════════════════════════════════════════════════════════════
   DASHBOARD COMPONENTS  (home.php — stat cards, page header, badges)
   ════════════════════════════════════════════════════════════════ */

/* CSS custom-property bridge for component classes shared with home.php */
:root {
  --success: #10b981;
  --warning: #f59e0b;
  --info:    #3b82f6;
  --border-color: var(--line);
  --card-bg:      var(--surface);
  --body-bg:      var(--bg-1);
  --text-primary: var(--ink);
  --text-secondary: var(--muted);
  --text-muted:   #8daaa7;
  --primary:      var(--brand);
  --primary-dark: #085f53;
  --shadow-sm: 0 1px 4px rgba(8,28,31,.06);
  --shadow-md: 0 4px 14px rgba(8,28,31,.10);
  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
}

/* Page header row (home.php .page-header block) */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 0 18px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--line);
}

.page-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.page-header-subtitle {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Stat card grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: transform 0.18s, box-shadow 0.18s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-icon.indigo { background: rgba(10,111,98,.12); color: var(--brand); }
.stat-icon.cyan   { background: rgba(15,154,135,.12); color: var(--brand-2); }
.stat-icon.green  { background: rgba(16,185,129,.12); color: var(--success); }
.stat-icon.amber  { background: rgba(214,158,46,.14); color: var(--accent); }
.stat-icon.red    { background: rgba(194,58,58,.12); color: var(--danger); }
.stat-icon.blue   { background: rgba(59,130,246,.12); color: var(--info); }
.stat-icon.orange { background: rgba(214,158,46,.12); color: var(--accent); }

.stat-content { flex: 1; }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 3px 0 2px;
}

.stat-change {
  font-size: 12px;
  color: var(--muted);
}

/* Card component (home.php recent activity tables etc.) */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 3px 10px rgba(8, 28, 31, 0.07);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #056a61, #0b9282);
  color: #fff;
}

.card-header h3,
.card-header h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.card-body { padding: 16px; }

.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

/* Modern badge pills */
.badge-modern {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-modern.success { background: rgba(16,185,129,.12); color: #059669; }
.badge-modern.danger  { background: rgba(194,58,58,.12);  color: var(--danger); }
.badge-modern.warning { background: rgba(214,158,46,.12); color: var(--accent); }
.badge-modern.info    { background: rgba(59,130,246,.12); color: var(--info); }
.badge-modern.primary { background: rgba(10,111,98,.12);  color: var(--brand); }
.badge-modern.muted   { background: var(--surface-soft);  color: var(--muted); }

/* Topbar avatar reused in tables */
.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

/* d-none / d-md-block Bootstrap 3 helpers */
.d-none   { display: none !important; }
@media (min-width: 768px) {
  .d-md-block { display: block !important; }
}

/* ════════════════════════════════════════════════════════════════
   OLD TEMPLATE COMPATIBILITY  (strips Indian-template wrapper styles)
   ════════════════════════════════════════════════════════════════ */

/* Neutralise section/container wrapping from the old template */
.v2-content-card section,
.v2-content-card section.transparent-bg,
.v2-content-card section#feature,
.v2-content-card #feature {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

.v2-content-card .container {
  width: 100%   !important;
  max-width: 100% !important;
  padding: 0    !important;
  margin: 0     !important;
}

/* Disable WOW.js animation stutter */
.wow {
  visibility: visible !important;
  animation-name: none !important;
  -webkit-animation-name: none !important;
}

/* Old template centre wrapper */
.v2-content-card .center {
  text-align: center;
  margin-bottom: 18px;
}

.v2-content-card .features,
.v2-content-card .services {
  background: transparent !important;
  padding: 0 !important;
}

/* ════════════════════════════════════════════════════════════════
   PAGE-LEVEL HEADERS  (h2.page-header, section headings)
   ════════════════════════════════════════════════════════════════ */

.v2-content-card h2.page-header,
.v2-content-card .page-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--brand);
  padding: 0 0 10px;
  margin: 0 0 20px;
  background: none;
}

/* ════════════════════════════════════════════════════════════════
   FORM REDESIGN  (Bootstrap 3 .form-horizontal, .form-control…)
   ════════════════════════════════════════════════════════════════ */

.v2-content-card .form-horizontal .form-group {
  margin-bottom: 14px;
}

.v2-content-card .control-label {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
  padding-top: 9px;
}

.v2-content-card .form-control,
.v2-content-card input.input-sm,
.v2-content-card select.input-sm,
.v2-content-card textarea.input-sm {
  border-radius: 6px !important;
  border: 1px solid var(--line) !important;
  height: 34px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: none !important;
}

.v2-content-card textarea.form-control,
.v2-content-card textarea.input-sm {
  height: auto !important;
  min-height: 80px;
  resize: vertical;
}

.v2-content-card .form-control:focus,
.v2-content-card input.input-sm:focus,
.v2-content-card select.input-sm:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(10,111,98,.13) !important;
  outline: none;
}

/* Inline validation error messages */
[id^="errormsg"],
.errormsg {
  font-size: 12px;
  color: var(--danger);
  padding: 3px 0;
  min-height: 16px;
}

/* ════════════════════════════════════════════════════════════════
   TABLE / DATATABLE REDESIGN
   ════════════════════════════════════════════════════════════════ */

.v2-content-card .table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.v2-content-card .table > thead > tr > th {
  background: linear-gradient(135deg, #056a61, #0b9282) !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #044a44 !important;
  padding: 9px 10px !important;
  white-space: nowrap;
  vertical-align: middle;
}

.v2-content-card .table > tbody > tr > td {
  vertical-align: middle;
  font-size: 12.5px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.v2-content-card .table > tbody > tr:hover > td {
  background: rgba(10,111,98,.04) !important;
}

.v2-content-card .table-bordered > thead > tr > th:first-child,
.v2-content-card .table-bordered > tbody > tr > td:first-child {
  border-left: none;
}

.v2-content-card .table-bordered > thead > tr > th:last-child,
.v2-content-card .table-bordered > tbody > tr > td:last-child {
  border-right: none;
}

.v2-content-card .table-bordered {
  border: none;
}

/* DataTables toolbar */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 12.5px;
  color: var(--ink);
  height: 32px;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--brand) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(10,111,98,.12) !important;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: 12px;
  margin-top: 8px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
  border-radius: 4px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface-soft) !important;
  border-color: var(--line) !important;
  border-radius: 4px !important;
}

/* ════════════════════════════════════════════════════════════════
   PANEL & WELL REDESIGN  (Bootstrap 3 .panel, .well)
   ════════════════════════════════════════════════════════════════ */

.v2-content-card .panel {
  border-radius: 8px !important;
  border-color: var(--line) !important;
  box-shadow: 0 2px 8px rgba(8,28,31,.07) !important;
  overflow: hidden;
}

.v2-content-card .panel-heading {
  background: linear-gradient(135deg, #056a61, #0b9282) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 600;
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 8px 8px 0 0 !important;
}

.v2-content-card .panel-body {
  padding: 14px;
}

.v2-content-card .panel-footer {
  background: var(--surface-soft) !important;
  border-color: var(--line) !important;
  border-radius: 0 0 8px 8px !important;
  padding: 10px 14px;
}

.v2-content-card .well {
  background: var(--surface-soft) !important;
  border-color: var(--line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  padding: 12px !important;
}

/* ════════════════════════════════════════════════════════════════
   BUTTON REDESIGN  (Bootstrap 3 .btn-*)
   ════════════════════════════════════════════════════════════════ */

.v2-content-card .btn {
  border-radius: 6px !important;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: filter 0.2s, transform 0.15s;
}

.v2-content-card .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.v2-content-card .btn-primary:hover,
.v2-content-card .btn-primary:focus {
  filter: brightness(0.93);
  color: #fff !important;
}

.v2-content-card .btn-success {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #fff !important;
}

.v2-content-card .btn-danger {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #fff !important;
}

.v2-content-card .btn-warning {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

.v2-content-card .btn-info {
  background: var(--info) !important;
  border-color: var(--info) !important;
  color: #fff !important;
}

.v2-content-card .btn-default {
  background: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}

.v2-content-card .btn-default:hover {
  background: var(--surface-soft) !important;
}

.v2-content-card .btn-secondary,
.v2-topbar .btn-default {
  background: #f1f5f7 !important;
  border-color: #d4dee2 !important;
  color: #35505a !important;
}

.v2-content-card .btn-secondary:hover,
.v2-topbar .btn-default:hover {
  background: #e8eff3 !important;
  border-color: #c7d5db !important;
}

/* Reusable quick actions style for home.php */
.quick-action-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 600;
}

.quick-action-link:hover,
.quick-action-link:focus {
  background: var(--body-bg);
  text-decoration: none;
  color: var(--text-primary);
}

.quick-action-link-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 12px;
}

.quick-action-link-arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════════
   ALERT REDESIGN
   ════════════════════════════════════════════════════════════════ */

.v2-content-card .alert,
#page-flash-messages .alert {
  border-radius: 6px;
  font-size: 13px;
  border-width: 1px;
  padding: 10px 14px;
}

.v2-content-card .alert-success,
#page-flash-messages .alert-success {
  background: rgba(16,185,129,.09);
  border-color: rgba(16,185,129,.28);
  color: #065f46;
}

.v2-content-card .alert-danger,
#page-flash-messages .alert-danger {
  background: rgba(194,58,58,.08);
  border-color: rgba(194,58,58,.28);
  color: #7f1d1d;
}

.v2-content-card .alert-warning,
#page-flash-messages .alert-warning {
  background: rgba(214,158,46,.09);
  border-color: rgba(214,158,46,.28);
  color: #78350f;
}

.v2-content-card .alert-info,
#page-flash-messages .alert-info {
  background: rgba(59,130,246,.08);
  border-color: rgba(59,130,246,.28);
  color: #1e3a5f;
}

/* ════════════════════════════════════════════════════════════════
   MODAL REDESIGN
   ════════════════════════════════════════════════════════════════ */

.modal-content {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(8,28,31,.18);
}

.modal-header {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.modal-body  { padding: 16px 18px; }
.modal-footer {
  border-top: 1px solid var(--line);
  padding: 10px 18px;
  background: var(--surface-soft);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ════════════════════════════════════════════════════════════════
   SELECT2 POLISHING  (consistent with v2 forms)
   ════════════════════════════════════════════════════════════════ */

.select2-container--default .select2-selection--single {
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  height: 34px !important;
  background: var(--surface) !important;
}

.select2-container--default .select2-selection--single
  .select2-selection__rendered {
  line-height: 32px !important;
  color: var(--ink) !important;
  padding-left: 10px !important;
}

.select2-container--default .select2-selection--single
  .select2-selection__arrow {
  height: 32px !important;
}

.select2-container--default.select2-container--open
  .select2-selection--single {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(10,111,98,.12) !important;
}

.select2-dropdown {
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  box-shadow: var(--shadow-1) !important;
  overflow: hidden;
}

.select2-results__option--highlighted {
  background: var(--brand) !important;
}

/* ════════════════════════════════════════════════════════════════
   INLINE STUDENT / ADD FORM  (student/add.php self-contained CSS)
   ════════════════════════════════════════════════════════════════ */

/* student/add.php uses a gradient body background — suppress inside v2 */
.v2-content-card .header,
.v2-content-card .form-container {
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

.v2-content-card .header h2 {
  font-size: 18px;
  color: var(--brand);
  font-weight: 700;
  text-align: left;
  margin-bottom: 10px;
}

.v2-content-card .info-banner {
  background: var(--surface-soft) !important;
  border-left: 4px solid var(--brand) !important;
  border-radius: 6px;
  padding: 10px 14px !important;
  margin-bottom: 14px;
}

.v2-content-card .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.v2-content-card .button-group {
  border-top: 1px solid var(--line) !important;
  padding-top: 18px !important;
}

/* ════════════════════════════════════════════════════════════════
   V2 FOOTER
   ════════════════════════════════════════════════════════════════ */

.v2-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* ════════════════════════════════════════════════════════════════
   MOBILE EXTRAS
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .v2-content-card .form-horizontal .control-label {
    text-align: left;
  }

  .page-header {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════════════════════════════
   CROSS-PAGE STYLE OVERRIDES
   Harmonise inline <style> blocks from student/list.php,
   attendance/list.php, and timetabling/timetabling.php so every
   page has a consistent look inside the v2 shell.
   ════════════════════════════════════════════════════════════════ */

/* ── Student list.php overrides ───────────────────────────────── */

.v2-content-card #dash-table {
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(8,28,31,.07);
}

.v2-content-card #dash-table thead {
  background: linear-gradient(135deg, #056a61, #0b9282) !important;
  color: #fff !important;
}

.v2-content-card #dash-table thead th {
  background: transparent !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 9px 10px !important;
}

.v2-content-card #dash-table tbody tr:hover {
  background-color: rgba(5,106,97,.06) !important;
}

/* Override inline page-header rules from list.php */
.v2-content-card .page-header {
  border-bottom: 3px solid var(--brand) !important;
  color: var(--ink);
  background: none !important;
}

/* Student controls panel */
.v2-content-card .nl-controls-panel {
  background: var(--surface) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 6px rgba(8,28,31,.06) !important;
  border: 1px solid var(--line) !important;
}

.v2-content-card .current-db-badge {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  padding: 6px 14px !important;
}

/* History card (student/list.php) */
.v2-content-card .history-card {
  background: var(--surface) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(8,28,31,.07) !important;
  border: 1px solid var(--line);
}

.v2-content-card .history-card-header {
  background: linear-gradient(135deg, #056a61, #0b9282) !important;
  border-radius: 8px 8px 0 0 !important;
  padding: 12px 16px !important;
}

.v2-content-card .history-card-header:hover {
  background: linear-gradient(135deg, #044a44, #056a61) !important;
}

/* Download section */
.v2-content-card .download-section {
  background: linear-gradient(135deg, #e8f5f3, #d6ecea) !important;
  border-left: 4px solid var(--brand) !important;
  border-radius: 8px !important;
  padding: 16px !important;
}

/* Import/Export section */
.v2-content-card .import-export-section {
  background: var(--surface) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(8,28,31,.07) !important;
  border-top: 3px solid var(--brand) !important;
  padding: 20px !important;
}

.v2-content-card .import-export-section h4 {
  border-bottom: 2px solid var(--brand) !important;
}

/* Action buttons row */
.v2-content-card .action-buttons {
  background: var(--surface) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 6px rgba(8,28,31,.06) !important;
  padding: 12px !important;
  border: 1px solid var(--line);
}

/* Export/action cards */
.v2-content-card .export-card,
.v2-content-card .action-card {
  border-radius: 8px !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 2px 8px rgba(8,28,31,.06) !important;
  overflow: hidden;
}

.v2-content-card .card-header-custom {
  background: linear-gradient(135deg, #056a61, #0b9282) !important;
  color: #fff !important;
  padding: 10px 14px !important;
}

.v2-content-card .card-header-custom .card-heading {
  color: #fff !important;
}

.v2-content-card .card-header-custom .card-description {
  color: rgba(255, 255, 255, 0.78) !important;
}

.v2-content-card .card-header-custom .step-number {
  color: #056a61 !important;
}

/* ── Attendance list.php overrides ────────────────────────────── */

/* Compact form controls */
.v2-content-card .compact-form {
  background: var(--surface) !important;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.v2-content-card .compact-form .form-control,
.v2-content-card .compact-form .form-control-sm {
  border-radius: 6px !important;
  height: 32px !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  border: 1px solid var(--line) !important;
}

.v2-content-card .compact-form .btn {
  font-size: 12px !important;
  padding: 5px 10px !important;
}

/* Attendance analytics cards */
.v2-content-card .card.bg-primary,
.v2-content-card .card.bg-success,
.v2-content-card .card.bg-warning,
.v2-content-card .card.bg-danger,
.v2-content-card .card.bg-info {
  border-radius: 8px !important;
  border: none !important;
}

.v2-content-card .card.bg-primary .card-body,
.v2-content-card .card.bg-success .card-body,
.v2-content-card .card.bg-warning .card-body,
.v2-content-card .card.bg-danger .card-body,
.v2-content-card .card.bg-info .card-body {
  padding: 14px !important;
}

/* View toggle buttons */
.v2-content-card .btn-group-toggle .btn {
  border-radius: 0 !important;
  font-size: 12px !important;
}

.v2-content-card .btn-group-toggle .btn:first-child {
  border-radius: 6px 0 0 6px !important;
}

.v2-content-card .btn-group-toggle .btn:last-child {
  border-radius: 0 6px 6px 0 !important;
}

.v2-content-card .btn-group-toggle .btn.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

/* Outline buttons */
.v2-content-card .btn-outline-primary {
  color: var(--brand) !important;
  border-color: var(--brand) !important;
  background: transparent !important;
}

.v2-content-card .btn-outline-primary:hover,
.v2-content-card .btn-outline-primary.active {
  background: var(--brand) !important;
  color: #fff !important;
}

.v2-content-card .btn-outline-secondary {
  color: var(--muted) !important;
  border-color: var(--line) !important;
  background: transparent !important;
}

.v2-content-card .btn-outline-secondary:hover {
  background: var(--surface-soft) !important;
  color: var(--ink) !important;
}

/* Card header with teal text in v2 card contexts */
.v2-content-card .card-header.bg-info {
  background: linear-gradient(135deg, #056a61, #0b9282) !important;
  border: none !important;
}

/* Daily view date input */
.v2-content-card input[type="date"] {
  border-radius: 6px !important;
  border: 1px solid var(--line) !important;
  padding: 4px 8px !important;
  font-size: 12.5px !important;
}

/* ── Timetabling overrides ────────────────────────────────────── */

/* Stat cards inside timetabling follow the main stat-card style */
.v2-content-card .stats-grid .stat-card {
  border-radius: 8px !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 2px 6px rgba(8,28,31,.06) !important;
}

/* Timetabling tabs */
.v2-content-card .tabs .tab-btn {
  border-radius: 6px 6px 0 0 !important;
  font-size: 12.5px !important;
}

.v2-content-card .tabs .tab-btn.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  color: #fff !important;
}

/* Form cards in timetabling */
.v2-content-card .form-card {
  border-radius: 8px !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 2px 6px rgba(8,28,31,.06) !important;
}

/* Section headers */
.v2-content-card .section-header {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  border-bottom: 2px solid var(--brand) !important;
  padding-bottom: 8px !important;
  margin-bottom: 14px !important;
}

/* Timetable grid cells */
.v2-content-card table th[style*="background"],
.v2-content-card table td[style*="background"] {
  border-radius: 0 !important;
}

/* ── Global inline-style neutralisers ─────────────────────────── */

/* Suppress body background overrides from sub-page <style> blocks */
body.ams-v2 {
  background: radial-gradient(circle at 88% 8%, #dcecf0 0%, #f2f5f7 34%, #ebf1f4 100%) !important;
}

/* Ensure all button gradients match the v2 brand inside the content area */
.v2-content-card .btn-primary,
.v2-content-card .btn-success,
.v2-content-card .btn-info {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border: none !important;
  color: #fff !important;
}

.v2-content-card .btn-primary:hover,
.v2-content-card .btn-success:hover,
.v2-content-card .btn-info:hover {
  filter: brightness(0.93) !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(5,106,97,.25) !important;
}

.v2-content-card .btn-warning {
  background: linear-gradient(135deg, #5A7D7A, #e6a817) !important;
  border: none !important;
  color: #fff !important;
}

/* Table selection form */
.v2-content-card .table-selection-form {
  background: var(--surface) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 6px rgba(8,28,31,.06) !important;
  border: 1px solid var(--line) !important;
  padding: 12px !important;
}

/* Search panel */
.v2-content-card .search_panel {
  background: var(--surface) !important;
  border-radius: 6px !important;
  padding: 8px 12px !important;
}

/* ============================================================
   OLD UI FIDELITY BRIDGE
   Maps v2 shell classes to the older visual language.
   ============================================================ */

body.ams-v2 {
  background: #f1f5f9 !important;
  color: #0f172a;
  font-family: "Poppins-Regular", "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
}

.v2-shell {
  display: flex;
  min-height: 100vh;
}

.v2-sidebar {
  width: 260px !important;
  background: linear-gradient(180deg, #002b27 0%, #003d38 40%, #00332f 100%) !important;
  color: rgba(255, 255, 255, 0.75) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2) !important;
  border-right: 1px solid rgba(255,255,255,0.04) !important;
  padding: 18px 12px 0 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.v2-brand {
  padding: 20px 20px 16px !important;
  margin-bottom: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  gap: 10px !important;
}

.v2-brand-mark {
  width: 38px !important;
  height: 38px !important;
  border-radius: 6px !important;
  background: linear-gradient(135deg, #00897b, #d4580f) !important;
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.45) !important;
}

.v2-brand-name {
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

.v2-brand-sub {
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 10px !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.v2-user {
  border: none !important;
  border-radius: 8px !important;
  margin: 10px 14px 8px !important;
  padding: 12px 14px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.v2-user-name {
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

.v2-user-role {
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 11px !important;
}

.v2-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  padding: 14px 10px !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 0 !important;
}

.v2-nav a {
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: rgba(255, 255, 255, 0.65) !important;
  padding: 9px 14px !important;
  font-size: 13.5px !important;
  font-weight: 400 !important;
  letter-spacing: 0.15px !important;
  position: relative !important;
}

.v2-nav a:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: transparent !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

.v2-nav a.active {
  background: rgba(0, 137, 123, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  font-weight: 500 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.v2-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #4fd1c5;
}

.v2-main {
  margin-left: 260px;
  min-height: 100vh;
}

.v2-topbar {
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  padding: 0 24px !important;
  min-height: 60px;
}

.v2-topbar h1 {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
}

.v2-topbar p {
  font-size: 12px !important;
  color: #94a3b8 !important;
}

.v2-content {
  padding: 24px !important;
}

.v2-content-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.v2-content-card .card,
.v2-content-card .panel,
.v2-content-card .well,
.v2-content-card .box {
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.v2-content-card .card-header,
.v2-content-card .panel-heading {
  background: #fff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 16px 20px !important;
}

.v2-content-card .card-header h3,
.v2-content-card .card-header h4,
.v2-content-card .panel-heading h3,
.v2-content-card .panel-heading h4 {
  color: #0f172a !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

.v2-content-card .card-body,
.v2-content-card .panel-body {
  padding: 20px !important;
}

.v2-content-card .table > thead > tr > th,
.v2-content-card .table thead th,
.table > thead > tr > th {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border-bottom: 2px solid #e2e8f0 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.6px !important;
  padding: 10px 12px !important;
}

.v2-content-card .table > tbody > tr > td,
.v2-content-card .table tbody td {
  font-size: 13.5px !important;
  color: #0f172a !important;
  padding: 10px 12px !important;
  border-top: 1px solid #e2e8f0 !important;
}

.v2-content-card .table-hover > tbody > tr:hover > td,
.v2-content-card .table > tbody > tr:hover > td {
  background: #f8fafc !important;
}

.v2-content-card .btn {
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.v2-content-card .btn-primary,
.v2-content-card .btn-success,
.v2-content-card .btn-info {
  background: #00897b !important;
  border-color: #00897b !important;
  color: #fff !important;
}

.v2-content-card .btn-primary:hover,
.v2-content-card .btn-success:hover,
.v2-content-card .btn-info:hover {
  background: #00695c !important;
  border-color: #00695c !important;
  box-shadow: none !important;
  transform: none !important;
}

.v2-content-card .btn-default,
.v2-content-card .btn-secondary,
.v2-topbar .btn-default {
  background: #fff !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
}

.v2-content-card .btn-default:hover,
.v2-content-card .btn-secondary:hover,
.v2-topbar .btn-default:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.v2-footer {
  background: #fff !important;
  border-top: 1px solid #e2e8f0 !important;
  padding: 14px 24px !important;
  margin: 0 !important;
  font-size: 12px !important;
  color: #94a3b8 !important;
}

@media (min-width: 992px) {
  body.ams-v2.sidebar-collapsed .v2-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    transform: translateX(-260px) !important;
  }

  body.ams-v2.sidebar-collapsed .v2-main {
    margin-left: 0 !important;
  }

  body.ams-v2:not(.sidebar-collapsed) .v2-main {
    margin-left: 260px !important;
  }
}

@media (max-width: 991px) {
  .v2-sidebar {
    left: -270px !important;
    width: 260px !important;
    position: fixed !important;
  }

  body.ams-v2.nav-open .v2-sidebar {
    left: 0 !important;
  }

  .v2-main {
    margin-left: 0 !important;
  }

  .v2-content {
    padding: 16px !important;
  }
}
