/* =========================================================
   Pawgress — Veterinary SaaS UI
   Drop-in stylesheet for Django templates
   No black. Calm teal + warm coral, cream surfaces.
   Works standalone. Tailwind optional (see bottom).
   ========================================================= */

/* ---------- Fonts ----------
   Add this to your base.html <head>:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
*/

:root {
  /* Brand — teal trust */
  --primary-50:  #effaf7;
  --primary-100: #d5f1e8;
  --primary-200: #ade2d1;
  --primary-300: #79ccb4;
  --primary-400: #46b196;
  --primary-500: #1f9479;     /* main */
  --primary-600: #157863;
  --primary-700: #115f50;
  --primary-color: var(--primary-500);
  --primary-hover: var(--primary-600);

  /* Accent — warm coral (paws + warmth) */
  --accent-50:  #fff3ef;
  --accent-100: #ffe1d6;
  --accent-300: #ffa98a;
  --accent-500: #ff7a59;
  --accent-600: #ea5d3b;

  /* Semantic */
  --success-color: #16a574;
  --success-soft:  #dcfce7;
  --warning-color: #f59e0b;
  --warning-soft:  #fef3c7;
  --danger-color:  #e5484d;
  --danger-soft:   #fee2e2;
  --info-color:    #2e8acd;
  --info-soft:     #dbeafe;

  /* Neutral — warm, never black */
  --ink-900: #1f2a37;          /* primary text (deep slate, not black) */
  --ink-700: #364152;
  --ink-500: #5b6776;
  --ink-400: #7a8696;
  --ink-300: #cdd5df;
  --ink-200: #e3e8ef;
  --ink-100: #f2f5f9;
  --cream:   #fdfbf6;          /* soft warm background */
  --paper:   #ffffff;

  /* Sidebar — deep teal, not black */
  --sidebar-bg:         #143b39;
  --sidebar-bg-2:       #0f2f2e;
  --sidebar-text:       #cfe3df;
  --sidebar-muted:      #8fb3ad;
  --sidebar-hover-bg:   rgba(255,255,255,0.06);
  --sidebar-active-bg:  rgba(255,255,255,0.10);
  --sidebar-hover-text: #ffffff;

  /* Aliases (compat with your old vars) */
  --secondary-color: var(--ink-100);
  --text-dark:  var(--ink-900);
  --text-body:  var(--ink-700);
  --text-muted: var(--ink-500);
  --bg-color:   var(--cream);
  --card-bg:    var(--paper);
  --border-color: var(--ink-200);

  /* Layout */
  --sidebar-width: 264px;
  --header-height: 68px;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Shadows — soft, layered */
  --shadow-xs: 0 1px 2px rgba(20, 59, 57, 0.06);
  --shadow-sm: 0 2px 4px rgba(20, 59, 57, 0.06), 0 1px 2px rgba(20, 59, 57, 0.04);
  --shadow:    0 6px 16px -8px rgba(20, 59, 57, 0.18), 0 2px 4px rgba(20, 59, 57, 0.04);
  --shadow-lg: 0 24px 48px -24px rgba(20, 59, 57, 0.28), 0 4px 8px rgba(20, 59, 57, 0.06);

  /* Signature gradients */
  --gradient-primary: linear-gradient(135deg, #1f9479 0%, #46b196 60%, #79ccb4 100%);
  --gradient-hero:    linear-gradient(135deg, #143b39 0%, #1f9479 55%, #46b196 100%);
  --gradient-warm:    linear-gradient(135deg, #ff7a59 0%, #ffa98a 100%);
  --gradient-cream:   linear-gradient(180deg, #fdfbf6 0%, #f5f1e7 100%);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(900px 500px at 100% -10%, rgba(31,148,121,0.07), transparent 60%),
    radial-gradient(700px 400px at -10% 100%, rgba(255,122,89,0.06), transparent 60%);
  color: var(--text-body);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  color: var(--text-dark);
  margin: 0 0 0.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.125rem; }

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

::selection { background: var(--primary-200); color: var(--primary-700); }

/* ---------- Utilities ---------- */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }    .mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }       .mt-4 { margin-top: 1.5rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: .5rem; } .gap-3 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }

/* ---------- Cards ---------- */
.glass-card,
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.glass-card:hover,
.card:hover { box-shadow: var(--shadow); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: .875rem;
  margin-bottom: 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-dark);
}

