/* ============================================================
   Hyde Legal Group Admin — main.css
   Variables, reset, layout primitives (login, topnav, sidebar, main)
   ============================================================ */

:root {
  /* Brand colors — Hyde Legal Group */
  --green: #1B5E20;
  --green-dark: #153820;
  --green-light: #2A643B;
  --green-pale: #e8f2eb;
  --green-tint: #f4f9f5;
  --gold: #C59E47;
  --gold-light: #D4B06A;
  --gold-dark: #a8873c;

  /* Neutrals */
  --gray-900: #1a1a1a;
  --gray-700: #3d3d3d;
  --gray-500: #6b6b6b;
  --gray-400: #767676;
  --gray-300: #b0b0b0;
  --gray-200: #d4d4d4;
  --gray-100: #ececec;
  --gray-50:  #f7f7f7;
  --white: #fff;

  /* Status */
  --success: #4CAF50;
  --warning: #FF9800;
  --error:   #F44336;
  --info:    #2196F3;

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 72px;
  --nav-h: 110px;   /* matches .topnav height — primary-nav + main-wrap derive from this */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* , *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── LOGIN SCREEN ───────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  /* `safe center` keeps centering when the card fits and falls back to
     flex-start when the card is taller than the viewport, so the top of
     the card never gets clipped above the scroll origin. */
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--green), var(--green) 40%, var(--green-dark) 70%, var(--green));
  transition: opacity 0.5s, transform 0.5s;
}
.login-screen.hidden { opacity: 0; transform: scale(1.05); pointer-events: none; }

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.login-card img { display: block; margin: 0 auto 28px; height: 160px; width: auto; }
.login-card h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  text-align: center;
  margin-bottom: 4px;
}
.login-card .subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 28px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}
.login-field input:focus { border-color: var(--green); }

