/* ============================================================
   Astra CRM — admin interface
   Vanilla CSS, no external fonts or frameworks.
   ============================================================ */

:root {
  --bg: #f2efe8;
  --bg-deep: #ebe6dc;
  --surface: #fbfaf6;
  --surface-raised: #fffefa;
  --surface-soft: #f6f2e9;
  --ink: #20211c;
  --ink-soft: #45463e;
  --muted: #807d72;
  --muted-strong: #65635a;
  --line: #e6e0d4;
  --line-strong: #d8d1c3;
  --night: #191a15;
  --night-soft: #22231d;
  --night-line: rgba(255, 255, 255, .09);
  --gold: #b18445;
  --gold-bright: #d7ac6a;
  --gold-wash: #f3e9d8;
  --green: #3f7359;
  --green-wash: #e8f0e8;
  --blue: #536f9b;
  --blue-wash: #e9eef5;
  --rose: #a25350;
  --rose-wash: #f6e9e6;
  --violet: #73618e;
  --violet-wash: #efebf4;
  --amber: #a26c2f;
  --amber-wash: #f6edde;
  --cyan: #48767d;
  --cyan-wash: #e5f0f0;
  --radius-xs: 8px;
  --radius-sm: 11px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --shadow-xs: 0 1px 2px rgba(43, 38, 27, .05);
  --shadow-sm: 0 4px 18px rgba(43, 38, 27, .06);
  --shadow-md: 0 16px 45px rgba(43, 38, 27, .12);
  --shadow-lg: 0 30px 90px rgba(20, 18, 12, .24);
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --ease: cubic-bezier(.22, .8, .26, 1);
  --sidebar-w: 258px;
  --topbar-h: 78px;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

img {
  max-width: 100%;
}

::selection {
  background: #e8d6b8;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cfc8ba;
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #b8b0a0;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ============================================================
   Shared primitives
   ============================================================ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.btn:not(:disabled):active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--night);
  color: #f8f4ea;
  box-shadow: 0 5px 14px rgba(25, 26, 21, .16);
}

.btn-primary:hover:not(:disabled) {
  background: #2b2d24;
  box-shadow: 0 8px 22px rgba(25, 26, 21, .2);
}

.btn-gold {
  background: var(--gold);
  color: #fffaf1;
  box-shadow: 0 5px 14px rgba(177, 132, 69, .24);
}

.btn-gold:hover:not(:disabled) {
  background: #a2773b;
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #c4bba9;
  background: #fff;
}

.btn-ghost {
  color: var(--muted-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--ink);
}

.btn-danger {
  border-color: #e7cfc9;
  background: var(--rose-wash);
  color: var(--rose);
}

.btn-danger:hover:not(:disabled) {
  border-color: #d9b5ad;
  background: #f3dfda;
}

.btn-sm {
  min-height: 34px;
  padding: 0 13px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted-strong);
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.field-label .optional {
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}

.field textarea,
.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.field input::placeholder,
.field textarea::placeholder,
.input::placeholder {
  color: #a9a396;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #c8c0b1;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(177, 132, 69, .13);
  background: #fff;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.session-list {
  display: grid;
  gap: 8px;
}
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted, #f8f6f1);
}
.session-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.session-main small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.mfa-secret {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 16px;
  letter-spacing: 0.08em;
  word-break: break-all;
  background: var(--surface-muted, #f6f4ef);
}
.mfa-hint {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e7cfc9;
  border-radius: var(--radius-sm);
  background: var(--rose-wash);
  color: #8e4542;
  font-size: 12.5px;
  line-height: 1.45;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.checkbox input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-raised);
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}

