/* PropTrack — Ledger Desk (docs/design/dashboard-visual-system.md) */

:root {
  --grey-50: #f4f6f9;
  --grey-100: #e8ecf1;
  --grey-200: #d5dce5;
  --grey-400: #8b95a5;
  --grey-500: #5a6572;
  --grey-800: #1e2a3a;
  --grey-900: #121a24;

  --teal-50: #e6f5f1;
  --teal-100: #d8f0eb;
  --teal-500: #0c7c69;
  --teal-600: #096b5b;
  --teal-700: #075a4c;

  --navy-800: #163a5f;
  --navy-900: #0e2744;
  --navy-950: #0a1c30;

  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #b54708;
  --warn-soft: #fff4e8;
  --success: #157a3c;
  --success-soft: #e8f7ef;
  --info: #163a5f;
  --info-soft: #e8eef6;

  --canvas: var(--grey-50);
  --surface: #ffffff;
  --ink: var(--grey-900);
  --muted: var(--grey-500);
  --line: var(--grey-200);
  --accent: var(--teal-500);
  --accent-hover: var(--teal-600);
  --accent-soft: var(--teal-100);

  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-page: 1.25rem;
  --text-section: 0.6875rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius: 8px;
  --sidebar-w: 220px;
  --shadow: 0 1px 2px rgba(18, 26, 36, 0.04), 0 4px 16px rgba(18, 26, 36, 0.06);
  --ease: ease;
  --dur: 120ms;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
}

body.app-body {
  display: block;
}

a { color: var(--accent); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

/* ——— App shell ——— */

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: flex-start; /* sidebar must not stretch with page content */
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  max-height: 100dvh;
  padding: var(--space-4) var(--space-3);
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.88);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: block;
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand span { color: #7dd3c4; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-nav a.is-active {
  background: rgba(12, 124, 105, 0.28);
  border-left-color: #7dd3c4;
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer form { margin: 0; }

.sidebar-footer button {
  width: 100%;
  min-height: 44px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.sidebar-footer button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

/* Hidden on desktop — sidebar is always visible. Shown only in mobile media query. */
.app-main > .sidebar-menu-btn {
  display: none;
  align-items: center;
  align-self: flex-start;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  margin: var(--space-3) var(--space-4) 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--ink);
  cursor: pointer;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-content {
  flex: 1;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding: var(--space-5) var(--space-6) var(--space-6);
  box-sizing: border-box;
}

/* Mobile sidebar collapse */
@media (max-width: 860px) {
  .app-main > .sidebar-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(18, 26, 36, 0.4);
    cursor: pointer;
  }

  /* Sibling + :has so the Menu label (nested in .app-main) still opens the drawer */
  #nav-toggle:checked ~ .sidebar,
  .app-shell:has(#nav-toggle:checked) .sidebar {
    transform: translateX(0);
  }

  #nav-toggle:checked ~ .sidebar-backdrop,
  .app-shell:has(#nav-toggle:checked) .sidebar-backdrop {
    display: block;
  }

  .app-content {
    padding: var(--space-4);
  }
}

/* Auth (no shell) — Ledger Desk guest screens */
body.is-auth {
  background: var(--navy-950);
}

body.is-auth .app-shell { display: none; }

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  overflow: hidden;
  padding: var(--space-6) var(--space-6) 0;
  color: rgba(255, 255, 255, 0.9);
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(12, 124, 105, 0.35), transparent 55%),
    radial-gradient(90% 70% at 90% 20%, rgba(22, 58, 95, 0.9), transparent 50%),
    linear-gradient(165deg, var(--navy-800) 0%, var(--navy-950) 55%, #071420 100%);
}

.auth-visual-glow {
  position: absolute;
  inset: -20% 20% auto -10%;
  height: 55%;
  background: radial-gradient(ellipse at center, rgba(125, 211, 196, 0.18), transparent 70%);
  pointer-events: none;
  animation: auth-glow 8s ease-in-out infinite alternate;
}

.auth-visual-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 70%);
  pointer-events: none;
}

.auth-visual-copy {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: 28rem;
  padding-bottom: var(--space-5);
  animation: auth-fade 700ms var(--ease) 120ms both;
}

.auth-visual-brand {
  margin: 0 0 var(--space-4);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.1;
}

.auth-visual-brand span { color: #7dd3c4; }

.auth-visual-headline {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: #fff;
}

.auth-visual-sub {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  max-width: 26rem;
}

/* Skyline band under copy — no absolute overlap with brand */
.auth-skyline-wrap {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  height: clamp(110px, 18vh, 160px);
  margin-inline: calc(-1 * var(--space-6));
  pointer-events: none;
  isolation: isolate;
}

.auth-skyline-wrap::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 48px;
  z-index: 1;
  background: linear-gradient(180deg, rgba(10, 28, 48, 0.95), transparent);
  pointer-events: none;
}

.auth-skyline {
  display: block;
  width: 108%;
  max-width: none;
  height: 100%;
  margin-left: -4%;
  color: rgba(6, 18, 32, 0.88);
  animation: auth-rise 900ms var(--ease) both;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background:
    linear-gradient(180deg, var(--grey-50) 0%, #eef2f6 100%);
}

.auth-layout {
  /* legacy single-column fallback if used elsewhere */
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: var(--space-5) var(--space-5) var(--space-6);
  animation: auth-fade 500ms var(--ease) both;
}

.auth-kicker {
  margin: 0 0 var(--space-2);
  font-size: var(--text-section);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-600);
}

