/* HELM enterprise presentation layer. No command, policy or data contract lives here. */
:root {
  --ink: #13251f;
  --ink-soft: #30453d;
  --muted: #697a73;
  --muted-light: #8b9993;
  --line: #dce6e1;
  --line-strong: #c8d7d0;
  --paper: #f2f6f4;
  --paper-deep: #e9f0ed;
  --green: #076548;
  --green-bright: #19a878;
  --deep: #0b211a;
  --deep-soft: #12342a;
  --mint: #ddf4ea;
  --mint-strong: #bfe8d8;
  --amber: #bf8013;
  --amber-soft: #fff1d4;
  --red: #ac3f45;
  --red-soft: #fae5e5;
  --blue: #2d6689;
  --blue-soft: #e3eff6;
  --white: #fff;
  --shadow-xs: 0 1px 2px rgba(14, 39, 30, 0.04);
  --shadow-sm: 0 8px 24px rgba(14, 39, 30, 0.06);
  --shadow-md: 0 18px 50px rgba(5, 28, 20, 0.13);
  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 18px;
  --header-height: 72px;
  --sidebar-width: 244px;
}

html {
  background: var(--paper);
}

body {
  font-family: Aptos, "SF Pro Text", "Segoe UI", Inter, ui-sans-serif, system-ui,
    -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.46;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(7, 101, 72, 0.025), transparent 34%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: var(--deep);
  background: var(--mint-strong);
}

a {
  color: var(--green);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid rgba(25, 168, 120, 0.3);
  outline-offset: 2px;
}

/* Authentication */
.login {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(28, 171, 123, 0.14), transparent 30%),
    radial-gradient(circle at 90% 84%, rgba(45, 102, 137, 0.12), transparent 28%),
    var(--deep);
}

.login::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 24px;
  pointer-events: none;
}

.login form {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  padding: 44px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.32);
}

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

.auth-brand img,
.brand-lockup img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.auth-brand > div,
.brand-lockup > span {
  display: grid;
  line-height: 1.02;
}

.auth-brand strong,
.brand-lockup strong {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.9px;
}

.auth-brand strong::first-letter,
.brand-lockup strong::first-letter {
  letter-spacing: -1.2px;
}

.auth-brand span,
.brand-lockup small {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.login h1 {
  margin: 38px 0 6px;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -1.2px;
}

.login p {
  font-size: 14px;
}

.login label {
  gap: 7px;
  margin: 20px 0;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.login input {
  min-height: 46px;
  padding: 11px 13px;
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
}

.login button:not(.login-link) {
  min-height: 46px;
  border-radius: var(--radius-sm);
  box-shadow: 0 7px 16px rgba(7, 101, 72, 0.16);
}

.login-link {
  margin-top: 8px;
  color: var(--green) !important;
  font-size: 12px;
}

/* Application shell */
header {
  height: var(--header-height);
  padding: 0 24px;
  z-index: 10;
  background:
    linear-gradient(90deg, rgba(25, 168, 120, 0.07), transparent 24%),
    var(--deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 18px rgba(5, 27, 19, 0.12);
}

.brand-lockup {
  width: calc(var(--sidebar-width) - 24px);
  color: white;
  text-decoration: none;
}

.brand-lockup img {
  filter: drop-shadow(0 4px 12px rgba(25, 168, 120, 0.15));
}

.brand-lockup small {
  color: #94b3a7;
}

.shell-status {
  display: flex;
  align-items: center;
  gap: 11px !important;
  color: #dce9e4;
  font-size: 12px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35cf95;
  box-shadow: 0 0 0 5px rgba(53, 207, 149, 0.09);
}

header .mode {
  margin-right: 8px;
  padding: 6px 10px;
  color: #503500;
  background: #f1bb4d;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 9px;
  letter-spacing: 1.15px;
}

button.link {
  margin-left: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
}

button.link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

aside {
  top: var(--header-height);
  width: var(--sidebar-width);
  z-index: 8;
  padding: 22px 14px 18px;
  color: #d9e7e1;
  background:
    linear-gradient(180deg, rgba(25, 168, 120, 0.055), transparent 30%),
    #0f2a21;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 6px 0 24px rgba(9, 36, 27, 0.05);
}

#primary-navigation {
  display: grid;
  gap: 21px;
}

.nav-section {
  display: grid;
  gap: 3px;
}

.nav-section > span {
  padding: 0 12px 7px;
  color: #6f9788;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

nav a {
  position: relative;
  min-height: 39px;
  padding: 9px 12px 9px 38px;
  color: #d5e4de;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  transition: 120ms ease;
}

nav a::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid #6e9385;
  border-radius: 2px;
  transform: translateY(-50%) rotate(45deg);
}

nav a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.055);
}

nav a.active {
  color: white;
  background: linear-gradient(90deg, rgba(25, 168, 120, 0.28), rgba(25, 168, 120, 0.11));
  border-color: rgba(82, 208, 160, 0.16);
  box-shadow: inset 3px 0 #39c994, 0 8px 20px rgba(0, 0, 0, 0.08);
}

nav a.active::before {
  border-color: #58d2a4;
  background: #58d2a4;
  box-shadow: 0 0 0 4px rgba(88, 210, 164, 0.1);
}

.system-nav {
  padding-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.system-nav a {
  color: #9eb4ab;
  font-size: 12px;
}

#identity {
  margin: 16px 4px 0;
  padding: 13px 12px;
  gap: 2px;
  color: #89a49a;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 10px;
  font-size: 9px;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}

#identity strong {
  color: #ecf4f0;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.nav-toggle,
.nav-scrim {
  display: none;
}

main,
main.whatsapp-mode {
  margin-left: var(--sidebar-width);
  max-width: calc(100vw - var(--sidebar-width));
}

main {
  min-height: 100vh;
  padding: 108px clamp(24px, 3vw, 48px) 64px;
}

main[aria-busy="true"] {
  position: relative;
  opacity: 1;
  pointer-events: none;
  transition: opacity 120ms ease;
}

main[aria-busy="true"]::after {
  content: "";
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  height: 2px;
  z-index: 9;
  background: linear-gradient(90deg, transparent, var(--green-bright), transparent);
  animation: helm-loading 850ms linear infinite;
}

@keyframes helm-loading {
  from { transform: translateX(-70%); }
  to { transform: translateX(70%); }
}

/* Typography and content hierarchy */
.page-head {
  position: relative;
  margin: 0 0 26px;
  padding-left: 17px;
}

.page-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(var(--green-bright), var(--green));
}

.page-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 3vw, 39px);
  font-weight: 790;
  line-height: 1.04;
  letter-spacing: -1.45px;
}

.page-head p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

h2 {
  margin: 22px 0 11px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: -0.35px;
}

h3 {
  color: var(--ink-soft);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.2px;
}

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

.line-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp.two {
  -webkit-line-clamp: 2;
}

/* Shared surfaces */
.card,
.lead-hero,
.forensic,
.workbench,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-xs);
}

.card,
.forensic {
  padding: 20px;
  margin: 15px 0;
}

.card:hover {
  border-color: var(--line-strong);
}

.section {
  margin-top: 34px;
}

.section > h2 {
  margin-bottom: 5px;
}

.grid {
  gap: 16px;
}

.empty,
.loading {
  min-height: 132px;
  display: grid;
  place-items: center;
  padding: 34px;
  color: var(--muted);
  border-style: dashed;
  background: rgba(255, 255, 255, 0.6);
}

.empty.compact {
  min-height: 86px;
  padding: 22px;
}

.summary-strip {
  width: max-content;
  min-width: 170px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-xs);
}

.summary-strip strong {
  color: var(--green);
  font-size: 31px;
}

/* Buttons and controls */
button,
.button-link,
.secondary-link,
.attachment-add {
  min-height: 40px;
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease,
    transform 80ms ease;
}

button:not(.link):not(.nav-toggle),
.button-link,
.attachment-add {
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--green);
  font-weight: 720;
  cursor: pointer;
}

button:not(.link):not(.nav-toggle):hover,
.button-link:hover,
.attachment-add:hover {
  border-color: #8cbbaa;
  background: #f6fbf9;
  box-shadow: 0 4px 12px rgba(7, 101, 72, 0.08);
}

