@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  color-scheme: light;
  
  /* Backgrounds & Surfaces */
  --bg-app: #f7f5f0;
  --bg-card: #ffffff;
  --bg-card-subtle: #fcfbf9;
  --bg-sidebar: #0f1a17;
  --bg-input: #ffffff;
  
  /* Borders & Shadows */
  --border: rgba(18, 32, 28, 0.08);
  --border-strong: rgba(18, 32, 28, 0.16);
  --shadow-sm: 0 1px 2px rgba(18, 32, 28, 0.04);
  --shadow: 0 4px 16px rgba(18, 32, 28, 0.06), 0 1px 2px rgba(18, 32, 28, 0.04);
  --shadow-lg: 0 12px 32px rgba(18, 32, 28, 0.08), 0 2px 6px rgba(18, 32, 28, 0.04);
  
  /* Text */
  --text-main: #12201c;
  --text-muted: #62726d;
  --text-dim: #94a39e;
  
  /* Nudge Primary Colors */
  --emerald: #0e6b5b;
  --emerald-dark: #0a5246;
  --emerald-light: #e8f5f2;
  --teal: #0d9488;
  --teal-light: #f0fdfa;
  
  /* Status & Accents */
  --amber: #d97706;
  --amber-light: #fffbeb;
  --red: #dc2626;
  --red-light: #fef2f2;
  --blue: #2563eb;
  --blue-light: #eff6ff;

  /* Typography Sizes */
  --font-page-title: 28px;
  --font-section-title: 20px;
  --font-card-title: 15px;
  --font-body: 14px;
  --font-meta: 12px;
  --font-metric: 32px;
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --sidebar-width: 246px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Legacy aliases to keep old classes working */
  --ink: var(--text-main);
  --muted: var(--text-muted);
  --paper: var(--bg-app);
  --panel: var(--bg-card);
  --surface-2: var(--bg-input);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --green: var(--emerald);
  --aqua: var(--teal);
  --danger: var(--red);
  --warning: var(--amber);
  --success: var(--emerald);
  --shadow: 0 4px 16px rgba(18, 32, 28, 0.06), 0 1px 2px rgba(18, 32, 28, 0.04);
  --shadow-soft: 0 1px 2px rgba(18, 32, 28, 0.04);
  --shadow-card: 0 12px 32px rgba(18, 32, 28, 0.08), 0 2px 6px rgba(18, 32, 28, 0.04);
  --sidebar-bg: var(--bg-sidebar);
  --sidebar-bg2: var(--bg-sidebar);
  --sidebar-text: rgba(255,255,255,0.65);
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #2dd4bf;
  --sidebar-hover: rgba(255,255,255,0.03);
  --sidebar-active: rgba(14, 107, 91, 0.22);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text-main);
  background: var(--bg-app);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }

/* Custom Scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Design System Utility Classes */
.empty-state { text-align:center; padding:40px 20px; color:var(--muted); }
.empty-state-icon, .empty-state svg { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); color: var(--muted); margin-bottom: 16px; font-size: 24px; }
.tag, .chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: rgba(104, 116, 111, .1); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.progress-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress-bar-fill { height: 100%; background: var(--green); border-radius: 999px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li { position: relative; padding: 12px 0 12px 20px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--green); }
.copy-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; color: var(--muted); transition: all 120ms ease; }
.copy-btn:hover { background: var(--surface-2); color: var(--ink); }
.date-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: rgba(21, 33, 30, .04); color: var(--muted); font-size: 12px; font-weight: 800; border: 1px solid var(--line); }
.section-title { margin: 0 0 16px; font-size: 18px; font-weight: 800; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.field-row label { font-size: 13px; font-weight: 700; white-space: nowrap; }
.field-row input, .field-row select, .field-row textarea { flex: 1; }
.field-row input[type="checkbox"], .field-row input[type="radio"] { flex: 0 0 auto; width: auto; min-height: auto; margin: 0; }

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(45, 183, 189, .15) 0%, #f5f2ea 50%, rgba(217, 164, 65, .15) 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 36px);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; margin-bottom: 32px; font-size: 20px; }
.auth-brand img { width: 34px; height: 34px; }
.auth-card h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.1; text-align: center; }
.auth-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; text-align: center; }
.auth-footer { margin-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-card input:focus-visible, .auth-card select:focus-visible, .auth-card textarea:focus-visible { border-color: rgba(45, 183, 189, .4); box-shadow: 0 0 0 4px rgba(45, 183, 189, .1); outline: none; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea, .ask-bar input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  gap: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.btn[disabled] { position: relative; color: transparent !important; pointer-events: none; opacity: 0.8; }
.btn[disabled]::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; border: 2px solid rgba(21, 33, 30, 0.2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; margin: -10px 0 0 -10px; }
.btn-primary[disabled]::after, .btn-danger[disabled]::after { border-color: rgba(255, 255, 255, 0.2); border-top-color: #fff; }

.btn-primary { background: var(--ink); color: #f5f2ea; }
.btn-primary:hover { background: #1a2e29; }
.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 30px; font-size: 12px; padding: 0 10px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.notice { border: 1px solid rgba(45, 183, 189, .24); background: rgba(45, 183, 189, .08); padding: 12px; border-radius: var(--radius); margin: 12px 0; color: #1d5b54; }
.notice.info { border-color: rgba(45, 183, 189, .24); background: rgba(45, 183, 189, .08); color: #1d5b54; }
.notice.success { border-color: rgba(14, 107, 91, .3); background: rgba(14, 107, 91, .08); color: var(--success); }
.notice.warn { border-color: rgba(217, 164, 65, .3); background: rgba(217, 164, 65, .08); color: var(--warning); }
.notice.error, .error { border-color: rgba(192, 57, 43, .3); background: rgba(192, 57, 43, .08); color: var(--danger); }
.fine-print { font-size: 13px; color: var(--muted); margin-top: 16px; }

.app-body { background: linear-gradient(135deg, #eef1ed 0%, #f0ede4 100%); font-size: 14px; }
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 0; /* No padding on sides for full width active state */
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  color: var(--sidebar-text);
  overflow-y: auto;
  box-shadow: 12px 0 34px rgba(21, 33, 30, .08);
  display: flex;
  flex-direction: column;
}
.side-brand { display: flex; align-items: center; gap: 10px; color: #fffdf8; font-weight: 800; margin-bottom: 22px; padding: 0 18px; }
.side-brand img { width: 34px; height: 34px; }
.sidebar nav { display: grid; gap: 3px; padding: 0 4px; }
.nav-heading {
  margin: 20px 14px 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245,242,234,.35);
  font-weight: 700;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  color: var(--sidebar-text);
  transition: all 150ms ease;
  border-left: 2px solid transparent;
}
.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}
.sidebar nav a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-accent);
  font-weight: 700;
  border-left: 2px solid var(--sidebar-accent);
}

.side-admin { 
  margin: 12px 14px; 
  padding: 9px 14px; 
  color: #fffdf8; 
  background: rgba(255, 255, 255, .07); 
  border-radius: var(--radius); 
  text-align: center;
  font-size: 13.5px;
}
.sidebar em { font-style: normal; color: rgba(255, 253, 248, .52); font-size: 11px; margin-left: auto; }
.main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  display: grid;
  grid-template-columns: minmax(220px, 520px) auto;
  gap: 18px;
  align-items: center;
  padding: 0 24px;
  background: rgba(244, 241, 232, .9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15,25,23,.06);
}
.ask-bar { margin: 0; }
.ask-bar input { min-height: 38px; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.top-actions a { font-weight: 700; color: var(--green); display: inline-flex; align-items: center; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .75);
  color: var(--ink);
  font-weight: 600;
}

.content { padding: 24px; }
.page-head { margin-bottom: 24px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 4px; color: var(--ink); }
.page-head p { color: var(--muted); font-size: 14px; margin: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel {
  background: #fff;
  border: 1px solid rgba(15,25,23,.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.panel h2, .panel h3 { margin: 0; line-height: 1.15; color: var(--ink); }
.panel h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.panel h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.panel p { color: var(--muted); line-height: 1.5; margin: 0; }
.metric {
  border-top: 3px solid var(--aqua);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.metric:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.metric b { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); line-height: 1; display: block; }
.metric span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: block; margin-top: 6px; }

.attention-list, .activity-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.attention-list li, .activity-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.attention-list small, .activity-list small, .status-pill { color: var(--muted); font-size: 12px; }
.quick-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.quick-actions .btn { justify-content: flex-start; }
.status-pill {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(14, 107, 91, .08);
  color: var(--green);
  padding: 6px 10px;
  font-weight: 700;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.filter-bar .field { margin-bottom: 0; flex: 1; min-width: 150px; }
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.permission-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #f0ede4;
  color: #637168;
  white-space: nowrap;
}
.badge.success { background: rgba(14,107,91,.1); color: #0a5a49; border: 1px solid rgba(14,107,91,.2); }
.badge.warning { background: rgba(217,164,65,.12); color: #7a5500; border: 1px solid rgba(217,164,65,.25); }
.badge.danger { background: rgba(192,57,43,.1); color: #9e2d22; border: 1px solid rgba(192,57,43,.2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.empty-note {
  border: 1px solid rgba(217, 164, 65, .26);
  background: rgba(217, 164, 65, .1);
  color: #5a430c;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0 0 14px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table, table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, th { 
  background: #f8f6f0; 
  font-size: 11px; 
  letter-spacing: 0.07em; 
  text-transform: uppercase; 
  color: var(--muted); 
  padding: 12px 14px; 
  border-bottom: 1.5px solid var(--line);
  text-align: left;
  white-space: nowrap; 
}
.data-table td, td { 
  padding: 12px 14px; 
  border-bottom: 1px solid var(--line); 
  vertical-align: middle; 
  white-space: nowrap; 
}
.data-table tbody tr, tbody tr { transition: background 120ms; }
.data-table tbody tr:hover, tbody tr:hover { background: rgba(45,183,189,.04); }
.data-table tbody tr td:first-child, tbody tr td:first-child { font-weight: 600; }

.row-menu { position: relative; }
.row-menu summary {
  display: inline-flex;
  min-height: 30px;
  font-size: 12px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu[open] > div {
  position: absolute;
  right: 0;
  z-index: 30;
  width: min(280px, 80vw);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
}
.row-menu form { display: grid; gap: 8px; margin: 0; }
.row-menu a,
.row-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #2c2114;
  color: #fff7e7;
  padding: 10px 18px;
  text-align: center;
  font-weight: 700;
}
.impersonation-banner a { text-decoration: underline; }
.crumb {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}
.profile-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,253,248,.96), rgba(248,246,239,.88));
  box-shadow: var(--shadow-soft);
}
.profile-header h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}
.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}
.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.action-strip form { margin: 0; }
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.inline-form select { min-height: 38px; }
.profile-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.profile-facts div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}
.profile-facts small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.profile-facts strong {
  display: block;
  overflow-wrap: anywhere;
}
.detail-grid { margin-top: 14px; }
.tab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.mini-table td,
.mini-table th { white-space: normal; }

/* KPI metric variant with accent strip */
.kpi-card {
  background: #fff;
  border: 1px solid rgba(15,25,23,.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--aqua), var(--green));
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card .kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.04em; color: var(--ink); line-height: 1; }
.kpi-card .kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-top: 8px; }
.kpi-card .kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Avatar / user initials */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aqua), var(--green));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* Section divider */
.section-sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* Stat bar */
.stat-bar { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stat-bar strong { color: var(--ink); font-weight: 700; }

/* Tab nav (top-level page tabs) */
.tab-nav {
  display: flex;
  gap: 2px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  white-space: nowrap;
  transition: color 120ms, border-color 120ms;
  border-radius: 4px 4px 0 0;
}
.tab-nav a:hover { color: var(--ink); }
.tab-nav a.active { color: var(--ink); border-bottom-color: var(--aqua); font-weight: 600; }

/* User row with avatar */
.user-row { display: flex; align-items: center; gap: 10px; }
.user-row .avatar { flex-shrink: 0; }
.user-row .user-info { min-width: 0; }
.user-row .user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .user-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Key pill (monospace code display) */
.key-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 8px;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { 
    position: fixed; 
    left: -280px; 
    top: 0; 
    bottom: 0; 
    z-index: 100;
    width: 280px;
    height: 100vh;
    transition: left 300ms ease;
  }
  .sidebar.open { left: 0; }
  .mobile-menu-toggle { display: inline-flex; }
  .sidebar nav { grid-template-columns: 1fr; }
  .nav-heading { grid-column: 1 / -1; margin-top: 12px; }
  .topbar { grid-template-columns: auto 1fr auto; padding: 12px 16px; }
  .top-actions { justify-content: flex-end; }
  .content { padding: 18px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .profile-header,
  .action-strip,
  .inline-form { flex-direction: column; align-items: stretch; }
  .profile-facts,
  .tab-grid { grid-template-columns: 1fr; }
  .page-head { display: grid; }
  .panel-head { display: grid; }
  .filter-bar { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
  .data-table thead, .table-wrap thead { display: none; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td,
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td { display: block; width: 100%; }
  .data-table tr, .table-wrap tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    margin-bottom: 10px;
    padding: 8px 10px;
  }
  .data-table td, .table-wrap td {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px dashed var(--line);
    padding: 9px 0;
    white-space: normal;
  }
  .data-table td:last-child, .table-wrap td:last-child { border-bottom: 0; }
  .data-table td::before, .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
  }
  .row-menu[open] > div { position: static; width: 100%; margin-top: 8px; }
}

@media print {
  .sidebar, .topbar, .action-strip, .quick-actions, .filter-bar, .row-menu { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .panel { border: none; box-shadow: none; padding: 0; }
}

/* User App Specific Classes */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.doc-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.doc-icon { font-size: 28px; flex-shrink: 0; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 10px; }
.doc-body { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.capture-bar { margin-bottom: 20px; }
.capture-form { display: flex; gap: 10px; align-items: center; }
.capture-input { flex: 1; min-height: 44px; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; background: #fff; transition: border-color 150ms; }
.capture-input:focus { border-color: var(--aqua); outline: none; box-shadow: 0 0 0 3px rgba(45,183,189,.12); }

.overdue { border-left: 3px solid var(--danger) !important; }
.due-soon { border-left: 3px solid var(--gold) !important; }

.family-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap:14px; margin-top:14px; }


/* NUDGE DESIGN SYSTEM V2 */

/* App Shell Components */
.app-body { background: var(--bg-app); color: var(--text-main); }
.sidebar { background: var(--bg-sidebar); width: 246px; border-right: 1px solid rgba(255,255,255,0.06); }
.sidebar nav a { padding: 8px 12px; border-radius: 8px; color: rgba(255,255,255,0.65); transition: color 150ms; }
.sidebar nav a:hover { color: #fff; }
.sidebar nav a.active { background: rgba(14, 107, 91, 0.22); color: #2dd4bf; font-weight: 700; border-left: 3px solid #2dd4bf; }
.sidebar nav a svg { width: 18px; height: 18px; stroke: currentColor; }
.topbar { background: rgba(247, 245, 240, 0.88); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.ask-bar input { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; }
.ask-bar input:focus { outline: 2px solid var(--emerald); outline-offset: -1px; }

/* Shared UI Components */
.panel, .card, .data-table-container, .table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: box-shadow 150ms ease, border-color 150ms ease;
}
.panel:hover, .card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.hero-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f4f0e6 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px 32px;
  box-shadow: var(--shadow);
}
.hero-banner .kicker, .hero-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: var(--emerald); text-transform: uppercase; margin-bottom: 6px;
}
.hero-banner h1, .hero-banner .title, .hero-title {
  font-size: var(--font-page-title); font-weight: 800; color: var(--text-main); margin: 0 0 6px;
}

.btn-primary { background: var(--emerald); color: #ffffff; font-weight: 700; border-radius: var(--radius); padding: 10px 18px; border: none; cursor: pointer; box-shadow: 0 2px 8px rgba(14, 107, 91, 0.25); }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-secondary { background: #ffffff; color: var(--text-main); border: 1px solid var(--border-strong); font-weight: 600; border-radius: var(--radius); padding: 10px 18px; }
.btn-secondary:hover { background: var(--bg-card-subtle); }
.btn-amber { background: #f59e0b; color: #ffffff; font-weight: 700; border-radius: var(--radius); padding: 10px 18px; border: none; cursor: pointer; }

.badge { border-radius: 999px; font-size: 11px; font-weight: 700; padding: 4px 10px; }
.badge-success, .badge-emerald { background: var(--emerald-light) !important; color: var(--emerald-dark) !important; border: none; }
.badge-warning, .badge-amber { background: var(--amber-light) !important; color: var(--amber) !important; border: none; }
.badge-danger, .badge-red { background: var(--red-light) !important; color: var(--red) !important; border: none; }

.data-table, table {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.data-table th, th {
  background: #f8f6f0; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.data-table td, td {
  padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.data-table tbody tr:hover, tbody tr:hover { background: #faf8f3; }

/* Accessibility Pass */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}
/* Enhanced Focus Visible */
*:focus-visible {
  outline: 2px solid var(--aqua) !important;
  outline-offset: 2px !important;
}
/* High Contrast Form Errors */
.error-text {
  color: #D92D20;
  font-weight: 600;
  margin-top: 4px;
  font-size: 13px;
}
.error-input {
  border-color: #D92D20 !important;
  box-shadow: 0 0 0 1px #D92D20 !important;
}

/* Mobile Touch Target Padding */
@media (max-width: 900px) {
  .btn, input, select, textarea, button, a.nav-link {
    min-height: 44px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
}

/* Notification Popover */
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: min(520px, calc(100vh - 80px));
  overflow-y: auto;
  z-index: 99999;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(0,0,0,0.15);
  border-radius: 12px;
}
.notification-dropdown .notif-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
@media (max-width: 430px) {
  .notification-dropdown {
    width: calc(100vw - 24px);
    right: -8px;
  }
}
