/* ==========================================================================
   HR Attendance System — Modern Enterprise UI Design
   Light / Dark theme, RTL + LTR first-class support
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;

  /* Modern Corporate Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --navy: #1e40af;
  --navy-dark: #1e3a8a;
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --link: #2563eb;

  /* Backgrounds & Surfaces */
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --card: #ffffff;
  --card-2: #f8fafc;
  --table-head: #f8fafc;
  --row-hover: #f1f5f9;

  /* Typography Colors */
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --input-border: #cbd5e1;

  /* Status Colors */
  --green: #059669;
  --green-bg: #ecfdf5;
  --green-line: #a7f3d0;
  
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-line: #fecaca;
  
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --amber-line: #fde68a;
  
  --blue-bg: #eff6ff;
  --blue-line: #bfdbfe;
  
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --purple-line: #ddd6fe;

  --cyan: #0891b2;
  --cyan-bg: #ecfeff;
  --cyan-line: #a5f3fc;

  /* Topbar & Shell */
  --topbar-a: #0f172a;
  --topbar-b: #1e293b;
  --topbar-fg: #f8fafc;
  --topbar-border: rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --code-bg: #0f172a;
  --code-fg: #f8fafc;
  --focus: rgba(37, 99, 235, 0.22);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e293b;
  --primary-border: #1e3a8a;

  --navy: #3b82f6;
  --navy-dark: #2563eb;
  --teal: #14b8a6;
  --teal-dark: #0d9488;
  --link: #60a5fa;

  --bg: #0b1120;
  --bg-soft: #162032;
  --card: #111c2e;
  --card-2: #16233b;
  --table-head: #16233b;
  --row-hover: #192742;

  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --line: #1e293b;
  --input-border: #334155;

  --green: #34d399;
  --green-bg: #064e3b;
  --green-line: #047857;

  --red: #f87171;
  --red-bg: #450a0a;
  --red-line: #991b1b;

  --amber: #fbbf24;
  --amber-bg: #451a03;
  --amber-line: #92400e;

  --blue-bg: #1e293b;
  --blue-line: #1e3a8a;

  --purple: #a78bfa;
  --purple-bg: #2e1065;
  --purple-line: #5b21b6;

  --cyan: #38bdf8;
  --cyan-bg: #083344;
  --cyan-line: #0e7490;

  --topbar-a: #070d18;
  --topbar-b: #0f172a;
  --topbar-fg: #f1f5f9;
  --topbar-border: rgba(255, 255, 255, 0.08);

  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5);
  --code-bg: #030712;
  --code-fg: #f8fafc;
  --focus: rgba(96, 165, 250, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Cairo", "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .15s ease, color .15s ease;
}

a { color: var(--link); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-hover); text-decoration: none; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  background: linear-gradient(135deg, var(--topbar-a) 0%, var(--topbar-b) 100%);
  color: var(--topbar-fg);
  padding: 0 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--topbar-border);
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.brand {
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.brand-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.4);
  border: 1px solid rgba(147, 197, 253, 0.3);
  color: #93c5fd;
  text-transform: uppercase;
}
.brand:hover { text-decoration: none; color: #fff; }

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-inline-start: auto;
  align-items: center;
}
.nav a, .nav button {
  color: #cbd5e1;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav a:hover, .nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}
.nav a[aria-current="page"] {
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  font-weight: 700;
  border: 1px solid rgba(147, 197, 253, 0.25);
}
.nav-badge-pill {
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: 12px;
  padding-inline-start: 12px;
  border-inline-start: 1px solid rgba(255, 255, 255, 0.12);
}

.lang-switch {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}
.lang-switch button {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 0;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.lang-switch button.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 700;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
  transition: all .15s ease;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-signout {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 12px !important;
  font-size: 12.5px !important;
  cursor: pointer;
}
.btn-signout:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #ffffff !important;
}

/* ---------------------------------------------------------------- page */
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-head .sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
  font-weight: 500;
}

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

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--primary-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); }

.btn.secondary {
  background: var(--card);
  color: var(--text-2);
  border-color: var(--line);
}
.btn.secondary:hover {
  background: var(--bg-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn.teal {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
}
.btn.teal:hover {
  filter: brightness(1.08);
}

.btn.success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
}
.btn.success:hover { filter: brightness(1.08); }

.btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}
.btn.danger:hover { filter: brightness(1.08); }

.btn.small {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---------------------------------------------------------------- KPI cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}
.card .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card .value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.card .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.card.accent {
  border-inline-start: 4px solid var(--teal);
}

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 20px;
  margin-bottom: 22px;
}
@media (max-width: 1024px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.chart-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}
.chart-card .sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 16px;
}
.chart-container {
  position: relative;
  width: 100%;
  height: 270px;
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: 13.5px;
}
table.data th, table.data td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}
table.data th {
  background: var(--table-head);
  color: var(--text-2);
  font-weight: 700;
  font-size: 13px;
  position: sticky;
  top: 0;
  letter-spacing: -0.01em;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color .12s ease; }
