/* Jen CRM — app shell + components.
 * Shell, tokens and most components follow the Pure Clean CRM (pc.jball.tech) so both
 * CRMs share one layout; colours are Jennifer Tumbrello's brand blues.
 * Dark is the base. Light applies when the OS asks for it and the user has not forced
 * dark, or when the user explicitly chose light.
 */
:root {
  --bg: #0d1219;
  --panel: #151c26;
  --panel-2: #1b2430;
  --line: #263142;
  --fg: #e6edf3;
  --muted: #8d99a8;
  --accent: #5facec;
  --accent-fg: #06223f;
  --navy: #9cc6ef;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .4);
  --sidebar-w: 240px;
  --topbar-h: 58px;
  --logo-light: none;
  --logo-dark: block;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-2: #f2f6fa;
    --line: #d9e1ea;
    --fg: #14243a;
    --muted: #5f6f82;
    --accent: #1d72b8;
    --accent-fg: #ffffff;
    --navy: #052a5c;
    --ok: #1a7f37;
    --warn: #9a6700;
    --err: #cf222e;
    --shadow: 0 8px 24px rgba(5, 42, 92, .12);
    --logo-light: block;
    --logo-dark: none;
  }
}

:root[data-theme="light"] {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f2f6fa;
  --line: #d9e1ea;
  --fg: #14243a;
  --muted: #5f6f82;
  --accent: #1d72b8;
  --accent-fg: #ffffff;
  --navy: #052a5c;
  --ok: #1a7f37;
  --warn: #9a6700;
  --err: #cf222e;
  --shadow: 0 8px 24px rgba(5, 42, 92, .12);
  --logo-light: block;
  --logo-dark: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- shell */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}
.layout__skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-fg);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 60;
}
.layout__skip:focus { left: 0; }

/* ----------------------------------------------------------- sidebar */
.sidebar {
  grid-area: sidebar;
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 0 12px 20px;
  z-index: 30;
  display: flex; flex-direction: column;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h);
  margin: 0 -12px 14px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo { height: 42px; width: auto; }
.sidebar__logo--light { display: var(--logo-light); }
.sidebar__logo--dark { display: var(--logo-dark); }
.sidebar__brand-tag {
  margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px; padding: 1px 7px;
}
.sidebar__nav { display: grid; gap: 2px; }
.sidebar__section {
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 14px 12px 6px;
}
.sidebar__link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 7px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  border-left: 2px solid transparent;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.sidebar__link:hover { color: var(--fg); background: var(--panel-2); text-decoration: none; }
.sidebar__link--active {
  color: var(--accent); border-left-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
  font-weight: 550;
}
.sidebar__icon { width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.sidebar__icon svg { width: 18px; height: 18px; display: block; }
.sidebar__count {
  margin-left: auto; font-size: 11.5px; font-weight: 650; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); line-height: 1.6;
}

/* ------------------------------------------------------------ topbar */
.topbar {
  grid-area: topbar;
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(14px, 2.5vw, 28px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.topbar__spacer { flex: 1; }
.topsearch { position: relative; flex: 0 1 420px; }
.topsearch svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topsearch input[type=search] { padding-left: 34px; background: var(--panel-2); border-radius: 999px; height: 36px; }
.burger {
  display: none; background: transparent; border: 1px solid var(--line);
  border-radius: 7px; color: var(--fg); padding: 6px 8px; cursor: pointer; line-height: 0;
}

/* --------------------------------------------------- profile bubble */
.dropdown { position: relative; }
.topbar__user {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; font: inherit; font-size: 13.5px; color: var(--fg);
  transition: background 140ms ease, border-color 140ms ease;
}
.topbar__user:hover { background: var(--panel-2); }
.topbar__user[aria-expanded="true"] { background: var(--panel-2); border-color: var(--accent); }
.topbar__avatar {
  width: 26px; height: 26px; flex: none; border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 18%, var(--panel-2));
  color: var(--accent); font-weight: 600; font-size: 12.5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar__name { font-weight: 550; }
.topbar__chevron { color: var(--muted); font-size: 10px; }
.dropdown__menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 250px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 7px; display: none; z-index: 40;
}
.dropdown__menu.is-open { display: block; }
.dropdown__head { padding: 8px 10px 10px; }
.dropdown__name { font-weight: 600; font-size: 14px; }
.dropdown__email { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.dropdown__divider { height: 1px; background: var(--line); margin: 5px 0; }
.dropdown__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--fg); font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer;
}
.dropdown__item:hover { background: var(--panel-2); text-decoration: none; }
.dropdown__glyph { color: var(--muted); }
.dropdown__group { padding: 4px 10px 8px; }
.dropdown__group-label {
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; margin-bottom: 7px;
}
.theme-toggle {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px; padding: 2px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
}
.theme-toggle__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 6px 4px; background: transparent; border: 0; border-radius: 6px;
  color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
}
.theme-toggle__btn:hover { color: var(--fg); }
.theme-toggle__btn.is-active { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); font-weight: 550; }
.layout__scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); border: 0; z-index: 25; cursor: pointer; }