.checkbox input:checked {
  border-color: var(--night);
  background: var(--night) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.3 6.2 4.7 8.5 9.7 3.5' fill='none' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}

.select {
  appearance: none;
  min-height: 38px;
  padding: 7px 33px 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23807d72' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 11px center / 11px 7px no-repeat;
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.select:hover {
  border-color: #c8c0b1;
}

.select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(177, 132, 69, .12);
}

.select-compact {
  max-width: 166px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: #e6dfd2;
  color: #6c5a3d;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
}

.avatar--sm {
  width: 26px;
  height: 26px;
  font-size: 9.5px;
}

.avatar--lg {
  width: 50px;
  height: 50px;
  font-size: 14px;
}

.avatar--me {
  background: linear-gradient(145deg, #c29a5e, #9a6c36);
  color: #fffaf1;
}

.avatar--0 { background: #e6dfd2; color: #6c5a3d; }
.avatar--1 { background: #dfe7e3; color: #42675a; }
.avatar--2 { background: #e5e1eb; color: #635478; }
.avatar--3 { background: #ece2d6; color: #855f3a; }
.avatar--4 { background: #e0e6ee; color: #4c6684; }
.avatar--5 { background: #eee2df; color: #8c5d58; }
.avatar--6 { background: #e7e9dc; color: #606b42; }

/* ============================================================
   Boot
   ============================================================ */

.boot-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--night);
  color: #eee8db;
  transition: opacity .45s var(--ease), visibility .45s var(--ease);
}

body.is-ready .boot-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.boot-mark {
  position: relative;
  width: 62px;
  height: 62px;
}

.brand-symbol svg {
  width: 100%;
  height: 100%;
}

.boot-mark .orbit {
  position: absolute;
  border: 1px solid rgba(215, 172, 106, .5);
  border-radius: 50%;
  inset: 0;
  animation: orbit-spin 9s linear infinite;
}

.boot-mark .orbit-1 {
  transform: rotate(28deg) scaleY(.42);
}

.boot-mark .orbit-2 {
  inset: 7px;
  transform: rotate(-38deg) scaleY(.5);
  animation-duration: 6s;
  animation-direction: reverse;
  border-color: rgba(215, 172, 106, .28);
}

.boot-mark .star {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 20px 4px rgba(215, 172, 106, .3);
  transform: translate(-50%, -50%);
}

.boot-text {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: .04em;
}

@keyframes orbit-spin {
  to { rotate: 360deg; }
}

/* ============================================================
   Login
   ============================================================ */

.login-screen {
  display: grid;
  grid-template-columns: minmax(420px, 46%) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.login-art {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100vh;
  padding: 38px 44px;
  background:
    radial-gradient(ellipse 60% 40% at 72% 18%, rgba(196, 151, 86, .15), transparent 65%),
    radial-gradient(ellipse 55% 45% at 18% 86%, rgba(84, 105, 86, .16), transparent 65%),
    linear-gradient(150deg, #1e2019 0%, #151612 48%, #191711 100%);
  color: #f1ebdf;
}

.login-art::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  background-image:
    radial-gradient(circle at 18% 24%, rgba(255,255,255,.8) 0 1px, transparent 1.7px),
    radial-gradient(circle at 76% 12%, rgba(255,255,255,.5) 0 1px, transparent 1.6px),
    radial-gradient(circle at 61% 64%, rgba(255,255,255,.5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 38% 78%, rgba(215,172,106,.6) 0 1px, transparent 1.8px),
    radial-gradient(circle at 89% 43%, rgba(255,255,255,.43) 0 1px, transparent 1.4px),
    radial-gradient(circle at 8% 55%, rgba(255,255,255,.35) 0 1px, transparent 1.4px),
    radial-gradient(circle at 52% 33%, rgba(255,255,255,.28) 0 1px, transparent 1.2px);
  pointer-events: none;
}

.login-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(14, 15, 11, .55), transparent 38%);
  pointer-events: none;
}

.login-art-glow {
  position: absolute;
  top: 18%;
  right: -15%;
  width: 62%;
  aspect-ratio: 1;
  border: 1px solid rgba(215, 172, 106, .16);
  border-radius: 50%;
  box-shadow:
    0 0 0 70px rgba(215, 172, 106, .028),
    0 0 0 140px rgba(215, 172, 106, .018);
  pointer-events: none;
}

.login-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: .025em;
}

.brand-symbol {
  width: 38px;
  height: 38px;
  color: var(--gold-bright);
}

.brand-symbol--small {
  width: 34px;
  height: 34px;
}

.constellation {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.constellation i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(233, 219, 192, .8);
  box-shadow: 0 0 8px rgba(233, 219, 192, .4);
}

.constellation::before,
.constellation::after {
  content: "";
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 172, 106, .25), transparent);
  transform-origin: left center;
}

.constellation-a {
  top: 28%;
  left: 18%;
  width: 180px;
  height: 140px;
}

.constellation-a i:nth-child(1) { top: 8px; left: 20px; }
.constellation-a i:nth-child(2) { top: 64px; left: 74px; }
.constellation-a i:nth-child(3) { top: 40px; left: 148px; }
.constellation-a i:nth-child(4) { top: 118px; left: 112px; background: var(--gold-bright); }

.constellation-a::before { width: 104px; top: 43px; left: 25px; transform: rotate(33deg); }
.constellation-a::after { width: 94px; top: 72px; left: 75px; transform: rotate(-18deg); }

.constellation-b {
  right: 13%;
  bottom: 23%;
  width: 120px;
  height: 90px;
}

.constellation-b i:nth-child(1) { top: 8px; left: 60px; }
.constellation-b i:nth-child(2) { top: 54px; left: 6px; }
.constellation-b i:nth-child(3) { top: 72px; left: 92px; }

.constellation-b::before { width: 84px; top: 37px; left: 8px; transform: rotate(20deg); }
.constellation-b::after { width: 68px; top: 48px; left: 60px; transform: rotate(-31deg); }

.login-quote {
  position: relative;
  z-index: 2;
  max-width: 460px;
  margin-top: auto;
  margin-bottom: auto;
  padding: 60px 0;
}

.login-quote p {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: clamp(32px, 3.2vw, 48px);
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.13;
}

.login-quote span {
  display: block;
  color: rgba(241, 235, 223, .53);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  line-height: 1.7;
  text-transform: uppercase;
}

.login-foot {
  position: relative;
  z-index: 2;
  color: rgba(241, 235, 223, .34);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 42px clamp(24px, 6vw, 100px) 28px;
  background:
    radial-gradient(ellipse 55% 45% at 80% 10%, rgba(255, 255, 255, .5), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 405px;
}

.login-heading {
  margin-bottom: 32px;
}

.login-heading h1 {
  margin: 12px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 46px);
  font-weight: 400;
  letter-spacing: -.022em;
  line-height: 1;
}

.login-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-form .field input {
  min-height: 50px;
  background: rgba(255, 254, 250, .72);
}

.login-form .field input:focus {
  background: #fff;
}

.reveal-btn {
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.reveal-btn:hover {
  color: var(--ink);
}

.login-submit {
  min-height: 48px;
  margin-top: 4px;
  border-radius: 12px;
  font-size: 13.5px;
}

.login-submit svg {
  width: 18px;
  transition: transform .2s var(--ease);
}

.login-submit:hover svg {
  transform: translateX(3px);
}

.login-help {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.login-copyright {
  margin: auto 0 0;
  padding-top: 40px;
  color: #a29c8f;
  font-size: 10.5px;
  letter-spacing: .03em;
}

/* ============================================================
   App frame / sidebar
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background:
    radial-gradient(ellipse 100% 40% at 18% 0%, rgba(184, 145, 83, .08), transparent 70%),
    linear-gradient(180deg, #1b1c16 0%, #171812 100%);
  color: #dcd6c9;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .3;
  background-image:
    radial-gradient(circle at 12% 14%, rgba(255,255,255,.35) 0 1px, transparent 1.6px),
    radial-gradient(circle at 83% 8%, rgba(255,255,255,.22) 0 1px, transparent 1.4px),
    radial-gradient(circle at 66% 26%, rgba(215,172,106,.22) 0 1px, transparent 1.5px),
    radial-gradient(circle at 31% 62%, rgba(255,255,255,.16) 0 1px, transparent 1.3px);
  pointer-events: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--night-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1;
}

.brand-copy b {
  font-weight: 400;
  color: #f2ecdf;
}

.brand-copy small {
  color: var(--gold-bright);
  font-family: var(--font-ui);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
  color: #a9a191;
}

.sidebar-close:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 26px 14px;
}

.nav-label {
  padding: 0 11px 9px;
  color: rgba(230, 223, 209, .32);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.nav-label--second {
  margin-top: 25px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #aaa597;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  transition: background .18s var(--ease), color .18s var(--ease);
}

.nav-item:hover {
  background: rgba(255, 255, 255, .045);
  color: #e8e2d6;
}

.nav-item.is-active {
  background: rgba(215, 172, 106, .11);
  color: #f6f0e3;
}

.nav-icon {
  display: inline-flex;
  width: 19px;
  height: 19px;
  flex: none;
  color: #827c6e;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-item.is-active .nav-icon {
  color: var(--gold-bright);
}

.nav-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #fffaf0;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}

.nav-external {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: #6d685d;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 16px 14px 18px;
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}

.connection-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #6caa82;
  box-shadow: 0 0 0 4px rgba(108, 170, 130, .1), 0 0 12px rgba(108, 170, 130, .3);
}

.connection-card b {
  display: block;
  color: #c9c2b4;
  font-size: 11px;
  font-weight: 650;
}

.connection-card small {
  display: block;
  margin-top: 1px;
  color: #6e6a5f;
  font-size: 9.5px;
}

.connection-card.is-reconnecting .connection-dot {
  background: var(--gold-bright);
  box-shadow: 0 0 0 4px rgba(215, 172, 106, .12);
  animation: pulse 1.3s ease-in-out infinite;
}

.connection-card.is-offline .connection-dot {
  background: #c57565;
  box-shadow: 0 0 0 4px rgba(197, 117, 101, .1);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 12px;
  text-align: left;
  transition: background .18s var(--ease);
}

.user-button:hover,
.user-button[aria-expanded="true"] {
  background: rgba(255,255,255,.045);
}

.user-copy {
  min-width: 0;
  flex: 1;
}

.user-copy b {
  display: block;
  overflow: hidden;
  color: #d9d3c6;
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy small {
  display: block;
  margin-top: 1px;
  color: #747064;
  font-size: 9.5px;
}

.user-button .chev {
  width: 14px;
  height: 14px;
  color: #6f6a5f;
}

.user-popover {
  position: absolute;
  z-index: 50;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 13px;
  background: #24251e;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .35);
  animation: pop-in .15s var(--ease);
}

.popover-head {
  padding: 13px 14px 11px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.popover-head b {
  display: block;
  color: #eee8dc;
  font-size: 12px;
}

.popover-head span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #7f7a6d;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 14px;
  color: #aaa597;
  font-size: 11.5px;
  text-align: left;
}

.popover-item svg {
  width: 16px;
  height: 16px;
}

.popover-item:hover {
  background: rgba(255,255,255,.05);
  color: #eee8dc;
}

.popover-item--danger {
  color: #be8175;
}

.popover-item--danger:hover {
  background: rgba(190, 129, 117, .09);
  color: #d99a8e;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   Main / topbar
   ============================================================ */

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

.topbar {
  position: sticky;
  z-index: 25;
  top: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 0 clamp(20px, 3vw, 40px);
  border-bottom: 1px solid rgba(216, 209, 195, .7);
  background: rgba(242, 239, 232, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.menu-btn {
  display: none;
}

.topbar-title {
  min-width: 0;
}

.topbar-kicker {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.topbar-title h1 {
  margin: 1px 0 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #d7e2d9;
  border-radius: 999px;
  background: rgba(246, 251, 246, .7);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 650;
}

.live-pill span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5c9976;
  box-shadow: 0 0 0 3px rgba(92, 153, 118, .12);
  animation: pulse 2.2s ease-in-out infinite;
}

.live-pill.is-reconnecting {
  border-color: #e3d2b7;
  background: #fbf5e9;
  color: #946a32;
}

.live-pill.is-reconnecting span {
  background: #b68b4d;
  box-shadow: 0 0 0 3px rgba(182, 139, 77, .12);
}

.live-pill.is-offline {
  border-color: #e5d0cb;
  background: #f9efed;
  color: #9b5751;
}

.live-pill.is-offline span {
  background: #b96c61;
  box-shadow: 0 0 0 3px rgba(185, 108, 97, .12);
  animation: none;
}

.main-scroll {
  flex: 1;
  padding: 30px clamp(20px, 3vw, 40px) 48px;
}

.view {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  animation: view-in .3s var(--ease);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-intro h2 {
  margin: 7px 0 5px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 400;
  letter-spacing: -.025em;
  line-height: 1.04;
}

.page-intro p {
  max-width: 580px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.intro-aside {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 3px;
  color: #9a9487;
  font-size: 10.5px;
  white-space: nowrap;
}

.intro-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-weight: 600;
}

.intro-note i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #679b7b;
}

/* Eyebrow details */
.page-intro .eyebrow {
  color: var(--gold);
}

.page-intro .eyebrow span {
  color: var(--ink-soft);
}

/* ============================================================
   Stats
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 18px 19px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(155deg, rgba(255,255,255,.55), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}

.stat-card:hover {
  z-index: 1;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -38px;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(177, 132, 69, .08);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(177, 132, 69, .022);
  pointer-events: none;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.stat-label {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  font-size: 11px;
  line-height: 1;
}

.stat-value {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-display);
  font-size: 33px;
  font-weight: 400;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: opacity .2s var(--ease);
}

.stat-value.is-loading {
  opacity: .35;
}

.stat-hint {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
}

.stat-hint b {
  color: var(--ink-soft);
  font-weight: 650;
}

.stat-line {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: #eee8dd;
}

.stat-line::after {
  content: "";
  display: block;
  width: var(--stat-fill, 40%);
  height: 100%;
  border-radius: inherit;
  background: var(--stat-color, var(--gold));
  transition: width .6s var(--ease);
}

.stat-card--new { --stat-color: #8b7654; }
.stat-card--free { --stat-color: #b18445; }
.stat-card--active { --stat-color: #6d8a76; }
.stat-card--won { --stat-color: #4f7c62; }

/* ============================================================
   Workspace / list
   ============================================================ */

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 426px);
  align-items: start;
  gap: 17px;
}

.leads-panel {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fdfcf9, #faf8f3);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}

.chip:hover {
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.chip.is-active {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(43,38,27,.04);
}

.chip-count {
  color: #a29b8e;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.chip.is-active .chip-count {
  color: var(--gold);
}

.filter-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 190px;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-raised);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), width .2s var(--ease);
}

.search-box:focus-within {
  width: 218px;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(177, 132, 69, .11);
}

.search-box svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: #989184;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11.5px;
}

.search-box input::placeholder {
  color: #a9a396;
}

.search-box input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-shortcut {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #b0a99c;
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.search-box:focus-within .search-shortcut {
  display: none;
}

.lead-list {
  min-height: 280px;
}

.lead-grid-head,
.lead-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) 108px minmax(115px, .95fr) 86px 80px;
  align-items: center;
  column-gap: 10px;
  padding: 0 18px;
}

.lead-grid-head {
  min-height: 36px;
  border-bottom: 1px solid #efeae0;
  background: rgba(250, 248, 243, .55);
  color: #a0998c;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.lead-row {
  position: relative;
  width: 100%;
  min-height: 66px;
  padding-top: 11px;
  padding-bottom: 11px;
  border-bottom: 1px solid #eee9df;
  background: transparent;
  text-align: left;
  transition: background .15s var(--ease);
}

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

.lead-row::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: transparent;
  transition: background .16s var(--ease);
}

.lead-row:hover {
  background: #f8f5ee;
}

.lead-row.is-selected {
  background: #f7f1e5;
}

.lead-row.is-selected::before {
  background: var(--gold);
}

.lead-row.is-fresh {
  animation: row-fresh 1.6s var(--ease);
}

@keyframes row-fresh {
  0% { background: #f4ead7; }
  100% { background: transparent; }
}

.client-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.client-main {
  min-width: 0;
}

.client-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.client-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread-dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
}

.client-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-meta .dot-sep {
  color: #c1baad;
}

.client-meta svg {
  width: 11px;
  height: 11px;
  flex: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

.status--blue { background: var(--blue-wash); color: var(--blue); }
.status--cyan { background: var(--cyan-wash); color: var(--cyan); }
.status--violet { background: var(--violet-wash); color: var(--violet); }
.status--amber { background: var(--amber-wash); color: var(--amber); }
.status--green { background: var(--green-wash); color: var(--green); }
.status--emerald { background: #e2efe7; color: #356e55; }
.status--rose { background: var(--rose-wash); color: var(--rose); }
.status--neutral { background: var(--surface-soft); color: var(--muted); }

.manager-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 10.5px;
}

.manager-cell span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-none {
  color: #a19a8c;
  font-style: italic;
}

.source-cell {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-cell {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.date-cell small {
  display: block;
  margin-top: 1px;
  color: #aaa396;
  font-size: 8.5px;
}

.list-state {
  padding: 34px 20px;
}

.skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 7px;
  background: #ede8df;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: shimmer 1.4s infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.skeleton-row {
  height: 44px;
  margin-bottom: 10px;
}

.skeleton-row:last-child {
  margin-bottom: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 330px;
  padding: 40px 24px;
  text-align: center;
}

.empty-orbit {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border: 1px solid #ddd4c4;
  border-radius: 50%;
}

.empty-orbit::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -8px;
  right: -8px;
  height: 1px;
  background: #e5ddd0;
  transform: rotate(-24deg);
}

.empty-orbit span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(177, 132, 69, .09);
  transform: translate(-50%, -50%);
}

.empty-orbit--large {
  width: 74px;
  height: 74px;
  margin-bottom: 22px;
}

.empty-state h3 {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
}

.empty-state p {
  max-width: 280px;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fbf9f4;
  color: var(--muted);
  font-size: 10.5px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pagination .icon-btn {
  width: 28px;
  height: 28px;
  border-color: var(--line);
  background: var(--surface-raised);
}

.pagination .icon-btn svg {
  width: 14px;
  height: 14px;
}

.pagination span {
  min-width: 25px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ============================================================
   Detail
   ============================================================ */

.detail-panel {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  overflow: hidden;
  height: calc(100vh - var(--topbar-h) - 52px);
  min-height: 400px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 36px 32px;
  background:
    radial-gradient(ellipse 70% 38% at 50% 30%, #fbf7ef, transparent 70%),
    var(--surface-raised);
  text-align: center;
}

.detail-empty .eyebrow {
  color: #a09a8c;
}

.detail-empty h3 {
  margin: 8px 0 7px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 400;
}

.detail-empty p {
  max-width: 270px;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.empty-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  color: #a29b8e;
  font-size: 9.5px;
}

.empty-hints span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #dfd7c8;
  border-radius: 4px;
  background: #fff;
  color: #7d776a;
  font-family: var(--font-ui);
  font-size: 8.5px;
  line-height: 1.4;
}

.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.detail-top {
  position: relative;
  flex: none;
  padding: 23px 23px 20px;
  background:
    radial-gradient(ellipse 65% 90% at 92% 0%, rgba(209, 170, 107, .16), transparent 60%),
    linear-gradient(155deg, #20211b, #191a15);
  color: #f4eee2;
}

.detail-top::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -50px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(215, 172, 106, .1);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(215, 172, 106, .025);
  pointer-events: none;
}

.detail-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
  color: rgba(244,238,226,.42);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.detail-eyebrow b {
  color: var(--gold-bright);
  font-weight: 600;
}

.detail-close {
  display: none;
  color: rgba(244,238,226,.55);
}

.detail-close:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.detail-name {
  max-width: 92%;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.detail-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 15px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d9d1c1;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: color .16s var(--ease);
}

.contact-link svg {
  width: 13px;
  height: 13px;
  color: var(--gold-bright);
}

.contact-link:hover {
  color: #fff;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: rgba(244,238,226,.35);
  transition: background .16s, color .16s;
}

.copy-btn svg {
  width: 12px;
  height: 12px;
}

.copy-btn:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
}

.detail-subline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  color: rgba(244,238,226,.4);
  font-size: 9.5px;
}

.detail-subline .status-badge {
  padding: 3px 7px;
  font-size: 8.5px;
}

.detail-actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: #fcfaf6;
}

.detail-actionbar .btn {
  min-height: 30px;
  padding: 0 11px;
  font-size: 10.5px;
  border-radius: 8px;
}

.detail-actionbar .btn svg {
  width: 13px;
  height: 13px;
}

.detail-action-spacer {
  flex: 1;
}

.btn-icon-text {
  color: var(--muted-strong);
}

.btn-icon-text:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.delete-btn:hover {
  background: var(--rose-wash);
  color: var(--rose);
}

.inline-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 16px 0;
  padding: 10px 11px;
  border: 1px solid #e6d5b7;
  border-radius: 9px;
  background: #fbf4e6;
  color: #7c6135;
  font-size: 10.5px;
  line-height: 1.45;
}

