/* Platform pages (login, hub, account, team) — base styles. */

:root {
  --page: #f4f4f1;
  --surface: #fff;
  --text: #0b0b0b;
  --muted: #6b6a66;
  --border: rgba(11, 11, 11, 0.12);
  --blue: #2a78d6;
  --blue-dark: #1c5cab;
  --green: #0a8f3c;
  --red: #c0392b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text: #fff;
    --muted: #8f8d87;
    --border: rgba(255, 255, 255, 0.11);
    --shadow: none;
  }
}
:root[data-theme="dark"] {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text: #fff;
    --muted: #8f8d87;
    --border: rgba(255, 255, 255, 0.11);
    --shadow: none;
  }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
}
.shell { max-width: 980px; margin: 0 auto; padding: 28px 20px 56px; }
.shell.narrow { max-width: 640px; }
.muted { color: var(--muted); }
h1 { font-size: 1.45rem; margin: 0 0 18px; letter-spacing: -0.01em; }

/* ------------------------------------------------------------------ auth */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(42, 120, 214, 0.14), transparent),
    var(--page);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 34px 30px;
  box-shadow: 0 10px 42px rgba(0, 0, 0, 0.1);
}
.brand { text-align: center; margin-bottom: 26px; }
.brand-logo { display: inline-block; margin-bottom: 12px; }
.brand-logo svg { border-radius: 12px; display: block; }
.brand h1 { margin: 0 0 4px; font-size: 1.3rem; }
.brand-sub { margin: 0; color: var(--muted); font-size: 0.9rem; }
.auth-form { display: grid; gap: 14px; }
.error {
  color: var(--red); font-size: 0.88rem;
  background: rgba(192, 57, 43, 0.09);
  padding: 9px 11px; border-radius: 7px;
}

