/* ==========================================================================
   PAREF Portal — Modern redesign
   Loaded AFTER Bootstrap (sidebar/css/style.css) and student_pay.css
   so its declarations win cascade ties.

   Theme via the --accent CSS variable below.
   ========================================================================== */

:root {
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-soft: #EEF2FF;
  --accent-text: #4338CA;
  --accent-grad-from: #6366F1;
  --accent-grad-to: #8B5CF6;

  --pf-bg: #F7F8FA;
  --pf-surface: #FFFFFF;
  --pf-surface-hover: #FAFBFC;
  --pf-surface-soft: #F1F3F7;

  --pf-border: #E8EAEE;
  --pf-border-strong: #D5D9E0;

  --pf-text: #0F172A;
  --pf-text-muted: #64748B;
  --pf-text-faint: #94A3B8;

  --pf-success: #059669;
  --pf-success-soft: #D1FAE5;
  --pf-success-text: #065F46;
  --pf-warning: #D97706;
  --pf-warning-soft: #FEF3C7;
  --pf-warning-text: #92400E;
  --pf-danger: #DC2626;
  --pf-danger-soft: #FEE2E2;
  --pf-danger-text: #991B1B;
  --pf-info-soft: #DBEAFE;
  --pf-info-text: #1E40AF;

  --pf-shadow-sm: 0 1px 2px rgb(15 23 42 / 0.04);
  --pf-shadow-md: 0 4px 12px rgb(15 23 42 / 0.06);
  --pf-shadow-lg: 0 12px 32px rgb(15 23 42 / 0.10);

  --pf-radius-sm: 6px;
  --pf-radius-md: 10px;
  --pf-radius-lg: 14px;
  --pf-radius-xl: 20px;
  --sidebar-w: 248px;
  --header-h: 64px;
}

/* Pull in Inter from Google Fonts via @import (the layout also <link>s it,
   this is a defensive fallback). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* Reset what Bootstrap / Odoo set globally so the new layout can breathe. */
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 14px;
  color: var(--pf-text);
  background: var(--pf-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   Wrapper / shell
   The original layout uses `.wrapper.d-flex.align-items-stretch` with `nav#sidebar`.
   We restyle that exact structure rather than rewrite it.
   ========================================================================== */

.wrapper {
  display: flex !important;
  min-height: 100vh;
  background: var(--pf-bg);
}

/* ----- Sidebar ----- */

#sidebar {
  width: var(--sidebar-w) !important;
  min-width: var(--sidebar-w);
  background: var(--pf-surface) !important;
  color: var(--pf-text) !important;
  border-right: 1px solid var(--pf-border);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  transition: margin-left 0.3s, width 0.3s;
  z-index: 10;
}

#sidebar.active {
  /* main.js toggles this — slide off the left edge on mobile */
  margin-left: calc(-1 * var(--sidebar-w));
}

#sidebar .p-4 {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#sidebar h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 16px !important;
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  color: var(--pf-text) !important;
  text-shadow: none !important;
}

#sidebar h1 .logo {
  color: inherit !important;
  text-decoration: none !important;
  font-size: 16px !important;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-meta .brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-meta .brand-sub {
  font-size: 11px;
  color: var(--pf-text-faint);
  font-weight: 500;
  letter-spacing: 0;
}

#sidebar .components {
  list-style: none !important;
  padding: 8px 12px !important;
  margin: 0 !important;
  flex: 1 !important;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#sidebar .components li {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

#sidebar .components li > a {
  display: flex !important;
  align-items: center;
  gap: 11px;
  padding: 9px 11px !important;
  border-radius: 8px;
  color: var(--pf-text-muted) !important;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s;
  background: transparent !important;
}

#sidebar .components li > a:hover {
  background: var(--pf-surface-hover) !important;
  color: var(--pf-text) !important;
}

#sidebar .components li.active > a,
#sidebar .components li > a.active {
  background: var(--accent-soft) !important;
  color: var(--accent-text) !important;
  font-weight: 600;
}