.inline-banner svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
}

.detail-tabs {
  display: flex;
  gap: 1px;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
  background: #fcfaf6;
}

.detail-tab {
  position: relative;
  padding: 12px 11px 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  transition: color .16s var(--ease);
}

.detail-tab:hover {
  color: var(--ink-soft);
}

.detail-tab.is-active {
  color: var(--ink);
}

.detail-tab.is-active::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 1.5px;
  background: var(--gold);
}

.detail-tab span {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #999284;
  font-size: 8px;
  font-weight: 650;
}

.detail-body {
  flex: 1;
  padding: 16px;
}

.detail-section {
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid #ede7db;
  border-radius: 13px;
  background: #fffdf9;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.section-link {
  padding: 0;
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
}

.section-link:hover {
  color: var(--ink);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 16px;
}

.info-item {
  min-width: 0;
}

.info-item--wide {
  grid-column: 1 / -1;
}

.info-label {
  display: block;
  margin-bottom: 3px;
  color: #a39c8e;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.info-value {
  display: block;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.info-value--serif {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.25;
}

.info-value--muted {
  color: var(--muted);
  font-style: italic;
}

.geo-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  color: #9a9386;
  font-size: 9px;
}

.geo-note svg {
  width: 10px;
  height: 10px;
}

.comment-box {
  margin-top: 12px;
  padding: 11px 12px;
  border-left: 2px solid #e0d5c4;
  border-radius: 0 8px 8px 0;
  background: #faf7f1;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comment-box .info-label {
  color: #9e9789;
}