/* ---------- Layout ---------- */
.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.3s ease;
}

.dashboard-layout.collapsed {
  grid-template-columns: 0 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .3s ease;
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow-y: auto;
  overflow-x: hidden;
  white-space: nowrap;
}
/* Soft paw silhouette accent */
.sidebar::after {
  content: "";
  position: absolute; inset: auto -40px -60px auto;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(70,177,150,0.18), transparent 65%);
  pointer-events: none;
}

.sidebar .brand {
  height: var(--header-height);
  display: flex; align-items: center; gap: .65rem;
  padding: 0 1.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 1rem;
}
/* .sidebar .brand::before removed since we now use an inline SVG logo */

.sidebar .nav-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-muted);
  padding: 0 1.5rem .5rem;
  font-weight: 600;
}

.sidebar nav {
  display: flex; flex-direction: column;
  padding: 0 .75rem;
  gap: .15rem;
}
.sidebar a {
  position: relative;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: .7rem .9rem;
  border-radius: 10px;
  transition: all .15s ease;
  font-weight: 500;
  font-size: .92rem;
  display: flex; align-items: center; gap: .65rem;
}
.sidebar a:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}
.sidebar a.active {
  background: linear-gradient(135deg, rgba(31,148,121,0.34), rgba(255,122,89,0.16));
  color: var(--sidebar-hover-text);
  font-weight: 800;
  border: 1px solid rgba(213, 241, 232, .24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 10px 24px -18px rgba(0,0,0,.55);
}
.sidebar a.active::before {
  content: ""; position: absolute; left: -4px; top: 14%; bottom: 14%;
  width: 4px; border-radius: 4px;
  background: var(--gradient-warm);
}

.sidebar-logout-form {
  margin: .25rem .55rem 1rem;
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .7rem .9rem;
  border: 1px solid rgba(255, 122, 89, .4);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--danger-color), var(--accent-600));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px -14px rgba(229, 72, 77, .75);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}

.sidebar-logout-btn:hover {
  filter: brightness(1.03);
  box-shadow: 0 14px 26px -16px rgba(229, 72, 77, .85);
}

.sidebar-logout-btn:active {
  transform: translateY(1px);
}

/* Sidebar profile card */
.sidebar-footer {
  margin: auto .75rem 1rem;
  padding: .85rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; gap: .65rem;
}
.sidebar-footer .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gradient-primary);
  color: #fff; font-weight: 700; font-size: .85rem;
}

/* ---------- Main / Header ---------- */
.main-wrapper { display: flex; flex-direction: column; width: 100%; overflow-x: hidden; }

.top-header {
  height: var(--header-height);
  background: rgba(255,255,255,0.8);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky; top: 0; z-index: 50;
}

.search-input {
  display: flex; align-items: center; gap: .5rem;
  background: var(--ink-100);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: .55rem .85rem;
  width: 360px; max-width: 100%;
  transition: all .15s ease;
}
.search-input:focus-within {
  background: #fff;
  border-color: var(--primary-300);
  box-shadow: 0 0 0 4px var(--primary-50);
}
.search-input input {
  border: 0; background: transparent; outline: none;
  font: inherit; color: var(--text-dark); width: 100%;
}

.sidebar-toggle {
  display: inline-grid; place-items: center;
  background: var(--ink-100); border: 1px solid var(--border-color);
  width: 40px; height: 40px; border-radius: 10px;
  font-size: 1.2rem; cursor: pointer; color: var(--text-dark);
}

.main-content { padding: 2rem; flex: 1; overflow-y: auto; }

/* ---------- Page header ---------- */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.page-header h1 { font-size: 1.6rem; margin: 0; }
.page-header .subtitle { color: var(--text-muted); margin-top: .25rem; font-size: .92rem; }

/* Greeting / hero banner */
.hero-banner {
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
  color: #fff;
  background: var(--gradient-hero);
  box-shadow: var(--shadow-lg);
}
.hero-banner h1 { color: #fff; font-size: 1.75rem; }
.hero-banner p  { color: rgba(255,255,255,0.85); margin: .35rem 0 1rem; max-width: 520px; }
.hero-banner::before,
.hero-banner::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.12); filter: blur(10px); pointer-events: none;
}
.hero-banner::before { width: 220px; height: 220px; top: -80px; right: -40px; }
.hero-banner::after  { width: 160px; height: 160px; bottom: -70px; left: 30%; background: rgba(255,169,138,0.25); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .45rem;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600; font-size: .88rem;
  cursor: pointer; text-decoration: none;
  font-family: inherit;
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:hover { 
  transform: translateY(-2px); 
  filter: brightness(1.05);
}
.btn:active { transform: translateY(1px); filter: brightness(0.95); }

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(31,148,121,.55);
}
.btn-primary:hover { box-shadow: 0 10px 22px -10px rgba(31,148,121,.7); }