/* Hide the old Font Awesome icons inside nav links — we render Lucide-style
   SVGs directly in the template. The `.fa.mr-3` class still exists so old
   templates keep working; just visually neutralize spacing if any FA icon slips through. */
#sidebar .components li > a .fa {
  font-size: 14px;
  width: 18px;
  text-align: center;
  margin-right: 0 !important;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
  display: inline-block;
}

#sidebar .nav-section {
  padding: 14px 10px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pf-text-faint);
}

#sidebar .footer {
  margin-top: auto !important;
  padding: 12px;
  border-top: 1px solid var(--pf-border);
  background: transparent;
}

#sidebar .footer p {
  margin: 0;
}

#sidebar .footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--pf-text-muted) !important;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s;
}

#sidebar .footer a:hover {
  background: var(--pf-surface-hover) !important;
  color: var(--pf-text) !important;
}

/* The collapse button (≡) — shrinks the chevron pill into a tasteful icon-btn. */
#sidebar .custom-menu {
  position: absolute;
  top: 18px;
  right: -16px;
  margin: 0;
  z-index: 11;
}

#sidebar .custom-menu .btn,
#sidebar .custom-menu .btn-primary,
#sidebar #sidebarCollapse {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: var(--pf-surface) !important;
  color: var(--pf-text-muted) !important;
  border: 1px solid var(--pf-border) !important;
  box-shadow: var(--pf-shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#sidebar #sidebarCollapse:hover {
  color: var(--pf-text) !important;
  background: var(--pf-surface-hover) !important;
}

#sidebar #sidebarCollapse .sr-only { display: none; }

/* ==========================================================================
   Main content area
   ========================================================================== */

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--pf-bg);
}

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  background: var(--pf-surface);
  border-bottom: 1px solid var(--pf-border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--pf-text-muted);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--pf-text-muted);
  position: relative;
  cursor: pointer;
  text-decoration: none !important;
}
.icon-btn:hover { background: var(--pf-surface-soft); color: var(--pf-text); }
.icon-btn .dot-indicator {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  background: var(--pf-danger);
  border-radius: 50%;
  border: 1.5px solid var(--pf-surface);
}

.student-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 10px;
  background: var(--pf-surface-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--pf-text);
}

#content,
.content {
  padding: 32px 40px 64px !important;
  max-width: 1200px;
}

@media (max-width: 720px) {
  #content, .content { padding: 20px 16px 48px !important; }
  .topbar { padding: 0 16px 0 64px; }   /* leave room for the floating hamburger */
}

/* ==========================================================================
   Mobile sidebar drawer
   ==========================================================================
   On phones/tablets the sidebar slides out from the left over the content
   instead of sharing horizontal real-estate with it. The hamburger button
   becomes a fixed top-left affordance so it stays reachable whether the
   drawer is open or closed (the desktop CSS pinned it to the sidebar's
   right edge, which slid off-screen with the sidebar — bad UX on mobile).

   We deliberately invert the semantics of `#sidebar.active` here:
     • on desktop, .active = collapsed (slide off, narrow workspace);
     • on mobile,  .active = drawer is OPEN (slide in over content).
   Same toggle JS, opposite default state — handled entirely in CSS. */