/* ----------------------------------------------------------------- forms */
label { display: grid; gap: 5px; font-size: 0.88rem; font-weight: 500; }
input, select, textarea {
  font: inherit; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--page); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue);
}
input:disabled { opacity: 0.6; }
button {
  font: inherit; cursor: pointer;
  border-radius: 8px; padding: 9px 16px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
.primary { background: var(--blue); color: #fff; border-color: var(--blue-dark); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.ghost { background: transparent; }
.danger-text { color: var(--red); }
.form-grid { display: grid; gap: 13px; max-width: 420px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row input, .form-row select { min-width: 150px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 1.02rem; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 14px; }

/* -------------------------------------------------------------------- hub */
.hub-hero { margin: 6px 0 22px; }
.hub-hero h1 { margin: 0 0 4px; }
.hub-hero p { margin: 0; }
.module-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  margin-bottom: 22px;
}
.module-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.module-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(42, 120, 214, 0.14);
}
.mod-badge {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 24px; padding: 0 7px;
  border-radius: 7px;
  background: rgba(42, 120, 214, 0.12); color: var(--blue-dark);
  font-size: 11.5px; font-weight: 750; letter-spacing: 0.05em;
  margin-bottom: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mod-badge { color: #7db4ee; }
}
:root[data-theme="dark"] .mod-badge { color: #7db4ee; }

.module-card h3 { margin: 0 0 5px; font-size: 0.98rem; }
.module-card p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.hub-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .hub-cols { grid-template-columns: 1fr; } }

/* -------------------------------------------------------------- link list */
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.link-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
}
.link-list li:hover { background: rgba(42, 120, 214, 0.06); }
.link-list a { color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.link-list a:hover { color: var(--blue); }
.link-list .when { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.link-list .rm {
  border: 0; background: none; color: var(--muted);
  font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 6px; cursor: pointer;
}
.link-list .rm:hover { color: var(--red); background: rgba(192, 57, 43, 0.09); }
.link-list .mini-badge {
  flex-shrink: 0;
  display: inline-grid; place-items: center;
  min-width: 26px; height: 18px; padding: 0 4px;
  border-radius: 5px;
  background: rgba(42, 120, 214, 0.12); color: var(--blue-dark);
  font-size: 9.5px; font-weight: 750; letter-spacing: 0.04em;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .link-list .mini-badge { color: #7db4ee; }
}
:root[data-theme="dark"] .link-list .mini-badge { color: #7db4ee; }


/* ------------------------------------------------------------------ table */
.table-scroll { overflow-x: auto; }
.team-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.team-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 0.8rem;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.team-table th.num, .team-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.team-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.team-table tr:last-child td { border-bottom: 0; }
.team-table select { padding: 5px 8px; }
.team-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.team-table .row-actions button { padding: 5px 10px; font-size: 0.82rem; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600;
}
.pill.ok { background: rgba(10, 143, 60, 0.12); color: var(--green); }
.pill.off { background: rgba(192, 57, 43, 0.1); color: var(--red); }

/* ---------------------------------------------------------- invite result */
.invite-result {
  margin-top: 12px; padding: 13px 15px;
  border: 1px dashed var(--blue); border-radius: 9px;
  background: rgba(42, 120, 214, 0.06);
  font-size: 0.9rem; line-height: 1.6;
}
.invite-result code {
  font: 600 0.95rem ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--surface); padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--border);
}

/* --------------------------------------------------------------- sessions */
.sess-ua { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-current { color: var(--green); font-weight: 600; font-size: 0.78rem; }

/* ----------------------------------------------------------- page chrome */
.shell.wide { max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .muted { margin: 0 0 14px; }
.page-actions { display: flex; gap: 8px; }
.ghost-btn {
  display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none; font: inherit; cursor: pointer;
}
.ghost-btn:hover { border-color: var(--blue); color: var(--blue); }
.ghost-btn.sm { padding: 4px 9px; font-size: 0.82rem; }
.tiny { font-size: 0.78rem; }
.filters-card { padding-bottom: 8px; }

/* ------------------------------------------------------------- lead board */
.lead-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.count-chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.count-chip strong { font-size: 0.98rem; font-variant-numeric: tabular-nums; }
.count-chip span { color: var(--muted); font-size: 0.82rem; }
.count-chip .chip-value { font-size: 0.74rem; font-style: normal; color: var(--green); }
.count-chip:hover { border-color: var(--blue); }
.count-chip.on { background: rgba(42, 120, 214, 0.14); border-color: rgba(42, 120, 214, 0.5); }
.count-chip.on span { color: var(--text); }
.count-chip.static { cursor: default; }
.lead-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.lead-toolbar .search { position: relative; display: flex; align-items: center; }
.lead-toolbar .search svg { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.lead-toolbar .search input { padding-left: 32px; min-width: 250px; }
.lead-toolbar select { min-width: 140px; }
.leads-table select { max-width: 150px; padding: 5px 8px; font-size: 0.85rem; border-radius: 999px; }
.leads-table select.lead-status-new { background: rgba(42, 120, 214, 0.12); }
.leads-table select.lead-status-contacted, .leads-table select.lead-status-replied { background: rgba(183, 121, 31, 0.14); }
.leads-table select.lead-status-quoted { background: rgba(130, 80, 200, 0.14); }
.leads-table select.lead-status-won { background: rgba(10, 143, 60, 0.14); }
.leads-table select.lead-status-lost { background: rgba(192, 57, 43, 0.12); color: var(--muted); }
.leads-table .row-actions .open-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 8px; background: var(--blue); color: #fff; border-color: var(--blue-dark); font-weight: 600; }
.leads-table .row-actions .open-btn:hover { background: var(--blue-dark); }
.leads-table .row-actions .ghost-btn { gap: 5px; }
.buyer-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini-badge { display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 6px; border-radius: 5px; background: rgba(42, 120, 214, 0.12); color: var(--blue-dark); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mini-badge { color: #7db4ee; }
}
:root[data-theme="dark"] .mini-badge { color: #7db4ee; }


/* ----------------------------------------------------------- lead drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 1000;
}
.lead-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 94vw);
  background: var(--surface); z-index: 1001;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
  padding: 22px 22px 40px; overflow: auto;
}
.drawer-close {
  position: absolute; top: 12px; right: 14px;
  border: 0; background: transparent; font-size: 18px;
  color: var(--muted); cursor: pointer; padding: 4px 8px;
}
.lead-drawer h2 { margin: 0 28px 6px 0; font-size: 1.2rem; }
.lead-drawer h3 { margin: 18px 0 8px; font-size: 0.95rem; }
.note-list { display: grid; gap: 8px; }
.note {
  padding: 10px 12px; border-radius: 8px;
  background: var(--page); border: 1px solid var(--border);
}
.note-meta { color: var(--muted); font-size: 0.78rem; margin-bottom: 4px; }

/* ----------------------------------------------------------- watch toggle */
.watch-btn {
  border: 0; background: none; cursor: pointer;
  font-size: 15px; color: var(--muted); padding: 2px 6px; border-radius: 6px;
}
.watch-btn.on { color: var(--blue); }
.watch-btn:hover { background: rgba(42, 120, 214, 0.08); }

/* ---- wt-17 CRM: follow-ups + contacts ---- */
.fu-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.fu-box.overdue { border-color: #c0392b; background: rgba(192, 57, 43, 0.05); }
.fu-box h3 { margin-top: 0; }
.mini-badge.fu-overdue { background: #c0392b; color: #fff; }
.mini-badge.fu-soon { background: #e9f2fc; color: #1c5cab; }
.contact-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: 0; }
.contact-del { background: none; border: 0; cursor: pointer; font-size: 14px; }
.lead-drawer section { margin-top: 18px; }
.lead-drawer h3 { margin-bottom: 8px; }

/* ---- wt-18 deals ---- */
.mini-badge.deal-badge { background: #e8f6ec; color: #1e7b3a; }
.count-chip .chip-value { display: block; font-size: 10.5px; font-style: normal; color: #1e7b3a; margin-top: 2px; }
.deal-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.deal-box .form-row { flex-wrap: wrap; }

/* ---- wt-19 analytics + logs ---- */
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.an-span2 { grid-column: 1 / -1; }
@media (max-width: 900px) { .an-grid { grid-template-columns: 1fr; } }
.an-bar-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.an-bar-label { flex: 0 0 120px; font-size: 0.84rem; color: var(--muted); }
.an-bar-track { flex: 1; height: 8px; background: var(--ggt-chip); border-radius: 999px; overflow: hidden; }
.an-bar-fill { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.an-bar-row.won .an-bar-fill { background: var(--green); }
.an-bar-row.lost .an-bar-fill { background: var(--muted); opacity: 0.5; }
.an-bar-n { flex: 0 0 40px; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.84rem; font-weight: 600; }
.an-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; }
.an-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: grid; gap: 2px; }
.an-tile strong { font-size: 1.45rem; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.an-tile span { color: var(--muted); font-size: 0.8rem; }
.an-tile.warn strong { color: var(--red); }
.an-tile.good strong { color: var(--green); }
.an-grid .card h3 { margin: 0 0 12px; font-size: 0.95rem; }
.an-empty { margin: 0; color: var(--muted); font-size: 0.86rem; }
.pill.warn { background: rgba(192, 57, 43, 0.1); color: var(--red); }
.count-chip.static { cursor: default; }
.warn-text { color: #b7791f; }

/* ---- wt-20 mail + logs pager ---- */
.logs-pager { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 12px 0 2px; }
.settings-table td:first-child, .dns-table td:first-child { white-space: nowrap; }
.dns-table code, .settings-table code { font-size: 11.5px; }
.break code { word-break: break-all; }
.cred-box { background: rgba(28,92,171,0.08); border: 1px solid rgba(28,92,171,0.25); border-radius: 10px; padding: 14px 16px; }
.big-code { font-size: 16px; font-weight: 600; letter-spacing: 0.02em; }
.addr-row { display: flex; align-items: stretch; }
.addr-row input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.addr-suffix { display: flex; align-items: center; padding: 0 10px; background: rgba(127,127,127,0.15); border: 1px solid var(--border); border-left: 0; border-radius: 0 8px 8px 0; font-size: 13px; color: var(--muted, #666); }

/* ---- wt-21 webmail ---- */
.wm-grid { display: grid; grid-template-columns: 160px 320px 1fr; gap: 12px; margin-top: 14px; align-items: start; }
@media (max-width: 1100px) { .wm-grid { grid-template-columns: 140px 1fr; } .wm-read { grid-column: 1 / -1; } }
.wm-folders { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.wm-folder { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.wm-folder:hover { background: rgba(127,127,127,0.1); }
.wm-folder.on { background: #1c5cab; color: #fff; }
.wm-badge { background: #c0392b; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.wm-count { color: var(--muted, #888); font-size: 11px; }
.wm-list { padding: 6px; max-height: 72vh; overflow-y: auto; }
.wm-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 10px; cursor: pointer; font: inherit; color: inherit; }
.wm-item:hover { background: rgba(127,127,127,0.06); }
.wm-item.unseen .wm-from, .wm-item.unseen .wm-subj { font-weight: 700; }
.wm-item-top { display: flex; justify-content: space-between; gap: 8px; }
.wm-from { font-size: 13px; }
.wm-date { font-size: 11px; color: var(--muted, #888); flex: 0 0 auto; }
.wm-subj { font-size: 12.5px; color: var(--muted, #666); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 10px 0; }
.wm-read { padding: 16px; min-height: 300px; }
.wm-msg-head h2 { margin: 0 0 8px; font-size: 18px; }
.wm-msg-meta { font-size: 13px; margin-bottom: 10px; }
.wm-msg-actions { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.wm-text { white-space: pre-wrap; font: inherit; margin: 0; }
.wm-html { max-width: 100%; overflow-x: auto; }
.wm-html img { max-width: 100%; height: auto; }
.wide-drawer { width: min(640px, 96vw); }

/* ---- wt-22 mail UI rework ---- */
.wm-grid2 { display: grid; grid-template-columns: 340px 1fr; gap: 12px; margin-top: 14px; align-items: start; }
@media (max-width: 900px) { .wm-grid2 { grid-template-columns: 1fr; } }
.wm-sb-folders { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 12px; padding-left: 6px; border-left: 2px solid rgba(255,255,255,0.08); }
.wm-sb-folder { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; color: #cfd6e0; text-align: left; }
.wm-sb-folder:hover { background: rgba(255,255,255,0.06); color: #fff; }
.wm-sb-folder.on { background: #1c5cab; color: #fff; }
.wm-sb-folder .wm-badge { margin-left: auto; }
.wm-list { padding: 0; max-height: 74vh; overflow-y: auto; }
.wm-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.wm-item:hover { background: rgba(127,127,127,0.06); }
.wm-item-main { flex: 1; text-align: left; border: 0; background: none; padding: 11px 10px; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.wm-item.unseen .wm-from, .wm-item.unseen .wm-subj { font-weight: 700; color: var(--text); }
.wm-item-top { display: flex; justify-content: space-between; gap: 8px; }
.wm-from { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-date { font-size: 11px; color: var(--muted, #888); flex: 0 0 auto; }
.wm-subj { font-size: 12.5px; color: var(--muted, #666); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-item-trash { border: 0; background: none; cursor: pointer; padding: 0 12px; opacity: 0; font-size: 14px; }
.wm-item:hover .wm-item-trash { opacity: 0.6; }
.wm-item-trash:hover { opacity: 1; }
.wm-pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px; }
.wm-read { padding: 16px; min-height: 340px; }
.wm-msg-head h2 { margin: 0 0 8px; font-size: 18px; }
.wm-msg-meta { font-size: 13px; margin-bottom: 10px; }
.wm-msg-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.wm-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wm-att { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit; font-size: 12.5px; }
.wm-att:hover { background: rgba(28,92,171,0.08); }
.wm-text { white-space: pre-wrap; font: inherit; margin: 0; }
.wm-html { max-width: 100%; overflow-x: auto; }
.wm-html img { max-width: 100%; height: auto; }
.wide-drawer { width: min(660px, 96vw); }
.c-att-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.c-attlist { display: flex; flex-wrap: wrap; gap: 6px; }
.c-att-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(28,92,171,0.08); border: 1px solid rgba(28,92,171,0.2); border-radius: 14px; padding: 3px 10px; font-size: 12px; }
.c-att-x { border: 0; background: none; cursor: pointer; font-size: 11px; }

/* ---- wt-24 mail read/unread contrast (theme-correct) ---- */
.wm-item .wm-from { color: var(--text); }
.wm-item:not(.unseen) .wm-from { color: var(--muted); font-weight: 400; }
.wm-item:not(.unseen) .wm-subj { color: var(--muted); }
.wm-item.unseen .wm-from { color: var(--text); font-weight: 700; }
.wm-item.unseen .wm-subj { color: var(--text); font-weight: 600; }
.wm-item.unseen { position: relative; }
.wm-item.unseen::before { content: ""; position: absolute; left: 3px; top: 50%; transform: translateY(-50%); width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.wm-item-main { padding-left: 18px !important; }
.wm-item.active { background: rgba(42,120,214,0.12); }
.wm-item.active .wm-from { color: var(--text); }

/* ---- admin view-another-mailbox ---- */
.wm-view-as { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 260px; }
.wm-imp-banner { background: rgba(192,57,43,0.1); border: 1px solid rgba(192,57,43,0.35); border-radius: 10px; padding: 10px 14px; margin: 12px 0 0; font-size: 13.5px; }
.linklike { border: 0; background: none; color: var(--blue); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* ---- wt-24 integrations ---- */
.int-card { margin-bottom: 14px; }
.int-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.int-head h3 { margin: 0 0 4px; }
.int-key { min-width: 280px; }

/* ---- lead detail: large centered modal (was a narrow side drawer) ----
   Scoped to #lead-drawer only — team/mailbox/webmail drawers keep their
   side-panel behaviour. */
#lead-drawer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(960px, 94vw);
  height: min(86vh, 900px);
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  padding: 26px 30px 34px;
}
/* Record layout: the story (compose, timeline, contacts) on the left, the
   facts (status, owner, follow-up, deal) on the right. History and the
   company finder render their own sections and span the full width. */
#lead-drawer #drawer-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  column-gap: 18px;
  align-items: start;
}
#lead-drawer #drawer-body > h2,
#lead-drawer #drawer-body > p { grid-column: 1 / -1; }
#lead-drawer #drawer-body > section { grid-column: 1 / -1; }
#lead-drawer #drawer-body > .ld-main { grid-column: 1; display: grid; gap: 14px; margin-top: 14px; }
#lead-drawer #drawer-body > .ld-side { grid-column: 2; display: grid; gap: 14px; margin-top: 14px; }
@media (max-width: 800px) {
  #lead-drawer { width: 96vw; height: 92vh; max-height: 92vh; padding: 18px 16px 26px; border-radius: 12px; }
  #lead-drawer #drawer-body { grid-template-columns: 1fr; }
  #lead-drawer #drawer-body > .ld-main, #lead-drawer #drawer-body > .ld-side { grid-column: 1; }
  #lead-drawer #drawer-body > .ld-head { order: -2; }
  #lead-drawer #drawer-body > .ld-side { order: -1; }
}

/* ---- lead modal: professional redesign ---- */
#lead-drawer { padding: 0 0 28px; }
#lead-drawer .drawer-close { top: 16px; right: 18px; z-index: 5; }
.ld-head {
  grid-column: 1 / -1;
  position: sticky; top: 0; z-index: 4;
  background: var(--surface);
  padding: 22px 30px 14px;
  margin: 0 -0px 4px;
  border-bottom: 1px solid var(--border);
}
#lead-drawer #drawer-body { padding: 0 30px; }
#lead-drawer #drawer-body > .ld-head { margin: 0 -30px 6px; }
.ld-title h2 { margin: 0 30px 2px 0; font-size: 1.45rem; letter-spacing: -0.01em; }
.ld-addr { color: var(--muted); font-size: 0.86rem; margin-bottom: 10px; }
.ld-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ld-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 11px; border-radius: 999px; font-size: 0.78rem;
  background: rgba(127,127,127,0.12); color: var(--text);
  border: 1px solid var(--border); text-decoration: none;
}
.ld-pill.ld-link:hover { background: rgba(42,120,214,0.15); }
.ld-pill.ld-status-new { background: rgba(42,120,214,0.16); border-color: rgba(42,120,214,0.4); }
.ld-pill.ld-status-contacted, .ld-pill.ld-status-replied { background: rgba(183,121,31,0.15); border-color: rgba(183,121,31,0.4); }
.ld-pill.ld-status-quoted { background: rgba(130,80,200,0.15); border-color: rgba(130,80,200,0.4); }
.ld-pill.ld-status-won { background: rgba(10,143,60,0.15); border-color: rgba(10,143,60,0.45); }
.ld-pill.ld-status-lost { background: rgba(192,57,43,0.14); border-color: rgba(192,57,43,0.4); }

.ld-card, #lead-drawer .fu-box, #lead-drawer .deal-box {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; background: rgba(127,127,127,0.03);
}
#lead-drawer .ld-card { margin-top: 0; }
#lead-drawer .fu-box, #lead-drawer .deal-box { margin: 0; }
#lead-drawer .ld-card h3, #lead-drawer .fu-box h3, #lead-drawer .deal-box h3 {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 0 0 12px; font-size: 0.92rem; color: var(--text); font-weight: 600;
}
#lead-drawer h3 > span { display: inline-flex; align-items: center; gap: 7px; }
#lead-drawer h3 svg { color: var(--muted); flex: 0 0 auto; }
#lead-drawer .ld-pill svg, .ld-title svg { flex: 0 0 auto; }
#lead-drawer .primary.sm, #lead-drawer .ghost-btn.sm { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; font-size: 0.84rem; }

/* contact cards */
.cc-list { display: grid; gap: 8px; }
.contact-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.cc-top { display: flex; align-items: center; gap: 10px; flex: 1 1 230px; min-width: 0; }
.cc-avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2a78d6, #1c5cab); color: #fff;
  font-weight: 700; font-size: 0.85rem;
}
.cc-id { min-width: 0; flex: 1; }
.cc-name { font-weight: 650; font-size: 0.95rem; }
.cc-role { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-card .contact-del { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px; opacity: 0.5; }
.contact-card .contact-del:hover { color: var(--red); opacity: 1; }
.cc-rows { display: flex; flex-wrap: wrap; gap: 4px 16px; flex: 2 1 280px; min-width: 0; }
.cc-row { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; min-width: 0; }
.cc-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-ico { flex: 0 0 auto; font-size: 0.8rem; }
.cc-copy { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 0.85rem; }
.cc-copy:hover { color: var(--blue); }
.cc-pending { color: var(--muted); font-style: italic; }

/* timeline */
#lead-drawer .note-list { border-left: 2px solid var(--border); padding-left: 16px; display: flex; flex-direction: column; gap: 10px; }
#lead-drawer .note { position: relative; }
#lead-drawer .note::before {
  content: ""; position: absolute; left: -21px; top: 6px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--blue);
}

/* ---- contact card link visibility + search indicator ---- */
.cc-row a { color: var(--text); opacity: 0.92; text-decoration: underline; text-decoration-color: rgba(127,127,127,0.5); text-underline-offset: 2px; }
.cc-row a:hover { color: var(--blue); opacity: 1; }
.enrich-banner {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(42,120,214,0.4); background: rgba(42,120,214,0.1);
  border-radius: 9px; padding: 9px 13px; margin-bottom: 12px; font-size: 0.85rem;
}
.enrich-banner.ok { border-color: rgba(10,143,60,0.45); background: rgba(10,143,60,0.1); }
.enrich-banner .spin { display: inline-block; animation: enrich-spin 1.6s linear infinite; }
@keyframes enrich-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---- company prospector ---- */
.pr-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.pr-row:last-child { border-bottom: 0; }
.pr-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.int-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bal-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; background: rgba(10,143,60,0.12); border: 1px solid rgba(10,143,60,0.35); white-space: nowrap; }
.bal-pill.low { background: rgba(192,57,43,0.12); border-color: rgba(192,57,43,0.4); }

/* ---- permissions page ---- */
.perm-yes { color: var(--green); font-weight: 700; }
.perm-no { color: var(--muted); opacity: 0.6; }
.perm-cell { text-align: center; }
.perm-cell input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }
.perm-cell input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.45; }

/* ---- lead delete + audit history ---- */
.ld-del { cursor: pointer; font: inherit; font-size: 0.78rem; background: rgba(192,57,43,0.1); border: 1px solid rgba(192,57,43,0.35); color: var(--red); }
.ld-del:hover { background: rgba(192,57,43,0.2); }
.audit-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.audit-row:last-child { border-bottom: 0; }
.audit-ic { flex: 0 0 auto; width: 24px; text-align: center; }
.audit-main { min-width: 0; }


/* ---- wt-31: dashboard "your day" strip ---- */
.day-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 22px; }
.day-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; }
.day-tile:hover { border-color: var(--blue); }
.day-tile .ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: rgba(42, 120, 214, 0.12); color: var(--blue); flex: 0 0 auto; }
.day-tile.warn .ic { background: rgba(192, 57, 43, 0.12); color: var(--red); }
.day-tile strong { display: block; font-size: 1.3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.day-tile span { color: var(--muted); font-size: 0.82rem; }
.hub h2 { font-size: 0.95rem; margin: 0 0 10px; }
.module-card h3 { font-size: 0.95rem; }
.link-list .watch-btn { font-size: 15px; }

/* ---- wt-31: reports picker ---- */
.report-list { display: grid; gap: 12px; }
.report-row { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.report-row .ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: rgba(42, 120, 214, 0.12); color: var(--blue); }
.report-row h3 { margin: 0 0 3px; font-size: 0.98rem; }
.report-row p { margin: 0 0 12px; color: var(--muted); font-size: 0.86rem; }
.report-row .form-row input[type="number"] { width: 90px; min-width: 0; }
.report-row .ghost-btn { gap: 6px; }

/* ---- wt-31: contact rows + audit icons ---- */
.cc-ico { display: grid; color: var(--muted); }
.cc-copy { display: grid; }
.audit-ic { display: grid; place-items: center; color: var(--muted); }
.ld-addr { display: flex; align-items: center; gap: 5px; }
.page-actions .ghost-btn, .page-actions .primary { display: inline-flex; align-items: center; gap: 6px; }


/* ---- wt-32: lead record layout ---- */
.ld-props { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(127, 127, 127, 0.03); }
.ld-prop { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: 0.86rem; min-height: 28px; }
.ld-prop > span { color: var(--muted); }
.ld-prop > b { font-weight: 500; overflow-wrap: anywhere; }
.ld-prop select { width: 100%; padding: 5px 9px; font-size: 0.86rem; border-radius: 999px; }
.ld-prop select.lead-status-new { background: rgba(42, 120, 214, 0.12); }
.ld-prop select.lead-status-contacted, .ld-prop select.lead-status-replied { background: rgba(183, 121, 31, 0.14); }
.ld-prop select.lead-status-quoted { background: rgba(130, 80, 200, 0.14); }
.ld-prop select.lead-status-won { background: rgba(10, 143, 60, 0.14); }
.ld-prop select.lead-status-lost { background: rgba(192, 57, 43, 0.12); }
.ld-when { display: grid; gap: 2px; margin: 0 0 8px; font-size: 0.9rem; }
.ld-when strong { font-size: 1.05rem; }
.ld-when .pill { justify-self: start; }
.ld-when .muted { font-size: 0.82rem; }
.ld-edit > summary { cursor: pointer; list-style: none; color: var(--ggt-link); font-size: 0.82rem; font-weight: 500; }
.ld-edit > summary::-webkit-details-marker { display: none; }
.ld-edit > summary:hover { text-decoration: underline; }
.ld-form { display: grid; gap: 8px; margin-top: 10px; }
.ld-form label { font-size: 0.78rem; gap: 4px; }
.ld-form label.check { flex-direction: row; display: flex; align-items: center; gap: 6px; font-size: 0.82rem; }
.ld-form .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ld-form .row > label { flex: 1 1 110px; min-width: 0; }
.ld-form input, .ld-form select { width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 0.86rem; }
.ld-composer { padding: 12px 14px; }
.ld-compose { display: grid; gap: 8px; }
.ld-compose-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ld-type-sel { padding: 5px 10px; border-radius: 999px; font-size: 0.84rem; font-weight: 600; }
.ld-compose textarea { width: 100%; box-sizing: border-box; min-height: 64px; resize: vertical; font-size: 0.9rem; line-height: 1.45; }
.ld-compose-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ld-compose-foot .spacer { flex: 1; }
.ld-fu-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.ld-fu-inline input { padding: 5px 8px; font-size: 0.82rem; }
#lead-drawer .note-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); margin-bottom: 3px; }
#lead-drawer .note-type { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text); }
#lead-drawer .note-type svg { color: var(--muted); }
#lead-drawer .note-text { font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
#lead-drawer .note::before { top: 5px; }

/* ---- wt-33: pipeline pager ---- */
.lead-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 4px 0; font-size: 0.8rem; color: var(--muted); }
.lead-pager:empty { display: none; }
.lead-pager span:only-child { margin-left: auto; }

/* ---- wt-34: pipeline board, lost-reason dialog, export menu, import ---- */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-left: auto; }
.view-toggle button { border: 0; border-radius: 0; padding: 7px 12px; background: var(--surface); color: var(--muted); font-size: 0.86rem; }
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle button.on { background: rgba(42, 120, 214, 0.14); color: var(--text); font-weight: 600; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); display: grid; }
.menu-list a { padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 0.88rem; }
.menu-list a:hover { background: var(--ggt-chip); }
.lead-board { display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; padding: 2px 2px 16px; scrollbar-width: thin; scrollbar-color: rgba(127, 127, 127, 0.35) transparent; }
.lead-board::-webkit-scrollbar { height: 8px; }
.lead-board::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, 0.35); border-radius: 999px; }
.lb-note { flex-basis: 100%; margin: 0 0 4px; font-size: 0.8rem; color: var(--muted); }
.lb-col { flex: 0 0 208px; width: 208px; display: flex; flex-direction: column; max-height: calc(100vh - 300px); background: var(--ggt-chip); border-radius: 12px; }
.lb-col.over { box-shadow: inset 0 0 0 2px var(--blue); }
.lb-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; padding: 12px 12px 6px; }
.lb-name { font-weight: 600; font-size: 0.9rem; }
.lb-count { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.lb-value { margin-left: auto; color: var(--green); font-size: 0.74rem; font-weight: 600; }
.lb-cards { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 10px; overflow-y: auto; min-height: 60px; scrollbar-width: thin; }
.lb-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 9px 14px; cursor: grab; }
.lb-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; }
.lb-card.prio-new::before { background: var(--blue); }
.lb-card.prio-contacted::before, .lb-card.prio-replied::before { background: #d97706; }
.lb-card.prio-quoted::before { background: #8250c8; }
.lb-card.prio-won::before { background: var(--green); }
.lb-card.prio-lost::before { background: var(--muted); }
.lb-card:hover, .lb-card:focus-visible { border-color: var(--blue); outline: none; }
.lb-card.dragging { opacity: 0.4; }
.lb-col.lb-lost .lb-card .lb-title { color: var(--muted); }
.lb-title { font-size: 0.88rem; font-weight: 600; line-height: 1.35; word-break: break-word; }
.lb-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 7px; font-size: 0.74rem; color: var(--muted); }
.lb-lost { font-style: italic; }
.lb-avatar { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.lb-empty { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 16px 8px; border: 1px dashed var(--border); border-radius: 10px; }
.ld-dlg { border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; width: min(460px, 94vw); background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35); }
.ld-dlg::backdrop { background: rgba(0, 0, 0, 0.4); }
.ld-dlg h3 { margin: 0 0 4px; font-size: 1.05rem; }
.ld-dlg .tiny { margin: 0 0 12px; }
.ld-dlg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ld-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--page); font-size: 0.82rem; }
.ld-chip:hover { border-color: var(--blue); color: var(--blue); }
.ld-dlg input { width: 100%; box-sizing: border-box; }
.note-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 0.8rem; color: var(--ggt-link); text-decoration: none; }
.note-link:hover { text-decoration: underline; }
@media (max-width: 640px) { .view-toggle { margin-left: 0; } .lb-col { flex-basis: 80vw; width: 80vw; } }

/* the pipeline (table or six-column board) uses the full width */
.shell.wide.leads-shell { max-width: none; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.check-line input { width: auto; margin: 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
