/*  Practicality – custom app stylesheet
 *  Replaces Bootstrap 5.  Manrope font loaded via <link> in base.html.
 *  ---------------------------------------------------------------  */

/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --ink: #142029;
  --muted: #5f6f7a;
  --brand: #035a67;
  --brand-2: #0d8f95;
  --good: #237a3e;
  --bad: #a43a25;
  --warn: #b8860b;
  --info: #1a6d8a;

  --nav-bg: #F1F3F5;
  --nav-text: #071a2b;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f7f9fa 0%, #f1f4f6 38%, #f8fafb 100%),
    radial-gradient(120% 90% at 100% -10%, rgba(3, 90, 103, 0.14) 0%, rgba(3, 90, 103, 0.08) 35%, rgba(3, 90, 103, 0.03) 60%, transparent 78%),
    radial-gradient(90% 70% at -8% 22%, rgba(13, 143, 149, 0.12) 0%, rgba(13, 143, 149, 0.06) 42%, rgba(13, 143, 149, 0.02) 65%, transparent 82%),
    radial-gradient(85% 80% at 50% 120%, rgba(20, 32, 41, 0.06) 0%, rgba(20, 32, 41, 0.02) 50%, transparent 74%),
    var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: 100% 100%, 150% 130%, 130% 120%, 120% 110%, auto;
}

/* Disable typographic ligatures/sitewide substitutions (e.g. (c) → ©)
   We keep the real © character in the footer where required; disabling
   ligatures prevents the font from substituting character sequences. */
body, input, textarea, select {
  font-variant-ligatures: none;
  -webkit-font-feature-settings: "liga" 0, "clig" 0, "dlig" 0;
  font-feature-settings: "liga" 0, "clig" 0, "dlig" 0;
}

html, body { height: 100%; }

/* ── Site header / navbar ──────────────────────────────────────── */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.75rem;
  min-height: 72px;
  background-color: var(--nav-bg);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.site-header a { color: var(--nav-text); text-decoration: none; margin-left: 1rem; }