@media (max-width: 900px) {
  /* Wrapper no longer reserves a sidebar column — content takes the
     full width. The sidebar is taken out of flow below. */
  .wrapper {
    display: block !important;
    min-height: 100vh;
  }
  .main-content {
    width: 100% !important;
    min-width: 0;
  }

  /* Sidebar becomes a fixed-position drawer, hidden by default. The
     transform-based slide also works around iOS Safari's quirky
     repaint of margin-only transitions. */
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
    margin-left: 0 !important;
    transform: translateX(-100%);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.18);
    z-index: 1000;
    transition: transform 0.28s cubic-bezier(.2,.7,.2,1);
    overflow-y: auto;
  }

  /* .active on mobile means "shown" — slide the drawer in */
  #sidebar.active {
    transform: translateX(0) !important;
  }

  /* Hamburger button pinned to the viewport top-left so it's always
     reachable regardless of drawer state. Sits ABOVE the drawer so it
     stays tappable when the drawer is open (turns into a close button
     conceptually). */
  #sidebar .custom-menu {
    position: fixed !important;
    top: 14px !important;
    left: 14px !important;
    right: auto !important;
    z-index: 1010 !important;
  }

  /* Tweak the hamburger pill on mobile — solid surface, slightly larger
     hit area for thumbs. */
  #sidebar .custom-menu .btn,
  #sidebar #sidebarCollapse {
    width: 38px !important;
    height: 38px !important;
    background: var(--pf-surface) !important;
    box-shadow: var(--pf-shadow-md) !important;
  }

  /* Translucent backdrop behind the open drawer. Built as a dedicated
     div (injected by main.js) so we can bind a click handler directly
     — pseudo-elements aren't event targets. */
  .pf-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  body.sidebar-open .pf-sidebar-backdrop {
    display: block;
  }
  /* Lock the page behind the drawer so a stray scroll on a tap doesn't
     drift the content underneath. */
  body.sidebar-open {
    overflow: hidden;
  }
}

/* On wider screens the backdrop element (if injected) stays hidden. */
.pf-sidebar-backdrop { display: none; }

.go-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pf-text-muted) !important;
  text-decoration: none !important;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.go-back:hover { background: var(--pf-surface-soft); color: var(--pf-text) !important; }

/* ==========================================================================
   Page header
   ========================================================================== */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
  flex-wrap: wrap;
}

.page-eyebrow {
  font-size: 12px;
  color: var(--pf-text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.page-title {
  font-size: 26px !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  color: var(--pf-text) !important;
  margin: 0 0 4px !important;
  line-height: 1.2 !important;
}

.page-subtitle {
  font-size: 14px;
  color: var(--pf-text-muted);
  max-width: 60ch;
  margin: 0;
}

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

/* Override the original h2/h3 used in views to give them visual hierarchy. */
#content > h3,
.content > h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--pf-text-muted);
  margin: 0 0 4px;
  letter-spacing: 0;
}

#content > h2,
.content > h2 {
  font-size: 26px !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  color: var(--pf-text) !important;
  margin: 0 0 24px !important;
  line-height: 1.2 !important;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.pf-card,
.card.pf-card {
  background: var(--pf-surface) !important;
  border: 1px solid var(--pf-border) !important;
  border-radius: var(--pf-radius-lg) !important;
  box-shadow: var(--pf-shadow-sm);
  margin-bottom: 16px;
}

.pf-card .card-pad { padding: 22px 24px; }

.pf-card .card-header {
  padding: 18px 24px !important;
  border-bottom: 1px solid var(--pf-border) !important;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pf-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--pf-text);
  margin: 0;
}

.pf-card .card-footer {
  padding: 14px 24px !important;
  border-top: 1px solid var(--pf-border) !important;
  background: var(--pf-surface-hover) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom-left-radius: var(--pf-radius-lg);
  border-bottom-right-radius: var(--pf-radius-lg);
}

/* Hero balance card (gradient) */
.pf-hero {
  background: linear-gradient(135deg, var(--accent), var(--accent-grad-to)) !important;
  border: none !important;
  color: white !important;
  overflow: hidden;
  position: relative;
  border-radius: var(--pf-radius-lg);
  padding: 22px 26px;
  box-shadow: 0 10px 24px rgb(99 102 241 / 0.20);
  margin-bottom: 20px;
}

.pf-hero::after {
  content: "";
  position: absolute;
  inset: -50% -30% auto auto;
  width: 280px;
  height: 280px;
  background: radial-gradient(closest-side, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}

.pf-hero-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.pf-hero-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-bottom: 6px;
}