.auth-brand {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.35rem, 2.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.auth-brand span { color: var(--accent); }

.auth-card .lede {
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.45;
}

.auth-card .stack { max-width: none; }

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.auth-form .field label,
.auth-label-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.auth-form input {
  min-height: 44px;
  width: 100%;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap .password-input {
  width: 100%;
  padding-right: 48px;
  min-height: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
}

.password-toggle:hover {
  background: var(--grey-100);
  color: var(--ink);
  border: none;
  box-shadow: none;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.password-toggle .icon {
  width: 18px;
  height: 18px;
}

/* Country code + national number (login, reset, team add) */
.phone-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.phone-field-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  min-width: 0;
}

.phone-country {
  flex: 0 0 auto;
  width: auto;
  min-width: 7.5rem;
  min-height: 44px;
  padding: 0 0.65rem;
  font-variant-numeric: tabular-nums;
}

.phone-national {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  width: 100%;
}

.phone-field .field-hint,
.field .field-hint {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.auth-forgot {
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.auth-forgot:hover { text-decoration: underline; }

.auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: var(--space-1);
}

.auth-foot {
  margin: var(--space-4) 0 0;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.45;
}

.auth-foot a { font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.auth-foot-tip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  margin-top: var(--space-5);
}

.auth-foot-tip .icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--teal-600);
}

@keyframes auth-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-rise {
  from { opacity: 0; transform: translate(-4%, 12px); }
  to { opacity: 1; transform: translate(-4%, 0); }
}

@keyframes auth-glow {
  from { opacity: 0.7; transform: translateY(0); }
  to { opacity: 1; transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-visual-glow,
  .auth-skyline,
  .auth-visual-copy,
  .auth-card {
    animation: none;
  }
}

/* Mobile: lean header, no skyline clash, one brand signal on the form */
@media (max-width: 860px) {
  body.is-auth {
    background: var(--grey-50);
  }

  .auth-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
  }

  .auth-visual {
    min-height: 0;
    padding: var(--space-5) var(--space-4) var(--space-4);
    justify-content: flex-start;
  }

  .auth-visual-copy {
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-bottom: 0;
    max-width: none;
  }

  .auth-visual-brand {
    font-size: 1.35rem;
    margin-bottom: var(--space-2);
  }

  .auth-visual-headline {
    font-size: var(--text-sm);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.82);
    margin: 0;
    max-width: 22rem;
  }

  .auth-visual-sub {
    display: none;
  }

  .auth-skyline-wrap {
    display: none; /* dots/skyline off on phone — clear brand only */
  }

  .auth-main {
    padding: var(--space-4);
    align-items: center;
    justify-content: center;
    background: var(--grey-50);
  }

  .auth-card {
    max-width: none;
    margin-top: 0;
  }

  /* Avoid PropTrack twice: visual already shows brand */
  .auth-card > .auth-brand {
    display: none;
  }

  .auth-card .auth-kicker {
    margin-bottom: var(--space-3);
  }

  .auth-card .lede {
    margin-bottom: var(--space-4);
  }
}



/* ——— Type ——— */

h1, .page-title {
  margin: 0;
  font-size: var(--text-page);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
}