.btn-secondary {
  background: var(--paper);
  color: var(--text-dark);
  border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--ink-100); border-color: var(--ink-300); }

.btn-accent {
  background: var(--gradient-warm);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(255,122,89,.55);
}

.btn-danger { background: var(--danger-color); color: #fff; }
.btn-danger:hover { background: #c93b3f; }

.btn-outline {
  background: transparent; border-color: var(--border-color); color: var(--text-body);
}
.btn-outline:hover { border-color: var(--primary-400); color: var(--primary-600); background: var(--primary-50); }

.btn-outline-primary { background: transparent; border-color: var(--primary-color); color: var(--primary-color); }
.btn-outline-primary:hover { background: var(--primary-color); color: #fff; }

.btn-outline-secondary { background: transparent; border-color: var(--ink-400); color: var(--ink-700); }
.btn-outline-secondary:hover { background: var(--ink-100); color: var(--text-dark); border-color: var(--ink-500); }

.btn-outline-danger { background: transparent; border-color: var(--danger-color); color: var(--danger-color); }
.btn-outline-danger:hover { background: var(--danger-color); color: #fff; }

.btn-outline-info { background: transparent; border-color: var(--info-color); color: var(--info-color); }
.btn-outline-info:hover { background: var(--info-color); color: #fff; }

.btn-outline-success { background: transparent; border-color: var(--success-color); color: var(--success-color); }
.btn-outline-success:hover { background: var(--success-color); color: #fff; }

.btn-outline-warning { background: transparent; border-color: var(--warning-color); color: var(--warning-color); }
.btn-outline-warning:hover { background: var(--warning-color); color: #fff; }
.btn-success { background: var(--success-color); color: #fff; }
.btn-success:hover { background: #139064; }

.btn-warning { background: var(--warning-color); color: #fff; }
.btn-warning:hover { background: #df8e0a; }

.btn-info { background: var(--info-color); color: #fff; }
.btn-info:hover { background: #267ab6; }

.btn-light { background: #ffffff; color: var(--ink-800); border-color: var(--ink-200); }
.btn-light:hover { background: var(--ink-50); border-color: var(--ink-300); }


.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; border-radius: 12px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; margin-bottom: .4rem;
  font-weight: 600; color: var(--text-dark); font-size: .85rem;
}
.form-control, .form-select {
  display: block; width: 100%;
  padding: .65rem .85rem;
  font-size: .9rem; font-family: inherit;
  color: var(--text-dark);
  background: var(--paper);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}
.form-control::placeholder { color: var(--ink-400); }
.form-control:focus, .form-select:focus {
  border-color: var(--primary-400); outline: 0;
  box-shadow: 0 0 0 4px var(--primary-50);
}

.form-help {
  display: block;
  margin-top: .35rem;
  color: var(--text-muted);
  font-size: .82rem;
}

.form-error,
.field-error {
  color: var(--danger-color);
  font-size: .86rem;
}

.form-error {
  padding: .85rem 1rem;
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger-color);
  border-radius: var(--radius);
}

input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--primary-color);
  cursor: pointer;
}

/* ---------- Staff access form ---------- */
.staff-form-header {
  margin-bottom: 1.5rem;
}

.staff-form-header p {
  color: var(--text-muted);
  margin: .25rem 0 0;
}

.staff-form-card {
  max-width: 760px;
}

.staff-form {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.staff-field-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: .2rem;
}

.module-access-header {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding-top: .35rem;
  border-top: 1px solid var(--border-color);
}

.module-access-panel {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-bottom: 1.5rem;
}

.module-access-header h5 {
  margin: 0;
  color: var(--text-dark);
  font-size: 1rem;
}

.module-access-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: .88rem;
}

.module-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .75rem;
  padding: 1rem;
  background: linear-gradient(180deg, var(--primary-50), #ffffff);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
}

.module-access-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 48px;
  padding: .75rem .85rem;
  background: var(--paper);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.module-access-item:hover,
.module-access-item:focus-within {
  border-color: var(--primary-300);
  box-shadow: 0 0 0 4px var(--primary-50);
}

.module-access-check {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.module-access-label {
  color: var(--text-dark);
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.25;
  cursor: pointer;
}

.module-access-help {
  color: var(--text-muted);
  font-size: .82rem;
  margin-top: .2rem;
}

.account-status-item {
  background: var(--accent-50);
  border-color: var(--accent-100);
}

.staff-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .25rem;
}

/* ---------- Tables ---------- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  padding: .9rem 1.1rem;
  vertical-align: middle;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.table th {
  background: linear-gradient(180deg, #f7faf9, #f1f5f4);
  font-weight: 700;
  color: var(--text-dark);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: var(--primary-50); }
.table tbody tr:last-child td { border-bottom: 0; }

.appointment-table .appointment-actions-heading,
.appointment-table .appointment-actions-cell {
  text-align: right;
}

.appointment-table .appointment-actions-cell {
  min-width: 260px;
}

.appointment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: nowrap;
}

.appointment-actions form {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  margin: 0;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3em .7em;
  font-size: .72em; font-weight: 700;
  text-align: center; white-space: nowrap;
  border-radius: 9999px;
  border: 1px solid transparent;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9;
}
.badge-success   { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.badge-warning   { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.badge-danger    { background: var(--danger-soft);  color: #991b1b; border-color: #fecaca; }
.badge-primary   { background: var(--primary-50);   color: var(--primary-700); border-color: var(--primary-200); }
.badge-secondary { background: var(--ink-100);      color: var(--ink-700); border-color: var(--ink-200); }
.badge-accent    { background: var(--accent-50);    color: var(--accent-600); border-color: var(--accent-100); }

/* ---------- Alerts ---------- */
.alert {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: 10px;
  font-weight: 500;
}
.alert-success { background: var(--success-soft); border-color: #bbf7d0; border-left-color: var(--success-color); color: #166534; }
.alert-error, .alert-danger { background: var(--danger-soft); border-color: #fecaca; border-left-color: var(--danger-color); color: #991b1b; }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; border-left-color: var(--warning-color); color: #92400e; }
.alert-info    { background: var(--info-soft);    border-color: #bfdbfe; border-left-color: var(--info-color);    color: #1e40af; }

/* ---------- Auth ---------- */
.auth-wrapper {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh;
  background: var(--gradient-hero);
  position: relative; overflow: hidden;
  padding: 1rem;
}
.auth-wrapper::before,
.auth-wrapper::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: .5; pointer-events: none;
}
.auth-wrapper::before { width: 380px; height: 380px; top: -100px; left: -80px; background: rgba(255,169,138,0.45); }
.auth-wrapper::after  { width: 420px; height: 420px; bottom: -120px; right: -90px; background: rgba(70,177,150,0.45); }

.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
}
.auth-card h1 { font-size: 1.5rem; text-align: center; }
.auth-card .auth-sub { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ---------- Metric / KPI cards ---------- */
.metric-card {
  position: relative; overflow: hidden;
  border-left: 4px solid var(--primary-color);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.metric-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg) !important;
}
.metric-card:hover .metric-icon {
  transform: scale(1.15) rotate(5deg);
}
.metric-card .metric-icon {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-50);
  color: var(--primary-600);
  font-size: 1.1rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.metric-card.accent  { border-left-color: var(--accent-500); }
.metric-card.accent  .metric-icon { background: var(--accent-50); color: var(--accent-600); }
.metric-card.success { border-left-color: var(--success-color); }
.metric-card.success .metric-icon { background: var(--success-soft); color: #166534; }
.metric-card.warning { border-left-color: var(--warning-color); }
.metric-card.warning .metric-icon { background: var(--warning-soft); color: #92400e; }

.metric-title {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  margin-bottom: .5rem;
}
.metric-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.metric-trend {
  display: inline-flex; align-items: center; gap: .25rem;
  margin-top: .5rem;
  font-size: .8rem; font-weight: 600;
  color: var(--success-color);
}
.metric-trend.down { color: var(--danger-color); }

/* ---------- Patient / appointment list items ---------- */
.list-item {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.list-item:hover {
  background: var(--primary-50);
  border-color: var(--primary-100);
}
.pet-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--gradient-primary);
  color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.pet-avatar.cat   { background: linear-gradient(135deg, #ff7a59, #ffa98a); }
.pet-avatar.rabbit{ background: linear-gradient(135deg, #b794f4, #d6bcfa); }
.pet-avatar.bird  { background: linear-gradient(135deg, #2e8acd, #79c2f4); }

/* ---------- Invoice detail / print ---------- */
.invoice-container {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 0 0 1.5rem;
}

.invoice-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.invoice-box {
  background: var(--paper);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  overflow: hidden;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.invoice-clinic {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
  max-width: 720px;
}

.invoice-logo {
  width: 96px;
  height: 96px;
  max-width: 96px;
  max-height: 96px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  flex: 0 0 auto;
}

.invoice-muted {
  color: var(--text-muted);
  margin: .35rem 0 0;
  font-size: .95rem;
  line-height: 1.65;
}

.invoice-title-block {
  text-align: right;
  flex: 0 0 auto;
  min-width: 220px;
}

.invoice-title-block h2 {
  margin: .45rem 0 .15rem;
  font-size: 1.55rem;
  color: var(--primary-700);
}

.invoice-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  margin: 1.25rem 0;
  padding: 1rem;
  background: linear-gradient(180deg, var(--primary-50), #ffffff);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
}

.invoice-details h4,
.invoice-payment-history h4 {
  margin-bottom: .45rem;
  font-size: .95rem;
}

.invoice-details p {
  margin: 0;
  color: var(--text-body);
  font-size: .95rem;
  line-height: 1.65;
}

.invoice-table {
  font-size: .95rem;
}

.invoice-totals {
  width: min(420px, 100%);
  margin: 1.5rem 0 0 auto;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #f8faf9;
}

.invoice-totals p,
.invoice-totals h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: .55rem 0;
}

.invoice-totals p + p,
.invoice-totals h3 {
  border-top: 1px solid var(--border-color);
}

.invoice-totals h3 {
  color: var(--primary-700);
  font-size: 1.1rem;
}

.invoice-payment-history {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--border-color);
}

.invoice-payment-table {
  font-size: .88rem;
}

.invoice-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.invoice-paid-amount {
  color: var(--success-color);
  font-weight: 700;
}

.invoice-thanks {
  margin-top: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

@media (max-width: 768px) {
  .invoice-container {
    width: min(100% - 1rem, 1120px);
    padding-top: .75rem;
  }

  .invoice-box {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  .invoice-header,
  .invoice-clinic {
    flex-direction: column;
  }

  .invoice-title-block {
    text-align: left;
  }

  .invoice-details {
    grid-template-columns: 1fr;
  }

  .invoice-action-bar {
    justify-content: stretch;
  }

  .invoice-action-bar .btn {
    flex: 1 1 100%;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm;
  }

  html,
  body {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff;
    background-image: none;
    color: #1f2a37;
    font-size: 10.5pt;
  }

  .no-print,
  .sidebar,
  .top-header,
  .messages {
    display: none !important;
  }

  .dashboard-layout {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .main-wrapper {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-content {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .invoice-container {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
    overflow: visible !important;
  }

  .invoice-box {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    overflow: visible !important;
  }

  .invoice-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 16pt;
    padding-bottom: 8pt;
    margin-bottom: 8pt;
    border-bottom: 1px solid #dfe6ee;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice-clinic {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 10pt;
    max-width: none;
    flex: 1 1 auto;
  }

  .invoice-clinic h1 {
    font-size: 15pt;
    margin-bottom: 4pt;
  }

  .invoice-muted {
    font-size: 8.5pt;
    line-height: 1.45;
    margin-top: 0;
  }

  .invoice-title-block {
    text-align: right !important;
    min-width: 150px;
    flex: 0 0 auto;
  }

  .invoice-title-block h2 {
    font-size: 14pt;
    color: #115f50;
    margin: 2pt 0;
  }

  .invoice-logo {
    box-shadow: none;
    width: 56px;
    height: 56px;
    max-width: 56px;
    max-height: 56px;
    border-radius: 6px;
  }

  .invoice-details {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 12pt;
    background: #f7faf9;
    border: 1px solid #dfe6ee;
    margin: 0 0 10pt;
    padding: 8pt 10pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice-details h4 {
    font-size: 9pt;
    margin-bottom: 3pt;
  }

  .invoice-details p {
    font-size: 9pt;
    line-height: 1.4;
  }

  .table-responsive {
    overflow: visible !important;
    border-radius: 0;
  }

  .table,
  .invoice-table {
    width: 100% !important;
    display: table !important;
    overflow: visible !important;
    border-radius: 0;
    font-size: 9pt;
    break-inside: auto;
    page-break-inside: auto;
  }

  .table thead,
  .invoice-table thead {
    display: table-header-group !important;
  }

  .table tbody,
  .invoice-table tbody {
    display: table-row-group !important;
  }

  .table tr,
  .invoice-table tr {
    display: table-row !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table th,
  .table td,
  .invoice-table th,
  .invoice-table td {
    display: table-cell !important;
    padding: 5pt 6pt;
    border-bottom: 1px solid #dfe6ee;
  }

  .table th,
  .invoice-table th {
    background: #eef3f2 !important;
    color: #1f2a37 !important;
    font-size: 7.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .invoice-totals {
    width: 52%;
    min-width: 200px;
    margin-top: 10pt;
    padding: 8pt 10pt;
    background: #f7faf9;
    border: 1px solid #dfe6ee;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice-totals p,
  .invoice-totals h3 {
    padding: 3pt 0;
    font-size: 9.5pt;
  }

  .invoice-totals h3 {
    font-size: 11pt;
    color: #115f50;
  }

  .invoice-payment-history {
    margin-top: 12pt;
    padding-top: 10pt;
    border-top: 1px solid #dfe6ee;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice-payment-history h4 {
    font-size: 10pt;
    margin-bottom: 6pt;
  }

  .invoice-payment-table {
    font-size: 8.5pt;
  }

  .invoice-thanks {
    margin-top: 14pt;
    font-size: 9pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .badge {
    font-size: 7.5pt;
    padding: 2pt 6pt;
    border: 1px solid currentColor;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .invoice-paid-amount,
  .invoice-totals h3 {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  a[href]::after {
    content: none !important;
  }
}

/* ---------- Pet search field ---------- */
.pet-search-field {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.pet-search-input {
  width: 100%;
  text-overflow: ellipsis;
}

.pet-search-select {
  width: 100%;
}

.pet-search-select.is-open {
  min-height: 2.75rem;
  box-shadow: var(--shadow-sm);
}

.pet-search-select option {
  padding: .5rem .65rem;
}

/* ---------- Clinic setup tabs ---------- */
.setup-panel {
  padding-top: 0;
}

.setup-tabs {
  display: flex;
  gap: .5rem;
  border-bottom: 1px solid var(--border-color);
  margin: 0 0 1.5rem;
  padding: 0 1rem;
}

.setup-tab {
  display: inline-flex;
  align-items: center;
  padding: .9rem 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}

.setup-tab:hover {
  color: var(--primary-color);
}

.setup-tab.is-active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.setup-form {
  padding: 0 1.5rem 1.5rem;
}

.setup-section-title {
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.form-section + .form-section {
  margin-top: 30px;
}

.setup-actions {
  margin-top: 30px;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

.setup-qr-preview {
  max-width: 150px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 5px;
  background: white;
}

.setup-staff-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Scrollbar polish ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 10px; border: 2px solid var(--cream); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-300); }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .search-input { width: 220px; }
}
@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: calc(-1 * var(--sidebar-width));
    height: 100vh; width: var(--sidebar-width);
  }
  .sidebar.show { left: 0; }
  .sidebar-toggle { display: inline-grid; place-items: center; }
  .top-header { padding: 0 1rem; }
  .main-content { padding: 1.25rem; }
  .hero-banner  { padding: 1.25rem 1.25rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .search-input { display: none; }
}

/* =========================================================
   OPTIONAL — Using Tailwind in Django
   1) Install:  pip install django-tailwind
                or use the Tailwind CLI:
                npx tailwindcss -i ./input.css -o ./static/css/tailwind.css --watch
   2) In your base.html load Tailwind AFTER this file so its
      utilities can override when you need them:
        <link rel="stylesheet" href="{% static 'css/style.css' %}">
        <link rel="stylesheet" href="{% static 'css/tailwind.css' %}">
   3) Use the same brand tokens in tailwind.config.js:
        theme: { extend: { colors: {
          primary: { DEFAULT:'#1f9479', 600:'#157863', 50:'#effaf7' },
          accent:  { DEFAULT:'#ff7a59', 600:'#ea5d3b' },
        }}}
   ========================================================= */