.source-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #e9e2d6;
  border-radius: 6px;
  background: #fbf8f2;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 600;
}

.source-tag::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

.utm-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.utm-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.utm-key {
  color: #a29b8e;
  font-size: 9px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.utm-value {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.utm-value--url {
  white-space: normal;
  overflow-wrap: anywhere;
}

.utm-empty {
  padding: 2px 0;
  color: #a8a194;
  font-size: 10px;
  font-style: italic;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 13px;
}

.note {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
}

.note-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 3px;
}

.note-author {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.note-time {
  color: #aaa396;
  font-size: 8.5px;
}

.note-body {
  padding: 8px 10px;
  border: 1px solid #eee8dd;
  border-radius: 2px 9px 9px 9px;
  background: #faf7f1;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notes-empty {
  padding: 3px 0 13px;
  color: #a8a194;
  font-size: 10px;
  font-style: italic;
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.note-form textarea {
  width: 100%;
  min-height: 68px;
  padding: 9px 10px;
  border: 1px solid #e5ded1;
  border-radius: 9px;
  outline: 0;
  background: #fbf9f4;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color .16s, box-shadow .16s, background .16s;
}

.note-form textarea:focus {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(177, 132, 69, .1);
}

.note-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-form-foot span {
  color: #aba496;
  font-size: 8.5px;
}

.note-submit {
  min-height: 29px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 10px;
}

.note-disabled {
  padding: 10px 11px;
  border: 1px dashed #e4ddcf;
  border-radius: 9px;
  color: #9d9688;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

/* History tab */
.history-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 15px;
}

.history-item:last-child {
  padding-bottom: 0;
}

.history-item::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 0;
  left: 7px;
  width: 1px;
  background: #ece6da;
}

.history-item:last-child::before {
  display: none;
}

.history-dot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border: 1px solid #dfd6c6;
  border-radius: 50%;
  background: #fffdfa;
}

.history-dot::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #b9ad99;
}