h2, .section-label {
  margin: 0 0 var(--space-3);
  font-size: var(--text-section);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede, .muted { color: var(--muted); }
.page-sub {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ——— Page header ——— */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* ——— Surfaces ——— */

.panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.form-panel {
  max-width: 28rem;
  display: grid;
  gap: var(--space-3);
}

.form-panel-wide {
  max-width: none;
  width: 100%;
}

/* Listing create/edit — full content width, multi-column fields */
.listing-form {
  gap: var(--space-4);
  padding: var(--space-5);
}

.listing-form .section-label {
  margin: 0;
  grid-column: 1 / -1;
}

.listing-form .field {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.listing-form .field input,
.listing-form .field select,
.listing-form .field textarea {
  width: 100%;
}

.listing-form .field-full {
  grid-column: 1 / -1;
}

.listing-form .field-row {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.listing-form .field-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.listing-form .field-row-2 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
}

.listing-form .field-hint {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

.listing-form .req {
  color: var(--danger);
  font-weight: 600;
}

.listing-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
  margin-top: var(--space-1);
}

.listing-form .form-actions .btn-ghost,
.listing-form .form-actions .btn-primary,
.listing-form .form-actions a.btn-ghost,
.listing-form .form-actions a.btn-primary {
  min-height: 44px;
}

.listing-form .photo-urls-optional {
  margin: 0;
}

@media (max-width: 860px) {
  .listing-form .field-row-3,
  .listing-form .field-row-2 {
    grid-template-columns: 1fr;
  }
}

.home-section {
  margin-top: var(--space-5);
}

.home-section.is-overdue {
  border-left: 3px solid var(--warn);
  background: linear-gradient(90deg, var(--warn-soft), var(--surface) 40%);
}

.home-snapshot {
  display: grid;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.snapshot-block {
  display: grid;
  gap: var(--space-3);
}

.snapshot-block .section-label .muted {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-left: var(--space-2);
}

.snapshot-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: var(--space-3);
}

.snapshot-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--grey-50);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

a.snapshot-item:hover {
  border-color: var(--accent);
  background: var(--teal-50);
}

.snapshot-item.is-warn {
  border-color: #f0c9a8;
  background: var(--warn-soft);
}

.snapshot-item.is-accent {
  border-color: var(--teal-100);
  background: var(--teal-50);
}

.snapshot-item.is-success {
  border-color: #b9e4c8;
  background: var(--success-soft);
}

.snapshot-value {
  font-family: var(--font-mono);
  font-size: var(--text-page);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.snapshot-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.snapshot-stake {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: var(--text-sm);
}

.snapshot-stake strong {
  color: var(--ink);
  font-weight: 600;
}

.home .empty-section {
  margin: 0;
  font-size: var(--text-sm);
}

.home .empty-inline {
  margin-bottom: var(--space-4);
}

/* ——— Flash ——— */

.flash {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--teal-100);
  border-left: 3px solid var(--accent);
  background: var(--teal-50);
  font-size: var(--text-sm);
}

.flash-error {
  border-color: #f3c1bc;
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.flash-info {
  border-color: var(--teal-100);
  border-left-color: var(--accent);
  background: var(--teal-50);
  color: var(--ink);
}

.flash-debug {
  border-color: #f5d0a8;
  border-left-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

/* ——— Forms ——— */

.stack {
  display: grid;
  gap: var(--space-3);
  max-width: 28rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

label {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--muted);
}

input, select, textarea, button {
  font: inherit;
  font-size: var(--text-sm);
  padding: 0 12px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

button,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

button:hover,
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.btn-ghost:hover {
  background: var(--grey-100);
  border-color: var(--grey-200);
}

.btn-ghost:disabled,
.btn-ghost[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.page-header-actions a.btn-ghost,
.page-header-actions a.btn-primary,
.toolbar-actions a.btn-ghost,
.toolbar-actions a.btn-primary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

.upload-zone {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1.5px dashed rgba(12, 124, 105, 0.4);
  border-radius: var(--radius);
  background: var(--teal-50);
}

.upload-zone input[type="file"] {
  width: 100%;
  min-height: auto;
  padding: var(--space-2);
  border: none;
  background: transparent;
}

.upload-zone .muted {
  margin: 0;
  font-size: var(--text-xs);
}

.photo-urls-optional summary {
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.photo-urls-optional textarea { width: 100%; }

/* ——— Filters / table ——— */

.filters {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-search {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-search .icon {
  position: absolute;
  left: 12px;
  pointer-events: none;
  color: var(--grey-400);
}

.filter-search input {
  width: 100%;
  padding-left: 40px;
}

@media (max-width: 640px) {
  .filters { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel .table-wrap {
  border: none;
  border-radius: 0;
}

.leads-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-table, var(--text-sm));
}

.leads-table th,
.leads-table td,
.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.leads-table tr:last-child td,
.data-table tr:last-child td { border-bottom: none; }

.leads-table tbody tr:hover,
.data-table tbody tr:hover {
  background: var(--grey-50);
}

.leads-table th,
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--grey-50);
}

.leads-table a,
.data-table a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.leads-table a:hover,
.data-table a:hover { text-decoration: underline; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 2px 8px;
  background: var(--grey-100);
  color: var(--grey-500);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

/* Lead statuses (models.LEAD_STATUSES) */
.status[data-status="Not Contacted"] {
  background: var(--grey-100);
  color: var(--grey-500);
}
.status[data-status="Contacted"] {
  background: var(--info-soft);
  color: var(--info);
}
.status[data-status="Follow Up"] {
  background: var(--warn-soft);
  color: var(--warn);
}
.status[data-status="Site Visit"] {
  background: var(--teal-50);
  color: var(--teal-700);
}
.status[data-status="Negotiation"] {
  background: #fef3c7;
  color: #b45309;
}
.status[data-status="Junk Lead"] {
  background: var(--danger-soft);
  color: var(--danger);
}
.status[data-status="Lost Lead"] {
  background: #f0ecea;
  color: #6b4a46;
}
.status[data-status="Won"] {
  background: var(--success-soft);
  color: var(--success);
}

/* Listing statuses (LISTING_STATUSES) */
.status[data-status="Available"] {
  background: var(--teal-50);
  color: var(--teal-700);
}
.status[data-status="Under Offer"] {
  background: var(--warn-soft);
  color: var(--warn);
}
.status[data-status="Sold"] {
  background: var(--success-soft);
  color: var(--success);
}
.status[data-status="Withdrawn"] {
  background: var(--grey-100);
  color: var(--grey-500);
}

.empty {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty p {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
}

.empty .muted {
  font-weight: 400;
  font-size: var(--text-sm);
}

.crumb {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--muted);
}

.crumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.status-lg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 4px 10px;
  font-weight: 600;
  border-radius: 999px;
  font-size: var(--text-sm);
  /* Color comes from .status[data-status="…"] when both classes are set */
}

.block {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line);
}

.block.panel {
  padding: var(--space-4);
  border-top: none;
  margin-top: var(--space-4);
}

.timeline,
.note-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li,
.note-feed li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}

.timeline li:last-child,
.note-feed li:last-child { border-bottom: none; }

.timeline time {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  margin-bottom: var(--space-1);
}

.timeline p,
.note-feed li p { margin: var(--space-1) 0 0; }

.overflow-note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
}

.report-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-3);
}

.report-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--muted);
  border: 1px solid transparent;
}

