/* =========================================================
   DAILY SEVA ATTENDANCE DESK — DESIGN SYSTEM
   Theme: Heritage Cream, Dark Navy, Deep Green, Royal Maroon
   ========================================================= */

/* =========================================================
   LOCAL OFFLINE FONTS (@font-face)
   ========================================================= */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/PlusJakartaSans-SemiBold.ttf') format('truetype');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/PlusJakartaSans-SemiBold.ttf') format('truetype');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/PlusJakartaSans-SemiBold.ttf') format('truetype');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/PlusJakartaSans-Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Inter-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Inter-Medium.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/Inter-SemiBold.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/JetBrainsMono-Medium.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/JetBrainsMono-Medium.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/JetBrainsMono-SemiBold.ttf') format('truetype');
}

:root {
  /* Color Palette */
  --paper: #F6F3EB;
  --paper-2: #ECE7DA;
  --surface: #FFFFFF;
  --surface-alt: #FAF8F2;
  --ink: #182230;
  --ink-2: #242E3E;
  --ink-3: #323E50;
  --maroon: #8C2F39;
  --maroon-dark: #6D222A;
  --maroon-soft: #FDF2F3;
  --marigold: #DF9B28;
  --marigold-dark: #B87C16;
  --marigold-soft: #FFF8EB;
  --teal: #1C634E;
  --teal-dark: #134B3B;
  --teal-soft: #EEF7F3;
  --slate: #2C4B6B;
  --slate-soft: #F0F5FA;
  --danger: #B52D36;
  --danger-soft: #FDECEC;

  /* Neutrals */
  --text: #231E18;
  --text-muted: #675F53;
  --text-light: #8E8474;
  --line: #DFD7C6;
  --line-light: #EFE9DC;
  --white: #FFFFFF;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing Scale (8px system) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(24, 34, 48, 0.04);
  --shadow-sm: 0 2px 6px rgba(24, 34, 48, 0.06);
  --shadow-md: 0 6px 18px rgba(24, 34, 48, 0.08);
  --shadow-lg: 0 16px 36px rgba(24, 34, 48, 0.12);
  --shadow-modal: 0 24px 60px rgba(10, 16, 26, 0.28);
}

/* =========================================================
   Reset & Base Styles
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Hidden elements */
[hidden] {
  display: none !important;
}

/* Barcode catcher - invisible but always focusable */
.barcode-catcher {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 1px;
  width: 1px;
  top: 0;
  left: 0;
}

/* Page wrapper — Wider Layout (max 1760px, min 96vw) */
.wrap {
  width: min(96vw, 1760px);
  max-width: 1760px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

/* =========================================================
   Top Bar / Header
   ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}

.brand,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: var(--maroon);
  line-height: 1;
  user-select: none;
}

.brand h1,
.topbar-brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header Navigation Pills (Desk, Candidates, Reports) */
.header-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.nav-pill svg {
  color: inherit;
  flex-shrink: 0;
}

.nav-pill:hover {
  background: var(--paper-2);
  border-color: var(--text-light);
  color: var(--maroon);
}

.nav-pill.active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(140, 47, 57, 0.25);
}

.nav-pill.active svg {
  color: #FFFFFF;
}

.nav-pill.active:hover {
  background: var(--maroon-dark);
  border-color: var(--maroon-dark);
  color: #FFFFFF;
}

.nav-pill:focus-visible {
  outline: 2px solid var(--maroon);
  outline-offset: 2px;
}

.topbar-clock,
.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
}

.clock {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
  white-space: nowrap;
}

/* Back to Desk button in topbar */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.btn-back:hover {
  background: var(--paper-2);
  border-color: var(--text-light);
  color: var(--maroon);
}

/* Banner error (DB offline) */
.banner {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner-error {
  background: var(--danger-soft);
  border: 1px solid rgba(181, 45, 54, 0.3);
  color: var(--danger);
}

.banner-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.85;
}