.pf-hero-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.pf-hero-meta { font-size: 13px; opacity: 0.85; }

/* ==========================================================================
   Buttons — override Bootstrap defaults
   ========================================================================== */

.btn,
button,
input[type=submit],
.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-light {
  border-radius: 8px;
}

.btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  border: 1px solid transparent !important;
  white-space: nowrap;
  letter-spacing: -0.005em;
  text-decoration: none !important;
  line-height: 1.2 !important;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }

.btn.btn-primary,
.btn-primary {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
  box-shadow: 0 1px 2px rgb(67 56 202 / 0.25);
}
.btn.btn-primary:hover,
.btn-primary:hover {
  background-color: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.btn.btn-secondary,
.btn-secondary {
  background-color: var(--pf-surface) !important;
  border-color: var(--pf-border-strong) !important;
  color: var(--pf-text) !important;
}
.btn.btn-secondary:hover,
.btn-secondary:hover {
  background-color: var(--pf-surface-hover) !important;
  border-color: #B8BFCB !important;
}

.btn.btn-success,
.btn-success {
  background-color: var(--pf-success) !important;
  border-color: var(--pf-success) !important;
  color: white !important;
}
.btn.btn-success:hover,
.btn-success:hover { background-color: #047857 !important; border-color: #047857 !important; }

.btn.btn-warning,
.btn-warning {
  background-color: var(--pf-warning) !important;
  border-color: var(--pf-warning) !important;
  color: white !important;
}
.btn.btn-warning:hover,
.btn-warning:hover { background-color: #B45309 !important; border-color: #B45309 !important; }

.btn.btn-ghost {
  background: transparent !important;
  color: var(--pf-text-muted) !important;
  border-color: transparent !important;
}
.btn.btn-ghost:hover { background: var(--pf-surface-soft) !important; color: var(--pf-text) !important; }

.btn-white-on-accent {
  background: rgba(255,255,255,0.18) !important;
  color: white !important;
  border-color: rgba(255,255,255,0.28) !important;
  backdrop-filter: blur(6px);
}
.btn-white-on-accent:hover { background: rgba(255,255,255,0.28) !important; color: white !important; }

.btn.btn-lg { padding: 12px 22px !important; font-size: 14px !important; }
.btn.btn-sm { padding: 6px 12px !important; font-size: 12.5px !important; }
.btn.btn-block,
.btn-block { display: flex !important; width: 100%; }

/* The native <input type="submit"> still appears in some forms — give it the
   primary button look so the gateway / proof-of-payment forms don't look 90s. */
input[type=submit] {
  display: block;
  width: 100%;
  background-color: var(--pf-success) !important;
  color: white !important;
  padding: 12px 22px !important;
  margin: 18px 0 8px !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: background 0.12s;
}
input[type=submit]:hover { background-color: #047857 !important; }

/* "Pay Outstanding Balance" inside payments.xml is btn-warning rounded-pill — restyle as primary. */
.btn-warning.rounded-pill {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
  border-radius: 999px !important;
  padding: 9px 20px !important;
}

/* ==========================================================================
   Pills / badges
   ========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.pill-success { background: var(--pf-success-soft); color: var(--pf-success-text); }
.pill-warning { background: var(--pf-warning-soft); color: var(--pf-warning-text); }
.pill-danger  { background: var(--pf-danger-soft);  color: var(--pf-danger-text); }
.pill-neutral { background: var(--pf-surface-soft); color: var(--pf-text-muted); }
.pill-accent  { background: var(--accent-soft);     color: var(--accent-text); }
.pill-info    { background: var(--pf-info-soft);    color: var(--pf-info-text); }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot-success { background: var(--pf-success); }
.dot-warning { background: var(--pf-warning); }
.dot-danger  { background: var(--pf-danger); }
.dot-accent  { background: var(--accent); }

/* The original Paid badge: `badge rounded-pill bg-success fa fa-check ... text-light` — soften it. */
.badge.rounded-pill.bg-success,
span.badge.bg-success {
  background-color: var(--pf-success-soft) !important;
  color: var(--pf-success-text) !important;
  font-weight: 600;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  font-size: 11.5px !important;
}
.badge.bg-success.fa::before { font-size: 10px; margin-right: 4px; }

/* ==========================================================================
   Tables — restyle Bootstrap's `.table.table-striped.table-sm`
   ========================================================================== */

.table-responsive {
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.table-responsive > .table,
.table {
  width: 100%;
  margin: 0 !important;
  font-size: 13px !important;
  border-collapse: collapse;
  background: transparent;
}

.table thead th {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--pf-text-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left !important;
  padding: 12px 20px !important;
  background: var(--pf-surface-hover) !important;
  border-bottom: 1px solid var(--pf-border) !important;
  border-top: none !important;
  white-space: nowrap;
  vertical-align: middle !important;
}

.table tbody td {
  padding: 14px 20px !important;
  border-top: none !important;
  border-bottom: 1px solid var(--pf-border) !important;
  color: var(--pf-text) !important;
  vertical-align: middle !important;
  font-variant-numeric: tabular-nums;
  font-size: 13px !important;
}

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

.table.table-striped tbody tr,
.table tbody tr {
  background: transparent !important;
  transition: background 0.08s;
}

.table.table-striped tbody tr:nth-of-type(odd),
.table tbody tr:nth-of-type(odd) {
  background-color: transparent !important;
}

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

.table tfoot th,
.table tfoot td {
  padding: 14px 20px !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  background: var(--pf-surface-hover) !important;
  border-top: 1px solid var(--pf-border) !important;
  color: var(--pf-text) !important;
}

.table .text-right { text-align: right !important; font-variant-numeric: tabular-nums; }
.table .text-center { text-align: center !important; }

/* Highlight an unpaid row inline */
.table tbody tr.row-unpaid { background: var(--pf-warning-soft) !important; }
.table tbody tr.row-unpaid:hover { background: #FDE68A !important; }

/* Mono cells for invoice references */
.table .mono,
.invoice-ref {
  font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--pf-text-muted);
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Forms — make the gateway / proof of payment forms feel current
   ========================================================================== */

input[type=text],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 10px 14px !important;
  margin: 6px 0 !important;
  border: 1px solid var(--pf-border-strong) !important;
  border-radius: 8px !important;
  font: inherit;
  font-size: 14px !important;
  background: var(--pf-surface) !important;
  color: var(--pf-text);
  box-sizing: border-box;
  display: block;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input[type=text]:focus,
input[type=number]:focus,
input[type=date]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type=file] {
  width: 100%;
  padding: 12px 14px !important;
  border: 1px dashed var(--pf-border-strong) !important;
  border-radius: 10px !important;
  background: var(--pf-surface-hover) !important;
  font-size: 13px;
  cursor: pointer;
}

#content h5,
.content h5 {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--pf-text) !important;
  margin: 18px 0 6px !important;
  letter-spacing: -0.005em;
}

#content h4,
.content h4 { margin: 0 0 12px !important; }

/* The gateway form's `<h4><input ...></h4>` displays the amount big */
#content h4 input[type=text],
#content h4 input[type=number] {
  font-size: 24px !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  padding: 14px 16px !important;
  font-variant-numeric: tabular-nums;
}

/* Amount display
   Currency symbol and the input as flex siblings so they never overlap,
   regardless of input padding. Use:

     <div class="amount-display">
       <span class="amount-currency">₱</span>
       <input class="amount-input" type="text" name="amount" value="0.00"/>
     </div>
*/
.amount-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 14px 18px;
  border: 1px solid var(--pf-border-strong);
  border-radius: 10px;
  background: var(--pf-surface);
  margin: 6px 0 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.amount-display:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.amount-display .amount-currency {
  font-size: 24px;
  font-weight: 700;
  color: var(--pf-text-muted);
  line-height: 1;
  flex-shrink: 0;
}
.amount-display input.amount-input,
.amount-display .amount-input {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  font-size: 28px !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  padding: 0 !important;
  margin: 0 !important;
  font-variant-numeric: tabular-nums;
  color: var(--pf-text);
  line-height: 1.1;
}
.amount-display input.amount-input:focus,
.amount-display .amount-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* Legacy: keep .amount-field selector working for any view that still uses it.
   Disables the absolute prefix and just relies on a normal input look. */
.amount-field { position: relative; }
.amount-field::before { content: none !important; }
.amount-field input { padding-left: 16px !important; }

/* Drop-zone for proof-of-payment uploads */
.dropzone {
  display: block;
  text-align: center;
  padding: 28px 20px;
  border: 2px dashed var(--pf-border-strong);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface-hover);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone .dz-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  display: grid;
  place-items: center;
  color: var(--pf-text-muted);
}
.dropzone .dz-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--pf-text);
}
.dropzone .dz-sub {
  font-size: 12px;
  color: var(--pf-text-muted);
  margin-top: 4px;
}