.report-nav a:hover {
  color: var(--ink);
  background: var(--grey-100);
}

.report-nav a.is-active {
  color: var(--teal-700);
  background: var(--teal-50);
  border-color: var(--teal-100);
  font-weight: 600;
}

.report-nav a.btn-ghost {
  /* reset legacy class on report tabs */
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.report-nav a.btn-ghost.is-active {
  color: var(--teal-700);
  background: var(--teal-50);
  border-color: var(--teal-100);
}

.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
}

.report-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.report-preset {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
}

.report-preset:hover {
  color: var(--ink);
  border-color: var(--grey-300);
}

.report-preset.is-active {
  color: var(--teal-700);
  background: var(--teal-50);
  border-color: var(--teal-100);
  font-weight: 600;
}

.report-range-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  max-width: 22rem;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}

.stake-block {
  background: var(--teal-50);
  padding: var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  border: 1px solid var(--teal-100);
}

.stake-hero {
  margin: var(--space-1) 0;
  font-size: var(--text-page);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

.stake-note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-4);
}

.photo-grid-lg {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.photo-card {
  display: block;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 1;
  margin: 0;
}

.photo-card > a {
  display: block;
  width: 100%;
  height: 100%;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove-form {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  margin: 0;
}

.photo-remove-btn {
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(18, 26, 36, 0.15);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.photo-remove-btn:hover {
  background: #fff;
  border-color: var(--danger, #b42318);
  color: var(--danger, #b42318);
}

.listing-photos {
  margin-bottom: var(--space-5);
}

.listing-photos-empty {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-5);
  text-align: center;
}

.listing-photos-empty p {
  margin: 0;
}

.listing-photos-empty .muted {
  margin-top: var(--space-2);
}

.listing-photo-upload {
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.listing-thumb-cell {
  width: 4rem;
  padding-right: 0;
}

.listing-thumb {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  background: var(--canvas);
}

.url-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  word-break: break-all;
}

/* ——— Icons ——— */

.icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.15em;
}

.icon-sm {
  width: 1em;
  height: 1em;
}

.icon-muted {
  color: var(--grey-400);
}

.sidebar-nav a,
.btn-icon,
.btn-primary,
.btn-ghost,
button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-nav a {
  display: flex;
}

.sidebar-nav a .icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.section-label .icon {
  opacity: 0.75;
}

.tel-link,
.follow-pill,
.crumb a,
.page-header-actions a,
.empty p {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.fact dt {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lead-hero-status .follow-pill {
  display: inline-flex;
}

.url-list li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
}

/* ——— Lead detail ——— */

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.quick-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
}

.quick-action:hover {
  border-color: var(--teal-100);
  background: var(--teal-50);
  color: var(--teal-700);
}

.quick-action .icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.page-title .icon,
.eyebrow .icon,
.timeline time {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.action-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.lead-hero {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.lead-hero-main { min-width: 0; flex: 1; }

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

.tel-link {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
  color: var(--accent);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.tel-link:hover { text-decoration: underline; }

.meta-sep { color: var(--grey-400); }

.lead-hero-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}

.last-update-line {
  margin: 0;
  font-size: var(--text-xs);
  text-align: right;
  max-width: 16rem;
}

.follow-pill {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--teal-700);
  background: var(--teal-50);
  padding: 4px 10px;
  border-radius: 999px;
}

.follow-pill-warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.lead-facts {
  margin-bottom: var(--space-4);
}

.muted-hint {
  margin: calc(var(--space-2) * -1) 0 var(--space-4);
  font-size: var(--text-xs);
}

/* Click-to-edit values on lead detail */
.inline-edit {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.lead-meta .inline-edit,
.inline-edit-phone {
  flex: 0 0 auto;
  min-width: min-content;
}

.lead-created {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.inline-edit-view {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: 100%;
  margin: 0;
  padding: 2px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: text;
  min-height: 36px;
}

.inline-edit-view .inline-edit-text {
  white-space: nowrap;
}

.inline-edit-view .icon {
  display: inline-block;
  flex-shrink: 0;
}

.page-title .inline-edit {
  display: block;
  max-width: 100%;
}

.page-title .inline-edit-view {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  min-height: 44px;
  padding: 2px 8px;
  margin-left: -8px;
  white-space: normal;
}

.fact .inline-edit {
  display: block;
  width: 100%;
}

.fact .inline-edit-view {
  white-space: normal;
}

.inline-edit-view:hover {
  background: var(--grey-100);
  border-color: var(--line);
}

.inline-edit-view:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.inline-edit-input {
  display: none;
  width: 100%;
  max-width: 28rem;
  margin: 0;
}

.inline-edit.is-editing .inline-edit-view {
  display: none;
}

.inline-edit.is-editing .inline-edit-input {
  display: block;
}

.inline-edit-block.is-editing .inline-edit-input {
  min-height: 88px;
}

.fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: 0;
}

.fact dt {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 var(--space-1);
}

.fact dd {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
}

.fact-wide {
  grid-column: 1 / -1;
}

.lead-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.action-card .action-hint,
.notes-panel .action-hint {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--muted);
}

.action-form,
.note-compose {
  display: grid;
  gap: var(--space-3);
}

.action-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.notes-panel {
  margin-bottom: var(--space-5);
}

.note-compose {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}

.notes-empty {
  margin-top: var(--space-2);
  padding: var(--space-5);
}

.empty-inline {
  display: flex;
  justify-content: center;
  align-items: center;
}

.empty-inline p {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  white-space: nowrap;
}

.empty-inline .muted {
  font-weight: 400;
  font-size: var(--text-sm);
}

.empty-inline .icon {
  flex-shrink: 0;
}

.timeline li {
  padding-left: var(--space-4);
  border-left: 2px solid var(--teal-100);
  margin-left: var(--space-1);
}

@media (max-width: 720px) {
  .lead-hero {
    flex-direction: column;
  }

  .lead-hero-status {
    align-items: flex-start;
  }

  .last-update-line {
    text-align: left;
  }

  .lead-actions {
    grid-template-columns: 1fr;
  }

  .fact-grid {
    grid-template-columns: 1fr;
  }
}

/* Meta channels + inbound messages */
.channel-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: var(--space-4, 1rem);
  margin-bottom: var(--space-4, 1rem);
  background: var(--surface, #fff);
}

.channel-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2, 0.5rem);
  margin-bottom: var(--space-2, 0.5rem);
}

.channel-card-title {
  margin: 0;
  font-size: 1.125rem;
}

.channel-status {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.channel-status[data-state="connected"] {
  color: #0f766e;
  background: #ccfbf1;
  border-color: #99f6e4;
}

.channel-status[data-state="inactive"],
.channel-status[data-state="disabled"] {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.channel-status[data-state="empty"] {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

/* Admin org subscription soft status (labels required — color secondary) */
.channel-status[data-state="active_trial"],
.channel-status[data-state="active_plan"] {
  color: #0f766e;
  background: #ccfbf1;
  border-color: #99f6e4;
}

.channel-status[data-state="expired"] {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.channel-status[data-state="none"] {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.channel-meta {
  margin: 0 0 var(--space-2, 0.5rem);
  font-size: 0.875rem;
  color: var(--muted, #64748b);
}

.channel-connect {
  margin-top: var(--space-3, 0.75rem);
}

.channel-connect > summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.channel-form {
  margin-top: var(--space-3, 0.75rem);
  max-width: 28rem;
}

.channel-disconnect {
  margin-top: var(--space-2, 0.5rem);
}

.team-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2, 0.5rem);
}

.team-set-password > summary {
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.team-set-password > summary::-webkit-details-marker {
  display: none;
}

.team-set-password[open] > summary {
  margin-bottom: var(--space-2, 0.5rem);
}

.team-set-password .listing-form {
  max-width: 16rem;
}

.team-empty {
  margin-bottom: var(--space-4);
}

.team-member-name {
  font-weight: 500;
}

.team-you {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #5a6572);
  background: #f1f5f9;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
}

.team-col-actions {
  width: 3rem;
  text-align: right;
  vertical-align: middle;
}

.team-table-wrap {
  overflow: visible;
}

.team-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius, 8px);
  border: 1px solid transparent;
  color: var(--muted, #5a6572);
  background: transparent;
  cursor: pointer;
}

.team-menu-trigger:hover,
.team-menu-trigger[aria-expanded="true"] {
  background: #f1f5f9;
  border-color: var(--line, #d5dce5);
  color: var(--ink, #121a24);
}

/* Fixed floating popover — never lays out inside the table */
.team-popover {
  position: fixed;
  z-index: 400;
  min-width: 11.5rem;
  padding: 0.35rem;
  margin: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #d5dce5);
  border-radius: var(--radius, 8px);
  box-shadow: 0 10px 28px rgba(18, 26, 36, 0.16);
}

.team-popover[hidden] {
  display: none !important;
}

.team-menu-form {
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
  border: 0;
}

/* Reset global `button` (centered accent CTA) so menu rows align like SaaS ⋮ menus */
.team-popover .team-menu-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  margin: 0;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink, #121a24);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition: background var(--dur, 0.15s) var(--ease, ease);
}

.team-popover .team-menu-item .icon,
.team-popover .team-menu-item .icon-sm {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 1.125rem;
  margin: 0;
  opacity: 0.9;
}

.team-popover .team-menu-item:hover {
  background: #f1f5f9;
  border-color: transparent;
  color: var(--ink, #121a24);
}

.team-popover .team-menu-item-danger {
  color: #b42318;
}

.team-popover .team-menu-item-danger:hover {
  background: #fef3f2;
  color: #b42318;
}

.team-popover .team-menu-item-danger .icon,
.team-popover .team-menu-item-danger .icon-sm {
  color: #b42318;
  opacity: 1;
}

.team-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.team-modal[hidden] {
  display: none !important;
}

.team-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 26, 36, 0.4);
}

.team-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 22rem;
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #d5dce5);
  border-radius: var(--radius, 8px);
  box-shadow: 0 16px 40px rgba(18, 26, 36, 0.2);
  padding: var(--space-4, 1rem);
}

.team-modal-card-wide {
  max-width: 26rem;
}

.team-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.team-modal-head .section-label {
  margin: 0;
}

.platform-badge {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
}

.platform-badge[data-platform="instagram"] { background: #fce7f3; color: #9d174d; }
.platform-badge[data-platform="facebook"] { background: #dbeafe; color: #1e40af; }
.platform-badge[data-platform="whatsapp"] { background: #dcfce7; color: #166534; }

.parse-status {
  font-size: 0.8125rem;
  font-weight: 500;
}

.parse-status[data-status="lead_created"],
.parse-status[data-status="note_appended"] {
  color: #0f766e;
}

.parse-status[data-status="failed"] {
  color: #b91c1c;
}

.parse-status[data-status="not_a_lead"],
.parse-status[data-status="skipped"] {
  color: #64748b;
}

.inbound-preview {
  display: block;
}

.inbound-sender {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .inbound-page .leads-table th:nth-child(2),
  .inbound-page .leads-table td:nth-child(2) {
    min-width: 10rem;
  }
}

/* Support tab */
.support-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}
.support-subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 2px solid transparent;
}
.support-subnav a.is-active {
  border-bottom-color: var(--color-accent, #0f766e);
  font-weight: 600;
}
.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.support-actions .btn-primary,
.support-actions .btn-ghost {
  min-height: 44px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ——— Profile ——— */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
  width: 100%;
}

.profile-panel {
  max-width: none;
  width: 100%;
  gap: 0;
}

.profile-section {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--line);
}

.profile-section:first-child {
  padding-top: 0;
}

.profile-section-last {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-facts {
  margin: 0;
}

.profile-form {
  display: grid;
  gap: var(--space-3);
}

.profile-email-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
}

.profile-email-state[data-state="pending"] {
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
}

.profile-actions-quiet {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.profile-actions-quiet .btn-ghost {
  min-height: 44px;
}

.profile-empty {
  margin: 0;
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted);
  background: var(--grey-50);
  border-radius: var(--radius);
}

@media (max-width: 860px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

/* Pipeline overview — Zoho-style stage strip (counts, not charts/kanban) */
.pipeline-header {
  align-items: flex-end;
  gap: var(--space-4);
}

.pipeline-header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  flex-shrink: 0;
}

.pipeline-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 3.5rem;
}

.pipeline-stat-value {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.pipeline-stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pipeline-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}

.pipeline-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pipeline-preset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
}

.pipeline-preset:hover {
  color: var(--ink);
  background: var(--grey-100);
}

.pipeline-preset.is-active {
  color: var(--teal-700);
  background: var(--teal-50);
  border-color: var(--teal-100);
  font-weight: 600;
}

.pipeline-custom-details {
  max-width: 28rem;
}

.pipeline-custom-details > summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--teal-700);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.pipeline-custom-details > summary::-webkit-details-marker {
  display: none;
}

.pipeline-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pipeline-custom .field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pipeline-custom .label-text {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 500;
}

.pipeline-custom .field-inline input[type="date"] {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--surface);
}

.pipeline-board {
  margin: 0 0 var(--space-6);
}

.pipeline-board-hint {
  margin: calc(-1 * var(--space-2)) 0 var(--space-3);
  font-size: var(--text-sm);
}

.pipeline-strip-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
  margin: 0 calc(-1 * var(--space-1));
  padding-left: var(--space-1);
  padding-right: var(--space-1);
}

.pipeline-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: min-content;
}