/* =========================================================
   Stat Cards Row (Scaled Up)
   ========================================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

/* When 5th card (needs correction) is visible, adapt gracefully */
.stats-row:has(#statNeedsCorrectionCard:not([style*="display: none"])) {
  grid-template-columns: repeat(5, 1fr);
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.stat-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(24, 34, 48, 0.05);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap svg {
  width: 18px;
  height: 18px;
}

.stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.3px;
  transition: transform 0.25s ease;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card color variants */
.stat-card.stat-navy {
  border-top-color: var(--ink);
}

.stat-card.stat-teal {
  border-top-color: var(--teal);
}
.stat-card.stat-teal .stat-icon-wrap {
  background: var(--teal-soft);
  color: var(--teal);
}
.stat-card.stat-teal .stat-num {
  color: var(--teal);
}

.stat-card.stat-marigold {
  border-top-color: var(--marigold);
}
.stat-card.stat-marigold .stat-icon-wrap {
  background: var(--marigold-soft);
  color: var(--marigold-dark);
}
.stat-card.stat-marigold .stat-num {
  color: var(--marigold-dark);
}

.stat-card.stat-maroon {
  border-top-color: var(--maroon);
}
.stat-card.stat-maroon .stat-icon-wrap {
  background: var(--maroon-soft);
  color: var(--maroon);
}
.stat-card.stat-maroon .stat-num {
  color: var(--maroon);
}

.stat-card.stat-danger {
  border-top-color: var(--danger);
  background: #FFFDFC;
}
.stat-card.stat-danger .stat-icon-wrap {
  background: var(--danger-soft);
  color: var(--danger);
}
.stat-card.stat-danger .stat-num {
  color: var(--danger);
}

.stat-card.pulse .stat-num {
  transform: scale(1.15);
}

/* =========================================================
   Main Grid Layout (Scan Zone ~30% + Present List ~70%)
   ========================================================= */
.main-grid {
  display: grid;
  grid-template-columns: minmax(320px, 30%) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* =========================================================
   Scan Zone Panel (Sticky on large screens)
   ========================================================= */
.scan-panel {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  color: var(--paper);
  position: sticky;
  top: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.scan-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.scan-panel-head h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  color: var(--white);
}

.scan-status {
  font-size: 11.5px;
  color: #B9C2CE;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scan-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--marigold);
  display: inline-block;
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.scanner-stage {
  position: relative;
  background: var(--ink-2);
  border: 1px solid #37414F;
  border-radius: 10px;
  height: 250px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--marigold), transparent);
  top: 0;
  animation: sweep 2.6s ease-in-out infinite;
  box-shadow: 0 0 10px 1px rgba(226, 163, 61, 0.7);
}

@keyframes sweep {
  0% { top: 6%; opacity: 0.9; }
  50% { top: 92%; opacity: 0.5; }
  100% { top: 6%; opacity: 0.9; }
}

.scan-idle {
  color: #8C99A8;
}

.scan-idle svg {
  color: #556272;
  margin-bottom: 8px;
}

.scan-idle p {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.scan-result {
  padding: 0 16px;
  animation: pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.result-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--teal);
  color: var(--white);
  margin-bottom: 8px;
}

.result-badge.out {
  background: var(--marigold);
  color: var(--ink);
}

.result-badge.cooldown {
  background: #D97706;
  color: #FFFFFF;
}

.result-badge.repeat {
  background: #505D6E;
}

.result-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
  line-height: 1.2;
}

.result-meta {
  font-size: 12.5px;
  color: #B5BFCC;
  margin-bottom: 8px;
}

.dotsep {
  margin: 0 6px;
  opacity: 0.5;
}

.result-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--marigold);
  margin-bottom: 12px;
  font-weight: 500;
}

.btn-revoke {
  background: none;
  border: 1px solid #505D6E;
  color: #D2D8E1;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-revoke:hover {
  border-color: #E26D75;
  color: #FFAEB2;
  background: rgba(181, 45, 54, 0.15);
}

.scan-error {
  color: #F8B4B8;
  padding: 10px;
}

.error-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(181, 45, 54, 0.2);
  border: 1px solid var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #FFAEB2;
}

.scan-error p {
  margin: 0;
  font-size: 13px;
}

.scanner-stage.flash-success {
  box-shadow: inset 0 0 0 2px var(--teal);
}