/* Multi-file dropzone wrapper + selected-file list */
.multi-dropzone { display: block; }

.dz-file-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dz-file-list:empty { display: none; }

.dz-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  font-size: 13px;
}
.dz-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dz-file-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dz-file-name {
  font-weight: 500;
  color: var(--pf-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dz-file-size {
  font-size: 11.5px;
  color: var(--pf-text-muted);
  font-variant-numeric: tabular-nums;
}
.dz-file-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--pf-text-muted);
  padding: 4px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dz-file-remove:hover {
  background: var(--pf-danger-soft);
  color: var(--pf-danger-text);
}

/* Payment-reference pills used on proof-of-payment confirmation cards */
.ref-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ref-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Stepper for gateway pages */
.pf-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pf-step { display: flex; align-items: center; gap: 8px; }
.pf-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pf-surface-soft);
  color: var(--pf-text-muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.pf-step.is-active .pf-step-num { background: var(--accent); color: #fff; }
.pf-step.is-done .pf-step-num   { background: var(--pf-success); color: #fff; }
.pf-step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--pf-text-muted);
  white-space: nowrap;
}
.pf-step.is-active .pf-step-label,
.pf-step.is-done .pf-step-label { color: var(--pf-text); font-weight: 600; }
.pf-step-sep {
  width: 28px;
  height: 2px;
  background: var(--pf-border);
  border-radius: 999px;
}
.pf-step.is-done + .pf-step-sep { background: var(--pf-success); }

/* Sticky action bar at the bottom of gateway pages */
.pf-action-bar {
  position: sticky;
  bottom: 16px;
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  z-index: 4;
  margin-top: 16px;
}
.pf-action-summary { display: flex; flex-direction: column; gap: 2px; }
.pf-action-summary .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--pf-text-muted);
}
.pf-action-summary .value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Form legacy container in student_pay templates */
#content div.container,
.content div.container {
  background: var(--pf-surface) !important;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  padding: 26px 28px !important;
  box-shadow: var(--pf-shadow-sm);
  max-width: 100%;
}