.pipeline-strip-item {
  display: flex;
  align-items: stretch;
  flex: 1 1 0;
  min-width: 7.5rem;
}

.pipeline-strip-closed .pipeline-strip-item {
  flex: 0 0 auto;
  min-width: 8.5rem;
  margin-right: var(--space-2);
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-height: 112px;
  padding: var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: border-color 0.12s var(--ease), background 0.12s var(--ease);
}

a.pipeline-stage:hover {
  border-color: var(--teal-500);
  background: var(--grey-50);
}

a.pipeline-stage:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
}

.pipeline-stage-static {
  cursor: default;
}

.pipeline-stage-rail {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grey-400);
}

.pipeline-stage[data-status="Not Contacted"] .pipeline-stage-rail { background: var(--grey-400); }
.pipeline-stage[data-status="Contacted"] .pipeline-stage-rail { background: var(--navy-800); }
.pipeline-stage[data-status="Follow Up"] .pipeline-stage-rail { background: var(--warn); }
.pipeline-stage[data-status="Site Visit"] .pipeline-stage-rail { background: var(--teal-500); }
.pipeline-stage[data-status="Negotiation"] .pipeline-stage-rail { background: #b45309; }
.pipeline-stage[data-status="Junk Lead"] .pipeline-stage-rail { background: var(--danger); }
.pipeline-stage[data-status="Lost Lead"] .pipeline-stage-rail { background: var(--grey-500); }
.pipeline-stage[data-status="Won"] .pipeline-stage-rail { background: var(--success); }
.pipeline-stage[data-status="Unmapped"] .pipeline-stage-rail { background: var(--grey-400); }

.pipeline-stage-count {
  margin-top: var(--space-2);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.pipeline-stage-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--grey-800);
  line-height: 1.3;
}