.scanner-stage.flash-error {
  animation: shake 0.35s ease;
  box-shadow: inset 0 0 0 2px var(--danger);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.manual-toggle {
  text-align: center;
  margin-top: 14px;
}

.manual-toggle button {
  background: none;
  border: none;
  color: #A3AFBD;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}

.manual-toggle button:hover {
  color: var(--marigold);
}

.manual-entry {
  margin-top: 12px;
}

.manual-entry label {
  display: block;
  font-size: 11px;
  color: #A3AFBD;
  margin-bottom: 6px;
  font-weight: 500;
}

.manual-row {
  display: flex;
  gap: 8px;
}

.manual-prefix {
  font-family: var(--font-mono);
  background: var(--ink-2);
  border: 1px solid #3B4656;
  color: #8C99A8;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  white-space: nowrap;
}

.manual-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 1px;
  background: var(--ink-2);
  border: 1px solid #3B4656;
  color: var(--white);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}

.manual-row input:focus {
  outline: none;
  border-color: var(--marigold);
  box-shadow: 0 0 0 2px rgba(223, 155, 40, 0.25);
}

.btn-submit {
  background: var(--marigold);
  color: var(--ink);
  border: none;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.btn-submit:hover {
  background: var(--marigold-dark);
  color: #FFF;
}

/* =========================================================
   List Panel & Table Containers
   ========================================================= */
.list-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-light);
  min-width: 0;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.list-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.2px;
}

#searchBox,
#tableSearch {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  width: 340px;
  max-width: 100%;
  min-height: 42px;
  background: var(--surface-alt);
  transition: all 0.15s ease;
}

#searchBox:focus,
#tableSearch:focus {
  outline: none;
  border-color: var(--marigold-dark);
  background: #FFF;
  box-shadow: 0 0 0 3px rgba(223, 155, 40, 0.15);
}

/* Responsive Table Scroll Container */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .table-scroll {
    overflow-x: hidden;
  }
}

/* =========================================================
   Table Layout & Column Width Alignment
   ========================================================= */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  text-align: left;
}

/* =========================================================
   Unified Data Table Architecture (.data-table)
   ========================================================= */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13.5px;
}

table.data-table th,
table.data-table td {
  border-bottom: 1px solid var(--line-light);
  vertical-align: middle;
}

table.data-table thead th {
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper-2);
  padding: 10px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-family: var(--font-body);
}

table.data-table tbody td {
  padding: 10px 10px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.35;
}

table.data-table tbody tr {
  transition: background 0.12s ease;
}

table.data-table tbody tr:hover {
  background: #F8F5EC;
}

table.data-table tbody tr.row-wrong-name {
  background: #FFF5F5 !important;
}

table.data-table tbody tr.row-wrong-name:hover {
  background: #FEECEC !important;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Alignment classes (Strictly percentage-based driven by <colgroup>) */
.th-num, .td-num {
  text-align: center !important;
}

.th-sev, .td-sev {
  text-align: left;
  white-space: nowrap;
}

.th-name, .td-name {
  text-align: left;
  word-break: break-word;
}

.th-seva, .td-seva {
  text-align: left;
}

.td-seva {
  line-height: 1.35;
}

.cell-seva-wrap {
  display: block;
  width: 100%;
  min-width: 0;
}

.cell-seva-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.35;
}