/* -------------------------------------------------------------- main */
.main { grid-area: main; padding: 24px clamp(14px, 2.5vw, 28px) 60px; }
.main__inner { max-width: 1180px; }

/* ------------------------------------------------------------ blocks */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px;
}
.card.tight { padding: 0; overflow: hidden; overflow-x: auto; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card__head h2 { margin: 0; }
.card.tight .card__head { padding: 16px 18px 0; margin-bottom: 12px; }
h1 { font-size: 23px; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.crumb { font-size: 13px; margin-bottom: 6px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid transparent; border-radius: 7px;
  padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-quiet { background: var(--panel-2); color: var(--fg); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--err); border-color: var(--line); }
.btn-danger:hover { background: var(--err); color: #fff; filter: none; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
button[disabled], .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------- forms */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=url],
input[type=datetime-local], input[type=date], input[type=time], input[type=number], input[type=file],
select, textarea {
  width: 100%; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 11px; font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px; border-color: var(--accent);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.short { min-height: 80px; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; }
.phone-row { display: grid; gap: 10px; grid-template-columns: 1fr 90px; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.check input { width: auto; margin: 0; }
.check label { margin: 0; color: var(--fg); font-size: 14px; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { padding: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

/* ------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
tr.rowlink { cursor: pointer; }
td .name { font-weight: 550; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.table-foot { padding: 10px 14px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------- misc */
.flash { border-radius: 8px; padding: 11px 14px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.flash-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.flash-error { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.flash-warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.errors { margin: 0 0 16px; padding: 12px 14px 12px 32px; border-radius: 8px;
  background: color-mix(in srgb, var(--err) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 40%, transparent); font-size: 14px; }
.errors li { margin-bottom: 3px; }
.empty { color: var(--muted); padding: 6px 0; margin: 0; }
.card .empty { padding: 4px 0; }
.card.tight .empty { padding: 18px; }

.tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.tag--typed {
  color: var(--tag, var(--muted));
  border-color: color-mix(in srgb, var(--tag, var(--line)) 45%, transparent);
  background: color-mix(in srgb, var(--tag, transparent) 9%, transparent);
}

/* lead status badges (New / Contacted / Quoted / Bound / Lost) */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge--new { color: #2f81f7; border-color: color-mix(in srgb, #2f81f7 45%, transparent); background: color-mix(in srgb, #2f81f7 9%, transparent); }
.badge--contacted { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.badge--quoted { color: #8957e5; border-color: color-mix(in srgb, #8957e5 45%, transparent); background: color-mix(in srgb, #8957e5 9%, transparent); }
.badge--bound { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 9%, transparent); }
.badge--lost { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); background: color-mix(in srgb, var(--err) 9%, transparent); }

/* ------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 9px 14px; color: var(--muted); font-size: 14px; font-weight: 500;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  background: none; font-family: inherit; cursor: pointer;
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab--active { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.tab__count {
  display: inline-block; min-width: 20px; margin-left: 5px; padding: 1px 6px;
  border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.5;
}
.tab--active .tab__count { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tabpanel { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.ctabs:not(.is-enhanced) .tabpanel + .tabpanel { margin-top: 28px; }

/* ---------------------------------------------------- colour swatches */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { margin: 0; cursor: pointer; line-height: 0; position: relative; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch > span[aria-hidden] { display: block; width: 26px; height: 26px; border-radius: 999px; background: var(--tag); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span[aria-hidden] { border-color: var(--panel); box-shadow: 0 0 0 2px var(--tag); }
.swatch input:focus-visible + span[aria-hidden] { box-shadow: 0 0 0 3px var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; background: var(--tag); vertical-align: middle; margin-right: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* -------------------------------------------------------- combobox */
.combo { position: relative; }
.combo.is-enhanced > select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.combo__input { width: 100%; }
.combo__list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 290px; overflow-y: auto; margin: 0; padding: 5px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: var(--shadow); z-index: 45;
}
.combo.is-open .combo__list { display: block; }
.combo__option { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo__option.is-active { background: var(--panel-2); }
.combo__option.is-selected { color: var(--accent); font-weight: 550; }
.combo__meta { color: var(--muted); font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__flag { margin-left: auto; flex: none; color: var(--warn); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.combo__empty { padding: 9px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------- uploader */
.drop {
  position: relative; display: grid; justify-items: center; gap: 6px;
  padding: 30px 20px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--panel-2); text-align: center;
  transition: border-color 140ms ease, background 140ms ease;
}
.drop.is-enhanced { cursor: pointer; }
.drop.is-enhanced:hover, .drop.is-enhanced:focus-visible { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); outline: none; }
.drop.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel-2)); }
.drop.is-busy { opacity: .6; cursor: progress; }
.drop.is-enhanced .drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop__icon { width: 30px; height: 30px; color: var(--muted); }
.drop.is-over .drop__icon { color: var(--accent); }
.drop__title { font-size: 15px; }
.drop__link { color: var(--accent); font-weight: 550; text-decoration: underline; text-underline-offset: 2px; }
.drop__hint { color: var(--muted); font-size: 12.5px; }
.drop:not(.is-enhanced) .drop__icon, .drop:not(.is-enhanced) .drop__title { display: none; }
.queue { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; max-height: 300px; overflow-y: auto; }
.queue__item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.queue__item:last-child { border-bottom: 0; }
.queue__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue__meta { flex: none; color: var(--muted); font-size: 12.5px; }
.queue__item--bad .queue__name { color: var(--muted); text-decoration: line-through; }
.queue__item--bad .queue__meta { color: var(--err); }
.queue__remove { flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.queue__remove:hover { background: var(--panel-2); color: var(--fg); }
.uploader__foot { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; }
.uploader__foot .field { margin: 0; flex: 1 1 220px; }
.uploader__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.uploader__summary { color: var(--muted); font-size: 13px; margin-right: 4px; }
.uploader:not(.is-enhanced) [data-js-only] { display: none; }
.progress { height: 6px; margin-top: 14px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width 120ms linear; }

/* -------------------------------------------------------- documents */
.docbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0 12px; }
.docbar input[type=search] { flex: 1 1 260px; width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 12.5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.chip.is-on { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.docgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.doc__thumb { aspect-ratio: 4 / 3; background: var(--panel-2); display: flex; align-items: center; justify-content: center; border: 0; padding: 0; cursor: zoom-in; width: 100%; }
.doc__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc__ext { font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--muted); border: 2px solid var(--line); border-radius: 8px; padding: 14px 12px; }
.doc__body { padding: 10px 12px 12px; display: grid; gap: 4px; flex: 1; }
.doc__name { font-size: 13.5px; font-weight: 550; overflow-wrap: anywhere; }
.doc__meta { color: var(--muted); font-size: 12px; }
.doc__note { font-size: 12.5px; color: var(--fg); white-space: pre-wrap; }
.doc__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.doc details summary { cursor: pointer; color: var(--accent); font-size: 12.5px; list-style: none; }
.doc details[open] summary { margin-bottom: 6px; }
.doc details .field { margin-bottom: 8px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(10, 12, 16, .92); z-index: 70; display: grid; grid-template-rows: auto 1fr auto; color: #e6edf3; }
.lightbox__bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.lightbox__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.lightbox__bar a, .lightbox__bar button { color: #e6edf3; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 7px; padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.lightbox__stage { position: relative; display: flex; align-items: center; justify-content: center; padding: 0 60px; min-height: 0; }
.lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__stage iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; font-size: 22px; cursor: pointer; }
.lightbox__nav--prev { left: 10px; }
.lightbox__nav--next { right: 10px; }
.lightbox__foot { padding: 10px 16px 16px; font-size: 13.5px; color: #c5ced8; text-align: center; white-space: pre-wrap; }

/* -------------------------------------------------------- pills/stats */
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.pill-pending, .pill-sending { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill-sent { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.pill-failed { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.pill-canceled, .pill-skipped { color: var(--muted); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: block; color: inherit; position: relative; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.stat .n { font-size: 26px; font-weight: 650; letter-spacing: -.02em; display: block; line-height: 1.2; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat--accent { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.stat--accent .n { color: var(--accent); }
.stat-group-label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 8px; }

.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin: 0; }
.filters input[type=text], .filters input[type=search] { min-width: 230px; }

.cols { display: grid; gap: 18px; grid-template-columns: 1.6fr 1fr; align-items: start; }
.cols-even { grid-template-columns: 1fr 1fr; }
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-group { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 20px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); font-weight: 650; }
.kv-group:first-of-type { margin-top: 2px; }

.note { border-bottom: 1px solid var(--line); padding: 12px 0; }
.note:last-child { border-bottom: 0; padding-bottom: 0; }
.note .meta { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.note .meta form { margin-left: auto; }
.note .body { white-space: pre-wrap; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.linkbtn:hover { color: var(--err); text-decoration: underline; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-plain li:last-child { border-bottom: 0; padding-bottom: 0; }
.list-plain .grow { flex: 1; min-width: 0; }

.inline { display: inline; }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.preview { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 12px; font-size: 13.5px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.statusdot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 6px; background: var(--muted); }
.statusdot--ok { background: var(--ok); }
.statusdot--warn { background: var(--warn); }
.statusdot--err { background: var(--err); }

/* contact header */
.person { display: flex; gap: 16px; align-items: center; }
.person__avatar {
  width: 54px; height: 54px; border-radius: 999px; flex: none;
  background: color-mix(in oklab, var(--tag, var(--accent)) 18%, var(--panel-2));
  color: var(--tag, var(--accent)); font-weight: 650; font-size: 19px;
  display: inline-flex; align-items: center; justify-content: center;
}
.person__line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* lead documents (ACORD / EZLynx) */
.docs__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.doccard { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; color: var(--fg); transition: border-color .12s; }
.doccard:hover { border-color: var(--accent); text-decoration: none; }
.doccard__icon { flex: none; width: 42px; height: 48px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: #fff; }
.doccard__icon--pdf { background: #c0392b; }
.doccard__icon--xml { background: #2d7a4f; }
.doccard__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.doccard__body b { font-size: 14px; }
.doccard__body span { font-size: 12px; color: var(--muted); }
.doccard__dl { margin-left: auto; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 15px; font-weight: 700; }
.docs__hint { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.ezblocked { background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 8px; padding: 12px 14px; margin: 0; }
.ezupload { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ezupload__status { font-size: 13.5px; color: var(--muted); }
.ezupload__status.good { color: var(--ok); }
.ezupload__status.warn { color: var(--warn); }
.ezupload .btn-small { margin-left: 8px; }

/* search results */
.results-group { margin-bottom: 18px; }

/* ------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.login-card { width: 100%; max-width: 390px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.login-card .sidebar__logo { height: 64px; margin: 0 auto 14px; }
.login-card h1 { margin-bottom: 4px; text-align: center; font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; text-align: center; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 10px; }

/* ------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .cols, .cols-even, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar { transform: translateX(-100%); transition: transform 180ms ease; box-shadow: var(--shadow); }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .layout.nav-open .layout__scrim { display: block; }
  .topbar { left: 0; }
  .burger { display: inline-flex; }
  .topbar__name, .topbar__chevron { display: none; }
  .topbar__user { padding: 4px; }
}
@media (max-width: 620px) {
  .main { padding: 18px 14px 50px; }
  .card { padding: 16px; }
  th, td { padding: 9px 10px; }
  .hide-sm { display: none; }
  .topsearch { flex-basis: auto; }
}

/* Grid children default to min-width:auto, which lets a wide child (tab strip, table)
   stretch the page past the screen on phones. */
.layout > *, .cols > *, .grid > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
/* The hidden attribute always wins over a component's own display rule. */
[hidden] { display: none !important; }
label.tab { display: inline-block; margin-bottom: -1px; font-size: 14px; color: var(--muted); }
label.tab.tab--active { color: var(--fg); }
.show-sm { display: none !important; }
@media (max-width: 620px) { .show-sm { display: block !important; } }