/* Password visibility toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--gray-600, #6c757d);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.pw-toggle:hover { color: var(--green, #1a5f3f); background: rgba(0,0,0,0.04); }
.pw-toggle:focus-visible { outline: 2px solid var(--green, #1a5f3f); outline-offset: 1px; }
.pw-toggle .pw-eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .pw-eye { display: none; }
.pw-toggle[aria-pressed="true"] .pw-eye-off { display: inline-block; }
.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s;
  margin-top: 8px;
}
.login-btn:hover { background: var(--green-dark); }
.login-activate {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 12px;
  transition: all 0.2s;
}
.login-activate:hover { background: var(--gold); color: #fff; }
.login-forgot {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 16px;
  cursor: pointer;
}
.login-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 6px;
  min-height: 16px;
}

/* Small "2FA required" note under the login form */
.login-mfa-note {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--green-pale, #e8f5e9);
  color: var(--green);
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.login-mfa-note svg { stroke: currentColor; fill: none; }

/* ── MFA ENROLLMENT + VERIFICATION CARDS ────────────────────── */
.mfa-card {
  max-width: 520px;
  padding: 36px 40px;
}
.mfa-card img { height: 96px; margin-bottom: 14px; }
.mfa-card h2 { margin-bottom: 6px; font-size: 22px; }
.mfa-card .subtitle {
  margin-bottom: 18px;
  color: var(--gray-600, #6c757d);
  font-size: 13px;
}

/* "Setting up for: jordan@..." pill */
.mfa-account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0 0 18px;
  background: var(--green-pale, #e8f5e9);
  border: 1px solid rgba(26, 95, 63, 0.15);
  border-radius: 999px;
  font-size: 13px;
  color: var(--green, #1a5f3f);
  max-width: 100%;
  overflow: hidden;
}
.mfa-account-pill svg { flex-shrink: 0; stroke: currentColor; }
.mfa-account-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  flex-shrink: 0;
}
.mfa-account-email {
  font-weight: 600;
  color: var(--gray-900, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.mfa-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 10px;
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mfa-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0;
}
.mfa-steps li strong { color: var(--gray-900, #212529); font-weight: 600; }
.mfa-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.mfa-qr-row {
  display: flex;
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  margin-bottom: 18px;
}
.mfa-qr {
  flex-shrink: 0;
  /* 196px QR canvas (set in app.js) + 4px padding on each side = 204px. */
  width: 204px;
  height: 204px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px solid var(--gray-100);
}
.mfa-qr canvas { display: block; }
.mfa-qr-loading {
  font-size: 12px;
  color: var(--gray-500, #adb5bd);
  text-align: center;
  padding: 12px;
}
.mfa-qr-fallback {
  font-size: 12px;
  color: var(--gray-700, #495057);
  text-align: center;
  padding: 10px;
  line-height: 1.45;
}
.mfa-qr-fallback strong { display: block; margin-bottom: 4px; color: var(--gray-900, #212529); }
.mfa-qr-fallback p { margin: 0; }
.mfa-secret-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.mfa-secret-block label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gray-500, #adb5bd);
  text-transform: uppercase;
  margin: 0;
}
.mfa-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--gray-900);
  background: #fff;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  word-break: break-all;
  user-select: all;
  letter-spacing: 0.02em;
}
.mfa-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.mfa-copy svg { stroke: currentColor; }
.mfa-copy:hover { background: var(--green-pale, #e8f5e9); color: var(--green); border-color: var(--green); }

.mfa-hint {
  font-size: 12px;
  color: var(--gray-500);
  text-align: center;
  margin: 0 0 14px;
  word-break: break-word;
}

/* Make the 6-digit code input feel like an OTP input */
#mfaEnrollCode, #mfaVerifyCode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.5em;
  text-align: center;
  font-weight: 600;
  color: var(--gray-900);
}

@media (max-width: 580px) {
  .mfa-card { padding: 24px; }
  .mfa-qr-row { flex-direction: column; align-items: stretch; gap: 14px; }
  .mfa-qr { align-self: center; }
  .mfa-account-pill { font-size: 12px; padding: 8px 12px; }
  .mfa-account-label { display: none; }
}

/* ── TOP NAV ──────────────────────────────────────────────────
   The legal admin uses a horizontal mega-menu on desktop instead
   of a left sidebar. The sidebar markup is kept in the DOM but
   hidden on desktop and turned into a mobile drawer on small
   screens. The main-wrap no longer offsets by --sidebar-w on
   desktop because the nav lives on top.
*/
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 110px;     /* slim — white card fills the entire topnav, no green above/below */
  /* Hyde green gradient — light at the top fading deeper to the bottom */
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  border-bottom: 1px solid rgba(0,0,0,0.18);
  box-shadow: 0 2px 14px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  /* Respect iPhone notch / Dynamic Island safe-area */
  padding-top: max(0px, env(safe-area-inset-top));
  z-index: 100;
  color: #fff;
}
/* On the gradient, override subtle UI affordances so they're visible. */
.topnav .topnav-btn { color: rgba(255,255,255,0.82); }
.topnav .topnav-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.topnav .topnav-search {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
}
.topnav .topnav-search input { color: #fff; }
.topnav .topnav-search input::placeholder { color: rgba(255,255,255,0.7); }
.topnav .topnav-search svg { stroke: rgba(255,255,255,0.7); }
.topnav .clock-btn {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
}
.topnav .clock-btn:hover { background: rgba(255,255,255,0.22); }
.topnav .topnav-user { color: #fff; cursor: pointer; }
.topnav .topnav-user:hover { background: rgba(255,255,255,0.14); }

.topnav-brand {
  display: inline-flex; align-items: center; gap: 14px;
  /* Zero vertical padding so the white card hugs the logo edge-to-edge; the
     topnav itself controls vertical breathing room (currently 0 — card fills
     the full topnav height for an edge-to-edge wordmark). */
  padding: 0 18px 0 8px;
  height: 100%;
  border-radius: 12px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  background: rgba(255,255,255,0.96);   /* white card on the dark green topnav */
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  overflow: hidden;
}
.topnav-brand:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
/* Re-bind --nav-h at each breakpoint so primary-nav and main-wrap stay aligned. */
@media (max-width: 1024px) {
  :root { --nav-h: 92px; }
  .topnav { height: 92px; }
  .topnav-brand img { width: 92px !important; height: 92px !important; }
  .topnav-brand span > span:first-child { font-size: 24px !important; }
}
@media (max-width: 720px) {
  :root { --nav-h: 64px; }
  .topnav { height: 64px; padding: 0 12px; }
  .topnav-brand img { width: 56px !important; height: 56px !important; }
  .topnav-brand span > span:first-child { font-size: 16px !important; }
  .topnav-brand span > span:last-child { font-size: 9px !important; letter-spacing: .18em !important; }
}

/* ── PRIMARY HORIZONTAL NAV (mega-menu) ───────────────────── */
.primary-nav {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  height: 44px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  z-index: 99;
  display: flex; align-items: center;
  padding: 0 24px;
}
.pn-list { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pn-item { position: relative; }
.pn-top {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  cursor: pointer; transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.pn-top:hover { background: var(--gray-50); color: var(--green-dark); }
.pn-item.is-active > .pn-top { color: var(--green); background: var(--green-pale); }
.pn-chev { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; opacity: 0.6; transition: transform 0.15s; }
.pn-item.pn-has-menu:hover .pn-chev { transform: rotate(180deg); }

/* Mega-menu dropdown — uses an invisible bridge so the cursor can travel
   from the trigger to the menu without crossing a "dead" gap. */
.pn-mega {
  position: absolute;
  top: 100%;            /* sit flush so the cursor never leaves the hover zone */
  left: 0;
  min-width: 480px;
  max-width: 640px;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10);
  padding: 10px;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  animation: pnMegaIn 0.12s ease-out;
  /* Hover-intent buffer above the menu so dropdown doesn't snap shut */
  margin-top: 0;
}
.pn-mega::before {
  content: '';
  position: absolute;
  left: -20px;
  right: -20px;
  top: -20px;
  height: 24px;
  background: transparent;   /* invisible bridge — wide for forgiving cursor travel */
}
.pn-mega-narrow { grid-template-columns: 1fr; min-width: 280px; }
.pn-top.pn-top-accent {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 600;
}
.pn-top.pn-top-accent:hover { background: rgba(255, 255, 255, 0.22); }
/* Stays open on hover, focus-within (keyboard), AND while a `data-pinopen`
   attribute is set by the JS hover-intent handler. */
.pn-item.pn-has-menu:hover .pn-mega,
.pn-item.pn-has-menu:focus-within .pn-mega,
.pn-item.pn-has-menu[data-pinopen="1"] .pn-mega { display: grid; }
/* Add a generous hit-area below the trigger so cursor travel is forgiving */
.pn-item.pn-has-menu > .pn-top { padding-bottom: 14px; margin-bottom: -10px; }
.pn-link {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.pn-link strong { font-size: 13px; color: var(--gray-900); font-weight: 600; }
.pn-link small { font-size: 11px; color: var(--gray-500); }
.pn-link:hover { background: var(--green-pale); }
.pn-link:hover strong { color: var(--green-dark); }
@keyframes pnMegaIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.topnav-left { display: flex; align-items: center; gap: 16px; }
.topnav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 8px;
  padding: 8px 14px;
  width: 320px;
}
.topnav-search svg { width: 16px; height: 16px; stroke: var(--gray-400); stroke-width: 2; fill: none; flex-shrink: 0; }
.topnav-search input { border: none; background: none; outline: none; font-size: 13px; width: 100%; }

.topnav-right { display: flex; align-items: center; gap: 12px; }
.topnav-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.topnav-btn:hover { background: var(--gray-50); color: var(--gray-900); }
.topnav-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.topnav-btn .dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--error);
  border: 2px solid #fff;
}
.clock-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.clock-btn.active { background: var(--green-pale); color: var(--green); }
.clock-btn.active::before {
  content: ""; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.topnav-user { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.topnav-user:hover { background: var(--gray-50); }
.topnav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #eef2f6;
  color: #fff;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* ── SIDEBAR (mobile drawer only on desktop layout) ─────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--green-dark);
  z-index: 110;
  display: none;            /* hidden on desktop — primary nav replaces it */
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.22s var(--ease);
}
body.sidebar-open .sidebar {
  display: flex;
  transform: translateX(0);
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.25);
}
.sidebar-brand {
  padding: 18px 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--gray-100, #e9ecef);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
}
.sidebar-brand img {
  height: 210px;
  width: auto;
  max-width: 100%;
  display: block;
  transition: opacity 0.15s;
}
.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--green-dark, #144b32);
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 24px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 8px 12px 6px;
  margin-top: 12px;
}
.sidebar-label:first-child { margin-top: 0; }

.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
  cursor: pointer;
  user-select: none;
}
.sb-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sb-link.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 500; }
.sb-link svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.sb-link.featured {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
}
.sb-link.featured:hover { filter: brightness(1.08); }
.sb-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}
.sidebar-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

/* ── MAIN CONTENT WRAPPER ───────────────────────────────────── */
.app { display: none; }
.app.show { display: block; }

.main-wrap {
  margin-left: 0;
  /* Top nav (60-ish) + primary horizontal nav (44) */
  margin-top: calc(var(--nav-h) + 44px);
  padding: 28px;
  min-height: calc(100vh - var(--nav-h) - 44px);
  background: #f6f7f9;
}

/* ── MODERN STAT TILES (CaseFox-style colored cards) ───────── */
/* Used by dashboard.js + financials.js for the colored Financial
   Overview tiles. Each tile gets a subtle gradient + icon chip. */
.mod-tile {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.mod-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,0.06); }
.mod-tile-lbl { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #6b7280; margin-bottom: 6px; }
.mod-tile-val { font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 600; color: #111827; line-height: 1.05; }
.mod-tile-sub { font-size: 11px; color: #6b7280; margin-top: 6px; }
.mod-tile-icon {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.mod-tile-icon svg { width: 18px; height: 18px; stroke-width: 2; fill: none; }

/* Color variants */
.mod-tile.tile-blue   { background: linear-gradient(135deg,#dbeafe 0%,#fff 60%); }
.mod-tile.tile-blue   .mod-tile-icon { background: #2563eb; color: #fff; }
.mod-tile.tile-green  { background: linear-gradient(135deg,#dcfce7 0%,#fff 60%); }
.mod-tile.tile-green  .mod-tile-icon { background: #16a34a; color: #fff; }
.mod-tile.tile-orange { background: linear-gradient(135deg,#ffedd5 0%,#fff 60%); }
.mod-tile.tile-orange .mod-tile-icon { background: #f97316; color: #fff; }
.mod-tile.tile-slate  { background: linear-gradient(135deg,#e5e7eb 0%,#fff 60%); }
.mod-tile.tile-slate  .mod-tile-icon { background: #1f2937; color: #fff; }
.mod-tile.tile-purple { background: linear-gradient(135deg,#ede9fe 0%,#fff 60%); }
.mod-tile.tile-purple .mod-tile-icon { background: #8b5cf6; color: #fff; }
.mod-tile.tile-rose   { background: linear-gradient(135deg,#ffe4e6 0%,#fff 60%); }
.mod-tile.tile-rose   .mod-tile-icon { background: #f43f5e; color: #fff; }

/* ── Legal Lion PracticePanther-style accents ───────────────
   Scoped to .ll-page so it doesn't bleed into the rest of the
   admin. Royal blue header bar inside the Legal Lion shell with
   the 4-stat-tile pattern (Trust / Paid / Due / Billable) used
   on contact cards. */
.ll-page {
  --ll-blue:       #2147D6;
  --ll-blue-dark:  #1A39B2;
  --ll-blue-soft:  #DCE5FF;
}
.ll-hero {
  background: linear-gradient(135deg, var(--ll-blue), var(--ll-blue-dark));
  color: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.ll-hero h2 { font-family: 'Cormorant Garamond', serif; font-size: 26px; margin: 0; color: #fff; }
.ll-hero p  { margin: 4px 0 0; font-size: 13px; color: rgba(255,255,255,0.85); }
.ll-tab-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; background: #fff; border: 1px solid #eef0f3; border-radius: 12px; margin-bottom: 14px; }
.ll-tab-bar .btn-sm { padding: 8px 14px; font-size: 12px; font-weight: 600; border-radius: 8px; }
.wf-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }

/* Modern card frame (rounded, soft border, hover lift) */
.mod-card {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 14px;
  padding: 18px 20px;
  transition: box-shadow 0.15s;
}
.mod-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.04); }
.mod-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.mod-card-head h3 { font-size: 15px; font-weight: 600; color: #111827; margin: 0; }
.mod-card-head small { font-size: 11px; color: #9ca3af; }

/* Calendar Events strip — colored event chips by day */
.mod-cal-strip { display: flex; flex-direction: column; gap: 10px; }
.mod-cal-day { display: flex; gap: 12px; align-items: stretch; }
.mod-cal-date { flex-shrink: 0; width: 48px; text-align: center; padding: 6px 0; border-radius: 10px; background: #f9fafb; }
.mod-cal-date .mc-dow { font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em; }
.mod-cal-date .mc-num { font-size: 18px; font-weight: 700; color: #111827; line-height: 1; }
.mod-cal-event { flex: 1; padding: 10px 12px; border-radius: 10px; font-size: 12px; }
.mod-cal-event .mc-title { font-weight: 600; color: #111827; }
.mod-cal-event .mc-time  { font-size: 10px; color: #6b7280; }
.mod-cal-event.ev-blue   { background: #dbeafe; }
.mod-cal-event.ev-green  { background: #dcfce7; }
.mod-cal-event.ev-orange { background: #ffedd5; }
.mod-cal-event.ev-purple { background: #ede9fe; }
.mod-cal-event.ev-rose   { background: #ffe4e6; }

.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn 0.2s var(--ease); }

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

.page-head {
  margin-bottom: 24px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-head-text h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 4px;
}
.page-head-text p { font-size: 14px; color: var(--gray-500); }
.page-head-actions { display: flex; gap: 8px; }

/* ── MOBILE DRAWER PRIMITIVES ──────────────────────────────── */
.sb-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  background: transparent;
  margin-right: 4px;
  flex-shrink: 0;
  touch-action: manipulation;
}
.sb-hamburger:hover { background: var(--gray-50); color: var(--gray-900); }
.sb-hamburger svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
.sb-hamburger:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 109;
  animation: fadeIn 0.15s var(--ease);
}
.sb-overlay.show { display: block; }

/* ── RESPONSIVE — TABLET (≤1024) ─────────────────────────────
   Compact horizontal mega-menu, smaller search box. */
@media (max-width: 1024px) and (min-width: 721px) {
  .topnav-search { width: 200px; }
  .topnav-user span:not(.topnav-avatar) { display: none; }
  .pn-top { padding: 8px 10px; font-size: 12px; }
  .primary-nav { padding: 0 12px; }
  .main-wrap { padding: 20px; }
}

/* ── RESPONSIVE — PHONE (≤720) ───────────────────────────────
   Sidebar becomes a slide-in drawer. Hamburger appears in topnav.
   Main content spans full width. All grids stack. */
@media (max-width: 720px) {
  /* Hide horizontal mega-menu — drawer nav takes over */
  .primary-nav { display: none; }
  /* The phone-size .topnav-brand img sizing is set in the rule near line 461 */

  body.sidebar-open { overflow: hidden; }
  .sidebar-brand img { height: 120px; }
  .sidebar-brand-sub { display: block; }
  .sidebar-label { display: block; }
  .sidebar .sb-link { justify-content: flex-start; padding: 11px 12px; }
  .sidebar .sb-link span:not(.sb-badge) { display: inline; }
  .sidebar-foot { justify-content: flex-start; font-size: 0; padding: 16px; gap: 10px; }

  /* Topnav */
  .topnav { padding: 0 12px; }
  .sb-hamburger { display: inline-flex; }
  .topnav-left { gap: 8px; flex: 1; min-width: 0; }
  .topnav-search { width: 100%; flex: 1; min-width: 0; }
  .topnav-right { gap: 4px; }
  .topnav-user span:not(.topnav-avatar) { display: none; }
  .topnav-user { padding: 2px 4px; }
  .clock-btn { padding: 6px 10px; font-size: 11px; }

  /* Main */
  .main-wrap {
    margin-left: 0;
    margin-top: var(--nav-h);
    min-height: calc(100vh - var(--nav-h));
    padding: 16px;
  }

  /* Page head stacks vertically, actions full width */
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head-actions { justify-content: flex-start; flex-wrap: wrap; }
  .page-head-text h1 { font-size: 22px; }
}

/* ── RESPONSIVE — SMALL PHONE (≤420) ─────────────────────────
   Edge polish: tighter paddings, hide purely-decorative topnav
   items that duplicate sidebar affordances. */
@media (max-width: 420px) {
  .main-wrap { padding: 12px; }
  .topnav { padding: 0 8px; }
  /* Hide the search on the smallest phones — still reachable via sidebar links */
  .topnav-search { display: none; }
  /* Hide the help button; Notifications + Clock + Signout still present */
  .topnav-btn[title="Help"] { display: none; }
  .page-head-text h1 { font-size: 20px; }
  .page-head-text p { font-size: 13px; }
}