button.primary,
.toolbar button,
.login button:not(.login-link),
.wa-composer .wa-message-send,
.wa-template-send {
  border-color: var(--green);
  color: white;
  background: linear-gradient(180deg, #087052, #075e45);
  box-shadow: 0 6px 15px rgba(7, 101, 72, 0.14);
}

button:active,
.button-link:active {
  transform: translateY(1px);
}

button:disabled,
.disabled-action {
  cursor: not-allowed;
  opacity: 0.62;
}

.toolbar {
  min-height: 48px;
  gap: 9px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select,
.command-form input,
.command-form select,
.command-form textarea,
.wa-contact-profile input,
.wa-contact-profile select,
.wa-contact-profile textarea {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(8, 36, 27, 0.025);
}

.toolbar input:hover,
.toolbar select:hover,
.command-form input:hover,
.command-form select:hover,
.command-form textarea:hover {
  border-color: #a9c6ba;
}

.command-form {
  gap: 17px;
}

.command-form > label,
.form-grid label,
.conditional label {
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 720;
}

.command-form textarea {
  min-height: 92px;
  line-height: 1.45;
}

.form-grid,
.conditional {
  gap: 14px;
}

.split-actions {
  align-items: center;
  gap: 14px;
}

.calendar-picker {
  width: 42px;
  height: 42px;
  border-color: var(--line-strong);
}

.result-count {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 780;
}

.command-result:not(:empty),
.notice:not(:empty),
.error:not(:empty) {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
}

.error:not(:empty) {
  color: var(--red);
  background: var(--red-soft);
}

/* Strict, quiet status language */
.badge,
.action-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 150px;
  min-height: 24px;
  padding: 4px 9px;
  overflow: hidden;
  color: #4c6158;
  border: 1px solid #d9e4df;
  border-radius: 999px;
  background: #edf2f0;
  font-size: 9px;
  font-weight: 820;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  white-space: nowrap;
}

.badge.failed,
.badge.conflict,
.badge.blocked,
.badge.unresolved,
.badge.overdue {
  color: #93353b;
  border-color: #f0caca;
  background: var(--red-soft);
}

.badge.open,
.badge.ready,
.badge.accepted,
.badge.sent,
.badge.live,
.badge.resolved,
.badge.active,
.badge.complete,
.badge.ok,
.badge.read,
.badge.delivered {
  color: #086144;
  border-color: #bfe5d6;
  background: var(--mint);
}

.badge.retryable,
.badge.processing,
.badge.awaiting,
.badge.required,
.badge.scheduled {
  color: #7c530d;
  border-color: #efd49d;
  background: var(--amber-soft);
}

/* Tables and operational lists */
.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-sm);
  scrollbar-color: #a9c3b9 transparent;
}

.table-wrap table {
  table-layout: fixed;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 42px;
  padding: 10px 12px;
  color: #66766f;
  border-bottom: 1px solid var(--line-strong);
  background: #edf3f0;
  font-size: 9px;
  font-weight: 820;
  letter-spacing: 0.9px;
}

td {
  padding: 13px 12px;
  color: var(--ink-soft);
  border-color: #e6ede9;
  vertical-align: middle;
}

td strong,
.identity-link {
  color: var(--ink);
  font-weight: 760;
}

tbody tr {
  transition: background 100ms ease, box-shadow 100ms ease;
}

tbody tr:hover {
  background: #f6faf8;
  box-shadow: inset 3px 0 var(--green-bright);
}

.leads-table tr,
.contacts-table tr {
  height: 82px;
}

.leads-table td,
.contacts-table td {
  max-height: 82px;
  overflow: hidden;
}