.pipeline-stage-pct {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.pipeline-chevron {
  flex: 0 0 12px;
  align-self: center;
  width: 0;
  height: 0;
  margin: 0 4px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--grey-400);
  background: none;
  opacity: 0.9;
}

@media (max-width: 860px) {
  .pipeline-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .pipeline-header-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .pipeline-stat {
    align-items: flex-start;
  }

  .pipeline-strip-item {
    flex: 0 0 auto;
    min-width: 8.25rem;
  }
}

/* ——— Notifications settings (full-width SaaS rows) ——— */

.notif-page {
  width: 100%;
  max-width: none;
}

.notif-header {
  align-items: flex-start;
  gap: var(--space-4);
}

.notif-tz-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--muted);
  white-space: nowrap;
}

.notif-staff-note {
  margin: 0 0 var(--space-4);
}

.notif-panel {
  width: 100%;
  max-width: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  display: block;
}

.notif-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 1fr);
  gap: var(--space-4) var(--space-6);
  align-items: center;
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--line);
}

.notif-row-last {
  border-bottom: none;
}

.notif-row-copy {
  min-width: 0;
}

.notif-row-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}

.notif-row-desc {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.45;
  max-width: 36rem;
}

.notif-row-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.notif-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.notif-switch input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent, #0f766e);
  cursor: pointer;
}