/* ==========================================================================
   Payment-method picker (.cc-selector-2 / .choice-tile / .drinkcard-cc / .bank-label)

   New markup pairs the icon and the text inside a single <label class="choice-tile">
   so they always wrap together. The radio input sits as the immediate sibling
   right before the label so :checked styling works via adjacent combinator:

     <div class="cc-selector-2">
       <input id="paymaya" type="radio" name="payment" .../>
       <label class="choice-tile" for="paymaya">
         <span class="drinkcard-cc paymaya"></span>
         <span class="bank-label">CREDIT CARD</span>
       </label>
     </div>

   Layout: responsive grid with auto-fit columns so 3, 4, 5+ tiles all line up.
   ========================================================================== */

.cc-selector-2 {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0;
  position: static !important;
}

.cc-selector-2 input[type=radio] {
  position: absolute !important;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

.cc-selector-2 .choice-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--pf-border-strong);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface);
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
  margin: 0 !important;
  min-height: 72px;
}

.cc-selector-2 .choice-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cc-selector-2 input:checked + .choice-tile {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cc-selector-2 input:checked + .choice-tile::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* Icon area — keeps the .drinkcard-cc class so existing background-image
   rules (.paymaya, .bank, .otc, .bank_bpi, etc.) keep painting the logos. */
.cc-selector-2 .choice-tile .drinkcard-cc {
  display: inline-block;
  width: 56px !important;
  height: 40px !important;
  margin: 0 !important;
  flex-shrink: 0;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 4px !important;
  filter: none !important;
  -webkit-filter: none !important;
  cursor: pointer;
}

/* Text label — the second sibling inside the choice-tile.
   Override every legacy positioning rule from student_pay.css. */
.cc-selector-2 .choice-tile .bank-label {
  position: static !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  height: auto !important;
  display: block;
  padding: 0;
  margin: 0 !important;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pf-text);
  cursor: pointer;
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

/* ==========================================================================
   Bank details block (under gateway forms)
   ========================================================================== */

.bank-details {
  background: var(--pf-surface-hover);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  padding: 18px 20px;
  margin: 22px 0;
  font-size: 13.5px;
}

.bank-details p {
  display: block !important;
  margin: 0 0 6px !important;
  color: var(--pf-text) !important;
  line-height: 1.55;
}

.bank-details p:first-child { font-weight: 600; color: var(--pf-text) !important; margin-top: 4px; }

/* Hide an empty .bank-details box (controller may pass empty bank_details) */
.bank-details:empty { display: none !important; }

/* ==========================================================================
   Summary chip strip
   ========================================================================== */

.chip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pf-text);
}
.chip .label { color: var(--pf-text-muted); }
.chip .value { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip .value.danger { color: var(--pf-danger-text); }
.chip .value.success { color: var(--pf-success-text); }

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--pf-text-muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--pf-surface-soft);
  display: grid;
  place-items: center;
  color: var(--pf-text-faint);
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--pf-text); margin-bottom: 4px; }
.empty-text { font-size: 13px; max-width: 30ch; margin: 0 auto; }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 980px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  padding: 20px 22px;
  box-shadow: var(--pf-shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--pf-text);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.1;
}