.th-time, .td-time {
  text-align: center !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.th-status, .td-status {
  text-align: center !important;
}

.th-actions, .td-actions {
  text-align: center !important;
  white-space: nowrap;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

tbody tr.row-new {
  animation: highlightRow 1.8s ease;
}

@keyframes highlightRow {
  from { background: #FEF3D6; }
  to { background: transparent; }
}

.empty-row td {
  text-align: center !important;
  color: var(--text-muted);
  padding: 48px 16px;
  font-style: italic;
  font-size: 14.5px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* Name cell wrap with inline badges */
.name-cell-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  justify-content: center;
}

.cell-name {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  font-size: 15px;
}

.cell-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* =========================================================
   Status Pills & Badges
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  letter-spacing: 0.2px;
  height: 24px;
}

.badge-in {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(28, 99, 78, 0.25);
}

.badge-out {
  background: var(--marigold-soft);
  color: var(--marigold-dark);
  border: 1px solid rgba(184, 124, 22, 0.3);
}

.badge-wrong-name {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(181, 45, 54, 0.35);
  font-size: 11px;
}

.badge-corrected {
  background: #EDF7F3;
  color: var(--teal);
  border: 1px solid rgba(28, 99, 78, 0.35);
  font-size: 11px;
}

.badge-absent {
  background: #FEECEC;
  color: var(--maroon);
  border: 1px solid rgba(140, 47, 57, 0.3);
}

/* =========================================================
   Actions Column Buttons (Mark Wrong & Revoke)
   ========================================================= */
.cell-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-mark-wrong-row,
.btn-revoke-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  line-height: 1;
  flex-shrink: 0;
}

/* Outlined Amber Button for Mark Wrong */
.btn-mark-wrong-row {
  background: #FFFBF0;
  color: #946006;
  border: 1px solid #E6B55E;
}

.btn-mark-wrong-row:hover {
  background: #DF9B28;
  border-color: #DF9B28;
  color: #FFFFFF;
}

/* Outlined Red Button for Revoke */
.btn-revoke-row {
  background: #FFF5F5;
  color: var(--danger);
  border: 1px solid #F0B8BC;
}

.btn-revoke-row:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

.btn-revoke-row:disabled,
.btn-mark-wrong-row:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* =========================================================
   Candidates Directory & Frequency Tracking Styles
   ========================================================= */
.btn-action-view,
.btn-action-edit,
.btn-action-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-action-view {
  background: #EDF7F3;
  color: var(--teal);
  border: 1px solid rgba(28, 99, 78, 0.35);
}
.btn-action-view:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #FFFFFF;
}

.btn-action-edit {
  background: #FFFBF0;
  color: #946006;
  border: 1px solid #E6B55E;
}
.btn-action-edit:hover {
  background: #DF9B28;
  border-color: #DF9B28;
  color: #FFFFFF;
}

.btn-action-delete {
  background: #FFF5F5;
  color: var(--danger);
  border: 1px solid #F0B8BC;
}
.btn-action-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

/* Frequency Toggle Switch */
.toggle-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #CBD5E1;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.toggle-switch input:checked + .toggle-slider {
  background-color: var(--teal);
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(28, 99, 78, 0.25);
}

/* Frequency Radios Grid */
.frequency-radios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
  transition: opacity 0.2s ease;
}
@media (max-width: 640px) {
  .frequency-radios-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.frequency-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.15s ease;
  user-select: none;
}
.frequency-radio-label:hover {
  background: var(--paper-2);
  border-color: var(--teal);
}
.frequency-radio-label.active {
  background: #EDF7F3;
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--teal);
}
.frequency-radio-label input[type="radio"] {
  accent-color: var(--teal);
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.frequency-radios-grid.disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(80%);
}

/* Detail Grid in View Modal */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.detail-item {
  background: var(--surface-alt);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.detail-val {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

/* Percentage & Progress Bar */
.freq-percentage-card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 14px;
}
.freq-percentage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.freq-percentage-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.freq-percentage-num.high { color: var(--teal); }
.freq-percentage-num.mid { color: var(--marigold-dark); }
.freq-percentage-num.low { color: var(--danger); }

.freq-progress-wrap {
  height: 8px;
  background: var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 8px;
}
.freq-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.freq-progress-fill.high { background: var(--teal); }
.freq-progress-fill.mid { background: var(--marigold); }
.freq-progress-fill.low { background: var(--danger); }

/* =========================================================
   Reports Access Banner & Footer
   ========================================================= */
.reports-nav-bar {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.reports-nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reports-nav-text strong {
  font-size: 14.5px;
  color: var(--ink);
  font-family: var(--font-display);
}

.reports-nav-text span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.btn-reports {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  min-height: 42px;
  background: var(--maroon);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-reports:hover {
  background: var(--maroon-dark);
}

.foot {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line-light);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* =========================================================
   Reports & Analytics Page Styles
   ========================================================= */
.filter-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.quick-month-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-light);
}

.month-pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.month-pill {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.month-pill:hover {
  background: var(--paper-2);
  border-color: var(--text-muted);
}

.month-pill.active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #FFF;
}

/* Day Picker Bar (All Candidates View) */
.day-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-light);
  flex-wrap: wrap;
}