.history-dot--stage {
  border-color: #d8c5a4;
  background: #fbf5e8;
}

.history-dot--stage::after {
  background: var(--gold);
}

.history-dot--system::after {
  background: #9caa9e;
}

.history-content {
  min-width: 0;
  padding-top: 0;
}

.history-text {
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.history-text b {
  color: var(--ink);
  font-weight: 650;
}

.history-text .arrow {
  padding: 0 3px;
  color: #aaa396;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  color: #a8a194;
  font-size: 8.5px;
}

.history-empty {
  padding: 20px 4px;
  color: #a29b8e;
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
}

/* Detail controls */
.control-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.control-label {
  color: #9d9688;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.control-select {
  width: 100%;
}

.claim-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid #e5d7bd;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 70% 100% at 100% 0%, rgba(215, 172, 106, .1), transparent 65%),
    #fdf8ee;
}

.claim-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  flex: none;
  border: 1px solid #e4d3b4;
  border-radius: 50%;
  color: var(--gold);
}

.claim-icon svg {
  width: 17px;
  height: 17px;
}

.claim-copy {
  min-width: 0;
  flex: 1;
}

.claim-copy b {
  display: block;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.claim-copy span {
  display: block;
  margin-top: 1px;
  color: #9b9385;
  font-size: 9px;
  line-height: 1.4;
}

.claim-card .btn {
  min-height: 31px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 9.5px;
}

/* Edit form */
.edit-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.edit-form .field {
  gap: 6px;
}

.edit-form .field-label {
  font-size: 9px;
  color: #9d9688;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.edit-form .field input,
.edit-form .field textarea {
  min-height: 39px;
  padding: 8px 10px;
  border-color: #e7e0d3;
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
}

.edit-form .field textarea {
  min-height: 85px;
}

.edit-form .checkbox {
  font-size: 11px;
  color: var(--muted-strong);
}

.edit-actions {
  display: flex;
  gap: 7px;
  margin-top: 3px;
}

.edit-actions .btn {
  min-height: 34px;
  font-size: 10.5px;
  border-radius: 8px;
}

.birth-time-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Loader inside detail */
.detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--muted);
  font-size: 11px;
}