.kpi-value .currency {
  font-size: 16px;
  font-weight: 600;
  color: var(--pf-text-muted);
}

.kpi-meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--pf-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.kpi-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-grad-to)) !important;
  color: white !important;
  border: none !important;
}
.kpi-accent .kpi-label { color: rgba(255,255,255,0.85); }
.kpi-accent .kpi-value, .kpi-accent .kpi-value .currency { color: white; }
.kpi-accent .kpi-meta { color: rgba(255,255,255,0.8); }
.kpi-accent::after {
  content: "";
  position: absolute;
  inset: -50% -30% auto auto;
  width: 220px; height: 220px;
  background: radial-gradient(closest-side, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}

/* Two-column dashboard split */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

/* Activity feed */
.activity-list { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--pf-border);
}
.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.activity-icon.success { background: var(--pf-success-soft); color: var(--pf-success-text); }
.activity-icon.warning { background: var(--pf-warning-soft); color: var(--pf-warning-text); }
.activity-icon.accent  { background: var(--accent-soft);     color: var(--accent-text); }

.activity-body { flex: 1; min-width: 0; }
.activity-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--pf-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-meta { font-size: 12px; color: var(--pf-text-muted); margin-top: 2px; }

.activity-amount {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--pf-text);
  white-space: nowrap;
}
.activity-amount.pos    { color: var(--pf-success-text); }
.activity-amount.unpaid { color: var(--pf-warning-text); }