.notif-time-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  z-index: 1;
}

.notif-time-sep {
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  user-select: none;
  line-height: 1;
}

.notif-row-controls > select,
.notif-time-pair > select {
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: menulist;
}

.notif-hour-select,
.notif-minute-select {
  min-width: 5.25rem;
  width: auto;
}

.notif-weekday-select {
  min-width: 8rem;
}

.notif-nag-select,
.notif-tz-select {
  min-width: 14rem;
  max-width: 100%;
}

.notif-control select,
.notif-control-wide select {
  min-height: 44px;
  min-width: 7.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
}

.notif-control-wide select {
  min-width: 14rem;
  max-width: 100%;
}

.notif-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 65%, var(--surface));
}

.notif-footer .btn-primary {
  min-height: 44px;
  margin-left: auto;
}

.notif-row-readonly {
  gap: var(--space-3);
}

.notif-readonly-when {
  font-size: var(--text-sm);
  color: var(--ink);
  text-align: right;
}

@media (max-width: 860px) {
  .notif-row {
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--space-3);
  }

  .notif-row-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .notif-control select,
  .notif-control-wide select,
  .notif-row-controls > select {
    flex: 1 1 auto;
    min-width: 0;
  }

  .notif-hour-select,
  .notif-minute-select {
    flex: 0 0 auto;
    min-width: 5.25rem;
  }

  .notif-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .notif-footer .btn-primary {
    margin-left: 0;
    width: 100%;
  }
}

/* Legacy aliases */
.site-header { display: none; }
.home-jump { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ——— Platform admin (ops) ——— */

.auth-ops-tag {
  display: inline-block;
  margin-left: 0.15em;
  padding: 0.1em 0.45em;
  border-radius: 4px;
  background: var(--navy-900);
  color: #7dd3c4;
  font-size: 0.55em;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: middle;
  text-transform: uppercase;
}

.admin-shell {
  min-height: 100vh;
  background: var(--canvas);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-5);
  background: var(--navy-950);
  color: #e8eef6;
  border-bottom: 1px solid rgba(125, 211, 196, 0.25);
}

.admin-topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.admin-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
}

.admin-brand span { color: #7dd3c4; }
.admin-brand em {
  font-style: normal;
  margin-left: 0.35em;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  background: rgba(125, 211, 196, 0.15);
  color: #7dd3c4;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.admin-nav {
  display: flex;
  gap: var(--space-3);
}

.admin-nav a {
  color: #b8c4d4;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.35rem 0.15rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.admin-nav a:hover,
.admin-nav a.is-active {
  color: #fff;
}

.admin-nav a.is-active {
  box-shadow: inset 0 -2px 0 #7dd3c4;
}

.admin-topbar-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.admin-email {
  font-size: var(--text-sm);
  color: #b8c4d4;
}

.admin-topbar .btn-ghost {
  color: #e8eef6;
  border-color: rgba(232, 238, 246, 0.25);
  background: transparent;
}

.admin-topbar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-main {
  max-width: 56rem;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
}

.admin-section + .admin-section {
  margin-top: var(--space-5);
}

.admin-section .section-label {
  margin-bottom: var(--space-3);
}

.admin-search-form {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.admin-search-form input {
  flex: 1;
  min-width: 12rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
}

.admin-org-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-org-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}

.admin-org-row:last-child { border-bottom: 0; }

.admin-org-row .muted { margin-left: var(--space-2); }

.admin-org-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1 1 12rem;
}

.admin-org-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.admin-org-title .muted { margin-left: 0; }

.admin-org-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.admin-org-sub .admin-sub-detail {
  margin-left: 0;
  font-size: 0.875rem;
}

.admin-page-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-1);
}