table.data tbody tr:hover { background: var(--row-hover); }
table.data td.name { text-align: start; font-weight: 600; color: var(--text); }
table.data td.wrap { white-space: normal; text-align: start; min-width: 220px; }
table.data .num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-2);
  border: 1px solid transparent;
}
.badge.present { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.badge.absent { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.badge.off { background: var(--blue-bg); color: var(--navy); border-color: var(--blue-line); }
.badge.leave { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.badge.holiday { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-line); }
.badge.new { background: var(--cyan-bg); color: var(--cyan); border-color: var(--cyan-line); }
.badge.manual { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.badge.flag { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.badge.pending { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.badge.approved { background: #dcfce7; color: #15803d; border-color: #86efac; }
.badge.rejected { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ---------------------------------------------------------------- forms */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 700; }

.input, input[type="text"], input[type="search"], input[type="month"], input[type="date"],
input[type="datetime-local"], input[type="number"], input[type="time"], input[type="password"],
select, textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  min-height: 40px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus);
}
select.input { min-width: 140px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 20px;
}
.form-grid .wide { grid-column: 1 / -1; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 700; font-size: 13.5px; }
.form-row .help { font-size: 12px; color: var(--muted); }
.form-row .errorlist { color: var(--red); margin: 0; padding-inline-start: 18px; font-size: 12.5px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.checkbox-grid label:hover {
  border-color: var(--primary-border);
  background: var(--bg-soft);
}

/* ---------------------------------------------------------------- messages */
.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.message.success { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.message.error { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.message.info { background: var(--blue-bg); border-color: var(--blue-line); color: var(--navy); }
.message.warning { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination .current { font-size: 13px; color: var(--muted); padding: 0 8px; font-weight: 600; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 20px;
  font-size: 14.5px;
  font-weight: 500;
}

.month-nav { display: flex; gap: 6px; align-items: center; }
.month-nav .month-title { font-weight: 700; font-size: 16px; min-width: 120px; text-align: center; }

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.stat-row:last-child { border-bottom: 0; }

pre.code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 14px;
  border-radius: var(--radius-md);
  overflow: auto;
  direction: ltr;
  text-align: left;
}
code.inline, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  direction: ltr;
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .9em;
}

/* ---------------------------------------------------------------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.08), transparent 70%); }
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-xl);
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; text-align: center; color: var(--text); }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.login-card .form-row { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.login-tools { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.login-tools .lang-switch { border-color: var(--line); background: transparent; }
.login-tools .lang-switch button { color: var(--text-2); }
.login-tools .lang-switch button.active { background: var(--bg-soft); color: var(--text); }
.login-tools .theme-toggle { border-color: var(--line); color: var(--text-2); background: transparent; }
.login-tools .theme-toggle:hover { background: var(--bg-soft); }

.audit-changes { direction: ltr; text-align: left; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
.setting-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: all .18s ease;
}
.setting-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.setting-card .icon { font-size: 26px; }
.setting-card h3 { margin: 10px 0 4px; font-size: 16.5px; font-weight: 700; color: var(--text); }
.setting-card p { margin: 0; color: var(--muted); font-size: 13px; }
.setting-card .count { margin-top: 12px; font-size: 13px; color: var(--link); font-weight: 700; }

.inline-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.inline-form { display: inline; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

/* ---------------------------------------------------------------- portal */
.portal-card {
  max-width: 500px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.punch-btn {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius-md);
  margin-top: 14px;
}

/* ---------------------------------------------------------------- manual */
.manual-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 980px) {
  .manual-layout { grid-template-columns: 1fr; }
  .manual-toc { position: static; max-height: none; }
}
.manual-toc {
  position: sticky;
  top: 80px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 100px);
  overflow: auto;
}
.manual-toc h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.manual-toc ol { margin: 0; padding-inline-start: 20px; }
.manual-toc li { margin: 6px 0; font-size: 13.5px; }
.manual-toc a { color: var(--text-2); font-weight: 500; }
.manual-toc a:hover { color: var(--link); }

.manual-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 80px;
}
.manual-section h2 { margin: 0 0 12px; font-size: 20px; font-weight: 800; }
.manual-section h3 { margin: 20px 0 10px; font-size: 16px; font-weight: 700; }
.manual-section p { margin: 8px 0; }
.manual-section ul, .manual-section ol { margin: 8px 0; padding-inline-start: 24px; }
.manual-section li { margin: 6px 0; }
.manual-section .note, .manual-section .warn {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 13.5px;
  border: 1px solid var(--line);
}
.manual-section .note { background: var(--blue-bg); border-color: var(--blue-line); }
.manual-section .warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }

/* ---------------------------------------------------------------- printable */
.printable-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 14px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.printable-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
  text-align: center;
}
.signature-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.page-foot { color: var(--muted); font-size: 12.5px; text-align: center; padding: 14px 0 24px; font-weight: 500; }

@media (max-width: 720px) {
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
  .brand { font-size: 17px; }
  .nav { margin-inline-start: 0; width: 100%; justify-content: flex-start; }
  .page-head h1 { font-size: 22px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  :root[data-theme="dark"] {
    --bg: #ffffff;
    --card: #ffffff;
    --card-2: #ffffff;
    --text: #000000;
    --text-2: #222222;
    --muted: #555555;
    --line: #cccccc;
    --table-head: #eeeeee;
  }
  .topbar, .actions, .filters, .pagination, .no-print, .manual-toc, .page-foot { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .page { max-width: none; padding: 0; margin: 0; }
  .panel, .card, .manual-section { box-shadow: none !important; border-color: #ccc !important; }
  .manual-layout { display: block; }
  table.data th { background: #f0f0f0 !important; color: #000 !important; }
  table.data td, table.data th { padding: 6px 8px !important; font-size: 10pt !important; }
}