.spinner {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 1.5px solid #ded6c8;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.detail-scrim {
  display: none;
}

/* ============================================================
   Team
   ============================================================ */

.team-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}

.team-stat {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.team-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--gold-wash);
  color: var(--gold);
  font-size: 15px;
}

.team-stat-icon svg {
  width: 18px;
  height: 18px;
}

.team-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

.team-stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 13px;
}

.team-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.team-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.team-card.is-inactive {
  opacity: .7;
}

.team-card-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
}

.team-card-name {
  min-width: 0;
  flex: 1;
}

.team-card-name h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 1px 0 2px;
  font-size: 13px;
  font-weight: 650;
}

.team-card-name p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--gold-wash);
  color: var(--amber);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.role-badge--manager {
  background: var(--surface-soft);
  color: var(--muted-strong);
}

.active-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  font-size: 8.5px;
  font-weight: 600;
}

.active-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.active-dot--off {
  color: #a39c8e;
}

.team-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid #efe9de;
  border-bottom: 1px solid #efe9de;
}

.team-meta-label {
  display: block;
  color: #a29b8e;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.team-meta-value {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.team-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 12px;
}

.team-card-actions .btn {
  min-height: 29px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 9.5px;
}

.team-loading {
  grid-column: 1 / -1;
  padding: 50px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* ============================================================
   Toasts
   ============================================================ */

.toast-stack {
  position: fixed;
  z-index: 300;
  top: 20px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 254, 250, .97);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  animation: toast-in .28s var(--ease);
}

.toast.is-leaving {
  animation: toast-out .22s var(--ease) forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-7px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(12px); }
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold-wash);
  color: var(--gold);
}

.toast-icon svg {
  width: 15px;
  height: 15px;
}

.toast--info .toast-icon {
  background: var(--blue-wash);
  color: var(--blue);
}

.toast--success .toast-icon {
  background: var(--green-wash);
  color: var(--green);
}

.toast--danger .toast-icon {
  background: var(--rose-wash);
  color: var(--rose);
}

.toast-body b {
  display: block;
  margin-bottom: 1px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.toast-body p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.45;
}

.toast-action {
  align-self: center;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.toast-action:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: -2px;
  margin-right: -3px;
  border-radius: 4px;
  color: #b0a99c;
}

.toast-close:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.toast-close svg {
  width: 11px;
  height: 11px;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
  position: fixed;
  z-index: 400;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 22, 17, .46);
  backdrop-filter: blur(5px);
  animation: fade-in .18s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(470px, 100%);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  animation: modal-in .24s var(--ease);
}

.modal--wide {
  width: min(560px, 100%);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 0;
}

.modal-heading {
  flex: 1;
}

.modal-heading h2 {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.modal-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.modal-close {
  flex: none;
  color: var(--muted);
}

.modal-body {
  padding: 19px 22px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form .field input,
.modal-form .field select {
  min-height: 41px;
  font-size: 12.5px;
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 22px 21px;
}

.modal-foot .btn {
  min-height: 38px;
  font-size: 11.5px;
}

.modal-note {
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 10.5px;
  line-height: 1.55;
}

.modal-note--danger {
  border: 1px solid #e9d4ce;
  background: var(--rose-wash);
  color: #8f4a45;
}

.conflict-details {
  margin-top: 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf8f2;
}

.conflict-details b {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
}

.conflict-details p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 10.5px;
  line-height: 1.55;
}

.modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--rose-wash);
  color: var(--rose);
}

.modal-icon svg {
  width: 20px;
  height: 20px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 11px;
  padding: 3px;
  color: var(--muted);
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 16px;
  height: 16px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1370px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 390px;
  }

  .lead-grid-head,
  .lead-row {
    grid-template-columns: minmax(170px, 1.6fr) 103px minmax(100px, .9fr) 72px;
  }

  .lead-grid-head > :last-child,
  .lead-row > :last-child {
    display: none;
  }
}