.admin-page-status .admin-sub-detail {
  font-size: var(--text-sm);
}

.admin-test-badge {
  background: #e0e7ff;
  color: #3730a3;
}

/* Mode / enum choice chips (replaces bare radios) */
.admin-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
}

.admin-choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.admin-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.admin-choice:hover {
  border-color: var(--grey-200);
  background: var(--grey-50);
}

.admin-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--teal-50);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.admin-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.admin-form.listing-form {
  display: grid;
  gap: var(--space-4);
  padding: 0;
  max-width: 28rem;
}

.admin-form .admin-sub-duration {
  margin-top: var(--space-1);
}

.admin-form .admin-sub-duration[hidden] {
  display: none !important;
}

.admin-form select {
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
}

.admin-form .checkbox-row {
  min-height: 44px;
  align-items: flex-start;
  gap: 0.65rem;
  padding: var(--space-2) 0;
  cursor: pointer;
}

.admin-form .checkbox-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.admin-disclose {
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-disclose > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  color: var(--ink);
}

.admin-disclose > summary::-webkit-details-marker {
  display: none;
}

.admin-disclose > summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}

.admin-disclose[open] > summary::before {
  transform: rotate(45deg);
}

.admin-disclose-body {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--grey-50);
}

.admin-form .radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-2) 0;
}

.admin-form .radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  cursor: pointer;
}

.admin-form fieldset.field {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.admin-form fieldset.field legend {
  font-weight: 600;
  margin-bottom: 0;
  padding: 0;
}

.admin-form details.field {
  margin-bottom: 0;
}

.admin-form .admin-disclose > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  color: var(--ink);
}

.admin-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.admin-section-head .section-label {
  margin: 0;
}

.admin-org-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.admin-org-actions form {
  margin: 0;
}

.admin-org-actions .btn-ghost,
.admin-org-actions .btn-primary,
.admin-org-actions a.btn-ghost,
.admin-org-actions a.btn-primary {
  min-height: 44px;
}

.admin-form {
  max-width: 28rem;
}

.admin-password-reveal {
  margin-bottom: var(--space-4);
}

.admin-password-reveal-warn {
  margin: 0 0 var(--space-3);
  color: var(--ink);
}

.admin-password-reveal-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.admin-password-field {
  flex: 1 1 12rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  background: var(--grey-50);
}

.admin-people-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-start;
}

.admin-people-actions form {
  margin: 0;
}

.admin-people-actions .btn-ghost,
.admin-people-actions .btn-primary {
  min-height: 44px;
}

.admin-btn-quiet {
  color: var(--muted);
  font-weight: 500;
}

.admin-people-disclose {
  min-width: 12rem;
}

.admin-people-disclose summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.admin-people-disclose summary::-webkit-details-marker {
  display: none;
}

.admin-people-disclose[open] summary {
  margin-bottom: var(--space-2);
}

.admin-people-phone-form {
  max-width: 18rem;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-inline-warn {
  display: inline-flex;
  margin: 0 0 0 var(--space-2);
  padding: 0.15rem 0.45rem;
  font-size: var(--text-xs);
}

.admin-hint { margin-top: var(--space-3); }

.admin-preview {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-filter-bar {
  align-items: flex-end;
  margin-bottom: var(--space-4);
}

.admin-filter-bar .field {
  margin: 0;
}

.admin-filter-bar .toolbar-actions {
  align-self: flex-end;
}

.admin-dl {
  display: grid;
  gap: var(--space-4);
  margin: 0;
}

.admin-dl > div {
  display: grid;
  gap: var(--space-1);
}

.admin-dl dt {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-dl dd {
  margin: 0;
}

.admin-dl-full { grid-column: 1 / -1; }

.admin-text-block {
  margin: 0;
  padding: var(--space-3);
  background: var(--grey-50);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  max-height: 16rem;
  overflow: auto;
}

.admin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.admin-detail-actions .btn-primary,
.admin-detail-actions .btn-ghost {
  min-height: 44px;
}

.page-crumb {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
}

.page-crumb a { text-decoration: none; }
.page-crumb a:hover { text-decoration: underline; }

/* ——— Impersonation banner (dealer chrome while ops acting) ——— */

.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--warn-soft);
  border-bottom: 2px solid var(--warn);
  color: var(--grey-900);
}

.impersonation-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.impersonation-banner-copy strong {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
}

.impersonation-banner-copy span {
  font-size: var(--text-sm);
  color: var(--grey-800);
}

.impersonation-exit {
  flex-shrink: 0;
  min-height: 44px;
  background: var(--warn);
  border-color: var(--warn);
}

.impersonation-exit:hover {
  background: #9a3b06;
  border-color: #9a3b06;
}

@media (max-width: 640px) {
  .admin-preview { max-width: 8rem; }
  .admin-topbar { padding: var(--space-3); }
  .impersonation-banner { padding: var(--space-3); }
  .admin-org-actions { width: 100%; }
  .admin-org-actions .btn-ghost,
  .admin-org-actions .btn-primary,
  .admin-org-actions form { flex: 1 1 auto; }
  .admin-password-reveal-row .btn-ghost { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