.day-picker-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.day-picker-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.day-nav-btn {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 10px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.day-nav-btn:hover:not(:disabled) {
  background: var(--paper-2);
  border-color: var(--text-light);
  color: var(--ink);
}

.day-nav-btn:disabled,
.day-nav-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.day-view-link {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 6px;
  white-space: nowrap;
}

.day-view-link:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.day-today-btn {
  background: var(--teal-soft);
  border: 1px solid rgba(28, 99, 78, 0.3);
  color: var(--teal);
  padding: 4px 12px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.day-today-btn:hover {
  background: var(--teal);
  color: #FFF;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr auto;
  gap: 16px;
  align-items: end;
  margin-top: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font-body);
  background: var(--surface-alt);
  color: var(--text);
  width: 100%;
  min-height: 40px;
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--marigold-dark);
  background: #FFF;
  box-shadow: 0 0 0 3px rgba(223, 155, 40, 0.15);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  min-height: 40px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  border: 1px solid var(--teal-dark);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--paper-2);
  border-color: var(--text-light);
}

/* Candidate Search Dropdown in Reports */
.candidate-search-results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  margin-top: 4px;
}

.candidate-search-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-light);
  transition: background 0.12s;
}

.candidate-search-item:last-child {
  border-bottom: none;
}

.candidate-search-item:hover {
  background: var(--paper);
}

.cs-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
}

.cs-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =========================================================
   Charts Section (Equal Visual Weight Side-by-Side)
   ========================================================= */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-card-head h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.chart-card-head span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-empty {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
}

/* =========================================================
   Single Candidate Calendar Section
   ========================================================= */
.candidate-profile-banner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}

.cp-left h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 4px 0 8px;
  color: var(--ink);
}

.cp-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-badge {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
}

.calendar-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-header h4 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0;
  color: var(--ink);
}

.calendar-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.present { background: var(--teal); }
.legend-dot.absent { background: var(--maroon); }
.legend-dot.future { background: var(--line); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 0;
}

.cal-day {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 12px;
  background: var(--surface);
}

.cal-day.empty {
  border-color: transparent;
  background: transparent;
}

.cal-day.present {
  background: var(--teal-soft);
  border-color: rgba(28, 99, 78, 0.3);
}
.cal-day.present .cal-day-num {
  font-weight: 700;
  color: var(--teal);
}

.cal-day.absent {
  background: var(--danger-soft);
  border-color: rgba(181, 45, 54, 0.25);
}
.cal-day.absent .cal-day-num {
  font-weight: 700;
  color: var(--maroon);
}

.cal-day.future {
  opacity: 0.6;
}

.cal-day-status {
  align-self: flex-end;
  font-weight: 700;
  font-size: 13px;
}

.cal-day-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* =========================================================
   Day-Wise Grouped Ledger View (All Candidates)
   ========================================================= */
.day-group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease;
}

.day-group-card:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.07);
}

.day-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-light);
  cursor: pointer;
  user-select: none;
  gap: 12px;
  flex-wrap: wrap;
}

.day-group-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.day-group-date {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.day-group-badges {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.day-group-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-group-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.day-group-toggle-btn:hover {
  background: var(--surface-alt);
  color: var(--ink);
  border-color: var(--text-muted);
}

.day-group-body {
  transition: all 0.2s ease;
}

.day-group-body.collapsed {
  display: none;
}

/* =========================================================
   Month-Wise Block View (Single Candidate)
   ========================================================= */
.month-group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.month-group-head {
  padding: 14px 20px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.month-group-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.month-group-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.month-group-content {
  padding: 18px 20px;
}

.candidate-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.cp-metric-card {
  background: var(--surface-alt);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
}

.cp-metric-val {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

.cp-metric-lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* =========================================================
   Pagination & Table Meta Bar
   ========================================================= */
.table-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-light);
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--paper-2);
  border-color: var(--text-light);
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* =========================================================
   Modal Dialog & Correction Form
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 34, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--surface);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-original-card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.modal-original-card .label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.orig-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 2px 0 4px;
}

.orig-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.form-row {
  display: grid;
  gap: 12px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface);
}

