:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --line: #d8e2e7;
  --text: #012f46;
  --muted: #58707c;
  --accent: #ed0a3a;
  --accent-2: #012f46;
  --soft: #edf2f5;
  --surface-muted: #f7f9fa;
}

@font-face {
  font-family: "Onest Variable";
  src: url("https://ilikeradio.ru/assets/onest-cyrillic-wght-normal-DXI_y_WF.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: "Onest Variable", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.sidebar {
  min-width: 0;
  min-height: 100vh;
  padding: 26px 20px;
  background: #012f46;
  color: white;
  position: sticky;
  top: 0;
}

.brand {
  display: block;
  font-size: 28px;
  font-weight: 720;
  margin-bottom: 30px;
  color: white;
  line-height: .9;
  letter-spacing: -0.04em;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #ecf4f1;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 480;
  line-height: 1.3;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

nav a.active {
  background: white;
  color: var(--accent-2);
  font-weight: 620;
}

.mode-switch {
  grid-template-columns: 1fr;
  gap: 4px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.25);
}

.mode-switch a {
  padding: 11px 13px;
  border: 0;
  font-weight: 540;
}

.mode-switch a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.context-nav {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.context-nav a { padding-left: 12px; }

.sidebar-settings {
  display: block;
  margin-top: 20px;
  padding: 12px 13px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 9px;
  color: white;
}

.sidebar-settings.active { background: white; color: var(--text); font-weight: 620; }

.main {
  min-width: 0;
  padding: 30px 32px 48px;
  max-width: 1600px;
  width: 100%;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(34px, 3.4vw, 48px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  margin: 0;
}

h2 {
  font-size: 23px;
  line-height: 1.2;
  margin: 0 0 14px;
}

h3 {
  font-size: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(1, 47, 70, 0.035);
}

.metrics div {
  padding: 16px;
}

.metrics strong {
  display: block;
  font-size: 28px;
}

.metrics span,
.muted {
  color: var(--muted);
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid > * { min-width: 0; }

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

.grid.compact {
  gap: 10px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.button,
button {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

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

.button.danger,
button.danger,
.panel.danger {
  border-color: #e6bbb3;
  color: #8f2f20;
}

.panel.success {
  border-color: #b8dccd;
  background: #f2faf6;
  color: #1f6b5d;
}

.panel.notice {
  border-color: #ead7a8;
  background: #fffaf0;
}

.button.small,
button.small {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
}

.num {
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--soft);
  color: #22483f;
  font-size: 16px;
  font-weight: 620;
  line-height: 1.25;
}

.checklist {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ready-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: white;
}

.ready-item span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-weight: 760;
}

.ready-item.ok span {
  background: #dff1e8;
  color: #1f6b5d;
}

.ready-item.todo span {
  background: #fae5df;
  color: #9c3828;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.actions form,
.row-actions form { margin: 0; }

.form {
  display: grid;
  gap: 13px;
}

.form > button,
.form > .button { justify-self: start; }

.manual-lead-panel { max-width: 1080px; }
.manual-lead-grid .field-wide { grid-column: 1 / -1; }
.grid.two > .field-wide { grid-column: 1 / -1; }
.manual-lead-grid textarea { min-height: 180px; }
.manual-task-check { width: fit-content; color: var(--text); font-size: 17px; }
.manual-lead-actions { margin: 0; }
.form-message { max-width: 1080px; font-size: 18px; }
.form-hint { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.45; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: white;
  font: inherit;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

.inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline.wide input {
  max-width: 420px;
}

.stack {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: auto;
}

dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 14px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mail {
  white-space: pre-wrap;
  background: #f8faf8;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.pdf-frame {
  height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.pdf-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.document-signing { display: grid; gap: 18px; }
.document-signature-list { display: grid; border-top: 1px solid var(--line); }
.document-signature-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.document-signature-row > div:first-child { display: grid; gap: 4px; min-width: 0; }
.document-signature-row span:not(.badge) { color: var(--muted); }
.document-signature-row .actions { flex-shrink: 0; }
.signer-signature-preview { display: block; width: 150px; height: 52px; object-fit: contain; object-position: left center; margin-bottom: 4px; }
.document-lock-note { margin: 0; color: var(--muted); }
.document-signing-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; }
.document-certificate-select { flex: 1 1 420px; margin: 0; }
.document-signing-status { flex: 1 0 100%; min-height: 24px; margin: 0; color: var(--muted); }
.document-signing-status[data-state="success"] { color: var(--success-text, #246548); }
.document-signing-status[data-state="error"] { color: var(--danger, #a62d25); }
.badge.success { background: #e3f2e9; color: #246548; }

@media (max-width: 760px) {
  .document-signature-row { align-items: stretch; flex-direction: column; }
  .document-signature-row .actions { justify-content: flex-start; }
  .document-signing-controls { align-items: stretch; flex-direction: column; }
  .document-certificate-select { flex-basis: auto; width: 100%; }
}

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

.block-card {
  min-height: 190px;
  padding: 24px;
  border-radius: 20px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.block-card strong {
  font-size: 54px;
  line-height: 1;
}

.block-card span {
  font-size: 20px;
  font-weight: 700;
}

.analytics-card { background: #012f46; }

.analytics-filter {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  flex-wrap: wrap;
}

.filter-group { display: grid; gap: 7px; }
.filter-label { color: var(--muted); font-size: 16px; font-weight: 600; }

.period-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.custom-period {
  display: grid;
  grid-template-columns: repeat(2,minmax(150px,1fr)) auto;
  align-items: end;
  gap: 10px;
}
.custom-period button { min-height: 42px; }

.custom-period label {
  display: grid;
  gap: 6px;
  font-weight: 650;
}

.analytics-sites {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.analytics-metrics div {
  display: grid;
  gap: 6px;
}

.analytics-metrics strong { font-size: 30px; }
.analytics-metrics span { color: var(--muted); }

.top-pages {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.top-page {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.analytics-trust {
  display: grid;
  grid-template-columns: minmax(190px, .45fr) minmax(190px, .45fr) minmax(320px, 2fr);
  gap: 18px;
  align-items: center;
}

.analytics-trust div { display: grid; gap: 5px; }
.analytics-trust strong { font-size: 34px; }
.analytics-trust span,
.analytics-trust p,
.coverage { color: var(--muted); }
.analytics-trust p { margin: 0; font-size: 17px; line-height: 1.45; }
.coverage { min-height: 48px; line-height: 1.45; }

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.workflow-card {
  min-height: 148px;
  padding: 21px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
}

.workflow-card strong { font-size: 23px; line-height: 1.2; }
.workflow-card span { color: var(--muted); font-size: 17px; line-height: 1.45; }
.workflow-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.workflow-card.primary-workflow { background: var(--accent); border-color: var(--accent); color: white; }
.workflow-card.primary-workflow span { color: white; }
.dashboard-entry .workflow-card { min-height: 136px; }

.lead-filter-grid {
  display: grid;
  grid-template-columns: minmax(250px,2fr) repeat(3,minmax(175px,1fr)) auto;
  gap: 14px;
  align-items: end;
}

.lead-table th,
.lead-table td { padding: 16px 12px; }

.lead-table form { margin: 0; }
.lead-row-action { margin-top: 12px !important; }
.archive-note,
.deferred-note,
.trash-note { margin: 4px 0 18px; color: var(--muted); font-size: 17px; line-height: 1.45; }
.archive-note { padding: 13px 15px; border-left: 4px solid #58a477; background: #f3f8f4; }
.deferred-note { padding: 13px 15px; border-left: 4px solid #d7a237; background: #fff9eb; }
.lead-list-actions { display: grid; min-width: 190px; gap: 8px; }
.lead-archive-form { display: grid; grid-template-columns: minmax(112px,1fr) auto; gap: 6px; }
.lead-archive-form select { min-height: 38px; padding: 7px 9px; font-size: 14px; }
.lead-archive-form button { padding-inline: 10px; }
.lead-defer-action > summary { width: fit-content; cursor: pointer; color: var(--accent); font-weight: 700; font-size: 14px; }
.lead-defer-form { display: grid; gap: 8px; margin-top: 8px !important; padding: 12px; border: 1px solid #ecd49e; border-radius: 10px; background: #fffaf0; }
.lead-defer-form label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.lead-defer-form select,
.lead-defer-form input,
.lead-defer-form textarea { min-height: 38px; padding: 7px 9px; font-size: 14px; }
.lead-defer-form textarea { min-height: 62px; resize: vertical; }
.lead-delete-action > summary { width: fit-content; cursor: pointer; color: var(--muted); font-size: 13px; }
.lead-delete-action > form { margin-top: 7px; }
.trash-banner { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.trash-banner h2, .trash-banner p { margin: 0; }
.trash-banner div { display: grid; gap: 8px; }
.lead-archive-banner { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-color: #a9c9b5; background: #f3f8f4; }
.lead-archive-banner h2,
.lead-archive-banner p { margin: 0; }
.lead-archive-banner > div { display: grid; gap: 8px; }
.company-readonly form { pointer-events: none; opacity: .62; }
.company-readonly form button { display: none; }

.pagination,
.settings-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pagination a {
  min-width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
}

.pagination a.active { background: var(--accent); border-color: var(--accent); color: white; }

.bar-chart {
  min-height: 205px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(34px,1fr);
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  padding: 18px 4px 8px;
  border-bottom: 1px solid var(--line);
  scrollbar-color: #a9bbc4 transparent;
  scrollbar-width: thin;
}

.bar-chart.large { min-height: 250px; }
.bar-column { min-width: 0; display: grid; justify-items: center; align-items: end; gap: 6px; }
.bar { width: 24px; min-height: 5px; border-radius: 8px 8px 0 0; background: var(--accent); }
.bar-level-0 { height: 5px; }
.bar-level-1 { height: 12px; }
.bar-level-2 { height: 19px; }
.bar-level-3 { height: 26px; }
.bar-level-4 { height: 33px; }
.bar-level-5 { height: 40px; }
.bar-level-6 { height: 47px; }
.bar-level-7 { height: 54px; }
.bar-level-8 { height: 61px; }
.bar-level-9 { height: 68px; }
.bar-level-10 { height: 75px; }
.bar-level-11 { height: 82px; }
.bar-level-12 { height: 89px; }
.bar-level-13 { height: 96px; }
.bar-level-14 { height: 103px; }
.bar-level-15 { height: 110px; }
.bar-level-16 { height: 117px; }
.bar-level-17 { height: 124px; }
.bar-level-18 { height: 131px; }
.bar-level-19 { height: 138px; }
.bar-level-20 { height: 145px; }
.bar-value { font-weight: 720; }
.bar-column time { padding-bottom: 8px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); }
.chart-scale { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.analytics-main-grid { grid-template-columns: minmax(0,2fr) minmax(330px,1fr); }
.audience-chart-panel { min-width: 0; overflow: hidden; }

.change-list,
.candidate-list { display: grid; }
.change-list a,
.candidate-list article {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.candidate-list article > div:first-child { display: grid; gap: 6px; }
.candidate-list article span { color: var(--muted); }
.change { display: inline-flex; align-items: center; width: fit-content; min-height: 32px; padding: 6px 12px; border-radius: 9px; font-weight: 620; line-height: 1.25; }
.change.up { background: #dff1e3; color: #1f6b43; }
.change.down { background: #f8dfdc; color: #9b3427; }
.change.stable { background: #e5eef2; color: #315968; }

.standards-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 18px;
}
.standards-grid ul { margin: 0; padding-left: 24px; display: grid; gap: 10px; font-size: 17px; line-height: 1.45; }
.integration-intro p { max-width: 960px; font-size: 19px; line-height: 1.5; }
.integration-step { display: grid; gap: 14px; }
.integration-step h2,.integration-step p { margin: 0; }
.integration-copy { width: 100%; min-height: 120px; resize: vertical; font: 600 16px/1.5 ui-monospace,monospace; }
.integration-copy-large { min-height: 440px; }
.integration-code { overflow: auto; padding: 16px; border-radius: 14px; background: #012f46; color: white; font-size: 16px; }
.check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.check-grid span { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 17px; }

.highlight-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
.highlight-grid a { min-height: 142px; padding: 17px; display: flex; flex-direction: column; justify-content: space-between; gap: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); color: var(--text); }
.highlight-grid a > span:not(.change) { color: var(--muted); }

@media (max-width: 900px) {
  .lead-archive-banner { align-items: stretch; flex-direction: column; }
  .analytics-sites,
  .analytics-metrics { grid-template-columns: 1fr; }
}
.inbound-card { background: #0a435d; }
.outbound-card { background: #ed0a3a; }
.tasks-card { background: #001d2b; }

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

.section-head h2 { margin: 0; }

.list-cards {
  display: grid;
  gap: 10px;
}

.list-card {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.list-card strong { font-size: 18px; }
.list-card span,
.list-card time { color: var(--muted); font-size: 16px; }
.list-card time { font-variant-numeric: tabular-nums; }

.lead-mini-timeline {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 1px;
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
  box-shadow: 0 10px 28px rgba(0, 47, 70, .16);
}

.lead-mini-timeline-item {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 82px;
  gap: 3px;
  padding: 12px 16px 12px 28px;
  background: white;
}

.lead-mini-timeline-item::before {
  content: "";
  position: absolute;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #58a477;
  box-shadow: 0 0 0 4px #e6f2ea;
}

.lead-mini-timeline-item.next::before { background: var(--accent); box-shadow: 0 0 0 4px #ffe2e8; }
.lead-mini-timeline-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.lead-mini-timeline-item strong { overflow: hidden; font-size: 15px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.lead-mini-timeline-item small { overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }

.lead-contact-center { margin-top: 10px; padding: 24px; border: 1px solid #b8cbd4; border-radius: 14px; background: #f5f9fa; }
.lead-contact-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.lead-contact-heading h3,
.lead-next-step-heading h3 { margin: 4px 0 6px; font-size: 24px; }
.lead-contact-heading p,
.lead-next-step-heading p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.45; }
.lead-eyebrow { color: var(--accent); font-size: 13px; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.contact-action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.contact-action-trigger { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; min-height: 88px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--text); text-align: left; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.contact-action-trigger:hover,
.contact-action-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 8px 20px rgba(0,47,70,.1); transform: translateY(-1px); }
.contact-action-trigger > span { grid-row: 1 / span 2; align-self: center; color: var(--accent); font-size: 28px; }
.contact-action-trigger strong { align-self: end; font-size: 20px; }
.contact-action-trigger small { align-self: start; color: var(--muted); font-size: 14px; }
.contact-action-panel { margin-top: 12px; }
.contact-action-panel[hidden] { display: none; }
.contact-action-form { max-width: none; margin: 0; padding: 20px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: white; }
.contact-action-form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.contact-action-form-head span { color: var(--muted); font-size: 14px; font-weight: 700; }
.contact-action-form-head h4 { margin: 3px 0 0; font-size: 21px; }
.contact-action-close { color: var(--muted); font-size: 28px; line-height: 1; }
.contact-action-form textarea { min-height: 94px; }
.contact-action-form .contact-email-text { min-height: 180px; }
.contact-action-form-footer { display: grid; grid-template-columns: minmax(250px,.6fr) minmax(230px,.4fr); align-items: end; gap: 16px; }
.contact-action-form-footer label { margin: 0; }
.contact-action-form-footer button { min-height: 50px; }
.contact-file-field { padding: 14px; border: 1px dashed #9fb2bc; border-radius: 10px; background: var(--surface-muted); }
.contact-file-field > span { font-weight: 700; }
.contact-file-field input { min-height: auto; padding: 8px 0 2px; border: 0; background: transparent; }
.contact-file-field small { overflow-wrap: anywhere; color: var(--muted); font-size: 14px; font-weight: 500; }
.contact-action-log { display: grid; gap: 1px; margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.contact-action-log > a { display: grid; grid-template-columns: 34px 180px minmax(0,1fr); align-items: center; gap: 10px; min-width: 0; padding: 11px 13px; background: white; color: var(--text); text-decoration: none; }
.contact-action-log > a:hover { background: #fff7f8; }
.contact-action-log > a > span:nth-child(2) { display: grid; }
.contact-action-log small { color: var(--muted); font-size: 13px; }
.contact-log-kind { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e6f2ea; color: #28734a; }
.contact-log-kind.email { background: #ffe2e8; color: var(--accent); }
.contact-log-result { overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.lead-next-step-planner { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.lead-next-step-heading { max-width: 760px; }
.next-step-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.next-step-card { max-width: none; margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); }
.next-step-card.client { border-top: 4px solid var(--accent); }
.next-step-card.internal { border-top: 4px solid var(--accent-2); }
.next-step-card-title { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.next-step-card-title > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: white; color: var(--accent-2); font-size: 20px; font-weight: 800; }
.next-step-card.client .next-step-card-title > span { color: var(--accent); }
.next-step-card-title h4 { margin: 0; font-size: 20px; }
.next-step-card-title p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.next-step-card textarea { min-height: 82px; }
.next-step-card > button { width: 100%; min-height: 50px; }

.lead-start-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  border-color: var(--accent);
}
.lead-start-panel p { max-width: 820px; margin: 8px 0 0; font-size: 18px; line-height: 1.45; }
.lead-start-button { min-width: 190px; min-height: 52px; font-weight: 750; }
.lead-pipeline > .section-head p { margin: 8px 0 0; color: var(--muted); font-size: 17px; }
.lead-pipeline-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; margin: 22px 0 0; padding: 0; list-style: none; }
.pipeline-step { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 12px; min-height: 158px; padding: 18px 22px 18px 0; border-top: 3px solid var(--line); background: white; }
.pipeline-step:last-child { padding-right: 0; }
.pipeline-step-index { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; margin-top: -21px; border: 3px solid white; border-radius: 50%; background: var(--line); color: var(--text); font-size: 16px; font-weight: 700; }
.pipeline-step-copy { display: grid; align-content: start; gap: 8px; }
.pipeline-step strong { display: block; font-size: 20px; line-height: 1.25; }
.pipeline-step p { margin: 0; font-size: 16px; line-height: 1.45; }
.pipeline-step-state { color: var(--muted); font-size: 15px; font-weight: 600; }
.pipeline-plan-link { width: fit-content; font-size: 15px; font-weight: 650; }
.pipeline-follow-up-control { margin-top: 2px; }
.pipeline-follow-up-control > summary { width: fit-content; cursor: pointer; color: var(--accent); font-size: 15px; font-weight: 650; }
.pipeline-follow-up-control > form { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.pipeline-follow-up-control label { gap: 5px; font-size: 14px; }
.pipeline-follow-up-control input { min-height: 42px; }
.pipeline-follow-up-control .actions { align-items: center; }
.pipeline-follow-up-control button { min-height: 40px; padding: 9px 12px; }
.pipeline-step.current { border-top-color: var(--accent); }
.pipeline-step.current .pipeline-step-index { background: var(--accent); color: white; }
.pipeline-step.current .pipeline-step-state { color: var(--accent); }
.pipeline-step.completed { border-top-color: #58a477; }
.pipeline-step.completed .pipeline-step-index { background: #58a477; color: white; }
.pipeline-planned-actions { margin-top: 8px; padding: 22px 0 4px; border-top: 1px solid var(--line); }
.pipeline-planned-actions > .section-head p { margin: 7px 0 0; color: var(--muted); font-size: 16px; }
.pipeline-planned-actions > .empty { margin: 14px 0 0; }
.planned-activities { display: grid; gap: 12px; margin: 16px 0 0; }
.planned-activity { display: grid; grid-template-columns: minmax(220px,.42fr) minmax(0,1.58fr); align-items: start; gap: 22px; padding: 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface-muted); }
.planned-activity-main { display: grid; gap: 6px; }
.planned-activity-main > span { color: var(--muted); font-size: 15px; font-weight: 650; }
.planned-activity-main h4 { margin: 0; font-size: 20px; }
.planned-activity-main time { font-weight: 700; font-variant-numeric: tabular-nums; }
.planned-activity-main p { margin: 4px 0 0; line-height: 1.5; white-space: pre-wrap; }
.planned-activity-actions { display: flex; min-width: 0; align-items: start; justify-content: flex-end; flex-wrap: wrap; gap: 14px; }
.planned-activity-actions details { position: relative; min-width: 0; }
.planned-activity-actions details[open] { flex: 1 0 100%; }
.planned-activity-actions summary { cursor: pointer; color: var(--accent); font-weight: 650; white-space: nowrap; }
.planned-activity-actions .form { position: relative; z-index: 2; width: 100%; max-width: none; margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.button-quiet { min-height: auto; padding: 0; border: 0; background: transparent; }
.lead-schedule-action { display: grid; grid-template-columns: minmax(260px,.55fr) minmax(0,1.45fr); gap: 28px; margin-top: 24px; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.lead-schedule-action h3 { margin: 0; font-size: 22px; }
.lead-schedule-action > div > p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.schedule-activity-form { margin: 0; }
.schedule-activity-form textarea { min-height: 90px; }
.pipeline-history { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.pipeline-history > .section-head { margin-bottom: 4px; }
.pipeline-history > .section-head p { margin: 7px 0 0; color: var(--muted); font-size: 16px; }
.pipeline-history-list { display: grid; }
.pipeline-history-item { border-bottom: 1px solid var(--line); }
.pipeline-history-summary { display: grid; grid-template-columns: 16px minmax(0,1fr) auto 18px; align-items: center; gap: 14px; min-height: 82px; padding: 13px 0; cursor: pointer; list-style: none; }
.pipeline-history-summary::-webkit-details-marker { display: none; }
.pipeline-history-summary:hover .pipeline-history-summary-copy > strong { color: var(--accent); }
.pipeline-history-marker { width: 11px; height: 11px; border-radius: 50%; background: #58a477; box-shadow: 0 0 0 4px #e6f2ea; }
.pipeline-history-summary-copy { display: grid; min-width: 0; gap: 2px; }
.pipeline-history-summary-copy > span { color: var(--muted); font-size: 14px; font-weight: 650; }
.pipeline-history-summary-copy > strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; transition: color .15s ease; }
.pipeline-history-summary-copy > small { overflow: hidden; color: var(--muted); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-history-summary time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pipeline-history-chevron { color: var(--muted); font-size: 21px; transition: transform .15s ease; }
.pipeline-history-item[open] .pipeline-history-chevron { transform: rotate(180deg); }
.pipeline-history-body { margin-left: 30px; padding: 0 0 18px; }
.pipeline-history-result { margin: 12px 0 0; padding: 14px 16px; border-left: 3px solid #58a477; background: #f3f8f4; line-height: 1.5; white-space: pre-wrap; }
.pipeline-history-empty { margin: 12px 0 0; color: var(--muted); font-style: italic; }
.stage-files { margin-top: 16px; padding: 16px; border-radius: 10px; background: var(--surface-muted); }
.stage-files-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.stage-files-head h5 { margin: 0; font-size: 17px; }
.stage-files-head > span { color: var(--muted); font-size: 15px; }
.stage-file-list { display: grid; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.stage-file-list[hidden] { display: none; }
.stage-file-list li { min-width: 0; }
.stage-file-list a { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 100%; color: var(--text); text-decoration: none; }
.stage-file-list a:hover strong { color: var(--accent); text-decoration: underline; }
.stage-file-list a > span:last-child { display: grid; min-width: 0; }
.stage-file-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-file-list small { color: var(--muted); font-size: 14px; }
.stage-file-icon { display: grid; flex: 0 0 auto; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: white; color: var(--accent); font-weight: 750; }
.stage-file-dropzone { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 88px; margin-top: 12px; padding: 16px 18px; border: 1px dashed #9fb2bc; border-radius: 9px; background: white; transition: border-color .15s ease, background .15s ease; }
.stage-file-dropzone.is-dragging { border-color: var(--accent); background: #fff4f6; }
.stage-file-dropzone.is-uploading { opacity: .72; }
.stage-file-dropzone > div { display: grid; gap: 4px; }
.stage-file-dropzone > div > strong { font-size: 17px; }
.stage-file-dropzone > div > span { color: var(--muted); line-height: 1.4; }
.stage-file-input { display: none; }
.stage-file-select { flex: 0 0 auto; border-color: var(--accent); background: var(--accent); color: white; }
.stage-file-select:hover { background: var(--accent-dark); }
.stage-file-select:disabled { cursor: wait; opacity: .65; }
.stage-file-help { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.stage-file-status { min-height: 22px; margin-top: 6px; color: #28734a; font-size: 15px; }
.stage-file-status.error { color: #a33a2b; }
.pipeline-history-editor { margin-top: 12px; }
.pipeline-history-editor summary { width: fit-content; cursor: pointer; color: var(--accent); font-weight: 650; }
.pipeline-history-editor .form { max-width: 820px; margin-top: 14px; padding: 16px; background: var(--surface-muted); }
.pipeline-history-editor textarea { min-height: 112px; }
.lead-state-panel { align-self: start; }
.lead-state-note { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); line-height: 1.5; }
.compact-data-section { padding: 0; overflow: hidden; }
.compact-data-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 88px; padding: 18px 22px; cursor: pointer; list-style: none; }
.compact-data-section > summary::-webkit-details-marker { display: none; }
.compact-data-section > summary > span:first-child { display: grid; gap: 4px; }
.compact-data-section > summary strong { font-size: 20px; }
.compact-data-section > summary small { color: var(--muted); font-size: 15px; }
.compact-data-section > summary:hover strong { color: var(--accent); }
.compact-data-chevron { color: var(--muted); font-size: 22px; transition: transform .15s ease; }
.compact-data-section[open] .compact-data-chevron { transform: rotate(180deg); }
.compact-data-body { padding: 0 22px 22px; border-top: 1px solid var(--line); }
.compact-data-body > .table-wrap { margin: 0 -22px -22px; padding: 0 22px 22px; }
.compact-data-body table { margin-top: 18px; }
.compact-data-body .payload-fields { margin-top: 18px; }
.technical-original { margin-top: 18px; }
.technical-original > summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.pipeline-action { margin-top: 8px; padding: 22px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface-muted); }
.pipeline-action h3 { margin: 0; font-size: 22px; }
.pipeline-action > p { margin: -4px 0 2px; color: var(--muted); }
.pipeline-result { margin: 20px 0 0; }
.pipeline-cadence { margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 16px; }
.task-result { margin: 4px 0; padding: 10px 12px; border-left: 3px solid #58a477; background: #f3f8f4; line-height: 1.45; }
.lead-origin-panel > .section-head p,
.seed-results > .section-head p { margin: 8px 0 0; color: var(--muted); font-size: 17px; }
.origin-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.origin-summary > div { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.origin-summary span { color: var(--muted); font-size: 16px; }
.origin-summary strong { font-size: 18px; line-height: 1.35; }
.origin-editor { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.origin-editor summary,
.defer-project summary { cursor: pointer; font-size: 18px; font-weight: 750; }
.origin-editor .form { margin-top: 16px; }
.origin-editor textarea { min-height: 88px; }
.badge.suggested { background: #fff0c7; color: #7a5510; }
.defer-project { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.nurture-state { margin-top: 20px; }
.seed-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.seed-metrics > div { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.seed-metrics strong { font-size: 30px; }
.seed-metrics span { color: var(--muted); font-size: 16px; }
.seed-suggestions { padding: 16px; border-radius: 12px; background: #fff0c7; font-size: 17px; }

@media (max-width: 900px) {
  .lead-mini-timeline { grid-template-columns: repeat(3,minmax(0,1fr)); top: 6px; }
  .lead-mini-timeline-item { min-height: 88px; padding: 9px 8px 9px 19px; }
  .lead-mini-timeline-item::before { left: 7px; width: 6px; height: 6px; box-shadow: 0 0 0 2px #e6f2ea; }
  .lead-mini-timeline-item.next::before { box-shadow: 0 0 0 2px #ffe2e8; }
  .lead-mini-timeline-label { font-size: 10px; }
  .lead-mini-timeline-item strong { font-size: 13px; white-space: normal; }
  .lead-mini-timeline-item small { font-size: 11px; white-space: normal; }
  .contact-action-buttons,
  .next-step-options { grid-template-columns: 1fr; }
  .contact-action-form-footer { grid-template-columns: 1fr; }
  .contact-action-log > a { grid-template-columns: 34px minmax(0,1fr); }
  .contact-log-result { grid-column: 2; white-space: normal; }
  .lead-start-panel { align-items: stretch; flex-direction: column; }
  .lead-pipeline-steps { grid-template-columns: 1fr; }
  .pipeline-step { min-height: 0; padding: 14px 0 18px 18px; border-top: 0; border-left: 3px solid var(--line); }
  .pipeline-step.current { border-left-color: var(--accent); }
  .pipeline-step.completed { border-left-color: #58a477; }
  .pipeline-step-index { margin: 0 0 0 -37px; }
  .planned-activity { grid-template-columns: 1fr; }
  .planned-activity-actions { align-items: stretch; flex-direction: column; }
  .planned-activity-actions .form { width: 100%; }
  .lead-schedule-action { grid-template-columns: 1fr; }
  .pipeline-history-summary { grid-template-columns: 14px minmax(0,1fr) 18px; gap: 11px; }
  .pipeline-history-summary time { grid-column: 2; grid-row: 2; }
  .pipeline-history-chevron { grid-column: 3; grid-row: 1 / span 2; }
  .pipeline-history-summary-copy > strong,
  .pipeline-history-summary-copy > small { white-space: normal; }
  .pipeline-history-summary-copy > small { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .pipeline-history-body { margin-left: 0; }
  .stage-file-dropzone { align-items: stretch; flex-direction: column; }
  .stage-file-select { width: 100%; }
  .compact-data-section > summary { min-height: 80px; padding: 16px 18px; }
  .compact-data-body { padding: 0 18px 18px; }
  .compact-data-body > .table-wrap { margin: 0 -18px -18px; padding: 0 18px 18px; }
  .origin-summary,
  .seed-metrics { grid-template-columns: 1fr; }
}

.compact-metrics {
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  margin: 0;
}

.big-number {
  margin: 12px 0 22px;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
}

.site-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.site-card { margin: 0; }
.site-card > p { color: var(--muted); }

.site-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: baseline;
}

.site-stats strong { font-size: 28px; }
.site-stats span { color: var(--muted); }

.sidebar-user {
  display: grid;
  gap: 10px;
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.2);
  color: white;
}

.sidebar-user button {
  background: transparent;
  border-color: rgba(255,255,255,.4);
  color: white;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #012f46;
}

.login-card {
  width: min(520px, 100%);
  padding: 36px;
  border-radius: 16px;
  background: white;
}

.login-card h1 { margin: 14px 0 28px; }
.login-brand { color: #ed0a3a; margin: 0; }

.empty {
  padding: 22px 0;
  color: var(--muted);
  font-size: 17px;
}

.table-wrap { overflow-x: auto; }
.raw-json,
.secret {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 18px;
  border-radius: 12px;
  background: #dce9ee;
  color: #001d2b;
  font-size: 16px;
}

code { font-size: 16px; }

button.primary,
.button.primary {
  box-shadow: none;
}

button:hover,
.button:hover {
  border-color: #ed0a3a;
}

:focus-visible {
  outline: none;
  box-shadow: none;
}

.page-actions { margin-bottom: 18px; }

.relationship-grid {
  display: grid;
  grid-template-columns: repeat(5,minmax(150px,1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.relationship-card {
  min-height: 132px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.relationship-card span { font-size: 18px; font-weight: 650; }
.relationship-card strong { font-size: 40px; line-height: 1; }
.relationship-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.relationship-no_work,.relationship-dead { background: #f8e1de; }
.relationship-warm,.relationship-success,.relationship-cyclic { background: #fff4c9; }
.relationship-working_now { background: #e3f4e6; }
.relationship-archive { background: #eef3f5; }

.dashboard-work { align-items: start; }
.task-zone { min-height: 360px; }
.today-zone { background: white; border-top: 3px solid #6eaf8b; }
.overdue-zone { background: white; border-top: 3px solid #d7796c; }
.task-card { display: grid; gap: 9px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.task-card strong { font-size: 19px; }
.task-card form { margin-top: 4px; }
.task-lead-context { display: grid; gap: 6px; font-size: 16px; line-height: 1.4; }
.task-lead-context a { font-weight: 750; }
.task-lead-context span { color: var(--muted); }
.recent-company-list { display: grid; }
.recent-company-list > a { display: grid; grid-template-columns: 1.7fr 1fr auto; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.recent-company-list span,.recent-company-list time { color: var(--muted); }

.company-search { display: grid; grid-template-columns: minmax(300px,2fr) minmax(240px,1fr) auto; gap: 14px; align-items: end; }
.status-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.status-chips a { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: white; }
.status-chips a.active { border-color: var(--accent); background: var(--soft); color: var(--accent-2); font-weight: 700; }
.status-filter { margin-top: 18px; }
.status-filter .status-chips { margin-top: 0; }
.company-table-panel { padding: 14px; }
.company-table th,.company-table td { padding: 16px 14px; }
.company-table tbody tr { border-left: 6px solid transparent; }
.company-table tbody tr.activity-fresh { background: #f6fbf7; border-left-color: #42a56a; }
.company-table tbody tr.activity-attention { background: #fffcf1; border-left-color: #dfa820; }
.company-table tbody tr.activity-stale { background: #f5f9fb; border-left-color: #5798c7; }
.company-table tbody tr.activity-old { background: #fcf7f6; border-left-color: #bd7c71; }
.company-table tbody tr.activity-unknown { background: #f1f3f4; border-left-color: #8da0a9; }
.company-name { font-size: 18px; font-weight: 750; }
.cell-meta { display: block; margin-top: 5px; color: var(--muted); font-size: 16px; }
.company-table tbody tr:hover,
.lead-table tbody tr:hover { background: #edf4f7; }

.company-summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.company-summary-grid > div { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.company-summary-grid p { margin: 10px 0 0; }
.activity-label { padding: 8px 12px; border-radius: 9px; font-weight: 620; }
.activity-label.activity-fresh { background: #dff1e3; }
.activity-label.activity-attention { background: #fff0b9; }
.activity-label.activity-stale { background: #deedf5; }
.activity-label.activity-old { background: #f4d9d5; }
.important-note { margin-top: 20px; padding: 20px; border-left: 6px solid var(--accent); background: #fff0ed; border-radius: 12px; }
.pre-wrap { white-space: pre-wrap; }
details { margin-top: 18px; }
summary { cursor: pointer; color: var(--accent); font-size: 18px; font-weight: 700; }

.email-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.email-row > div:first-child { display: grid; gap: 5px; }
.email-row span { color: var(--muted); }
.add-form { padding-top: 8px; }
.add-form > form { margin-top: 18px; }
.people-table th,.people-table td { padding: 16px 10px; }
.industry-list { display: grid; gap: 10px; }
.industry-row { display: grid; grid-template-columns: minmax(280px,1fr) 180px auto; gap: 16px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rules-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.rule-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.rule-card > input:first-child { font-size: 20px; font-weight: 750; }
.rule-card textarea { min-height: 240px; }

.document-intro,
.document-summary,
.section-heading-actions,
.document-number-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
}
.document-intro p,
.document-summary p,
.section-heading-actions p,
.document-number-banner p { margin: 6px 0 0; font-size: 17px; color: var(--muted); }
.document-number-banner { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.document-number-banner div { display: grid; gap: 3px; }
.document-number-banner span { color: var(--muted); font-weight: 650; }
.document-number-banner strong { font-size: 34px; }
.document-builder { display: grid; gap: 2px; min-width: 0; max-width: 100%; }
.document-builder > .panel { min-width: 0; max-width: 100%; }
.section-heading-actions { margin-bottom: 16px; }
.section-heading-actions h2 { margin-bottom: 0; }
.template-rename-control { position: relative; margin: 0; }
.template-rename-control > summary { list-style: none; }
.template-rename-control > summary::-webkit-details-marker { display: none; }
.template-rename-form {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(440px, 82vw);
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: 0 12px 32px rgba(1, 47, 70, .12);
}
.template-rename-form button { justify-self: start; }
.table-scroll { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; }
.invoice-editor { min-width: 940px; }
.invoice-editor th:nth-child(1) { width: 52px; }
.invoice-editor th:nth-child(2) { min-width: 280px; }
.invoice-editor th:nth-child(3) { width: 110px; }
.invoice-editor th:nth-child(4) { width: 120px; }
.invoice-editor th:nth-child(5) { width: 150px; }
.invoice-editor th:nth-child(6) { width: 150px; }
.invoice-editor td { vertical-align: middle; }
.item-total { white-space: nowrap; font-weight: 720; }
.document-totals { display: grid; gap: 16px; max-width: 620px; margin: 24px 0 0 auto; }
.custom-tax-fields[hidden] { display: none; }
.total-summary { grid-template-columns: 1fr auto; font-size: 18px; padding: 16px; border-radius: 14px; background: white; }
.total-summary dt:last-of-type,
.total-summary dd:last-of-type { font-size: 22px; font-weight: 780; color: var(--text); }
.document-submit { justify-content: flex-end; }
.document-submit .button { min-height: 52px; padding: 14px 22px; font-weight: 760; }
.counterparty-modes { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.counterparty-panel { display: grid; gap: 16px; padding: 22px 0; margin: 4px 0 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.counterparty-panel h2 { margin: 0; }
.document-content-fields { margin-top: 4px; }
.rich-text-field { display: grid; gap: 8px; }
.field-label { color: var(--muted); font-weight: 700; }
.rich-text-toolbar { display: flex; gap: 8px; }
.rich-text-command { width: 46px; min-height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--text); font: 700 18px/1 "Onest Variable", sans-serif; cursor: pointer; }
.rich-text-editor { min-height: 240px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--text); font-size: 18px; line-height: 1.45; }
.rich-text-editor:empty::before { content: attr(data-placeholder); color: #71818a; pointer-events: none; }
.rich-text-editor p,
.rich-text-preview p { margin: 0 0 .75em; text-indent: 1.5em; }
.rich-text-editor p:last-child,
.rich-text-preview p:last-child { margin-bottom: 0; }
.choice-card { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; font-weight: 700; }
.choice-card input { width: 20px; height: 20px; margin: 0; }
.counterparty-panel > p { font-size: 17px; margin: 0; }
.counterparty-panel [hidden], #valid-until-field[hidden] { display: none; }
.tag-catalog { display: grid; gap: 10px; }
.tag-catalog div { display: grid; grid-template-columns: minmax(180px,.8fr) 1.5fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.tag-catalog code { padding: 7px 9px; border-radius: 7px; background: white; color: var(--text); font: 650 16px/1.3 "Onest Variable", sans-serif; }
.tag-catalog span { font-size: 16px; line-height: 1.45; }
.template-upload-panel { max-width: 1040px; }
.template-upload-panel > p { max-width: 900px; margin: 0 0 18px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.template-upload-form { gap: 16px; }
.template-form-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(150px,.3fr); gap: 14px; }
.template-form-grid .field-wide { grid-column: 1 / -1; }
.template-form-grid textarea { min-height: 110px; }
.template-upload-actions { margin: 0; justify-content: flex-start; }
.template-upload-actions .button { min-width: 210px; }
.template-tags-panel { margin-top: 18px; }
.template-tags-panel > p { max-width: 960px; color: var(--muted); line-height: 1.5; }
.template-tags-panel .tag-catalog { grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 24px; }
.template-tags-panel .tag-catalog div { grid-template-columns: minmax(185px,.72fr) 1.4fr; }
.template-table-panel { margin-top: 18px; }
.template-version-links { display: flex; flex-wrap: wrap; gap: 8px; }
.template-version-links a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 9px; background: white; color: var(--text); }
.template-version-links a span { color: #326656; font-weight: 700; }
.template-version-row:target { background: #fff4f6; }
.template-version-row td:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.document-module-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.document-module-tabs .button { min-height: 44px; }
.error-message { padding: 14px; border: 1px solid #e6bbb3; border-radius: 10px; color: #8f2f20; background: #fff4f2; }

.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 18px 22px; }
.calendar-month-navigation { display: flex; align-items: center; gap: 16px; }
.calendar-month-navigation h2 { margin: 1px 0 0; text-transform: capitalize; font-size: 27px; }
.calendar-eyebrow { display: block; color: var(--muted); font-size: 13px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.calendar-nav-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--text); font-size: 22px; font-weight: 700; }
.calendar-nav-button:hover { border-color: var(--accent); color: var(--accent); }
.calendar-month-summary { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.calendar-month-summary strong { color: var(--text); font-size: 18px; }
.calendar-month-summary .button { margin-left: 8px; }
.calendar-panel { padding: 0; overflow: hidden; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border-bottom: 1px solid var(--line); background: #f8fafb; }
.calendar-weekdays span { padding: 12px 10px; color: var(--muted); font-size: 13px; font-weight: 750; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.calendar-day { min-width: 0; min-height: 170px; padding: 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside-month { background: #f7f9fa; color: #8799a2; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--accent); background: #fff9fa; }
.calendar-day.overdue { background: #fff8f6; }
.calendar-day-head { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.calendar-day-head > time { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--text); font-weight: 780; }
.calendar-day.today .calendar-day-head > time { background: var(--accent); color: white; }
.calendar-day.outside-month .calendar-day-head > time { color: #91a0a8; }
.calendar-today-label { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.calendar-day-load { display: flex; align-items: center; gap: 7px; margin: 8px 0; }
.calendar-task-count { min-width: 27px; height: 24px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 999px; background: #d9f0e8; color: #185945; font-size: 13px; font-weight: 850; }
.calendar-day.overdue .calendar-task-count { background: #f8deda; color: #9a3528; }
.calendar-time-range { color: var(--muted); font-size: 12px; font-weight: 720; white-space: nowrap; }
.calendar-day-tasks { display: grid; gap: 5px; }
.calendar-task { min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 5px; padding: 5px 7px; border-left: 3px solid #58a477; border-radius: 6px; background: #eff7f3; color: var(--text); font-size: 12px; line-height: 1.25; }
.calendar-task time { color: #326656; font-weight: 800; }
.calendar-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-task.high-priority { border-left-color: var(--accent); background: #fff0f2; }
.calendar-task.high-priority time { color: #a91534; }
.calendar-more { padding-left: 7px; color: var(--accent); font-size: 12px; font-weight: 750; }
.calendar-free-day { display: block; margin-top: 14px; color: #9aabb2; font-size: 12px; }
.calendar-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 14px 18px; color: var(--muted); font-size: 13px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend small { margin-left: auto; }
.calendar-legend-dot { width: 10px; height: 10px; border-radius: 50%; background: #58a477; }
.calendar-legend-dot.urgent { background: var(--accent); }
.calendar-legend-dot.late { background: #d87363; }

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    min-height: auto;
    position: static;
  }
  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metrics,
  .grid.two,
  .checklist,
  .block-grid,
  .site-grid,
  .relationship-grid,
  .rules-grid,
  .company-summary-grid,
  .company-search {
    grid-template-columns: 1fr;
  }
  .workflow-grid,
  .lead-filter-grid,
  .analytics-trust,
  .analytics-main-grid,
  .standards-grid,
  .check-grid,
  .highlight-grid { grid-template-columns: 1fr; }
  .industry-row { grid-template-columns: 1fr; }
  .document-intro,
  .document-summary,
  .section-heading-actions,
  .document-number-banner { align-items: flex-start; flex-direction: column; }
  .tag-catalog div { grid-template-columns: 1fr; }
  .counterparty-modes { grid-template-columns: 1fr; }
  .template-form-grid,
  .template-tags-panel .tag-catalog { grid-template-columns: 1fr; }
  .custom-period { grid-template-columns: 1fr 1fr; }
  .custom-period button { grid-column: 1 / -1; }
  .calendar-toolbar { align-items: flex-start; flex-direction: column; }
  .calendar-month-summary { flex-wrap: wrap; }
  .calendar-weekdays { display: none; }
  .calendar-grid { grid-template-columns: 1fr; }
  .calendar-day { min-height: auto; border-right: 0; padding: 14px 16px; }
  .calendar-day.outside-month { display: none; }
  .calendar-day:not(.today):not(:has(.calendar-day-load)) { display: none; }
  .calendar-day-tasks { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .calendar-free-day { display: none; }
  .calendar-legend small { width: 100%; margin-left: 0; }
}

@media (max-width: 520px) {
  .sidebar { padding: 22px 18px; }
  .main { padding: 20px 16px; }
  .lead-contact-center { padding: 16px; }
  .lead-contact-heading { flex-direction: column; gap: 10px; }
  .contact-action-trigger { grid-template-columns: 34px 1fr; padding: 13px; }
  .contact-action-form { padding: 16px; }
  .context-nav { grid-template-columns: 1fr; }
  .calendar-month-navigation { width: 100%; justify-content: space-between; }
  .calendar-month-navigation h2 { font-size: 22px; }
  .calendar-month-summary .button { margin-left: 0; }
  .calendar-day-tasks { grid-template-columns: 1fr; }
}