.leads-table td > strong,
.leads-table td > a,
.contacts-table td > strong,
.contacts-table td > a {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.contacts-table td:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-table table {
  min-width: 0;
}

.daily-table th:nth-child(1) { width: 8%; }
.daily-table th:nth-child(2) { width: 15%; }
.daily-table th:nth-child(3) { width: 13%; }
.daily-table th:nth-child(4) { width: 14%; }
.daily-table th:nth-child(5) { width: 15%; }
.daily-table th:nth-child(6) { width: 12%; }
.daily-table th:nth-child(7) { width: 8%; }
.daily-table th:nth-child(8) { width: 15%; }

.daily-table tr.lead-row {
  height: 112px;
}

.daily-table td {
  height: 112px;
  max-height: 112px;
  overflow: hidden;
}

.daily-table .identity-link {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.daily-table time {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
}

.daily-comms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.daily-comms .button-link {
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
}

/* Dashboard, built exclusively from existing read models */
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-metric {
  position: relative;
  min-height: 132px;
  display: grid;
  align-content: start;
  padding: 17px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  transition: 120ms ease;
}

.dashboard-metric:hover {
  border-color: #a8cabe;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dashboard-metric > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.85px;
  text-transform: uppercase;
}

.dashboard-metric > strong {
  margin: 7px 0 5px;
  color: var(--ink);
  font-size: 32px;
  font-weight: 780;
  line-height: 1;
  letter-spacing: -1.2px;
}

.dashboard-metric > small {
  padding-right: 20px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.dashboard-metric > b {
  position: absolute;
  right: 15px;
  bottom: 13px;
  color: var(--green);
}

.dashboard-metric.primary {
  color: white;
  border-color: var(--green);
  background: linear-gradient(145deg, #087151, #0b5c45);
  box-shadow: 0 12px 28px rgba(7, 101, 72, 0.17);
}

.dashboard-metric.primary > span,
.dashboard-metric.primary > strong,
.dashboard-metric.primary > small,
.dashboard-metric.primary > b {
  color: white;
}

.dashboard-metric.warning { border-top: 3px solid var(--amber); }
.dashboard-metric.critical { border-top: 3px solid var(--red); }
.dashboard-metric.positive { border-top: 3px solid var(--green-bright); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.dashboard-wide {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.section-head h2,
.section-head .eyebrow {
  margin: 0;
}

.section-head .eyebrow {
  margin-bottom: 5px;
}

.section-head > a {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.action-stack,
.compact-list {
  display: grid;
}

.action-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(140px, 0.8fr) minmax(160px, 1.1fr) 20px;
  gap: 11px;
  align-items: center;
  min-height: 67px;
  padding: 9px 4px;
  color: var(--ink);
  border-bottom: 1px solid #e8eeeb;
  text-decoration: none;
}

.action-summary:last-child,
.compact-list a:last-child {
  border-bottom: 0;
}

.action-summary:hover,
.compact-list a:hover,
.recent-grid a:hover {
  background: #f7faf8;
}

.action-marker,
.channel-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: var(--green);
  border-radius: 9px;
  background: var(--mint);
  font-size: 11px;
  font-weight: 850;
}

.action-copy,
.action-next,
.compact-list a > span,
.recent-grid a > span:not(.channel-mark) {
  min-width: 0;
  display: grid;
}

.action-copy strong,
.action-copy small,
.action-next strong,
.action-next small,
.compact-list strong,
.compact-list small,
.recent-grid strong,
.recent-grid small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-summary small,
.compact-list small,
.recent-grid small {
  color: var(--muted);
  font-size: 10px;
}

.action-next strong {
  font-size: 12px;
}

.action-chevron {
  color: var(--green);
}

.compact-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 63px;
  padding: 8px 4px;
  color: var(--ink);
  border-bottom: 1px solid #e8eeeb;
  text-decoration: none;
}

.compact-list time,
.recent-grid time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.recent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.recent-grid a {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 67px;
  padding: 8px 4px;
  color: var(--ink);
  border-bottom: 1px solid #e8eeeb;
  text-decoration: none;
}

.recent-grid time {
  grid-column: 2 / -1;
  margin-top: -18px;
}

.recent-grid .badge {
  max-width: 86px;
}

/* Lead workspace */
main[data-page="lead"] {
  max-width: 1460px;
}

.lead-hero {
  position: relative;
  grid-template-columns: minmax(220px, 0.82fr) minmax(300px, 1.35fr) minmax(220px, 0.8fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.lead-hero > div {
  padding: 22px;
}

.lead-hero > div + div {
  border-left: 1px solid var(--line);
}

.lead-hero .next-action {
  padding: 22px 25px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(145deg, #ecf8f3, #f7fbf9);
}

.next-action h2 {
  margin: 9px 0;
  color: var(--green);
  font-size: 22px;
  line-height: 1.14;
}

.contact-card a {
  overflow-wrap: anywhere;
  font-weight: 720;
}

.workbench {
  position: relative;
  padding: 23px;
  overflow: hidden;
  border: 1px solid #91c9b4;
  background: linear-gradient(145deg, #ffffff 32%, #edf8f3);
  box-shadow: 0 9px 28px rgba(7, 101, 72, 0.08);
}

.workbench::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(var(--green-bright), var(--green));
}

.workbench h2 {
  margin-top: 4px;
  font-size: 23px;
}

.consequences {
  border: 1px solid #bee5d5;
  border-left: 4px solid var(--green);
  background: var(--mint);
}

.timeline {
  max-width: none;
  max-height: 540px;
  padding: 18px 20px 4px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.timeline-item {
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 20px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--green);
}

.timeline-item strong {
  font-size: 13px;
}

.forensic {
  color: var(--muted);
  border-style: dashed;
  background: #eef3f1;
  box-shadow: none;
}

.forensic > summary {
  color: var(--ink-soft);
  font-size: 11px;
}

/* Performance, administration and system views */
.metrics {
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 11px;
}

.metric {
  min-height: 116px;
  padding: 17px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.metric > span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.75px;
}

.metric > strong {
  margin: 8px 0 5px;
  color: var(--ink);
  font-size: 25px;
  font-weight: 760;
  letter-spacing: -0.6px;
}

.metric small {
  font-size: 10px;
}

.health-banner {
  padding: 14px 17px;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-xs);
}

.health-banner.healthy {
  border-left: 4px solid var(--green-bright);
}

.periods {
  width: max-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.periods a {
  border-radius: 7px;
  font-size: 11px;
}

/* Communications centre */
main[data-page="communications"] .table-wrap tr {
  height: 82px;
}

main[data-page="communications"] .table-wrap td {
  max-height: 82px;
  overflow: hidden;
}

tr.unread {
  background: #f0faf6;
  box-shadow: inset 3px 0 var(--green-bright);
}

.body-copy {
  max-height: 440px;
  overflow: auto;
  padding: 15px;
  border-radius: 9px;
  background: #f6f9f7;
}

/* WhatsApp remains HELM, not a clone of the consumer product */
main.whatsapp-mode {
  height: calc(100dvh - var(--header-height));
  margin-top: var(--header-height);
  padding: 18px 24px 24px;
}

.wa-product {
  gap: 14px;
}

.wa-product-head h1 {
  font-size: 30px;
  font-weight: 780;
  letter-spacing: -1px;
}

.wa-page {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.wa-list-head,
.wa-chat-head,
.wa-context,
.wa-composer {
  border-color: var(--line);
}

.wa-list-head {
  padding: 16px;
  background: #fbfcfb;
}

.wa-search input {
  min-height: 42px;
  border-color: var(--line-strong);
  border-radius: 9px;
}

.wa-filters {
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: var(--paper-deep);
}

.wa-filters a {
  border-radius: 7px;
  font-size: 11px;
}

.wa-conversation {
  min-height: 83px;
  padding: 13px 15px;
  border-color: #e6ede9;
}

.wa-conversation.selected {
  background: #e9f7f1;
  box-shadow: inset 3px 0 var(--green-bright);
}

.wa-avatar {
  color: var(--green);
  background: var(--mint);
}

.wa-chat-head {
  min-height: 66px;
  padding: 11px 18px;
}

.wa-chat-head h2 {
  font-size: 18px;
  font-weight: 760;
}

.wa-context {
  min-height: 48px;
  padding: 8px 18px;
  background: #f8faf9;
}

.wa-thread {
  padding: 18px 22px;
  background:
    radial-gradient(circle at 20% 10%, rgba(7, 101, 72, 0.025), transparent 28%),
    #eef3f1;
}

.wa-bubble {
  padding: 9px 12px;
  border: 1px solid #dce5e1;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(8, 34, 25, 0.05);
}

.wa-out {
  border-color: #c8e8dc;
  background: #daf2e8;
}

.wa-composer {
  padding: 11px 14px 13px;
  background: #fff;
}

.wa-compose-row textarea {
  border-color: var(--line-strong);
  border-radius: 9px;
}

.wa-compose-menu > summary {
  border-color: var(--line-strong);
  border-radius: 9px;
}

.wa-template-flow,
.wa-template-panel {
  border-color: #e5cb92;
  border-radius: 10px;
  background: #fffaf0;
  box-shadow: var(--shadow-sm);
}

/* Templates */
.template-workspace {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-sm);
}

.template-navigation {
  background: #f5f8f6;
}

.template-nav-item.active {
  box-shadow: inset 3px 0 var(--green-bright);
}

.template-editor {
  background: white;
}

.template-attachments,
.variable-points {
  border-radius: 10px;
  background: #f5f8f6;
}

/* Mobile and compact layouts */
@media (max-width: 1220px) {
  :root { --sidebar-width: 220px; }
  main { padding-left: 24px; padding-right: 24px; }
  .dashboard-metrics { grid-template-columns: repeat(3, 1fr); }
  .dashboard-metric { min-height: 112px; }
  .daily-table th:nth-child(3), .daily-table td:nth-child(3) { display: none; }
  .daily-table th:nth-child(2) { width: 18%; }
  .daily-table th:nth-child(4) { width: 17%; }
  .daily-table th:nth-child(5) { width: 18%; }
  .daily-table th:nth-child(8) { width: 19%; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; --header-height: 64px; }

  header { padding: 0 14px; }
  .brand-lockup { width: auto; }
  .brand-lockup img { width: 31px; height: 31px; }
  .brand-lockup strong { font-size: 19px; }
  .brand-lockup small { font-size: 8px; letter-spacing: 1.25px; }
  header .mode, header #refresh-state, header .live-dot { display: none; }
  button.link { margin-left: 0; }

  .nav-toggle {
    width: 44px;
    height: 40px;
    display: grid;
    grid-template-columns: 16px 1fr;
    grid-template-rows: repeat(3, 3px);
    align-content: center;
    gap: 3px 7px;
    padding: 8px 9px;
    color: #dce9e4;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
  }

  .nav-toggle span {
    grid-column: 1;
    width: 15px;
    height: 1px;
    background: currentColor;
  }

  .nav-toggle b {
    display: none;
  }

  aside {
    top: var(--header-height);
    bottom: 0;
    left: 0;
    right: auto;
    width: min(326px, 86vw);
    height: auto;
    display: flex;
    padding: 20px 14px;
    overflow-y: auto;
    border-top: 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.navigation-open aside { transform: translateX(0); }

  #primary-navigation { display: grid; overflow: visible; gap: 20px; }
  aside nav .nav-section { display: grid; }
  aside nav a { min-height: 40px; padding: 10px 12px 10px 38px; font-size: 13px; }
  #identity { display: grid; }

  .nav-scrim {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 7;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(5, 23, 17, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.navigation-open .nav-scrim { display: block; opacity: 1; pointer-events: auto; }
  body.navigation-open { overflow: hidden; }

  main,
  main.whatsapp-mode {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
  }

  main { padding: 88px 18px 40px; }
  main.whatsapp-mode {
    height: calc(100dvh - var(--header-height));
    margin-top: var(--header-height);
    padding: 10px;
  }

  main[aria-busy="true"]::after { left: 0; top: var(--header-height); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-wide { grid-column: auto; }
  .recent-grid { grid-template-columns: 1fr; }
  .lead-hero { grid-template-columns: 1fr 1fr; }
  .lead-hero > div:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }

  .daily-table th:nth-child(3), .daily-table td:nth-child(3) { display: table-cell; }
  .daily-table thead { display: none; }
  .daily-table table, .daily-table tbody { display: block; }
  .daily-table tr.lead-row {
    height: 306px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "person type"
      "company company"
      "need need"
      "action due"
      "owner owner"
      "communicate communicate";
    gap: 7px 14px;
    margin: 10px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: white;
    box-shadow: var(--shadow-xs);
  }

  .daily-table td {
    width: auto !important;
    height: auto;
    max-height: none;
    display: block;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
  }

  .daily-table td:nth-child(1) { grid-area: type; float: none; text-align: right; }
  .daily-table td:nth-child(2) { grid-area: person; font-size: 15px; }
  .daily-table td:nth-child(3) { grid-area: company; }
  .daily-table td:nth-child(4) { grid-area: need; }
  .daily-table td:nth-child(5) { grid-area: action; }
  .daily-table td:nth-child(6) { grid-area: due; text-align: right; }
  .daily-table td:nth-child(7) { grid-area: owner; }
  .daily-table td:nth-child(8) { grid-area: communicate; }
  .daily-table td::before { display: inline; color: var(--muted); font-size: 10px; font-weight: 700; }
  .daily-table td:nth-child(3)::before { content: "Company · "; }
  .daily-table td:nth-child(4)::before { content: "Need · "; }
  .daily-table td:nth-child(5)::before { content: "Next · "; display: block; }
  .daily-table td:nth-child(6)::before { content: "Due · "; display: block; }
  .daily-table td:nth-child(7)::before { content: "Owner · "; }
  .daily-table td:nth-child(8)::before { content: "Communicate"; display: block; margin-bottom: 5px; }
  .daily-comms { display: flex; flex-wrap: nowrap; overflow-x: auto; }
  .daily-comms .button-link { flex: 0 0 auto; }

  .wa-chat.open { inset: var(--header-height) 0 0; }
  .wa-page { border-radius: 10px; }
  .wa-product-head { min-height: 44px; }
  .wa-alert-controls { max-width: 58%; }
}

@media (max-width: 640px) {
  .shell-status { gap: 4px !important; }
  .brand-lockup small { display: none; }
  button.link { padding: 6px; font-size: 11px; }

  main { padding: 86px 13px 30px; }
  .page-head { margin-bottom: 20px; padding-left: 13px; }
  .page-head h1 { font-size: 30px; letter-spacing: -1px; }
  .page-head p { margin-top: 6px; font-size: 13px; }
  .section-head { align-items: start; }
  .section-head > a { max-width: 110px; text-align: right; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-metric { min-height: 118px; padding: 14px; }
  .dashboard-metric > strong { font-size: 28px; }
  .dashboard-grid { gap: 12px; }
  .panel { padding: 16px; }
  .action-summary { grid-template-columns: 32px minmax(0, 1fr) 16px; }
  .action-next { grid-column: 2; }
  .action-chevron { grid-row: 1 / span 2; grid-column: 3; }
  .lead-hero { grid-template-columns: 1fr; }
  .lead-hero > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .lead-hero > div:nth-child(3) { grid-column: auto; }
  .workbench, .card, .forensic { padding: 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 108px; padding: 14px; }
  .metric > strong { font-size: 21px; }
  .health-banner { align-items: start; flex-direction: column; }

  /* Every non-Daily table becomes labelled record cards at phone width. */
  .table-wrap:not(.daily-table) {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .table-wrap:not(.daily-table) table,
  .table-wrap:not(.daily-table) tbody {
    display: block;
  }

  .table-wrap:not(.daily-table) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table-wrap:not(.daily-table) tr {
    height: auto;
    display: block;
    margin: 10px 0;
    padding: 8px 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: white;
    box-shadow: var(--shadow-xs);
  }

  .table-wrap:not(.daily-table) td {
    width: 100% !important;
    height: auto;
    max-height: none;
    display: grid;
    grid-template-columns: minmax(84px, 31%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    overflow: hidden;
    border-bottom: 1px solid #edf1ef;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table-wrap:not(.daily-table) td:last-child { border-bottom: 0; }
  .table-wrap:not(.daily-table) td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 9px;
    font-weight: 820;
    letter-spacing: 0.45px;
    text-transform: uppercase;
  }

  .form-grid, .conditional, .outcome-grid { grid-template-columns: 1fr; }
  .split-actions { grid-template-columns: 1fr; }
  .split-actions > button { width: 100%; }
  .toolbar { display: grid; grid-template-columns: 1fr auto; }
  .toolbar input { grid-column: 1 / -1; min-width: 0; width: 100%; }
  .result-count { grid-column: 1 / -1; }
  .button-row { flex-wrap: wrap; }
  .button-row button { flex: 1 1 150px; }
  .timeline { max-height: 480px; padding: 15px 13px 2px; }
  .kv { grid-template-columns: 90px 1fr; }

  main.whatsapp-mode { padding: 7px; }
  .wa-product { gap: 6px; }
  .wa-product-head h1 { font-size: 22px; }
  .wa-product-head p { font-size: 10px; }
  .wa-alert-controls { max-width: 62%; }
  .wa-alert-controls > span, .wa-alert-controls details { display: none; }
  .wa-thread { padding: 11px; }
  .wa-bubble { max-width: 90%; }
  .wa-bubble footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
  }
  .wa-bubble footer > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .wa-bubble footer .wa-status { white-space: nowrap; }
  .wa-composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   HELM command-system successor
   Presentation composition only: canonical commands, fields and routes remain
   owned by the frozen application contract.
   -------------------------------------------------------------------------- */

:root {
  --ink: #0d201a;
  --ink-soft: #2d443b;
  --muted: #6f817a;
  --line: #d4dfda;
  --line-strong: #b8cbc3;
  --paper: #edf2f0;
  --paper-deep: #e4ebe8;
  --green: #006c4c;
  --green-bright: #29d394;
  --deep: #061914;
  --deep-soft: #0b2b22;
  --graphite: #14241f;
  --signal: #96f3cf;
  --mint: #dff6ed;
  --mint-strong: #bcebd8;
  --amber: #b97708;
  --amber-soft: #fff0ce;
  --red: #a93b42;
  --red-soft: #fae4e5;
  --white: #fff;
  --shadow-xs: 0 1px 1px rgba(3, 25, 17, 0.04);
  --shadow-sm: 0 12px 30px rgba(3, 25, 17, 0.07);
  --shadow-md: 0 28px 80px rgba(2, 20, 14, 0.16);
  --radius-sm: 5px;
  --radius: 9px;
  --radius-lg: 14px;
  --header-height: 78px;
  --sidebar-width: 264px;
}

body {
  background:
    linear-gradient(90deg, rgba(8, 54, 41, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(8, 54, 41, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  font-size: 14px;
  letter-spacing: -0.008em;
}

header {
  height: var(--header-height);
  padding: 0 30px 0 24px;
  background:
    linear-gradient(90deg, rgba(41, 211, 148, 0.12), transparent 22%),
    #051711;
  border-bottom-color: rgba(150, 243, 207, 0.12);
  box-shadow: 0 8px 35px rgba(0, 18, 12, 0.2);
}

.brand-lockup {
  width: calc(var(--sidebar-width) - 26px);
  gap: 13px;
}

.brand-lockup img { width: 42px; height: 42px; }
.brand-lockup strong { font-size: 25px; letter-spacing: -1.3px; }
.brand-lockup small { color: #86a99b; font-size: 8px; letter-spacing: 2.1px; }

.shell-command-title {
  display: grid;
  gap: 3px;
  margin-right: auto;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.shell-command-title span {
  color: #76998b;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 2px;
}

.shell-command-title b {
  color: #effaf6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.shell-status { gap: 13px !important; font-variant-numeric: tabular-nums; }
header .mode { border-radius: 3px; box-shadow: 0 0 24px rgba(241, 187, 77, 0.14); }

aside {
  top: var(--header-height);
  width: var(--sidebar-width);
  padding: 28px 18px 20px;
  background:
    linear-gradient(180deg, rgba(41, 211, 148, 0.075), transparent 27%),
    #082219;
  border-right-color: rgba(150, 243, 207, 0.1);
}

#primary-navigation { gap: 25px; }
.nav-section { gap: 4px; }
.nav-section > span {
  padding: 0 13px 8px;
  color: #6f9a89;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 2.1px;
}

aside nav a {
  min-height: 43px;
  display: grid;
  grid-template-columns: 25px 1fr;
  align-items: center;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #b9d0c7;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

aside nav a::before { display: none; }
aside nav a[href="#/whatsapp"]::before {
  content: "05";
  display: block;
  color: #547d6d;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
aside nav a[href="#/whatsapp"].active::before { color: var(--signal); }
aside nav a[href="#/whatsapp"] { position: relative; display: flex; padding-left: 42px; }
aside nav a[href="#/whatsapp"]::before { position: absolute; left: 12px; }
aside nav a i {
  color: #547d6d;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* The Meta link has no number <i>; place its label in the shared second column. */
aside nav a[href="#/meta-generation"] > span {
  grid-column: 2;
  white-space: nowrap;
}

aside nav a:hover { color: white; background: rgba(150, 243, 207, 0.055); }
aside nav a.active {
  color: white;
  border-color: rgba(93, 233, 180, 0.2);
  background: linear-gradient(90deg, rgba(25, 176, 121, 0.27), rgba(25, 176, 121, 0.08));
  box-shadow: inset 3px 0 var(--green-bright), 0 10px 26px rgba(0, 0, 0, 0.14);
}

aside nav a.active i { color: var(--signal); }
.system-nav { padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

#identity {
  order: -1;
  position: relative;
  margin: 0 0 22px;
  padding: 14px 15px;
  border: 1px solid rgba(150, 243, 207, 0.2);
  border-left: 3px solid var(--green-bright);
  border-radius: 6px;
  background: linear-gradient(110deg, rgba(41, 211, 148, 0.12), rgba(255, 255, 255, 0.025));
  box-shadow: 0 12px 28px rgba(0, 14, 9, 0.16);
  display: none;
}

#identity::before {
  content: "ACTIVE OPERATOR";
  color: #8ab9a6;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 1.8px;
}

#identity strong { margin-top: 7px; overflow: hidden; color: #f5fffb; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
#identity span { color: #89b4a3; font-size: 8px; letter-spacing: 1.1px; }

#header-identity {
  min-width: 190px;
  max-width: 230px;
  display: grid;
  gap: 2px;
  margin: 0 20px 0 14px;
  padding: 9px 14px;
  border: 1px solid rgba(150, 243, 207, 0.2);
  border-left: 3px solid var(--green-bright);
  border-radius: 4px;
  background: linear-gradient(110deg, rgba(41, 211, 148, 0.13), rgba(255, 255, 255, 0.025));
  box-shadow: 0 10px 25px rgba(0, 14, 9, 0.15);
}

#header-identity::before {
  content: "ACTIVE OPERATOR";
  color: #8ab9a6;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 1.7px;
}

#header-identity strong {
  overflow: hidden;
  color: #f5fffb;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#header-identity span {
  overflow: hidden;
  color: #79a290;
  font-size: 7px;
  letter-spacing: 1px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

main {
  width: calc(100% - var(--sidebar-width));
  max-width: 1880px;
  margin-left: var(--sidebar-width);
  padding: 116px 40px 60px;
}

.page-head {
  min-height: 106px;
  display: grid;
  grid-template-columns: 1fr 120px;
  align-items: end;
  gap: 30px;
  margin: 0 0 30px;
  padding: 0 0 23px;
  border-bottom: 1px solid var(--line-strong);
}

.page-head::before { display: none; }
.page-coordinate,
.queue-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.page-head h1 {
  font-size: clamp(38px, 3.25vw, 56px);
  line-height: 0.96;
  letter-spacing: -0.055em;
  font-weight: 790;
}

.page-head p { max-width: 720px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.page-rule { height: 3px; margin-bottom: 7px; background: linear-gradient(90deg, var(--green-bright) 0 30%, var(--deep) 30% 100%); }

button,
.button-link {
  min-height: 40px;
  border-radius: 5px;
  font-weight: 750;
}

button.primary,
.button-link.primary,
form > button:not([type="button"]) {
  background: linear-gradient(135deg, #007657, #00583f);
  border-color: #00553d;
  box-shadow: 0 8px 18px rgba(0, 92, 66, 0.16);
}

button.primary:hover,
.button-link.primary:hover,
form > button:not([type="button"]):hover { background: #004f39; transform: translateY(-1px); }

input,
select,
textarea {
  min-height: 44px;
  border-radius: 5px;
  border-color: var(--line-strong);
  background: #fbfdfc;
  box-shadow: inset 0 1px 0 rgba(5, 40, 28, 0.02);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 108, 76, 0.1), inset 3px 0 var(--green-bright);
}

label { color: var(--ink-soft); font-size: 11px; font-weight: 740; letter-spacing: 0.02em; }
.card, .panel, .workbench, .forensic, .table-wrap {
  border-radius: var(--radius);
  border-color: var(--line);
}

.badge {
  min-width: 0;
  padding: 5px 9px;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.05px;
}

/* Authentication is a deliberate system threshold, not a generic form. */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
  gap: 0;
  padding: 34px;
  background:
    linear-gradient(115deg, rgba(16, 83, 61, 0.38), transparent 48%),
    #03140f;
}

.login::before { inset: 34px; border-radius: 12px; border-color: rgba(150, 243, 207, 0.09); }
.login form {
  justify-self: stretch;
  align-self: stretch;
  width: auto;
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(45px, 7vw, 96px);
  border: 0;
  border-radius: 0 10px 10px 0;
  box-shadow: var(--shadow-md);
}

.auth-stage {
  position: relative;
  z-index: 1;
  min-height: 650px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(48px, 7vw, 110px);
  overflow: hidden;
  color: white;
  border: 1px solid rgba(150, 243, 207, 0.12);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background:
    radial-gradient(circle at 22% 14%, rgba(41, 211, 148, 0.22), transparent 25%),
    linear-gradient(145deg, rgba(5, 58, 41, 0.4), transparent 65%),
    #061d16;
}

.auth-stage::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  top: -220px;
  right: -160px;
  border: 1px solid rgba(150, 243, 207, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 90px rgba(150, 243, 207, 0.025), 0 0 0 180px rgba(150, 243, 207, 0.018);
}

.auth-stage > span { color: var(--signal); font-size: 9px; font-weight: 900; letter-spacing: 2.5px; }
.auth-stage h2 { max-width: 780px; margin: 25px 0; color: white; font-size: clamp(48px, 5.5vw, 90px); line-height: 0.93; letter-spacing: -0.06em; }
.auth-stage p { max-width: 620px; color: #9db8ae; font-size: 16px; }
.auth-stage > div { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr; gap: 12px; margin-top: 60px; color: #87a99c; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-stage > div b { color: var(--signal); }

/* Growth command centre */
main[data-page="dashboard"] { padding-top: 102px; }
.mission-control {
  min-height: 310px;
  display: grid;
  grid-template-columns: 1fr 280px;
  overflow: hidden;
  color: white;
  border: 1px solid rgba(150, 243, 207, 0.13);
  border-radius: 12px;
  background:
    radial-gradient(circle at 75% -20%, rgba(41, 211, 148, 0.18), transparent 35%),
    linear-gradient(135deg, #08281f, #041712 70%);
  box-shadow: 0 24px 60px rgba(3, 25, 17, 0.18);
}

.mission-copy { position: relative; padding: 48px 52px 44px; }
.mission-copy::after { content: ""; position: absolute; right: 0; top: 36px; bottom: 36px; width: 1px; background: rgba(150, 243, 207, 0.13); }
.mission-copy .page-coordinate { color: var(--signal); }
.mission-copy h1 { margin: 0; font-size: clamp(48px, 4.7vw, 78px); line-height: 0.94; letter-spacing: -0.06em; }
.mission-copy p { max-width: 680px; margin: 22px 0 30px; color: #aac2b8; font-size: 15px; }
.mission-action { width: max-content; display: flex; align-items: center; gap: 42px; padding: 12px 16px; color: #061914; background: var(--signal); border-radius: 4px; text-decoration: none; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: 0.08em; }
.mission-action:hover { background: white; }
.mission-readout { display: flex; flex-direction: column; justify-content: center; padding: 42px; }
.readout-label { color: #71988a; font-size: 8px; font-weight: 900; letter-spacing: 2px; }
.mission-readout > strong { margin-top: 10px; color: var(--signal); font-size: 88px; line-height: 0.9; letter-spacing: -0.07em; font-variant-numeric: tabular-nums; }
.mission-readout > span:not(.readout-label) { color: #9bb6ab; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.mission-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid rgba(150, 243, 207, 0.13); }
.mission-split span { color: #8fa99f; font-size: 9px; text-transform: uppercase; }
.mission-split b { display: block; margin-bottom: 4px; color: white; font-size: 18px; }
.mission-split .risk b { color: #ffd17b; }

.control-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 16px 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--line-strong); }
.control-strip .dashboard-metric { min-height: 118px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; gap: 0 10px; padding: 22px; border: 0; border-radius: 0; box-shadow: none; background: rgba(255,255,255,.92); }
.control-strip .dashboard-metric > span { grid-column: 1; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: 1.6px; }
.control-strip .dashboard-metric > strong { grid-column: 1; align-self: center; font-size: 35px; letter-spacing: -0.05em; }
.control-strip .dashboard-metric > small { grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.control-strip .dashboard-metric > b { grid-column: 2; grid-row: 1 / 4; align-self: center; color: var(--green); font-size: 18px; }
.control-strip .dashboard-metric.signal { box-shadow: inset 0 3px var(--green-bright); }
.control-strip .dashboard-metric.critical { box-shadow: inset 0 3px var(--red); }

.control-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(310px, .8fr); gap: 16px; }
.control-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.93); box-shadow: var(--shadow-xs); }
.control-panel .section-head { min-height: 82px; margin: 0; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.control-panel .section-head h2 { font-size: 20px; letter-spacing: -.035em; }
.control-panel .section-head a { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.mission-queue { grid-row: span 2; }
.mission-list { display: grid; }
.mission-item { min-height: 84px; display: grid; grid-template-columns: 44px minmax(150px, 1.1fr) minmax(160px, 1fr) 150px 16px; align-items: center; gap: 16px; padding: 14px 22px; color: var(--ink); border-bottom: 1px solid #e3eae7; text-decoration: none; }
.mission-item:last-child { border-bottom: 0; }
.mission-item:hover { background: #f0f8f5; box-shadow: inset 3px 0 var(--green-bright); }
.mission-rank { color: #9aaba4; font-size: 10px; font-weight: 850; font-variant-numeric: tabular-nums; }
.mission-person, .mission-next { min-width: 0; display: grid; }
.mission-person strong, .mission-next strong, .mission-person small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mission-person strong { font-size: 13px; }
.mission-person small, .mission-next small { color: var(--muted); font-size: 10px; }
.mission-next strong { margin-top: 4px; font-size: 11px; }
.mission-item time { color: var(--muted); font-size: 10px; }
.mission-item.overdue time { color: var(--amber); font-weight: 800; }
.mission-item > b { color: var(--green); }

.growth-pulse { min-height: 350px; }
.pulse-total { display: flex; align-items: baseline; gap: 9px; padding: 20px 24px 10px; }
.pulse-total strong { font-size: 42px; line-height: 1; letter-spacing: -.06em; }
.pulse-total span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.pipeline-spectrum { display: grid; gap: 10px; padding: 10px 24px 24px; }
.pipeline-spectrum a { display: grid; grid-template-columns: 100px 1fr 28px; align-items: center; gap: 10px; color: var(--ink-soft); text-decoration: none; font-size: 10px; }
.pipeline-spectrum a > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-spectrum i, .owner-load i { height: 5px; overflow: hidden; background: var(--paper-deep); border-radius: 0; }
.pipeline-spectrum i b { width: var(--share); height: 100%; display: block; background: linear-gradient(90deg, var(--green), var(--green-bright)); }
.pipeline-spectrum a strong { text-align: right; }

.communication-pulse { min-height: 275px; }
.comms-readout { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.comms-readout > div { padding: 18px 20px; border-right: 1px solid var(--line); }
.comms-readout > div:last-child { border-right: 0; }
.comms-readout strong { display: block; font-size: 25px; letter-spacing: -.04em; }
.comms-readout span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.owner-load { display: grid; gap: 8px; padding: 16px 20px 20px; }
.owner-load .eyebrow { margin-bottom: 2px; }
.owner-load > div { display: grid; grid-template-columns: 80px 1fr 24px; align-items: center; gap: 8px; font-size: 9px; }
.owner-load i b { height: 100%; display: block; background: var(--green); }

.upcoming-panel { min-height: 310px; }
.upcoming-rail a { min-height: 65px; display: grid; grid-template-columns: 130px 1fr 15px; align-items: center; gap: 14px; padding: 12px 22px; color: var(--ink); border-bottom: 1px solid #e3eae7; text-decoration: none; }
.upcoming-rail time { color: var(--green); font-size: 9px; font-weight: 800; }
.upcoming-rail span { min-width: 0; display: grid; }
.upcoming-rail strong, .upcoming-rail small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-rail small { color: var(--muted); font-size: 9px; }
.movement-panel { grid-column: 1 / -1; }
.movement-grid { display: grid; grid-template-columns: 1fr 1fr; }
.movement-grid a { min-height: 72px; display: grid; grid-template-columns: 34px 1fr auto 118px; align-items: center; gap: 12px; padding: 12px 20px; color: var(--ink); border-right: 1px solid #e3eae7; border-bottom: 1px solid #e3eae7; text-decoration: none; }
.movement-grid a:nth-child(even) { border-right: 0; }
.movement-grid a > span:nth-child(2) { min-width: 0; display: grid; }
.movement-grid a strong, .movement-grid a small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movement-grid a small, .movement-grid time { color: var(--muted); font-size: 9px; }
.channel-mark, .channel-orb { display: grid; place-items: center; color: var(--green); background: var(--mint); font-size: 9px; font-weight: 900; }
.channel-mark { width: 30px; height: 30px; border-radius: 4px; }
.channel-mark.whatsapp { color: #075e45; background: #d9f4e8; }

/* Daily Actions is an operational queue, never a spreadsheet. */
.queue-control,
.index-control,
.comms-control {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding: 17px 20px;
  color: white;
  border: 1px solid rgba(150,243,207,.1);
  border-radius: 7px;
  background: linear-gradient(110deg, #0a2c22, #061b15);
  box-shadow: var(--shadow-sm);
}

.queue-control > div:first-child,
.index-control > div:first-child,
.comms-control > div:first-child { min-width: 220px; display: grid; }
.queue-control .queue-kicker,
.index-control .queue-kicker,
.comms-control .queue-kicker { margin-bottom: 4px; color: var(--signal); }
.queue-control > div > strong,
.index-control > div > strong,
.comms-control > div > strong { font-size: 19px; letter-spacing: -.03em; }
.queue-control > div > small,
.index-control > div > small,
.comms-control > div > small { color: #7fa295; font-size: 9px; }
.queue-control .toolbar,
.index-control .toolbar { margin: 0; }
.queue-control #filters {
  width: min(100%, 560px);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 44px auto;
  flex: 1 1 560px;
}
.queue-control .toolbar input,
.index-control .toolbar input { min-width: 260px; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.08); color: white; }
.queue-control #filters > input { width: 100%; min-width: 0; }
.queue-control .toolbar input::placeholder,
.index-control .toolbar input::placeholder { color: #83a497; }
.queue-control .toolbar button,
.index-control .toolbar button { color: var(--deep); background: var(--signal); border-color: var(--signal); }
.queue-control .calendar-picker { color: white; border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.06); }
.queue-control .calendar-picker { overflow: hidden; }
.queue-control .calendar-picker input { width: 100% !important; min-width: 0 !important; }

.command-queue { display: grid; gap: 8px; }
.command-unit {
  height: 132px;
  display: grid;
  grid-template-columns: 38px 76px minmax(145px, 1.1fr) minmax(115px, .8fr) minmax(160px, 1fr) 210px 22px;
  align-items: center;
  gap: 15px;
  padding: 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.command-unit:hover { border-color: #93b9aa; box-shadow: 0 12px 30px rgba(3,25,17,.09), inset 3px 0 var(--green-bright); transform: translateY(-1px); }
.command-unit.overdue { box-shadow: inset 3px 0 var(--amber); }
.command-index { align-self: stretch; display: grid; grid-template-rows: 1fr 26px; place-items: center; color: #91a29b; font-size: 9px; font-weight: 850; font-variant-numeric: tabular-nums; }
.command-index i { width: 1px; height: 20px; background: var(--line-strong); }
.command-signal { display: grid; gap: 7px; }
.command-signal small { color: #85978f; font-size: 7px; font-weight: 900; letter-spacing: 1px; }
.command-unit.overdue .command-signal small { color: var(--amber); }
.unit-label { display: block; margin-bottom: 7px; color: #80928b; font-size: 7px; font-weight: 900; letter-spacing: 1.35px; }
.daily-person, .command-reason, .command-plan, .command-next, .command-due { min-width: 0; }
.daily-person { display: block; }
.daily-person .identity-link { max-width: 100%; display: block; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 790; text-overflow: ellipsis; white-space: nowrap; }
.daily-person > strong { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.daily-person .contact { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.command-reason > span:last-child { color: var(--ink-soft); font-size: 11px; }
.command-next > strong { color: var(--ink); font-size: 13px; }
.command-next > small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.command-plan { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.command-plan .unit-label { margin-bottom: 3px; }
.command-due time { color: var(--ink-soft); font-size: 10px; font-variant-numeric: tabular-nums; }
.command-unit.overdue .command-due time { color: var(--amber); font-weight: 750; }
.daily-comms { display: grid; grid-template-columns: repeat(4, minmax(48px, 1fr)); gap: 5px; }
.daily-comms > .unit-label { grid-column: 1 / -1; margin: 0; }
.command-channel { min-width: 0; min-height: 48px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 5px 3px; color: var(--green); border: 1px solid var(--line); border-radius: 4px; background: #f7faf8; text-decoration: none; }
.command-channel svg, .lead-channel svg, .channel-orb svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.command-channel { overflow: hidden; font-size: 7px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.command-channel::before { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 3px; font-size: 8px; line-height: 1; }
.command-channel.channel-email::before { content: "@"; }
.command-channel.channel-whatsapp::before { content: "W"; }
.command-channel.channel-phone::before { content: "P"; }
.command-channel.channel-wa-call::before { content: "C"; }
.command-channel:hover { color: white; border-color: var(--green); background: var(--green); }
.command-channel.disabled-action { grid-column: span 2; color: #9aa8a2; font-size: 8px; }
.unit-open { color: var(--green); font-size: 18px; font-weight: 500; text-decoration: none; }

/* Relationship intelligence and lead workspace */
.index-control { padding-right: 14px; }
.index-control .split-actions { align-items: center; }
.command-drawer { border-top: 4px solid var(--green-bright); box-shadow: var(--shadow-md); }
.drawer-heading { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.drawer-heading h2 { margin: 0; font-size: 25px; }
.drawer-heading p { margin: 6px 0 0; color: var(--muted); }
.leads-table { border-radius: 7px; }
.leads-table thead { color: #a8c1b7; background: #0b2a21; }
.leads-table th { height: 52px; border: 0; font-size: 8px; letter-spacing: 1.5px; }
.leads-table tr { height: 92px; }
.leads-table tbody tr:hover { background: #f0f8f5; box-shadow: inset 3px 0 var(--green-bright); }
.leads-table .identity-link { color: var(--ink); font-size: 12px; font-weight: 800; }

.lead-command-deck {
  min-height: 280px;
  display: grid;
  grid-template-columns: .8fr 1.35fr 1fr;
  grid-template-rows: 1fr 82px;
  overflow: hidden;
  margin-bottom: 16px;
  color: white;
  border: 1px solid rgba(150,243,207,.1);
  border-radius: 10px;
  background:
    radial-gradient(circle at 65% -20%, rgba(41,211,148,.15), transparent 35%),
    #071e17;
  box-shadow: var(--shadow-md);
}
.lead-command-deck > div { padding: 28px 30px; border-right: 1px solid rgba(150,243,207,.11); }
.lead-command-deck .eyebrow { color: #76a392; }
.lead-state dl { grid-template-columns: 70px 1fr; margin-top: 23px; }
.lead-state dt { color: #759688; }
.lead-state dd { color: #eaf6f1; }
.lead-command-deck .next-action { display: flex; flex-direction: column; justify-content: center; background: linear-gradient(145deg, rgba(18,86,64,.42), rgba(7,30,23,.2)); }
.lead-command-deck .next-action h2 { max-width: 520px; margin: 12px 0 15px; color: var(--signal); font-size: clamp(25px, 2.4vw, 39px); line-height: 1; letter-spacing: -.05em; }
.lead-command-deck .next-action p { margin: 0; color: white; font-size: 13px; }
.lead-command-deck .next-action small { margin-top: 6px; color: #789d8e; }
.lead-context { display: flex; flex-direction: column; justify-content: center; }
.lead-context strong { max-width: 330px; margin: 13px 0 9px; font-size: 19px; line-height: 1.2; }
.lead-context > span:last-child { color: #8baca0; }
.lead-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 26px; border-top: 1px solid rgba(150,243,207,.11); border-right: 0 !important; padding-top: 16px !important; padding-bottom: 16px !important; }
.lead-actions .eyebrow { margin: 0; min-width: 90px; }
.lead-actions > div { display: flex; gap: 6px; }
.lead-channel { min-width: 100px; min-height: 45px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--signal); border: 1px solid rgba(150,243,207,.2); border-radius: 4px; background: rgba(255,255,255,.035); text-decoration: none; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.lead-channel:hover { color: var(--deep); background: var(--signal); }
.lead-actions > small { min-width: 0; margin-left: auto; overflow: hidden; color: #7d9e91; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.relationship-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .65fr); gap: 16px; margin: 16px 0 34px; }
.relationship-primary .workbench { min-height: 100%; margin: 0; padding: 28px 30px; border: 1px solid #9bcfbc; border-top: 4px solid var(--green-bright); box-shadow: var(--shadow-sm); }
.relationship-primary .workbench > h2 { margin: 5px 0 22px; font-size: 30px; letter-spacing: -.045em; }
.relationship-primary #outcome-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.relationship-primary #outcome-form > label:has(textarea),
.relationship-primary #outcome-form > .channel-choice,
.relationship-primary #outcome-form > .outcome-wa-preview,
.relationship-primary #outcome-form > .consequences,
.relationship-primary #outcome-form > button,
.relationship-primary #outcome-form > .command-result { grid-column: 1 / -1; }
.relationship-primary #outcome-form .conditional { grid-column: 1 / -1; }
.relationship-primary .consequences { border-left: 3px solid var(--green-bright); background: #eef8f4; }
.relationship-secondary { display: grid; align-content: start; gap: 10px; }
.relationship-secondary > * { margin: 0; }
.relationship-secondary .grid { display: block; }
.relationship-secondary .card { box-shadow: none; }
.context-panel { padding: 24px; color: white; border-radius: 8px; background: var(--graphite); }
.context-panel .eyebrow { color: #75a091; }
.context-panel h2 { margin: 8px 0; font-size: 20px; }
.context-panel p { margin: 0; color: #94aaa1; font-size: 11px; }
.section > h2 { font-size: 24px; letter-spacing: -.04em; }
.timeline { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.6); }
.timeline-item { padding: 17px 16px; border-bottom: 1px solid var(--line); }
.timeline-dot { border-radius: 2px; }

/* Bounded Growth relationship controls: native density, progressive disclosure. */
.relationship-primary{display:grid;align-content:start;gap:16px}.relationship-primary .workbench{min-height:0}.relationship-primary .relationship-interaction{border-top-color:var(--signal)}
.priority-control{display:grid;grid-template-columns:auto auto minmax(220px,1fr) auto;align-items:center;gap:12px;margin:0 0 16px;padding:12px 16px;border:1px solid var(--line);border-radius:8px;background:#fff}.priority-control .eyebrow{margin:0}.priority-control strong{color:var(--green)}.priority-control input{min-width:0;padding:9px 10px;border:1px solid var(--line);border-radius:6px}.priority-control button{padding:9px 12px}.priority-control .command-result{grid-column:3/-1;margin:0;min-height:0}
.command-unit.fresh-enquiry{box-shadow:inset 3px 0 var(--green-bright),var(--shadow-xs)}.command-unit.manual-high{border-color:#d7b56a}.priority-flag{justify-self:start;padding:2px 6px;border-radius:10px;background:#fff0cc;color:#795000;font-size:7px;font-weight:900;letter-spacing:.8px}
.timeline-edit{max-width:620px}.timeline-edit form{display:grid;grid-template-columns:minmax(130px,.4fr) minmax(220px,1fr) auto;gap:8px;align-items:end;margin-top:9px;padding:10px;border:1px solid var(--line);border-radius:7px;background:#f7faf8}.timeline-edit label{display:grid;gap:4px;color:var(--muted);font-size:11px}.timeline-edit select,.timeline-edit textarea{width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:6px;background:#fff}.timeline-edit textarea{min-height:58px}.timeline-edit .command-result{grid-column:1/-1;margin:0}
.email-control{grid-column:1/-1;padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:#f7faf8}.email-control>summary{margin-bottom:8px}.email-control label{display:grid;gap:5px;max-width:620px;color:var(--muted);font-size:12px}.email-control .alternate-template{margin-top:9px}
@media(max-width:680px){.priority-control{grid-template-columns:1fr}.priority-control .command-result{grid-column:1}.timeline-edit form{grid-template-columns:1fr}.timeline-edit .command-result{grid-column:1}.command-signal{flex-wrap:wrap}}

/* Unified communications */
.comms-control { padding-right: 24px; }
.comms-totals { display: flex; align-self: stretch; }
.comms-totals span { min-width: 92px; display: grid; place-content: center; padding: 0 20px; color: #789c8e; border-left: 1px solid rgba(150,243,207,.1); font-size: 8px; text-transform: uppercase; }
.comms-totals b { color: white; font-size: 20px; line-height: 1.1; }
.comms-totals .risk b { color: #ffd17b; }
.communication-stream { display: grid; gap: 7px; }
.communication-unit { min-height: 92px; display: grid; grid-template-columns: 30px 44px minmax(160px,.85fr) minmax(240px,1.4fr) 105px 130px 18px; align-items: center; gap: 16px; padding: 12px 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.96); cursor: pointer; }
.communication-unit:hover { border-color: #94baa9; box-shadow: inset 3px 0 var(--green-bright), var(--shadow-sm); }
.communication-unit.attention { box-shadow: inset 3px 0 var(--amber); }
.communication-index { color: #91a39b; font-size: 8px; font-weight: 850; }
.channel-orb { width: 40px; height: 40px; border-radius: 5px; }
.channel-orb svg { width: 19px; height: 19px; }
.communication-party { min-width: 0; display: grid; }
.communication-party small { color: var(--green); font-size: 7px; font-weight: 900; letter-spacing: 1px; }
.communication-party strong, .communication-party span, .communication-subject { overflow: hidden; text-overflow: ellipsis; }
.communication-party strong { margin-top: 4px; font-size: 12px; white-space: nowrap; }
.communication-party span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.communication-subject { color: var(--ink); font-size: 12px; font-weight: 700; text-decoration-color: #a9beb5; }
.communication-unit time { color: var(--muted); font-size: 9px; }

/* Secondary and system surfaces use the same architectural grammar. */
main[data-page="performance"] .metrics,
main[data-page="admin"] .metrics { gap: 1px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--line-strong); }
main[data-page="performance"] .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
main[data-page="admin"] .metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
main[data-page="performance"] .metric,
main[data-page="admin"] .metric { min-width: 0; min-height: 132px; border: 0; border-radius: 0; box-shadow: none; }
main[data-page="performance"] .metric:nth-child(1),
main[data-page="admin"] .metric:nth-child(-n+4) { background: #f9fbfa; }
.metric > strong { max-width: 100%; overflow-wrap: normal; word-break: normal; font-size: clamp(22px, 2vw, 31px); line-height: 1.05; }
.health-banner { min-height: 58px; border-radius: 6px; background: #09281f; color: white; }
.health-banner span { color: #8fafA3; }
.performance-grid .card { box-shadow: none; border-top: 3px solid var(--green); }
.bar-row progress { border-radius: 0; }
.summary-strip { border-radius: 6px; box-shadow: none; background: #09281f; color: white; }
.summary-strip strong { color: var(--signal); }
main[data-page="integrity"] .table-wrap { box-shadow: none; }
main[data-page="integrity"] thead { color: #a8c1b7; background: #0b2a21; }
.template-workspace { border-radius: 7px; box-shadow: none; }
.template-navigation { background: #e8efec; }
.template-nav-item { border-radius: 4px; }
.template-nav-item.active { color: white; background: #0b2a21; box-shadow: inset 3px 0 var(--green-bright); }
.template-nav-item.active strong, .template-nav-item.active small { color: inherit; }
.template-editor-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
main[data-page="website"] > .grid { align-items: start; }
main[data-page="website"] > .grid > .card:first-child { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; background: #0b2a21; color: white; }
main[data-page="website"] > .grid > .card:first-child a { color: #b6ebd7; }
main[data-page="website"] > .grid > .card:first-child h2,
main[data-page="website"] > .grid > .card:first-child h3,
main[data-page="website"] > .grid > .card:first-child label { color: #f1faf6; }
main[data-page="website"] > .grid > .card:first-child .badge { color: #b7d3c8; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.body-copy { border-left: 3px solid var(--green-bright); border-radius: 4px; }

/* WhatsApp becomes a controlled communications instrument. */
.wa-product-head { min-height: 54px; }
.wa-product-head h1 { font-size: 34px; letter-spacing: -.05em; }
.wa-product-head h1::before { content: "COMMS / "; color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: 1.8px; vertical-align: middle; }
.wa-page { border-radius: 7px; box-shadow: 0 20px 50px rgba(3,25,17,.11); }
.wa-list { border-right-color: var(--line-strong); }
.wa-list-head { background: #0a2a20; }
.wa-list-head label, .wa-list-head span { color: #a8c2b7; }
.wa-search input { color: white; border-color: rgba(255,255,255,.13); background: rgba(255,255,255,.07); }
.wa-search input::placeholder { color: #77998b; }
.wa-filters { background: rgba(255,255,255,.06); }
.wa-filters a { color: #9eb9ae; }
.wa-filters a.active { color: #072119; background: var(--signal); }
.wa-conversation { min-height: 88px; }
.wa-conversation.selected { background: #e2f4ed; box-shadow: inset 4px 0 var(--green-bright); }
.wa-avatar { border-radius: 5px; }
.wa-chat-head { min-height: 72px; }
.wa-context { background: #e6edea; }
.wa-thread { background: linear-gradient(135deg, rgba(0,108,76,.035), transparent 45%), #edf2f0; }
.wa-bubble { border-radius: 6px; }
.wa-out { border-color: #aaddc9; background: #d8f2e7; }
.wa-composer { box-shadow: 0 -12px 30px rgba(3,25,17,.07); }
.wa-compose-row textarea { border-radius: 5px; }

@media (max-width: 1320px) {
  :root { --sidebar-width: 236px; }
  main { padding-left: 28px; padding-right: 28px; }
  .command-unit { grid-template-columns: 30px 65px minmax(135px,1fr) minmax(110px,.75fr) minmax(150px,1fr) 165px 18px; gap: 10px; padding: 0 12px; }
  .command-channel { font-size: 0; }
  .command-channel { min-height: 42px; }
  .communication-unit { grid-template-columns: 25px 40px minmax(140px,.8fr) minmax(200px,1.3fr) 95px 110px 16px; gap: 12px; }
  .movement-grid a { grid-template-columns: 30px 1fr auto 100px; }
}

@media (min-width: 641px) {
  .command-channel { font-size: 0; }
}

@media (max-width: 1050px) {
  .shell-command-title { display: none; }
  .control-grid { grid-template-columns: 1fr; }
  .mission-queue { grid-row: auto; }
  .movement-panel { grid-column: auto; }
  .movement-grid { grid-template-columns: 1fr; }
  .movement-grid a { border-right: 0; }
  .command-unit { height: 158px; grid-template-columns: 30px 68px minmax(140px,1fr) minmax(130px,.9fr) minmax(150px,1fr) 150px 18px; grid-template-areas: "index signal person reason plan acts open"; }
  .command-index { grid-area: index; }
  .command-signal { grid-area: signal; }
  .daily-person { grid-area: person; }
  .command-reason { grid-area: reason; }
  .command-plan { grid-area: plan; }
  .daily-comms { grid-area: acts; }
  .unit-open { grid-area: open; }
  .relationship-workspace { grid-template-columns: 1fr; }
  .relationship-secondary { grid-template-columns: 1fr 1fr; }
  .relationship-secondary .context-panel { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; --header-height: 68px; }
  header { padding: 0 16px; }
  #header-identity { display: none; }
  .brand-lockup img { width: 36px; height: 36px; }
  aside nav a { grid-template-columns: 26px 1fr; padding-left: 12px; }
  aside { justify-content: flex-start; }
  #identity { display: grid; }
  main { padding: 98px 20px 44px; }
  main[data-page="dashboard"] { padding-top: 82px; }
  .mission-control { grid-template-columns: 1fr 220px; }
  .mission-copy { padding: 38px; }
  .mission-readout { padding: 28px; }
  .control-strip { grid-template-columns: 1fr 1fr; }
  .control-strip .dashboard-metric { min-height: 105px; }
  .queue-control, .index-control { align-items: stretch; flex-direction: column; }
  .queue-control #filters { flex: 0 0 auto; }
  .queue-control .toolbar, .index-control .toolbar { width: 100%; }
  .queue-control .toolbar input, .index-control .toolbar input { min-width: 0; }
  .command-unit { height: 178px; grid-template-columns: 28px 68px 1.2fr 1fr 1fr 145px 18px; }
  .communication-unit { grid-template-columns: 24px 38px minmax(130px,.75fr) minmax(180px,1fr) 90px 100px 16px; }
  .lead-command-deck { grid-template-columns: .8fr 1.2fr; }
  .lead-context { border-top: 1px solid rgba(150,243,207,.11); }
  .lead-actions { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  header { padding: 0 13px; }
  .brand-lockup strong { font-size: 22px; }
  .brand-lockup img { width: 34px; height: 34px; }
  main { padding: 94px 13px 34px; }
  .page-head { min-height: 0; grid-template-columns: 1fr; gap: 15px; margin-bottom: 20px; padding: 0 0 17px; }
  .page-head h1 { font-size: 36px; }
  .page-rule { width: 80px; }
  .page-coordinate { margin-bottom: 7px; font-size: 7px; letter-spacing: 1.5px; }

  .login { display: flex; padding: 13px; }
  .auth-stage { display: none; }
  .login form { min-height: calc(100dvh - 26px); padding: 34px 26px; border-radius: 9px; }

  .mission-control { min-height: 390px; display: flex; flex-direction: column; }
  .mission-copy { padding: 30px 26px 24px; }
  .mission-copy::after { display: none; }
  .mission-copy h1 { font-size: 48px; }
  .mission-copy p { margin: 18px 0 24px; font-size: 13px; }
  .mission-action { width: 100%; justify-content: space-between; }
  .mission-readout { display: grid; grid-template-columns: 1fr 1fr; padding: 20px 26px 26px; border-top: 1px solid rgba(150,243,207,.12); }
  .mission-readout > strong { font-size: 58px; }
  .mission-readout > span:not(.readout-label) { align-self: end; padding-bottom: 8px; }
  .mission-split { grid-column: 1 / -1; margin-top: 15px; padding-top: 15px; }
  .control-strip { gap: 1px; }
  .control-strip .dashboard-metric { min-height: 112px; padding: 17px; }
  .control-strip .dashboard-metric > strong { font-size: 30px; }
  .control-strip .dashboard-metric > small { max-width: 130px; }
  .control-grid { gap: 10px; }
  .control-panel .section-head { min-height: 74px; padding: 17px; }
  .mission-item { min-height: 92px; grid-template-columns: 28px minmax(0,1fr) 12px; gap: 10px; padding: 12px 15px; }
  .mission-item .mission-next { grid-column: 2; }
  .mission-item time { grid-column: 2; }
  .mission-item > b { grid-column: 3; grid-row: 1 / span 3; }
  .upcoming-rail a { grid-template-columns: 1fr 12px; padding: 12px 17px; }
  .upcoming-rail time { grid-column: 1; }
  .movement-grid a { grid-template-columns: 30px 1fr auto; padding: 12px 15px; }
  .movement-grid time { grid-column: 2 / 4; }

  .queue-control, .index-control, .comms-control { padding: 18px; }
  .queue-control #filters { grid-template-columns: 50px minmax(0, 1fr); }
  .queue-control .toolbar input { grid-column: 1 / -1; }
  .queue-control .calendar-picker { grid-column: 1; }
  .queue-control .toolbar button { grid-column: 2; width: 100%; min-width: 0; white-space: nowrap; }
  .command-queue { gap: 8px; }
  .command-unit {
    height: 362px;
    grid-template-columns: 28px minmax(0,1fr) auto;
    grid-template-rows: 38px 68px 58px 78px 60px;
    grid-template-areas:
      "index signal open"
      "person person person"
      "reason reason reason"
      "plan plan plan"
      "acts acts acts";
    gap: 7px 12px;
    padding: 15px 16px;
  }
  .command-index { display: flex; justify-content: flex-start; }
  .command-index i { width: 20px; height: 1px; margin-left: 7px; }
  .command-signal { display: flex; align-items: center; gap: 7px; }
  .daily-person .identity-link { font-size: 17px; }
  .command-reason, .command-plan, .command-next, .command-due { overflow: hidden; }
  .command-plan { display: grid; grid-template-columns: minmax(0,1fr) minmax(125px,.75fr); align-items: start; gap: 18px; }
  .daily-comms { grid-template-columns: repeat(4,1fr); }
  .daily-comms > .unit-label { display: none; }
  .command-channel { min-height: 54px; }
  .command-channel { font-size: 7px; }

  .index-control .split-actions { width: 100%; }
  .index-control .toolbar { grid-template-columns: 1fr auto; }
  .leads-table tr { height: 258px !important; display: grid !important; grid-template-columns: 1fr 1fr; gap: 0 14px; padding: 15px !important; }
  .leads-table td { display: block !important; padding: 7px 0 !important; border: 0 !important; }
  .leads-table td::before { display: block; margin-bottom: 3px; }
  .leads-table td:nth-child(1), .leads-table td:nth-child(2), .leads-table td:nth-child(3), .leads-table td:nth-child(5) { grid-column: 1 / -1; }
  .leads-table td:nth-child(3) { display: none !important; }
  .leads-table td:nth-child(7), .leads-table td:nth-child(8) { display: none !important; }
  .leads-table .identity-link { font-size: 16px; }

  .lead-command-deck { display: flex; flex-direction: column; }
  .lead-command-deck > div { padding: 22px; border-right: 0; border-bottom: 1px solid rgba(150,243,207,.11); }
  .lead-command-deck .next-action h2 { font-size: 31px; }
  .lead-actions { align-items: stretch; flex-direction: column; }
  .lead-actions > div { display: grid; grid-template-columns: repeat(3,1fr); }
  .lead-channel { min-width: 0; }
  .lead-actions > small { width: 100%; margin: 0; }
  .relationship-primary #outcome-form { grid-template-columns: 1fr; }
  .relationship-primary #outcome-form > * { grid-column: 1 !important; }
  .relationship-secondary { grid-template-columns: 1fr; }
  .relationship-secondary .context-panel { grid-column: auto; }

  .comms-control { flex-direction: column; align-items: stretch; }
  .comms-totals { min-height: 64px; border-top: 1px solid rgba(150,243,207,.1); }
  .comms-totals span { min-width: 0; flex: 1; padding: 12px; border-left: 0; border-right: 1px solid rgba(150,243,207,.1); }
  .communication-unit { min-height: 150px; grid-template-columns: 26px 38px 1fr 18px; grid-template-rows: 42px 1fr 28px; grid-template-areas: "index channel party open" ". subject subject subject" ". state when when"; gap: 7px 10px; padding: 13px; }
  .communication-index { grid-area: index; }
  .channel-orb { grid-area: channel; width: 36px; height: 36px; }
  .communication-party { grid-area: party; }
  .communication-subject { grid-area: subject; }
  .communication-state { grid-area: state; }
  .communication-unit time { grid-area: when; text-align: right; }
  .communication-unit .unit-open { grid-area: open; }

  main[data-page="performance"] .metrics,
  main[data-page="admin"] .metrics { grid-template-columns: 1fr 1fr; }
  main[data-page="performance"] .metric,
  main[data-page="admin"] .metric { min-height: 116px; }
  main[data-page="website"] > .grid > .card:first-child { position: static; max-height: 480px; }
  .wa-product-head h1::before { display: block; margin-bottom: 3px; }
}

/*
 * Responsive closure guard.
 *
 * The accepted desktop layer intentionally re-declares the application rail
 * late in this stylesheet. At phone widths that late width declaration used
 * the zero-width desktop variable and overrode the earlier drawer geometry,
 * leaving its padded contents visible over the workspace while closed. Keep
 * the desktop declaration intact and make the mobile drawer authoritative at
 * the end of the cascade.
 */
@media (max-width: 900px) {
  aside {
    width: min(326px, 86vw);
    max-width: 86vw;
    padding: 20px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(calc(-100% - 8px));
  }

  body.navigation-open aside {
    transform: translateX(0);
  }

  #primary-navigation {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .timeline-item > div:last-child {
    min-width: 0;
  }

  .timeline-item small.muted {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Leads Stage labels are complete operational states, not truncatable metadata. */
@media (min-width: 641px) {
  .leads-table table { min-width: 1080px; }
  .leads-table th:nth-child(4) { width: 228px; }
}

.leads-table td:nth-child(4) .badge {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

@media (max-width: 640px) {
  .leads-table tr { height: 282px !important; }
  .leads-table td:nth-child(4) { grid-column: 1 / -1; }
}

/* Bound the desktop rail to the visible viewport and let its nav scroll. */
@media (min-width: 901px) {
  aside {
    left: 0;
    bottom: auto;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    min-height: 0;
    overflow: hidden;
  }

  #primary-navigation {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  #identity {
    flex: 0 0 auto;
  }
}