/* =========================================================
   Toast Notification System
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: #FFF;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-success {
  background: #17523F;
  border: 1px solid #207358;
}

.toast-error {
  background: #8C2229;
  border: 1px solid #B0333A;
}

.toast-info {
  background: #1B3552;
  border: 1px solid #2B527E;
}

/* =========================================================
   RESPONSIVE DESIGN BREAKPOINTS
   (1440, 1280, 1024, 768, 640, 425, 375 px)
   ========================================================= */

/* =========================================================
   RESPONSIVE DESIGN BREAKPOINTS
   (1440, 1280, 1024, 768, 640, 425, 375 px)
   ========================================================= */

/* Medium Desktops & Laptops (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
  .wrap {
    padding: 24px 20px 56px;
  }

  .main-grid {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
  }

  .list-panel {
    padding: 18px 16px;
  }
}

/* Standard Desktops (1400px - 1599px) */
@media (min-width: 1400px) and (max-width: 1599px) {
  .main-grid {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 20px;
  }

  .list-panel {
    padding: 20px 18px;
  }
}

/* =========================================================
   Stacked Card Layout for Tablets & Phones (< 1024px)
   Eliminates all horizontal table scrolling
   ========================================================= */
@media (max-width: 1023px) {
  .table-scroll {
    overflow-x: visible !important;
    border: none !important;
    background: transparent !important;
    max-height: none !important;
  }

  table.data-table {
    display: block !important;
    width: 100% !important;
  }

  table.data-table colgroup,
  table.data-table thead {
    display: none !important;
  }

  table.data-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  table.data-table tbody tr {
    display: flex !important;
    flex-direction: column !important;
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    padding: 12px 14px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    gap: 7px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  table.data-table tbody tr:hover {
    background: var(--surface) !important;
  }

  table.data-table tbody tr.row-wrong-name {
    background: #FFF8F8 !important;
    border-color: rgba(181, 45, 54, 0.3) !important;
  }

  table.data-table tbody td {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 3px 0 !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
    text-align: right !important;
  }

  table.data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    text-align: left;
    margin-right: 12px;
    flex-shrink: 0;
  }

  table.data-table tbody td.td-num {
    display: none !important;
  }

  table.data-table tbody td.td-name {
    justify-content: space-between !important;
  }

  table.data-table tbody td.td-name .name-cell-wrap {
    align-items: flex-end;
  }

  table.data-table tbody td.td-actions {
    justify-content: flex-end !important;
    margin-top: 6px;
    padding-top: 8px !important;
    border-top: 1px dashed var(--line-light) !important;
  }

  table.data-table tbody td.td-actions .cell-actions {
    width: 100%;
    justify-content: flex-end;
  }

  table.data-table tbody tr.empty-row td {
    display: block !important;
    text-align: center !important;
    padding: 24px 12px !important;
  }
  table.data-table tbody tr.empty-row td::before {
    display: none !important;
  }
}

/* Responsive Header Navigation (Tablet: < 1100px) */
@media (max-width: 1099px) {
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 14px;
    gap: 14px;
  }

  .brand,
  .topbar-brand {
    order: 1;
    flex: 1 1 auto;
  }

  .topbar-clock,
  .topbar-right {
    order: 2;
    margin-left: auto;
    flex-shrink: 0;
  }

  .header-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
    gap: 8px;
    padding-top: 2px;
  }
}