@media (max-width: 1200px) {
  :root {
    --sidebar-w: 234px;
  }

  .search-box {
    width: 155px;
  }

  .search-box:focus-within {
    width: 190px;
  }

  .select-compact {
    max-width: 140px;
  }

  .source-cell {
    display: none;
  }

  .lead-grid-head,
  .lead-row {
    grid-template-columns: minmax(170px, 1.7fr) 103px minmax(105px, .9fr);
  }

  .lead-grid-head > :nth-child(4),
  .lead-row > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(286px, 84vw);
    visibility: hidden;
    transform: translateX(-104%);
    transition: transform .26s var(--ease), visibility .26s;
    box-shadow: 0 0 60px rgba(0, 0, 0, .25);
  }

  body.nav-open .sidebar {
    visibility: visible;
    transform: none;
  }

  .sidebar-close,
  .menu-btn {
    display: inline-flex;
  }

  .mobile-scrim {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    background: rgba(25, 24, 18, .35);
    backdrop-filter: blur(2px);
    animation: fade-in .2s var(--ease);
  }

  .topbar {
    min-height: 70px;
  }

  :root {
    --topbar-h: 70px;
  }

  .detail-panel {
    position: fixed;
    z-index: 60;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, calc(100vw - 34px));
    height: 100dvh;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    visibility: hidden;
    transform: translateX(103%);
    transition: transform .28s var(--ease), visibility .28s;
    box-shadow: -20px 0 70px rgba(25, 24, 18, .2);
  }

  body.detail-open .detail-panel {
    visibility: visible;
    transform: none;
  }

  body.detail-open {
    overflow: hidden;
  }

  .detail-close {
    display: inline-flex;
  }

  .detail-scrim {
    position: fixed;
    z-index: 55;
    inset: 0;
    display: block;
    background: rgba(24, 23, 18, .36);
    backdrop-filter: blur(2px);
    animation: fade-in .2s var(--ease);
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-chips {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 1px;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .filter-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-box {
    flex: 1;
    min-width: 170px;
    width: auto;
  }

  .search-box:focus-within {
    width: auto;
  }

  .lead-grid-head,
  .lead-row {
    grid-template-columns: minmax(170px, 1.7fr) 106px minmax(105px, .9fr) 78px;
  }

  .lead-grid-head > :nth-child(4),
  .lead-row > :nth-child(4) {
    display: block;
  }

  .lead-grid-head > :last-child,
  .lead-row > :last-child {
    display: block;
  }

  .source-cell {
    display: none;
  }

  .lead-grid-head > :nth-child(4),
  .lead-row > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 760px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-art {
    display: none;
  }

  .login-panel {
    min-height: 100dvh;
    padding: 34px 24px 22px;
    background:
      radial-gradient(ellipse 80% 50% at 80% 0%, rgba(219, 202, 172, .5), transparent 70%),
      var(--bg);
  }

  .login-card {
    max-width: 390px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .stat-card {
    min-height: 118px;
    padding: 15px;
  }

  .stat-value {
    font-size: 29px;
  }

  .stat-label {
    font-size: 8.5px;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 19px;
  }

  .intro-aside {
    display: none;
  }

  .main-scroll {
    padding: 22px 14px 34px;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-title h1 {
    font-size: 19px;
  }

  .topbar-kicker {
    font-size: 8px;
  }

  .topbar-actions .live-pill b {
    display: none;
  }

  .live-pill {
    padding: 0 9px;
  }

  .lead-grid-head {
    display: none;
  }

  .lead-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 9px;
    min-height: 72px;
    padding: 12px 14px;
  }

  .lead-row > .manager-cell,
  .lead-row > .source-cell,
  .lead-row > .date-cell {
    display: none;
  }

  .lead-grid-head > .date-cell,
  .lead-row > .date-cell {
    display: none;
  }

  .lead-row .client-cell {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .lead-row > .status-cell {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .lead-row > .manager-cell {
    display: none;
  }

  .lead-row .client-meta {
    max-width: 100%;
  }

  .filter-bar {
    padding: 12px;
    gap: 9px;
  }

  .filter-tools {
    gap: 6px;
  }

  .select-compact {
    flex: 1;
    max-width: none;
    min-width: 120px;
  }

  .select-sort {
    flex: 1;
    min-width: 138px;
  }

  .search-shortcut {
    display: none;
  }

  .date-cell {
    text-align: left;
  }

  .list-footer {
    padding: 10px 14px;
  }

  .detail-panel {
    width: 100%;
    border-radius: 0;
  }

  .detail-top {
    padding: 21px 18px 18px;
  }

  .detail-name {
    font-size: 28px;
  }

  .detail-body {
    padding: 12px;
  }

  .detail-section {
    padding: 13px;
  }

  .detail-tabs {
    padding: 0 12px;
  }

  .detail-actionbar {
    padding: 10px 12px;
  }

  .info-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
  }

  .team-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .team-stat {
    padding: 13px 15px;
  }

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

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 91dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: sheet-in .26s var(--ease);
  }

  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: none; }
  }

  .modal-head {
    padding: 20px 17px 0;
  }

  .modal-body {
    padding: 17px;
  }

  .modal-foot {
    padding: 0 17px 20px;
  }

  .toast-stack {
    top: 12px;
    right: 12px;
  }

  .empty-hints {
    display: none;
  }

  .page-intro .btn {
    align-self: flex-start;
  }

  .team-view .page-intro .btn {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    min-height: 110px;
    padding: 13px;
  }

  .stat-icon {
    width: 22px;
    height: 22px;
  }

  .stat-value {
    font-size: 27px;
  }

  .stat-hint {
    font-size: 9.5px;
  }

  .stat-line {
    right: 13px;
    left: 13px;
    bottom: 14px;
  }

  .detail-actionbar .btn span {
    display: none;
  }

  .detail-actionbar .btn {
    width: 32px;
    padding: 0;
  }

  .detail-actionbar .claim-btn span {
    display: inline;
  }

  .detail-actionbar .claim-btn {
    width: auto;
    padding: 0 11px;
  }

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

  .note-form-foot span {
    display: none;
  }

  .team-card {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
.mfa-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 200px;
  height: 200px;
  margin: 0 auto 14px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .02);
}

.mfa-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mfa-qr:empty {
  display: none;
}
.avatar {
  position: relative;
  overflow: hidden;
}

.avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.avatar-crop {
  display: flex;
  justify-content: center;
  margin: 6px 0 12px;
}

.avatar-crop canvas {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
  background: #eee;
}

.avatar-zoom {
  width: 100%;
  height: 28px;
  margin: 2px 0 6px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.avatar-zoom::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #e8e1d4;
}

.avatar-zoom::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #1c1b17;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  -webkit-appearance: none;
  appearance: none;
}

.avatar-zoom::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #e8e1d4;
}

.avatar-zoom::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #1c1b17;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .28);
}

.avatar-crop canvas:active {
  cursor: grabbing;
}

.lead-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.lead-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, .05);
}

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

