:root {
  --ink: #10221b;
  --muted: #708078;
  --line: #dfe7e2;
  --canvas: #f1f5f2;
  --panel: #ffffff;
  --green: #168f59;
  --green-dark: #073526;
  --green-deep: #052b20;
  --green-bright: #47d797;
  --mint: #e2f3eb;
  --gold: #d6a33e;
  --red: #c34b42;
  --shadow: 0 14px 40px rgba(11, 47, 34, 0.08);
  --shadow-soft: 0 8px 24px rgba(11, 47, 34, 0.06);
  --forest-gradient: linear-gradient(155deg, #062b20 0%, #0a3b2b 52%, #147a4c 115%);
  --hero-gradient: linear-gradient(118deg, #052d21 0%, #09452f 48%, #188858 100%);
  --action-gradient: linear-gradient(135deg, #17985f 0%, #4bdd9b 100%);
}

* { box-sizing: border-box; }
html { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(circle at 78% 0%, rgba(72, 216, 151, .09), transparent 28rem),
    linear-gradient(180deg, #f8faf8 0%, var(--canvas) 46%, #eef3ef 100%);
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px; padding: 22px 16px;
  color: #fff; background: var(--forest-gradient); display: flex; flex-direction: column; z-index: 20;
  box-shadow: 12px 0 36px rgba(5, 40, 29, .09);
}
.sidebar-head { display: block; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand:hover { color: #fff; }
.brand-logo { display: block; width: 188px; max-width: 100%; height: auto; }
.login-brand {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  object-fit: cover; background: #0d1928;
}
.nav { display: grid; gap: 4px; margin-top: 22px; overflow: auto; scrollbar-width: thin; }
.nav a { color: #cbd9d4; padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: rgba(167,217,196,.18); }
.nav-primary { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.nav-icon { width: 18px; display: inline-grid; place-items: center; color: #7eddb1; font-size: 15px; }
.nav-primary.active .nav-icon { color: var(--green-bright); }
.nav-sub { display: grid; gap: 1px; margin: -1px 0 4px 28px; padding-left: 9px; border-left: 1px solid rgba(203, 232, 219, .15); }
.nav-sub a { padding: 7px 8px; color: #91aa9f; font-size: 11px; }
.nav-sub a.active { color: #cbf6e1; background: transparent; }
.nav .nav-admin { margin-top: 10px; color: #fff; border: 1px solid rgba(167,217,196,.18); }
.nav .nav-admin.active { background: rgba(167,217,196,.18); }
.mobile-menu-toggle { display: none; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 18px 8px 0; }
.user-card { display: flex; gap: 10px; align-items: center; }
.user-card strong, .user-card small { display: block; }
.user-card strong { font-size: 13px; }
.user-card small { color: #9fb2aa; font-size: 11px; margin-top: 2px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #295342; font-weight: 700; }
.text-button { border: 0; background: none; color: #9fb2aa; padding: 12px 0 0; cursor: pointer; font: inherit; font-size: 12px; }

.main { margin-left: 232px; padding: 34px 38px 56px; min-height: 100vh; }
.auth-main { min-height: 100vh; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
.page-header.compact { align-items: center; margin-bottom: 22px; }
h1, h2 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(28px, 3vw, 42px); }
h2 { font-size: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--green); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; }
.muted { color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.header-actions { display: flex; gap: 10px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px;
  padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.button-primary { color: #fff; background: var(--action-gradient); box-shadow: 0 8px 20px rgba(27, 153, 96, .18); }
.button-primary:hover { color: #fff; background: linear-gradient(135deg, #117f4f, #3aca8b); }
.button-secondary { color: var(--green); background: var(--mint); }
.button-ghost { color: var(--muted); background: #fff; border-color: var(--line); }
.button-danger { color: #fff; background: var(--red); }
.button-wide { width: 100%; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.button-warning { color: #7b5011; background: #fff4dc; border-color: #efd6a5; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.metric-card span, .metric-card small, .metric-card strong { display: block; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { margin: 8px 0 5px; font-size: 30px; letter-spacing: -.04em; }
.metric-card small { color: #8a958f; font-size: 11px; }
.metric-card.accent { background: #173d31; color: #fff; border-color: #173d31; }
.metric-card.accent span, .metric-card.accent small { color: #b9d0c7; }
.metric-card.success { border-top: 3px solid var(--gold); }
.metric-card.metric-danger { border-top: 3px solid var(--red); }

.dashboard-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { min-width: 0; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-soft); backdrop-filter: blur(10px); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-header a { font-size: 13px; font-weight: 700; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 11px 12px; color: #7a8781; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 12px; font-size: 13px; border-bottom: 1px solid #edf0ee; vertical-align: top; }
tbody tr:hover { background: #f8faf8; }
.row-action { text-align: right; white-space: nowrap; font-weight: 700; }
.status-pill { display: inline-flex; padding: 5px 8px; border-radius: 999px; color: var(--green-dark); background: var(--mint); font-size: 11px; }
.status-danger { color: #7c2424; background: #fdecec; }
.status-neutral { color: #58645e; background: #edf0ee; }
.status-warning { color: #7b5011; background: #fff4dc; }
.danger-link { color: var(--red); }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.followup-list { display: grid; }
.followup-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.followup-item strong, .followup-item small { display: block; }
.followup-item small { margin-top: 4px; color: var(--muted); }
.followup-item time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pipeline { display: flex; gap: 10px; overflow-x: auto; }
.pipeline-item { min-width: 150px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.pipeline-item span, .pipeline-item strong { display: block; }
.pipeline-item span { color: var(--muted); font-size: 11px; min-height: 28px; }
.pipeline-item strong { margin-top: 8px; font-size: 24px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-input { max-width: 440px; }
.input {
  width: 100%; min-height: 42px; border: 1px solid #d9e0dc; border-radius: 9px;
  padding: 9px 11px; background: #fff; color: var(--ink); font: inherit;
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: 3px solid rgba(24,106,76,.12); border-color: var(--green); }
.form-panel { max-width: 1080px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; color: #3e4c46; font-size: 13px; font-weight: 700; }
.field b { color: var(--red); }
.field small { color: var(--muted); font-weight: 400; }
.field em { color: var(--red); font-style: normal; font-weight: 500; }
.field-checkbox { display: flex; align-items: center; padding-top: 28px; }
.checkbox { width: 18px; height: 18px; accent-color: var(--green); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
.form-error { padding: 12px 14px; color: #7c2424; background: #fdecec; border: 1px solid #f0c8c8; border-radius: 9px; margin-bottom: 16px; }
.pagination { display: flex; justify-content: center; gap: 20px; padding-top: 20px; font-size: 13px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dfeee8, #f6f7f5 55%); }
.login-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 38px; box-shadow: 0 25px 70px rgba(18,46,37,.13); }
.login-brand { margin-bottom: 24px; }
.login-card h1 { font-size: 30px; line-height: 1.1; }
.stack { display: grid; gap: 16px; margin-top: 26px; }
.stack label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }

.messages { margin-bottom: 16px; }
.message { padding: 12px 14px; border-radius: 9px; background: var(--mint); color: var(--green-dark); }
.message.error { color: #7c2424; background: #fdecec; }

.alert { padding: 14px 16px; margin-bottom: 18px; border-radius: 11px; border: 1px solid var(--line); line-height: 1.5; }
.alert strong { margin-right: 4px; }
.alert-danger { color: #7c2424; background: #fdecec; border-color: #f0c8c8; }
.alert-warning { color: #6f4c19; background: #fff7e8; border-color: #efd6a5; }
.alert-info { color: #1d4e6f; background: #eaf5fc; border-color: #c8dfed; }

.control-nav {
  display: flex; gap: 8px; flex-wrap: wrap; margin: -10px 0 22px;
  padding: 8px; border-radius: 12px; background: #e9eeeb;
}
.control-nav a { padding: 9px 12px; border-radius: 8px; color: #425049; font-size: 13px; font-weight: 700; }
.control-nav a:hover { background: #fff; color: var(--green-dark); }
.control-nav a.active { color: var(--green-dark); background: #fff; box-shadow: 0 2px 7px rgba(25,45,36,.08); }
.audit-list { display: grid; }
.audit-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.audit-item strong, .audit-item small { display: block; }
.audit-item small { margin-top: 4px; color: var(--muted); }
.audit-item time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.confirm-panel { max-width: 680px; }

.segmented-control { display: inline-flex; gap: 4px; margin-bottom: 18px; padding: 4px; border-radius: 10px; background: #edf0ee; }
.segmented-control a { padding: 8px 11px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.segmented-control a.active { color: var(--green-dark); background: #fff; box-shadow: 0 2px 7px rgba(25,45,36,.08); }
.table-actions { display: flex; flex-wrap: wrap; gap: 7px; min-width: 330px; }
.table-actions form { margin: 0; }

.client-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(340px, .75fr); gap: 18px; align-items: start; }
.client-main { min-width: 0; display: grid; gap: 18px; }
.client-side { min-width: 0; }
.sticky-panel { position: sticky; top: 24px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.detail-grid > div { padding: 13px; border-radius: 9px; background: #f7f9f7; }
.detail-grid dt { color: var(--muted); font-size: 11px; }
.detail-grid dd { margin: 5px 0 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.detail-grid .detail-wide { grid-column: 1 / -1; }
.compact-details { margin: 18px 0; }
.record-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.record-card strong, .record-card small { display: block; }
.record-card small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.record-meta { color: var(--muted); font-size: 12px; text-align: right; }
.subheading { margin: 20px 0 8px; font-size: 14px; }
.timeline { position: relative; display: grid; gap: 0; margin-top: 20px; max-height: 920px; overflow-y: auto; padding-right: 4px; }
.timeline-item { position: relative; padding: 0 0 20px 22px; border-left: 2px solid #e2e9e5; }
.timeline-item::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #e3f1eb; }
.timeline-item time, .timeline-item strong, .timeline-item small { display: block; }
.timeline-item time { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.timeline-item strong { font-size: 13px; }
.timeline-item p { margin: 6px 0; color: #526059; font-size: 12px; line-height: 1.45; }
.timeline-item small { color: #8a958f; font-size: 10px; }

.duplicate-list { display: grid; gap: 12px; }
.duplicate-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.duplicate-clients { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.duplicate-clients > div { min-width: 0; }
.duplicate-clients small, .duplicate-clients strong, .duplicate-clients span { display: block; }
.duplicate-clients small { color: var(--muted); font-size: 10px; }
.duplicate-clients strong { margin: 5px 0; overflow-wrap: anywhere; }
.duplicate-clients span { color: var(--muted); font-size: 12px; }
.duplicate-mark { color: var(--gold); font-size: 24px; font-weight: 800; }
.duplicate-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.reason-list { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-state { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 18px; }
.empty-state p { margin: 8px auto 0; max-width: 520px; }
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.compare-card h2 { margin-top: 12px; }
.compare-primary { border-top: 3px solid var(--green); }
.merge-confirm, .import-actions { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.merge-confirm p, .import-actions p { margin-bottom: 0; }

.upload-zone { display: grid; gap: 8px; margin-bottom: 16px; padding: 20px; border: 1px dashed #b7c5be; border-radius: 12px; background: #f8faf8; }
.upload-zone > span { font-weight: 800; }
.upload-zone small { color: var(--muted); line-height: 1.45; }
.upload-zone em { color: var(--red); font-size: 12px; font-style: normal; }
.check-list { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding-left: 25px; color: #4c5a53; line-height: 1.45; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }
.metric-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.table-note { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.error-text { color: var(--red); }

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.work-card { align-self: start; }
.score-badge { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); font-weight: 800; }
.work-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0 0 18px; }
.work-details div { padding: 12px; border-radius: 9px; background: #f6f8f6; }
.work-details dt { color: var(--muted); font-size: 11px; }
.work-details dd { margin: 5px 0 0; font-size: 13px; font-weight: 700; }
.contact-box { padding: 14px; border: 1px solid var(--line); border-radius: 10px; line-height: 1.5; font-size: 13px; }
.contact-box > strong { display: block; margin-bottom: 8px; }

.dashboard-tasks { margin-bottom: 18px; }
.task-filters { max-width: 100%; overflow-x: auto; }
.task-list { display: grid; }
.task-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px;
  align-items: center; padding: 14px 2px; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.task-row:hover { color: var(--ink); background: #f8faf8; }
.task-row.task-overdue { background: #fff8f8; }
.task-check {
  width: 18px; height: 18px; border: 2px solid #aebbb4; border-radius: 50%;
  background: #fff;
}
.task-check.is-done { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 4px #fff; }
.task-content { min-width: 0; }
.task-content strong, .task-content small, .task-content > span { display: block; }
.task-content strong { overflow-wrap: anywhere; }
.task-content small, .task-content > span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.task-meta { display: grid; justify-items: end; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.task-meta small { color: var(--muted); }
.compact-task-list .task-row { padding: 11px 2px; }

.qualification-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  max-width: 1080px; margin-bottom: 18px;
}
.qualification-summary article {
  padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff;
}
.qualification-summary span, .qualification-summary strong { display: block; }
.qualification-summary span { color: var(--muted); font-size: 11px; }
.qualification-summary strong { margin-top: 5px; font-size: 13px; }

.call-workspace {
  display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.4fr);
  gap: 18px; align-items: start;
}
.call-sidebar { display: grid; gap: 18px; }
.call-result-form { min-width: 0; }
.call-contact + .call-contact { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.call-contact strong, .call-contact small, .call-contact a { display: block; }
.call-contact small { margin: 4px 0 9px; color: var(--muted); }
.call-phone { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.script-card { color: #fff; background: #173d31; border-color: #173d31; }
.script-card .eyebrow, .script-card small { color: #b9d0c7; }
.script-card p { margin: 0 0 14px; line-height: 1.6; }
.script-card small { display: block; line-height: 1.5; }
.work-card .form-actions form { margin: 0; }

.workspace-header {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-bottom: 22px;
}
.title-line { display: flex; align-items: baseline; gap: 14px; }
.title-line h1 { font-size: clamp(30px, 3vw, 42px); }
.title-line > span { color: #8a9891; font-size: 13px; }
.workspace-tools { display: flex; align-items: center; gap: 9px; }
.global-search { width: min(330px, 32vw); }
.global-search input {
  width: 100%; min-height: 42px; padding: 0 14px 0 38px; border: 1px solid var(--line);
  border-radius: 11px; background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23889991' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E")
    no-repeat 13px center;
  color: var(--ink); font: inherit; outline: none;
}
.global-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,143,89,.1); }

.next-action-card {
  position: relative; overflow: hidden; display: flex; align-items: center;
  justify-content: space-between; gap: 28px; min-height: 150px; margin-bottom: 16px;
  padding: 24px 26px; border-radius: 17px; color: #fff; background: var(--hero-gradient);
  box-shadow: 0 18px 40px rgba(7, 56, 39, .16);
}
.next-action-card::after {
  content: ""; position: absolute; width: 330px; height: 330px; right: -120px; top: -170px;
  border-radius: 50%; background: radial-gradient(circle, rgba(82,236,169,.22), transparent 66%);
  pointer-events: none;
}
.next-action-copy, .next-action-buttons { position: relative; z-index: 1; }
.next-action-copy { min-width: 0; }
.next-label { margin: 0 0 8px; color: #76e1ae; text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 800; }
.next-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.next-title h2 { font-size: clamp(24px, 3vw, 34px); }
.next-action-copy > p:not(.next-label) { margin: 7px 0 0; color: #bad3c8; font-size: 13px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.hero-meta span, .hero-tag {
  display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px;
  border-radius: 7px; color: #d9eee4; background: rgba(255,255,255,.1); font-size: 11px;
}
.hero-tag { color: #062d20; background: #63e4a9; font-weight: 800; }
.hero-tag-muted { color: #d8ece3; background: rgba(255,255,255,.09); }
.next-action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.next-action-buttons form { margin: 0; }
.button-bright { color: #062d20; background: linear-gradient(135deg, #64e5aa, #46d793); box-shadow: 0 9px 24px rgba(0,0,0,.13); }
.button-bright:hover { color: #062d20; filter: brightness(1.04); }
.button-on-dark { color: #d7ebe2; background: rgba(0,0,0,.12); border-color: rgba(255,255,255,.2); }
.button-on-dark:hover { color: #fff; background: rgba(0,0,0,.22); }

.day-metrics, .handoff-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px;
}
.day-metrics article, .handoff-metrics article {
  min-width: 0; padding: 17px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255,255,255,.94); box-shadow: var(--shadow-soft);
}
.day-metrics span, .day-metrics strong, .day-metrics small,
.handoff-metrics span, .handoff-metrics strong, .handoff-metrics small { display: block; }
.day-metrics span, .handoff-metrics span { color: var(--muted); font-size: 11px; }
.day-metrics strong, .handoff-metrics strong { margin: 6px 0 3px; font-size: 28px; letter-spacing: -.04em; }
.day-metrics small, .handoff-metrics small { color: #93a098; font-size: 10px; line-height: 1.4; }
.day-metrics .has-alert { border-color: #efc7c2; background: linear-gradient(150deg, #fff, #fff4f2); }
.day-metrics .has-alert strong { color: var(--red); }
.handoff-metrics .accent { color: #fff; border-color: transparent; background: var(--hero-gradient); }
.handoff-metrics .accent span, .handoff-metrics .accent small { color: #bad3c8; }

.day-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .78fr); gap: 16px; align-items: start; }
.day-side { display: grid; gap: 16px; }
.queue-panel { padding: 0; overflow: hidden; }
.queue-panel .panel-header { padding: 18px 20px 14px; margin: 0; border-bottom: 1px solid var(--line); }
.call-queue { min-width: 0; }
.queue-row {
  display: grid; grid-template-columns: 52px minmax(150px, 1.5fr) minmax(110px, .7fr) minmax(120px, .8fr);
  align-items: center; gap: 12px; min-height: 66px; padding: 9px 18px; color: var(--ink);
  border-bottom: 1px solid #edf1ee;
}
.queue-row:hover { color: var(--ink); background: linear-gradient(90deg, rgba(226,243,235,.55), transparent); }
.queue-row time { font-size: 12px; font-weight: 800; }
.queue-row.is-overdue time { color: var(--red); }
.queue-person { min-width: 0; }
.queue-person strong, .queue-person small { display: block; }
.queue-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.queue-person small { margin-top: 3px; color: #91a098; font-size: 10px; }
.queue-phone { color: var(--muted); font-size: 11px; text-align: right; }
.operator-queue-row { grid-template-columns: 50px minmax(130px, 1.4fr) 110px 125px 36px; }
.queue-actions form { margin: 0; }
.icon-button {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid #d7e1db;
  border-radius: 9px; color: var(--green-dark); background: #fff; font: inherit; font-weight: 800; cursor: pointer;
}
.icon-button:hover { color: #fff; background: var(--green); border-color: var(--green); }
.queue-empty-note { padding: 22px; }

.attention-panel, .outcome-panel { padding: 18px; }
.attention-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  margin-top: 8px; padding: 13px; border-radius: 11px; color: #3c4d45; background: #f1f5f2;
}
.attention-row:hover { color: var(--ink); filter: brightness(.98); }
.attention-row > strong { font-size: 18px; }
.attention-row span, .attention-row small { display: block; }
.attention-row span { font-size: 12px; }
.attention-row small { margin-top: 2px; color: #8b9892; font-size: 9px; }
.attention-row b { font-size: 20px; }
.attention-red { color: #8d302a; background: linear-gradient(120deg, #fff0ee, #fbe3df); }
.attention-gold { color: #76541b; background: linear-gradient(120deg, #fff7e6, #f9ecd0); }
.outcome-feed { display: grid; gap: 11px; }
.outcome-feed > div { display: flex; align-items: flex-start; gap: 9px; }
.outcome-feed span, .outcome-feed strong, .outcome-feed small { display: block; }
.outcome-feed strong { font-size: 11px; }
.outcome-feed small { margin-top: 2px; color: #8c9993; font-size: 9px; }
.outcome-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #9eaaa4; }
.outcome-qualified, .outcome-interested { background: var(--green); }
.outcome-callback { background: var(--gold); }
.outcome-refused, .outcome-dnc { background: var(--red); }

.base-summary-strip {
  display: grid; grid-template-columns: minmax(180px, .6fr) minmax(260px, 1.4fr) auto;
  align-items: center; gap: 24px; margin-bottom: 14px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}
.base-summary-strip div span, .base-summary-strip div strong, .base-summary-strip div small { display: block; }
.base-summary-strip div span { color: var(--green); font-size: 11px; font-weight: 800; }
.base-summary-strip div strong { margin: 3px 0; font-size: 23px; }
.base-summary-strip div small, .base-summary-strip p { color: var(--muted); font-size: 10px; }
.base-summary-strip p { margin: 0; line-height: 1.5; }
.base-summary-strip a { font-size: 11px; font-weight: 800; white-space: nowrap; }
.client-register-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.95); box-shadow: var(--shadow); }
.client-filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) 210px auto; gap: 9px; padding: 14px; border-bottom: 1px solid var(--line); }
.register-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 9px 14px; border-bottom: 1px solid var(--line); background: #f7f9f7; }
.register-tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.register-tabs a.active { color: #fff; background: var(--green-dark); font-weight: 800; }
.client-register-table th { padding-top: 13px; padding-bottom: 13px; }
.client-register-table td { vertical-align: middle; }
.client-register-table .client-name { color: var(--ink); font-weight: 800; }
.client-register-table td small { display: block; margin-top: 3px; color: #98a49e; font-size: 9px; }
.client-register-table tr.is-dnc { opacity: .65; }
.segment-badge {
  display: inline-grid; min-width: 25px; height: 25px; place-items: center; padding: 0 7px;
  border-radius: 7px; color: var(--green-dark); background: var(--mint); font-size: 10px; font-weight: 800;
}
.segment-c, .segment-d { color: #80342e; background: #fde9e6; }
.segment-b, .segment-nurture { color: #76541b; background: #fff1d7; }

.handoff-board {
  display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px;
  overflow-x: auto; padding-bottom: 4px;
}
.handoff-column {
  min-height: 510px; padding: 11px; border: 1px solid #e0e7e2; border-radius: 15px;
  background: linear-gradient(180deg, rgba(232,239,235,.88), rgba(244,247,245,.78));
}
.handoff-column > header { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 4px 9px; }
.handoff-column h2 { flex: 1; font-size: 12px; }
.handoff-column header b { color: var(--muted); font-size: 11px; }
.board-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot-mint { background: #51d99c; }.dot-gold { background: var(--gold); }.dot-green { background: var(--green); }.dot-dark { background: var(--green-dark); }
.handoff-cards { display: grid; align-content: start; gap: 9px; }
.handoff-card { padding: 13px; border: 1px solid #dfe5e1; border-radius: 11px; background: #fff; box-shadow: 0 5px 15px rgba(12,53,38,.05); }
.handoff-card h3 { margin: 0; font-size: 13px; }
.handoff-card p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.handoff-card small, .handoff-card > strong { display: block; margin-top: 6px; }
.handoff-card small { color: #96a29c; font-size: 9px; }
.handoff-card > strong { font-size: 12px; }
.handoff-card > a:not(.button) { display: inline-block; margin-top: 9px; font-size: 10px; font-weight: 800; }
.handoff-card .button { margin-top: 11px; width: 100%; }
.board-empty { padding: 18px 10px; color: #8e9c95; text-align: center; font-size: 10px; line-height: 1.5; }

.call-mode-header {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  margin: -34px -38px 0; padding: 14px 20px; color: #fff;
  background: linear-gradient(90deg, #052a1f, #0a4b34 60%, #178451);
}
.call-live { display: flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; background: rgba(60,220,146,.12); color: #63e4a9; font-size: 11px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #46db97; box-shadow: 0 0 0 4px rgba(70,219,151,.12); }
.call-client-title strong, .call-client-title span { display: block; }
.call-client-title strong { font-size: 14px; }
.call-client-title span { margin-top: 3px; color: #a9c8ba; font-size: 10px; }
.call-header-actions { display: flex; gap: 8px; }
.call-mode-shell { margin: 0 -38px -56px; }
.call-mode-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .78fr); gap: 14px;
  padding: 16px 20px 92px; background: linear-gradient(180deg, #f4f7f4, #eef3ef);
}
.call-script-column { display: grid; align-content: start; gap: 14px; }
.call-info-card, .script-flow, .call-form-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow-soft); }
.tag-stack { display: flex; gap: 6px; }
.call-client-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.call-client-facts dt { color: #89968f; font-size: 9px; }
.call-client-facts dd { margin: 4px 0 0; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.previous-touch { display: grid; grid-template-columns: 110px 1fr; gap: 12px; margin-top: 14px; padding: 11px; border-radius: 10px; background: #f2f5f3; }
.previous-touch span { color: #8d9a93; text-transform: uppercase; font-size: 8px; letter-spacing: .06em; }
.previous-touch p { margin: 0; color: #58675f; font-size: 10px; line-height: 1.5; }
.call-contact-actions { display: grid; gap: 8px; margin-top: 13px; }
.call-contact-actions > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.call-contact-actions span strong, .call-contact-actions span small { display: block; }
.call-contact-actions span strong { font-size: 11px; }.call-contact-actions span small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.script-progress { color: var(--green); font-size: 10px; font-weight: 800; }
.script-flow details { border: 1px solid #e2e8e4; border-radius: 10px; margin-top: 8px; overflow: hidden; }
.script-flow details[open] { border-color: var(--green); box-shadow: 0 0 0 2px rgba(22,143,89,.07); }
.script-flow summary { display: flex; align-items: center; gap: 10px; padding: 11px 12px; color: #6e7d75; cursor: pointer; list-style: none; font-size: 10px; font-weight: 700; }
.script-flow summary::-webkit-details-marker { display: none; }
.script-flow summary b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: var(--green); background: var(--mint); }
.script-copy { padding: 2px 13px 13px 42px; color: #3f5047; font-size: 11px; line-height: 1.6; }
.objection-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.objection-chips span { padding: 5px 8px; border-radius: 7px; color: var(--green-dark); background: var(--mint); font-size: 9px; font-weight: 700; }
.call-qualification-column { min-width: 0; }
.call-form-card { display: grid; gap: 14px; }
.call-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.call-segment-field > div, .call-segment-field .input { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 0; border: 0; }
.call-segment-field label { position: relative; display: grid; min-height: 43px; place-items: center; padding: 6px; border: 1px solid #d6dfda; border-radius: 9px; background: #fff; text-align: center; font-size: 9px; cursor: pointer; }
.call-segment-field input { position: absolute; opacity: 0; }
.call-segment-field label:has(input:checked) { color: #fff; border-color: var(--green-dark); background: var(--green-dark); }
.call-checkbox { min-height: 43px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8faf8; }
.consent-status { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border: 1px solid #e5ddd0; border-radius: 10px; background: #fff9ed; }
.consent-status span strong, .consent-status span small { display: block; }
.consent-status span strong { font-size: 11px; }.consent-status span small { margin-top: 3px; color: #978b78; font-size: 9px; }
.consent-status > b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #f1e3c6; }
.consent-status.is-ready { border-color: #b9dfcc; background: #eef9f3; }
.consent-status.is-ready > b { color: #fff; background: var(--green); }
.call-form-error { margin: 14px 20px 0; }
.call-outcome-bar {
  position: fixed; z-index: 16; left: 232px; right: 0; bottom: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  min-height: 76px; padding: 10px 20px; border-top: 1px solid #dce4df; background: rgba(255,255,255,.96);
  box-shadow: 0 -12px 35px rgba(9,46,33,.09); backdrop-filter: blur(14px);
}
.outcome-label span, .outcome-label small { display: block; }
.outcome-label span { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.outcome-label small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.outcome-field > div, .outcome-field .outcome-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; list-style: none; }
.outcome-field > div > div, .outcome-field li { position: relative; }
.outcome-field label {
  position: relative; display: inline-flex; align-items: center; min-height: 37px; padding: 0 11px;
  border: 1px solid #d5ded9; border-radius: 9px; color: #56655d; background: #fff; font-size: 10px; font-weight: 700; cursor: pointer;
}
.outcome-field input { position: absolute; opacity: 0; }
.outcome-field label:has(input:checked) { color: #fff; border-color: var(--green-dark); background: var(--green-dark); }
.outcome-field li:last-child label:has(input:checked) { background: var(--red); border-color: var(--red); }
.outcome-field em { display: block; color: var(--red); font-size: 9px; font-style: normal; }
.call-save-button { min-width: 190px; }
.mobile-action-nav { display: none; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .workspace-header { align-items: flex-start; flex-direction: column; }
  .workspace-tools { width: 100%; }
  .global-search { flex: 1; width: auto; }
  .call-workspace { grid-template-columns: 1fr; }
  .client-layout { grid-template-columns: minmax(0, 1fr); }
  .client-layout, .client-main, .client-side { min-width: 0; width: 100%; }
  .sticky-panel { position: static; }
  .day-layout { grid-template-columns: 1fr; }
  .day-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-mode-grid { grid-template-columns: 1fr; }
  .call-client-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-outcome-bar { grid-template-columns: 1fr; position: static; }
  .call-mode-grid { padding-bottom: 16px; }
  .call-mode-shell { margin-bottom: -56px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; min-height: auto; padding: 14px 16px; display: block; }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
  .brand { flex: 1; min-width: 0; padding: 0; border-bottom: 0; }
  .brand-logo { width: 168px; }
  .mobile-menu-toggle {
    display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
    min-height: 38px; padding: 0 12px; border: 1px solid rgba(167,217,196,.25);
    border-radius: 9px; color: #fff; background: rgba(167,217,196,.12);
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  }
  .mobile-menu-toggle:hover { background: rgba(167,217,196,.2); }
  .nav {
    display: none; grid-template-columns: 1fr; gap: 3px; margin-top: 14px;
    padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12);
  }
  .sidebar.nav-open .nav { display: grid; }
  .nav .nav-admin { margin-top: 6px; }
  .sidebar-footer { display: none; }
  .main { margin-left: 0; padding: 24px 16px 96px; }
  .page-header, .page-header.compact { align-items: flex-start; flex-direction: column; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .header-actions, .toolbar { width: 100%; flex-wrap: wrap; }
  .header-actions .button { flex: 1; }
  .detail-grid, .compare-grid { grid-template-columns: 1fr; }
  .duplicate-clients { grid-template-columns: 1fr; }
  .duplicate-mark { transform: rotate(90deg); }
  .duplicate-footer, .merge-confirm, .import-actions { align-items: stretch; flex-direction: column; }
  .qualification-summary { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: auto minmax(0, 1fr); }
  .task-meta { grid-column: 2; justify-items: start; white-space: normal; }
  .table-actions { min-width: 220px; }
  .table-wrap.is-scrollable::before {
    content: "← Проведите по таблице →";
    position: sticky; left: 0; display: block; width: max-content;
    margin: 0 0 8px; padding: 5px 8px; border-radius: 7px;
    color: var(--muted); background: #f1f4f2; font-size: 10px; font-weight: 700;
  }
  .workspace-header { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
  .title-line { display: block; }
  .title-line > span { display: block; margin-top: 4px; }
  .workspace-tools { width: 100%; flex-wrap: wrap; }
  .workspace-tools .button { flex: 1; }
  .global-search { flex: 0 0 100%; width: 100%; order: 3; }
  .next-action-card { min-height: 0; align-items: stretch; flex-direction: column; padding: 19px; }
  .next-title { display: block; }
  .next-title h2 { margin-bottom: 10px; }
  .next-title .hero-tag { margin: 0 4px 4px 0; }
  .next-action-buttons { justify-content: stretch; }
  .next-action-buttons .button, .next-action-buttons form, .next-action-buttons form .button { width: 100%; }
  .day-metrics, .handoff-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-metrics article, .handoff-metrics article { padding: 14px; }
  .day-metrics strong, .handoff-metrics strong { font-size: 24px; }
  .day-side { grid-template-columns: 1fr; }
  .queue-row, .operator-queue-row {
    grid-template-columns: 42px minmax(0, 1fr) auto; gap: 9px; padding: 11px 13px;
  }
  .queue-row .status-pill { grid-column: 2; width: max-content; }
  .queue-phone { display: none; }
  .queue-actions { grid-column: 3; grid-row: 1 / span 2; }
  .base-summary-strip { grid-template-columns: 1fr; gap: 9px; }
  .client-filter-bar { grid-template-columns: 1fr; }
  .register-tabs { padding: 8px; }
  .client-register-table::before { display: none !important; }
  .client-register-table table, .client-register-table tbody { display: block; }
  .client-register-table thead { display: none; }
  .client-register-table tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    margin: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  }
  .client-register-table td {
    display: block; padding: 0; border: 0; font-size: 12px;
  }
  .client-register-table td::before {
    content: attr(data-label); display: block; margin-bottom: 4px; color: #94a099;
    text-transform: uppercase; letter-spacing: .06em; font-size: 8px; font-weight: 800;
  }
  .client-register-table td:first-child { grid-column: 1 / -1; }
  .client-register-table .row-action { position: absolute; right: 27px; }
  .client-register-table tr { position: relative; }
  .handoff-board { grid-template-columns: repeat(4, minmax(82vw, 1fr)); scroll-snap-type: x mandatory; }
  .handoff-column { min-height: 430px; scroll-snap-align: start; }
  .call-mode-header {
    grid-template-columns: 1fr auto; margin: -24px -16px 0; padding: 12px 16px;
  }
  .call-live { display: none; }
  .call-client-title span { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .call-header-actions .button-on-dark { display: none; }
  .call-mode-shell { margin: 0 -16px -96px; }
  .call-mode-grid { padding: 12px 12px 18px; background: linear-gradient(180deg, #073426, #105a3b 52%, #eef3ef 52%); }
  .call-info-card, .script-flow, .call-form-card { padding: 14px; }
  .call-client-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .previous-touch { grid-template-columns: 1fr; }
  .call-contact-actions > div { align-items: stretch; flex-direction: column; }
  .call-contact-actions .button { width: 100%; min-height: 52px; }
  .script-flow { color: #fff; border-color: rgba(255,255,255,.13); background: linear-gradient(145deg, #073426, #12623f); }
  .script-flow .eyebrow, .script-flow summary, .script-flow .script-copy { color: #d9ede3; }
  .script-flow details { border-color: rgba(255,255,255,.15); }
  .script-flow details[open] { border-color: #4bdd9b; }
  .script-flow summary b { color: #062d20; background: #60dfa5; }
  .call-form-grid { grid-template-columns: 1fr; }
  .call-segment-field > div, .call-segment-field .input { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .call-outcome-bar {
    display: block; padding: 17px 14px 22px; border-radius: 22px 22px 0 0;
    background: #fff; box-shadow: 0 -12px 35px rgba(9,46,33,.12);
  }
  .outcome-label { margin-bottom: 12px; }
  .outcome-field > div, .outcome-field .outcome-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .outcome-field label { width: 100%; min-height: 52px; justify-content: center; font-size: 12px; }
  .call-save-button { width: 100%; min-height: 54px; margin-top: 14px; }
  .mobile-action-nav {
    position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; display: grid;
    grid-template-columns: repeat(4, 1fr); min-height: 68px; padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid #dce4df; background: rgba(255,255,255,.95); box-shadow: 0 -8px 25px rgba(7,45,32,.08);
    backdrop-filter: blur(14px);
  }
  .role-operator .mobile-action-nav { grid-template-columns: repeat(3, 1fr); }
  .mobile-action-nav a { display: grid; place-items: center; gap: 2px; color: #809088; font-size: 9px; }
  .mobile-action-nav a span { font-size: 17px; }
  .mobile-action-nav a.active { color: var(--green); font-weight: 800; }
  body:has(.call-mode-shell) .sidebar, body:has(.call-mode-shell) .mobile-action-nav { display: none; }
  body:has(.call-mode-shell) .main { padding-top: 24px; padding-bottom: 0; }
}