/* Large Tablets / Small Laptops (<= 1024px) */
@media (max-width: 1024px) {
  .wrap {
    padding: 20px 20px 48px;
  }

  .main-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .scan-panel {
    position: static;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filter-group[style*="span 2"] {
    grid-column: span 2;
  }

  .filter-actions {
    grid-column: span 2;
  }
}

/* Tablets Portrait (<= 768px) */
@media (max-width: 768px) {
  .clock {
    font-size: 19px;
  }

  .reports-nav-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .btn-reports {
    justify-content: center;
  }

  .calendar-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .filter-group[style*="span 2"] {
    grid-column: span 1;
  }

  .filter-actions {
    grid-column: span 1;
  }
}

/* Mobile Screens (<= 640px) */
@media (max-width: 640px) {
  .wrap {
    padding: 14px 14px 40px;
  }

  .topbar {
    padding-bottom: 16px;
    margin-bottom: 20px;
    row-gap: 12px;
    gap: 10px;
  }

  .brand,
  .topbar-brand {
    order: 1;
    gap: 8px;
    min-width: 0;
    flex: 0 1 auto;
    max-width: calc(100% - 150px);
  }

  .brand > div,
  .topbar-brand > div {
    min-width: 0;
  }

  .brand-mark {
    font-size: 24px;
    flex-shrink: 0;
  }

  .brand h1,
  .topbar-brand h1 {
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: -0.2px;
  }

  .subtitle {
    font-size: 10.5px;
    line-height: 1.2;
  }

  .topbar-clock,
  .topbar-right {
    order: 2;
    margin-left: auto;
  }

  .topbar-clock .clock,
  .topbar-right .clock {
    font-size: 17px;
  }

  .topbar-clock .date,
  .topbar-right .date {
    font-size: 10.5px;
  }

  .header-nav {
    order: 3;
    display: flex;
    width: 100%;
    gap: 6px;
    margin-left: 0;
    margin-right: 0;
  }

  .header-nav .nav-pill {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    padding: 0 4px;
    font-size: 12.5px;
    gap: 5px;
    justify-content: center;
  }

  .header-nav .nav-pill svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  .stats-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .stat-card {
    min-height: auto;
    padding: 14px;
  }

  .list-head {
    flex-direction: column;
    align-items: stretch;
  }

  #searchBox, #tableSearch {
    width: 100%;
    min-height: 44px;
  }

  /* Touch targets minimum 44px on mobile */
  .btn-submit,
  .btn-reports,
  .btn-back,
  .btn-primary,
  .btn-secondary,
  .page-btn,
  .month-pill {
    min-height: 44px;
  }

  .btn-mark-wrong-row,
  .btn-revoke-row {
    min-height: 34px;
    padding: 0 12px;
  }

  /* Modal Mobile Bottom-Sheet Behavior */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-dialog {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-body {
    padding: 16px 18px;
    max-height: calc(92vh - 130px);
  }

  .modal-footer {
    padding: 14px 18px;
    background: var(--surface);
    position: sticky;
    bottom: 0;
  }

  .modal-footer button {
    flex: 1;
    min-height: 44px;
  }

  .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Toasts pinned across bottom on mobile */
  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 16px;
  }

  .toast {
    max-width: 100%;
    width: 100%;
  }
}

/* Very Small Mobile Screens (<= 375px) */
@media (max-width: 375px) {
  .clock,
  .topbar-clock .clock,
  .topbar-right .clock {
    font-size: 14px;
  }

  .date,
  .topbar-clock .date,
  .topbar-right .date {
    font-size: 9.5px;
  }

  .brand h1,
  .topbar-brand h1 {
    font-size: 13.5px;
  }

  .brand-mark {
    font-size: 20px;
  }

  .stat-num {
    font-size: 24px;
  }

  .header-nav .nav-pill {
    font-size: 11px;
    gap: 3px;
    padding: 0 2px;
  }
}

/* =========================================================
   Accessibility & Reduced Motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 2px;
}

/* =========================================================
   Shibirarthi Match Report Styles
   ========================================================= */
.match-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .match-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .match-summary-grid {
    grid-template-columns: 1fr;
  }
}

.cache-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.cache-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cache-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  display: inline-block;
}

.cache-pulse-dot.stale {
  background: var(--marigold);
}

.match-filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.match-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.match-tab-btn:hover {
  border-color: var(--maroon);
  color: var(--maroon);
}

.match-tab-btn.active {
  background: var(--maroon);
  color: #fff;
  border-color: var(--maroon);
}

.match-tab-count {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
}

.match-tab-btn.active .match-tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Match Status Badges */
.badge-match-exact {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(28, 99, 78, 0.28);
}

.badge-match-flexible {
  background: #E0F2FE;
  color: #0369A1;
  border: 1px solid rgba(3, 105, 161, 0.28);
}

.badge-match-possible {
  background: var(--marigold-soft);
  color: var(--marigold-dark);
  border: 1px solid rgba(184, 124, 22, 0.32);
}