.site-header a:hover { color: #0b2540; }
.site-header .logo-img { height: clamp(36px, 5vw, 48px); max-height: 48px; width: auto; display: block; }
.site-header nav { display: flex; align-items: center; gap: 0.25rem; }
.site-header nav a { padding: 0.35rem 0.5rem; }
.site-header ul { list-style: none; margin: 0; padding: 0; }

/* Ensure auth links (Login / Account / Logout) are pinned to the right
   even if other styles change the navbar layout. Keeps behavior robust. */
.site-header .navbar-nav.ms-auto {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-header .navbar-nav.me-auto { margin-right: 0; }

/* Navbar toggler (mobile hamburger) */
.navbar-toggler {
  display: none;
  background: none;
  border: 1px solid rgba(0,0,0,0.15);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 1.25rem;
  line-height: 1;
}
.navbar-toggler:focus { box-shadow: 0 0 0 0.1rem rgba(0,0,0,0.08); }

.site-header .navbar-collapse { display: flex; align-items: center; width: 100%; }
.navbar-nav { display: flex; list-style: none; padding: 0; margin: 0; gap: 0.25rem; }
.navbar-nav li a { display: block; padding: 0.35rem 0.5rem; color: var(--nav-text); text-decoration: none; }
.navbar-nav li a:hover { color: #0b2540; }

@media (max-width: 992px) {
  .navbar-toggler { display: block; }
  .site-header .navbar-collapse { display: none; flex-direction: column; align-items: flex-start; padding: 0.5rem 0; }
  .site-header .navbar-collapse.open { display: flex; }
  .navbar-nav { flex-direction: column; width: 100%; }
  .navbar-nav li a { padding: 0.5rem 0; }
}

/* ── Layout ────────────────────────────────────────────────────── */
.container {
  width: min(90vw, 2304px);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-inline: clamp(12px, 2.5vw, 64px);
}

@media (max-width: 1600px) {
  .container { width: min(92vw, 1500px); padding-inline: clamp(12px, 3vw, 48px); }
}
@media (max-width: 1200px) {
  .container { width: min(92vw, 1200px); padding-inline: clamp(10px, 3.5vw, 36px); }
}
@media (max-width: 992px) {
  .container { width: 94vw; padding-inline: clamp(10px, 4vw, 28px); }
}
@media (max-width: 768px) {
  .container { width: 96vw; padding-inline: 12px; }
}
@media (max-width: 576px) {
  .container { width: 100vw; padding-inline: 8px; }
}

.narrow { max-width: 540px; margin-left: auto; margin-right: auto; }

/* ── Responsive grid ────────────────────────────────────────────── */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
}
[class*="col-"] {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  box-sizing: border-box;
  flex: 0 0 100%;
  max-width: 100%;
}
/* xs always-on sizes */
.col-12 { flex: 0 0 100%;    max-width: 100%;    }
.col-6  { flex: 0 0 50%;     max-width: 50%;     }
.col-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-3  { flex: 0 0 25%;     max-width: 25%;     }
/* sm ≥ 576px */
@media (min-width: 576px) {
  .col-sm-12 { flex: 0 0 100%;    max-width: 100%;    }
  .col-sm-6  { flex: 0 0 50%;     max-width: 50%;     }
  .col-sm-4  { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-sm-3  { flex: 0 0 25%;     max-width: 25%;     }
}
/* md ≥ 768px */
@media (min-width: 768px) {
  .col-md-12 { flex: 0 0 100%;    max-width: 100%;    }
  .col-md-8  { flex: 0 0 66.667%; max-width: 66.667%; }
  .col-md-6  { flex: 0 0 50%;     max-width: 50%;     }
  .col-md-4  { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-md-3  { flex: 0 0 25%;     max-width: 25%;     }
}
/* lg ≥ 992px */
@media (min-width: 992px) {
  .col-lg-12 { flex: 0 0 100%;    max-width: 100%;    }
  .col-lg-6  { flex: 0 0 50%;     max-width: 50%;     }
  .col-lg-4  { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-lg-3  { flex: 0 0 25%;     max-width: 25%;     }
}
/* xl ≥ 1200px */
@media (min-width: 1200px) {
  .col-xl-12 { flex: 0 0 100%;    max-width: 100%;    }
  .col-xl-6  { flex: 0 0 50%;     max-width: 50%;     }
  .col-xl-4  { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-xl-3  { flex: 0 0 25%;     max-width: 25%;     }
}

/* ── Sticky footer ─────────────────────────────────────────────── */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.site-content { flex: 1 0 auto; }
.site-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  border-top: 1px solid rgba(0,0,0,0.05);
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
  background: var(--panel);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(20, 32, 41, 0.08);
}

/* ── Badge ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: #d8f2f1;
  color: #0b5f65;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.badge-success { background: #ddf4e3; color: var(--good); }
.badge-danger  { background: #f8e0dc; color: var(--bad);  }
.badge-warning { background: #fef3cd; color: var(--warn); }
.badge-info    { background: #d1ecf1; color: var(--info); }

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20, 32, 41, 0.07);
  margin-bottom: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-body {
  padding: 0.8rem;
  flex: 1;
}
.card-header {
  padding: 0.7rem 1.3rem;
  background: #f1f4f7;
  border-bottom: 1px solid #e2e8ea;
  font-weight: 600;
}
.card-header.bg-primary { background: var(--brand); color: white; border-bottom-color: transparent; }
.card-title {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.card-text {
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-size: clamp(0.82rem, 1.2vw, 0.9rem);
}

.card-body p { margin-bottom: 0.35rem; }

/* Buttons inside cards: spacing for stacked (vertical) and inline flows */
.card-body .btn { margin-top: 0.5rem; display: inline-block; }
.card-body .btn:first-child { margin-top: 0; }
.card-body .btn + .btn { margin-left: 0.5rem; }

/* On small viewports, make card buttons stack and centre-align */
@media (max-width: 576px) {
  .card-body .btn { display: block; width: 100%; max-width: 360px; margin-left: auto; margin-right: auto; }
  .card-body .btn + .btn { margin-left: 0; }
}
.h-100 { height: 100%; }
@media (max-width: 576px) { .card-body { padding: 0.5rem; } }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-size: inherit;
  line-height: 1.4;
}
.btn:hover { opacity: 0.9; }

.btn.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}
.btn.ghost:hover { background: rgba(3,90,103,0.06); }

.btn.btn-success {
  background: linear-gradient(90deg, #1a7a3a, #25a350);
}
.btn.btn-danger, .btn.btn-outline-danger {
  background: linear-gradient(90deg, #a43a25, #c94e33);
}
.btn.btn-warning {
  background: linear-gradient(90deg, #b8860b, #d4a017);
  color: #142029;
}
.btn.btn-info {
  background: linear-gradient(90deg, var(--info), #2190b0);
}
.btn.btn-link {
  background: transparent;
  color: var(--brand);
  border: none;
  text-decoration: underline;
  padding: 0.25rem 0.4rem;
}
.btn.btn-link:hover { color: var(--brand-2); }

.btn.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0.25rem;
  line-height: 1;
}
.btn-close::after { content: "×"; }
.btn-close:hover { opacity: 1; }

.btn-group { display: inline-flex; gap: 0; position: relative; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }
.btn.active {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
  border-color: transparent;
}

.actions { display: flex; gap: 0.7rem; }

@media (max-width: 768px) {
  .btn { font-size: 0.9rem; padding: 0.4rem 0.8rem; }
}
@media (max-width: 576px) {
  .btn { font-size: 0.85rem; padding: 0.35rem 0.7rem; }
}

/* ── Split grid (2-column) ─────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
}

/* ── Forms ─────────────────────────────────────────────────────── */
textarea, input, select {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #b7c3c9;
  border-radius: 8px;
  font-family: inherit;
  font-size: inherit;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(3,90,103,0.15);
}
input[type="checkbox"], input[type="radio"] { width: auto; }
label { display: block; margin-bottom: 0.3rem; font-weight: 600; }
.grid-form p { margin-bottom: 0.8rem; }

@media (max-width: 768px) {
  textarea, input, select { font-size: 0.9rem; }
}

/* ── Flash / alert ─────────────────────────────────────────────── */
.flash, .alert {
  background: #d8f2f1;
  border-left: 4px solid var(--brand);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}
.alert-success { border-left-color: var(--good); background: #ddf4e3; }
.alert-danger  { border-left-color: var(--bad);  background: #f8e0dc; }
.alert-warning { border-left-color: var(--warn); background: #fef3cd; }
.alert-info    { border-left-color: var(--info); background: #d1ecf1; }
.alert .btn-close { position: absolute; right: 0.5rem; top: 0.5rem; }

.alert-dismissible { padding-right: 2.5rem; }

/* ── Tables ────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid #e2e8ea;
  text-align: left;
  padding: 0.55rem;
}
thead th {
  background: var(--ink);
  color: white;
  font-weight: 700;
}
thead.table-dark th {
  background: #212529;
  color: #ffffff;
}
thead.table-light th {
  background: #f8f9fa;
  color: #212529;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
  table { font-size: 0.85rem; }
  th, td { padding: 0.5rem 0.3rem; }
}
@media (max-width: 576px) {
  table { font-size: 0.8rem; }
  th, td { padding: 0.4rem 0.25rem; }
}

/* ── Modal ─────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 25, 31, 0.62);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}
.modal.open { display: flex; }

.modal-panel, .modal-content {
  width: min(760px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 20px 40px rgba(10, 19, 24, 0.26);
}

/* Compat aliases for bootstrap modal markup */
.modal-dialog { display: contents; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0.75rem; border-bottom: 1px solid #e2e8ea; margin-bottom: 0.75rem; }
.modal-header.bg-danger { background: var(--bad); color: white; margin: -1rem -1rem 0.75rem; padding: 0.75rem 1rem; border-radius: 14px 14px 0 0; }
.modal-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-body { padding: 0.5rem 0; }
.modal-footer { display: flex; gap: 0.7rem; justify-content: flex-end; padding-top: 0.75rem; border-top: 1px solid #e2e8ea; margin-top: 0.75rem; }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 1rem;
  z-index: 1100;
}
.toast {
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20,32,41,0.15);
  padding: 0.75rem 1rem;
  min-width: 240px;
  display: none;
}
.toast.open { display: block; }
.toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.toast-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Dropdown ──────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown.open > .dropdown-toggle::after,
.btn-group.open > .dropdown-toggle::after { transform: translateY(-1px) rotate(180deg); }
.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.dropdown-toggle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.85;
  transition: transform 0.15s ease;
}
.dropdown-toggle .dropdown-selected-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  padding: 0 0.35rem;
  background: rgba(3, 90, 103, 0.12);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  min-width: 180px;
  max-width: min(92vw, 420px);
  background: var(--panel);
  border: 1px solid #d6e3e8;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20,32,41,0.10);
  padding: 0.3rem 0;
  margin-top: 0.25rem;
}
.dropdown-menu.open { display: block; }
.dropdown-menu-end { left: auto; right: 0; }
.dropdown-menu li { list-style: none; }
.dropdown-divider {
  margin: 0.25rem 0;
  border: 0;
  border-top: 1px solid #e2e8ea;
}
.dropdown-item, .dropdown-menu button, .dropdown-menu a {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  font-size: inherit;
}
.dropdown-item:hover, .dropdown-menu button:hover, .dropdown-menu a:hover {
  background: #f1f4f7;
}
.dropdown-item.active {
  background: #d8f2f1;
  color: #0b5f65;
  font-weight: 700;
}

/* ── Collapse ──────────────────────────────────────────────────── */
.collapse { display: none; }
.collapse.open { display: block; }

/* ── Feedback list ─────────────────────────────────────────────── */
.feedback-list { list-style: none; padding: 0; }
.feedback-list li { padding: 0.55rem 0.7rem; margin-bottom: 0.4rem; border-radius: 8px; }
.feedback-list li.ok { background: #ddf4e3; color: var(--good); }
.feedback-list li.missed { background: #f8e0dc; color: var(--bad); }
.feedback-list li.not-attempted { background: #f1f3f5; color: #6b7280; }

/* ── MCQ / parts ───────────────────────────────────────────────── */
.whole-question { background: #f7fbfc; border: 1px solid #d2e5ea; padding: 0.8rem; border-radius: 10px; max-height: 340px; overflow: auto; margin-bottom: 1rem; }
.paper-frame-wrap { margin: 0.8rem 0 1rem; border: 1px solid #c8d6dc; border-radius: 10px; overflow: hidden; background: #f1f4f7; }
.paper-frame { width: 100%; height: 440px; border: 0; }
.part-answer-box { border: 1px solid #d6e3e8; border-radius: 10px; padding: 0.75rem; margin-bottom: 0.8rem; background: #fbfdfe; }
.part-prompt { margin: 0.35rem 0 0.5rem; color: var(--ink); }
.mcq { display: grid; gap: 0.45rem; }
.mcq-choice { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; border: 1px solid #d6e3e8; border-radius: 8px; padding: 0.45rem 0.55rem; background: #ffffff; }
.mcq-choice input[type="radio"], .mcq-choice input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }
.mcq-content { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.mcq-text { color: var(--ink); line-height: 1.3; }
.mcq-snippet { display: block; max-height: 44px; width: auto; border: 1px solid #d6e3e8; border-radius: 4px; background: #fff; }
.part-scores { list-style: none; padding: 0; margin: 0 0 0.8rem; }
.part-scores li { padding: 0.35rem 0.5rem; border-bottom: 1px solid #e4ecef; }
.part-scores li.not-attempted { color: #6b7280; background: transparent; }
.score { font-size: 1.1rem; font-weight: 700; }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  display: flex;
  list-style: none;
  padding: 0;
  gap: 0.25rem;
  justify-content: center;
  flex-wrap: wrap;
}
.page-item { display: inline-block; }
.page-link {
  display: block;
  padding: 0.35rem 0.7rem;
  border: 1px solid #d6e3e8;
  border-radius: 6px;
  color: var(--brand);
  text-decoration: none;
  background: var(--panel);
}
.page-link:hover { background: #d8f2f1; }
.page-item.disabled .page-link { color: var(--muted); pointer-events: none; opacity: 0.6; }
.page-item.active .page-link { background: var(--brand); color: white; }

/* ── List group compat ─────────────────────────────────────────── */
.list-group { list-style: none; padding: 0; margin: 0; }
.list-group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #e2e8ea;
}
.list-group-item:last-child { border-bottom: none; }

/* ── Cookie consent (app-specific) ─────────────────────────────── */
.cookie-consent-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background-color: #2d3e50; color: #ecf0f1;
  padding: 1.5rem; border-top: 4px solid #3498db;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  z-index: 1000; font-size: 0.95rem; display: none;
}
.cookie-consent-banner.show { display: block; }
.cookie-consent-content {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
}
.cookie-consent-text { flex: 1; min-width: 250px; }
.cookie-consent-text a { color: #3498db; text-decoration: none; border-bottom: 1px solid #3498db; }
.cookie-consent-text a:hover { color: #2980b9; }
.cookie-consent-buttons { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.cookie-consent-btn { padding: 0.5rem 1.5rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.95rem; font-weight: 500; transition: all 0.3s ease; white-space: nowrap; }
.cookie-consent-btn-accept { background-color: #27ae60; color: white; }
.cookie-consent-btn-accept:hover { background-color: #229954; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.cookie-consent-btn-decline { background-color: #e74c3c; color: white; }
.cookie-consent-btn-decline:hover { background-color: #c0392b; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.cookie-consent-btn-settings { background-color: transparent; color: #3498db; border: 1px solid #3498db; }
.cookie-consent-btn-settings:hover { background-color: #3498db; color: #2d3e50; }

@media (max-width: 768px) {
  .cookie-consent-banner { padding: 1rem; }
  .cookie-consent-content { gap: 1rem; }
  .cookie-consent-text { flex: 1 1 100%; min-width: 100%; }
  .cookie-consent-buttons { flex: 1 1 100%; }
  .cookie-consent-btn { flex: 1; min-width: 100px; }
}

/* ── Utility classes (Bootstrap compat) ────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-danger { color: var(--bad); }
.text-white  { color: white; }
.text-decoration-none { text-decoration: none; }

.fw-bold     { font-weight: 700; }
.fw-semibold { font-weight: 600; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.d-flex  { display: flex; }
.d-none  { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }

.flex-wrap   { flex-wrap: wrap; }
.flex-column { flex-direction: column; }

.align-items-center   { align-items: center; }
.justify-content-start   { justify-content: flex-start; }
.justify-content-end     { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-center  { justify-content: center; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-3 { margin-left: 1rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.me-3 { margin-right: 1rem; }
.me-auto { margin-right: auto; }
.ms-auto { margin-left: auto; }
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.ps-3 { padding-left: 1rem; }
.pb-2 { padding-bottom: 0.5rem; }

.mb-lg-0 { }
@media (min-width: 992px) { .mb-lg-0 { margin-bottom: 0; } }

.border-bottom { border-bottom: 1px solid #e2e8ea; }
.border-top    { border-top: 1px solid #e2e8ea; }
.border        { border: 1px solid #e2e8ea; }
.rounded-pill  { border-radius: 999px; }

.shadow-sm { box-shadow: 0 4px 12px rgba(20,32,41,0.06); }

/* Background utilities */
.bg-primary { background: var(--brand); color: white; }
.bg-success { background: var(--good); color: white; }
.bg-danger  { background: var(--bad); color: white; }
.bg-warning { background: var(--warn); color: #142029; }
.bg-light   { background: #f8f9fa; }
.bg-secondary { background: #6c757d; color: white; }

/* Text-bg utilities */
.text-bg-light { background: #f8f9fa; color: var(--ink); }
.text-bg-success { background: var(--good); color: white; }
.text-bg-danger  { background: var(--bad); color: white; }

.align-middle { vertical-align: middle; }

.small { font-size: 0.85em; }

/* Form compat classes */
.form-check        { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.3rem; }
.form-check-input  { width: auto; margin: 0; }
.form-check-label  { font-weight: 400; margin-bottom: 0; cursor: pointer; }
.form-label         { font-weight: 600; margin-bottom: 0.3rem; }

/* Width utilities */
.w-50 { width: 50%; }
.w-100 { width: 100%; }
.form-control, .form-select { /* no-op: global input/select styles apply */ }

/* List utilities */
.list-unstyled { list-style: none; padding: 0; }

/* Sort icons for tables */
.sortable { cursor: pointer; user-select: none; }
.sort-icons { display: inline-flex; flex-direction: column; gap: 0; margin-left: 4px; vertical-align: middle; line-height: 0; }

/* Keep action buttons in all tables visually consistent */
table td .btn,
.table td .btn {
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  vertical-align: middle;
}

table td .btn.btn-sm,
.table td .btn.btn-sm {
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

table td .btn .bi,
.table td .btn .bi {
  font-size: 0.9rem;
  line-height: 1;
}

table td .btn-group,
.table td .btn-group {
  display: inline-flex;
  align-items: center;
}

table td .btn-group .btn,
.table td .btn-group .btn {
  min-width: 32px;
}

/* Shared table action-button system */
.table .table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.table td .table-icon-btn,
table td .table-icon-btn {
  width: 2.1rem;
  min-width: 2.1rem;
  height: 2.1rem;
  min-height: 2.1rem;
  padding: 0;
  border-radius: 0.65rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: #334155;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.table td .table-icon-btn:hover,
table td .table-icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.24);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
}

.table td .table-icon-btn:focus-visible,
table td .table-icon-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.table td .table-icon-btn.dropdown-toggle::after,
table td .table-icon-btn.dropdown-toggle::after {
  display: none;
}

.table td .table-icon-btn .bi,
table td .table-icon-btn .bi {
  font-size: 0.95rem;
  line-height: 1;
}

.table td .table-view-btn,
table td .table-view-btn {
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  border-color: rgba(37, 99, 235, 0.3);
  color: #1d4ed8;
}

.table td .table-view-btn:hover,
table td .table-view-btn:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(180deg, #f1f7ff 0%, #e4efff 100%);
}

.table td .table-menu-btn,
table td .table-menu-btn {
  color: #475569;
}

.table td .table-danger-btn,
table td .table-danger-btn {
  background: linear-gradient(180deg, #fff7f6 0%, #ffeceb 100%);
  border-color: rgba(196, 65, 38, 0.3);
  color: #a63f2b;
}

.table td .table-danger-btn:hover,
table td .table-danger-btn:hover {
  border-color: rgba(196, 65, 38, 0.45);
  background: linear-gradient(180deg, #fff2f1 0%, #ffe4e1 100%);
}

.table td .table-success-btn,
table td .table-success-btn {
  background: linear-gradient(180deg, #f4fff8 0%, #e7f9ef 100%);
  border-color: rgba(22, 138, 70, 0.32);
  color: #1a7a3a;
}

.table td .table-success-btn:hover,
table td .table-success-btn:hover {
  border-color: rgba(22, 138, 70, 0.48);
  background: linear-gradient(180deg, #ecfdf3 0%, #ddf7e8 100%);
}

.table td .table-neutral-btn,
table td .table-neutral-btn {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(71, 85, 105, 0.3);
  color: #475569;
}

.table td .table-neutral-btn:hover,
table td .table-neutral-btn:hover {
  border-color: rgba(71, 85, 105, 0.46);
  background: linear-gradient(180deg, #fbfdff 0%, #f1f5f9 100%);
}

.table td .table-actions .btn-group,
table td .table-actions .btn-group {
  display: inline-flex;
  align-items: center;
}

.table td .table-actions .btn-group .table-icon-btn,
table td .table-actions .btn-group .table-icon-btn {
  border-radius: 0.65rem;
}

.table td .table-actions .dropdown-menu,
table td .table-actions .dropdown-menu {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.75rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 0;
  padding-left: 0;
  list-style: none;
}
.nav-tabs .nav-item {
  margin-bottom: -2px;
}
.nav-tabs .nav-link {
  display: block;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  /* Reset default <button> browser styles */
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  line-height: inherit;
  box-shadow: none;
  outline-offset: 2px;
}
.nav-tabs .nav-link:hover {
  color: var(--brand);
  background-color: transparent;
  border-color: transparent;
  border-bottom-color: var(--brand-2);
}
.nav-tabs .nav-link.active {
  color: var(--brand);
  background-color: transparent;
  border-color: transparent;
  border-bottom-color: var(--brand);
  margin-bottom: -2px;
}

.tab-content { }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Responsive helpers ────────────────────────────────────────── */
@media (max-width: 760px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .paper-frame { height: 320px; }
}
@media (max-width: 768px) {
  .site-header .logo-img { height: 40px; }
  body { font-size: 0.95rem; }
}
@media (max-width: 576px) {
  .site-header .logo-img { height: 34px; }
  body { font-size: 0.9rem; }
}