/* Side card list (Quick actions / Help) */
.stack-card { display: flex; flex-direction: column; gap: 16px; }

/* Full-bleed centered CTA card (Other Payments hero) */
.cta-card {
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-sm);
  text-align: center;
  padding: 56px 32px;
}

.cta-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
}

.cta-card h2 {
  font-size: 22px !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  margin: 0 0 8px !important;
  color: var(--pf-text) !important;
}

.cta-card .lead {
  color: var(--pf-text-muted);
  max-width: 44ch;
  margin: 0 auto 24px;
  font-size: 14px;
}

/* ==========================================================================
   Login page (own layout, no sidebar)
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--pf-bg);
}
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } }

.auth-side {
  background: linear-gradient(135deg, #4338CA 0%, #6366F1 50%, #8B5CF6 100%);
  color: white;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-side::before {
  content: "";
  position: absolute;
  inset: -20% -20% auto auto;
  width: 480px; height: 480px;
  background: radial-gradient(closest-side, rgba(255,255,255,0.16), transparent);
  pointer-events: none;
}
.auth-side::after {
  content: "";
  position: absolute;
  inset: auto auto -10% -10%;
  width: 360px; height: 360px;
  background: radial-gradient(closest-side, rgba(255,255,255,0.10), transparent);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.auth-brand .brand-logo {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 4px;
}
.auth-brand .label { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.auth-brand .sub { font-size: 12px; opacity: 0.8; line-height: 1.1; margin-top: 2px; }

.auth-pitch { position: relative; z-index: 1; }
.auth-pitch h1 {
  font-size: 38px !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em;
  line-height: 1.1 !important;
  margin: 0 0 18px !important;
  max-width: 14ch;
  color: white !important;
}
.auth-pitch p {
  font-size: 15px;
  opacity: 0.85;
  max-width: 36ch;
  line-height: 1.55;
  margin-bottom: 28px;
  color: white !important;
}

.auth-feats { display: flex; flex-direction: column; gap: 14px; }
.auth-feat { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.auth-feat .check {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: grid; place-items: center;
  flex-shrink: 0;
}

.auth-foot { font-size: 12px; opacity: 0.7; position: relative; z-index: 1; }

.auth-form-side {
  display: grid;
  place-items: center;
  padding: 56px 32px;
  background: var(--pf-bg);
}
.auth-form {
  width: 100%;
  max-width: 380px;
}
.auth-form h2 {
  font-size: 26px !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  margin: 0 0 6px !important;
  color: var(--pf-text) !important;
}
.auth-form .lead {
  font-size: 14px;
  color: var(--pf-text-muted);
  margin-bottom: 28px;
}
.auth-form input[type=text],
.auth-form input[type=password] {
  padding: 14px 16px !important;
  font-size: 16px !important;
  font-weight: 500;
}
.auth-form button[type=submit],
.auth-form button {
  width: 100%;
  padding: 14px 22px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  background: var(--accent) !important;
  color: white !important;
  border: none !important;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.12s;
}
.auth-form button:hover { background: var(--accent-hover) !important; }

.auth-form .field-row { margin-bottom: 18px; }
.auth-form .field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--pf-text);
  margin-bottom: 6px;
}
.auth-form .field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--pf-text-muted);
}

/* ==========================================================================
   Helpers
   ========================================================================== */

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.text-muted { color: var(--pf-text-muted) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 12px !important; }
.mb-3 { margin-bottom: 20px !important; }
.mb-4 { margin-bottom: 28px !important; }
.mt-3 { margin-top: 20px !important; }

.divider {
  height: 1px;
  background: var(--pf-border);
  border: none;
  margin: 16px 0;
}

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 720px) {
  #sidebar {
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--pf-shadow-lg);
  }
  #sidebar:not(.active) { margin-left: 0; }
  #sidebar.active { margin-left: calc(-1 * var(--sidebar-w)); }
  .topbar { padding: 0 16px; }
  .page-title { font-size: 22px !important; }
}