.badge-match-none {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.badge-match-multiple {
  background: #FEECEC;
  color: var(--maroon);
  border: 1px solid rgba(140, 47, 57, 0.35);
}

.badge-source-dup {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 600;
  background: #F3E8FF;
  color: #7E22CE;
  border: 1px solid rgba(126, 34, 206, 0.25);
  margin-top: 3px;
}

.subtext-muted {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =========================================================
   GROUP TABS & COMPLIANCE UI (Frequent & Non-Frequent)
   ========================================================= */
.segmented-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--paper-2);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  gap: 4px;
}

.segmented-tabs .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.segmented-tabs .tab-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}

.segmented-tabs .tab-btn.active {
  background: var(--surface);
  color: var(--maroon);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.segmented-tabs .tab-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--text-muted);
  font-weight: 700;
  border: 1px solid var(--line);
}

.segmented-tabs .tab-btn.active .tab-badge {
  background: var(--maroon-soft);
  color: var(--maroon);
  border-color: rgba(140, 47, 57, 0.2);
}

/* Compliance Badges */
.badge-met {
  background: #E8F5E9 !important;
  color: #2E7D32 !important;
  border: 1px solid #C8E6C9 !important;
}

.badge-ontrack {
  background: #E0F2FE !important;
  color: #0369A1 !important;
  border: 1px solid #BAE6FD !important;
}

.badge-low {
  background: #FFFBEB !important;
  color: #B45309 !important;
  border: 1px solid #FDE68A !important;
}

.badge-poor {
  background: #FEF2F2 !important;
  color: #B91C1C !important;
  border: 1px solid #FECACA !important;
}

.badge-unset {
  background: #F3F4F6 !important;
  color: #6B7280 !important;
  border: 1px solid #E5E7EB !important;
}

/* Progress bar inside table cell */
.compliance-cell-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.compliance-progress-bar {
  height: 6px;
  width: 100%;
  background: var(--paper-2);
  border-radius: 3px;
  overflow: hidden;
}

.compliance-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.compliance-progress-fill.met { background: #2E7D32; }
.compliance-progress-fill.ontrack { background: #0369A1; }
.compliance-progress-fill.low { background: #D97706; }
.compliance-progress-fill.poor { background: #DC2626; }
.compliance-progress-fill.unset { background: #9CA3AF; }

/* Expandable row styling */
.btn-row-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.btn-row-expand:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.btn-row-expand.open {
  transform: rotate(90deg);
  background: var(--maroon-soft);
  color: var(--maroon);
  border-color: var(--maroon);
}

.expanded-detail-row {
  background: #FAFAFA !important;
}

.expanded-detail-row td {
  padding: 14px 18px !important;
  border-bottom: 2px solid var(--line) !important;
}

.nested-breakdown-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.nested-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}

.nested-breakdown-table th {
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  padding: 6px 8px;
  border: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.nested-breakdown-table td {
  padding: 6px 8px !important;
  border: 1px solid var(--line) !important;
  background: var(--surface);
}

/* Attended dates tag list */
.attended-dates-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.attended-date-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
}

/* =========================================================
   Print Stylesheet
   ========================================================= */
@media print {
  body {
    background: #FFF !important;
    color: #000 !important;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif !important;
  }

  .topbar-right,
  .topbar-clock,
  .header-nav,
  .filter-card,
  .reports-nav-bar,
  .cache-banner,
  .match-filter-tabs,
  .match-toolbar-actions,
  .btn-back,
  .btn-reports,
  .foot,
  .pagination-controls,
  .table-meta-bar,
  .cell-actions,
  .th-actions,
  .td-actions,
  #barcodeCatcher,
  #searchBox,
  #tableSearch,
  #matchSearchBox,
  .modal-overlay,
  .toast-container,
  .charts-grid {
    display: none !important;
  }

  .wrap {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .stat-card,
  .calendar-card,
  .list-panel {
    box-shadow: none !important;
    border: 1px solid #AAA !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  table {
    border-collapse: collapse !important;
    font-size: 11px !important;
  }

  th, td {
    border: 1px solid #CCC !important;
    padding: 6px 8px !important;
  }
}