.lead-photo__delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.lead-photo__empty {
  grid-column: 1 / -1;
  color: var(--muted, #8a8a8a);
  font-size: 13px;
}
.export-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 12px;
}

.export-links .btn {
  justify-content: center;
  text-align: center;
}
/* «В работе» у менеджера, который взял заявку */
.lead-row.is-mine {
  background: #f2f7f1;
}

.lead-row.is-mine::before {
  background: #3f8f5f;
}

.lead-row.is-mine:hover {
  background: #ecf4e9;
}

.lead-row.is-mine.is-selected {
  background: #e9f2e5;
}

.row-work-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2f0e3;
  color: #2f6b45;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Карточка заявки на весь экран */
body.detail-fullscreen {
  overflow: hidden;
}

body.detail-fullscreen .detail-panel {
  position: fixed;
  inset: 0;
  top: 0;
  height: 100vh;
  width: 100%;
  z-index: 1200;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.detail-fullscreen .detail-content {
  height: 100%;
}

body.detail-fullscreen .detail-body {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(14px, 2.4vw, 32px) clamp(12px, 2.4vw, 32px) 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 16px;
  align-content: start;
}

body.detail-fullscreen .detail-section {
  margin-bottom: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

body.detail-fullscreen .detail-body > .inline-banner {
  grid-column: 1 / -1;
}
/* Dashboard */
.dash-kpis {
  margin-top: 4px;
}

.dash-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.dash-panel {
  padding: 18px;
  border: 1px solid #ede7db;
  border-radius: 14px;
  background: #fffdf9;
}

.dash-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
}

.dash-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-bar {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
}

.dash-bar__label {
  overflow: hidden;
  color: #5d594f;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-bar__track {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe9dd;
}

.dash-bar__track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b9924f, #d8b878);
}

.dash-bar b {
  color: #2c2a24;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-days {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 150px;
  padding-top: 8px;
}

.dash-day {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 5px;
}

.dash-day i {
  width: 100%;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: #c9a96a;
}

.dash-day small {
  color: #9a9384;
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.dash-empty,
.dash-loading {
  margin: 0;
  padding: 10px 0;
  color: #9a9384;
  font-size: 11.5px;
}

@media (max-width: 900px) {
  .dash-panels {
    grid-template-columns: 1fr;
  }
}
.field-hint {
  display: block;
  margin-top: 5px;
  color: #9a9384;
  font-size: 10.5px;
  line-height: 1.45;
}
.avatar-zoom-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 2px 0 0;
  color: #8a8478;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.avatar-zoom-head b {
  color: #2c2a24;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.maintenance-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid #e6dfd1;
  border-radius: 12px;
  background: #fffdf9;
}

.maintenance-toggle input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #1c1b17;
  flex: none;
}

.maintenance-toggle b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.maintenance-toggle small {
  display: block;
  color: #7d776a;
  font-size: 11px;
  line-height: 1.55;
}
/* Deter casual source/text copying in the CRM. Real protection stays on the
   server: the browser already has the HTML/JS it renders. */
body,
body * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea,
select,
[contenteditable="true"],
.allow-select {
  -webkit-user-select: text;
  user-select: text;
}
/* ============================================================
   Archives and date range (owner-managed lead archives)
   ============================================================ */
.date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-range__input {
  width: 132px;
  padding: 8px 10px;
  font-size: 12.5px;
  border-radius: 9px;
}

.date-range__dash {
  color: var(--muted);
  font-size: 12px;
}

.archive-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.archive-control .select {
  max-width: 320px;
}

.archive-create {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.archive-create .input {
  flex: 1;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
}

.archive-row__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.archive-row__main b {
  font-size: 13.5px;
}

.archive-row__main small {
  color: var(--muted);
  font-size: 12px;
}

.archive-row__spacer {
  flex: 1;
}

.archive-delete {
  color: #b04a3a;
}

.archive-access-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}

.archive-access-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.archive-access-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
}

.archive-access-row span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13px;
}

.archive-access-row small {
  color: var(--muted);
  font-size: 12px;
}

/* ============================================================
   Manual lead entry
   ============================================================ */
.manual-lead-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.manual-lead-self {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
}

.manual-lead-form .modal-note {
  margin: 0;
}

/* ============================================================
   Consent receipts
   ============================================================ */
.receipt-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
}

.receipt-summary.is-ok { background: #eef6ea; border-color: #cfe3c5; }
.receipt-summary.is-bad { background: #fbeeee; border-color: #e8c9c9; }

.receipt-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--surface-raised);
}

.receipt-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.receipt-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.receipt-badge.is-given { background: #e6f2df; color: #3f6b32; }

.receipt-grid {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 4px 10px;
  font-size: 12px;
}

.receipt-grid > span:nth-child(odd) { color: var(--muted); }

.receipt-grid .mono,
.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
}

/* ============================================================
   Security alerts and subject-request register
   ============================================================ */
.popover-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: #b04a3a;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

.alert-list { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow: auto; }

.alert-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-raised);
}
.alert-card--critical { border-left-color: #b04a3a; }
.alert-card--info { border-left-color: #6b8f5a; }
.alert-card__head { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.alert-card__head span { color: var(--muted); }
.alert-card p { margin: 6px 0; font-size: 12.5px; line-height: 1.5; }
.alert-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 11.5px; }

.sr-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 360px; overflow: auto; }
.sr-row { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--surface-raised); }
.sr-row__main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; flex: 1; font-size: 12.5px; }
.sr-row__main small { color: var(--muted); font-size: 11.5px; }
.sr-row__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sr-badge { padding: 1px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em; }
.sr-badge--done { background: #e6f2df; color: #3f6b32; }
.sr-badge--new { background: #eef2fa; color: #405a86; }
.sr-badge--overdue { background: #fbe6e6; color: #9a3a2f; }
.section-actions { display: flex; gap: 6px; }

.security-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: #9a3a2f;
  color: #fff;
  font: 600 12.5px/1.2 inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.security-banner:hover { background: #7f2d24; }
