:root {
  --paper: #f3f0e8;
  --paper-deep: #e8e4da;
  --ink: #17201d;
  --muted: #65716b;
  --line: #cbc9bd;
  --rail: #14211e;
  --rail-soft: #20322d;
  --teal: #167c69;
  --teal-dark: #0d5f51;
  --teal-soft: #dcebe5;
  --coral: #c75b4b;
  --coral-soft: #f3ded8;
  --white: #fffefa;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --sans: "Segoe UI Variable", Aptos, "Segoe UI", sans-serif;
  --rail-width: 238px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid #e59a43; outline-offset: 3px; }
::selection { background: var(--teal); color: white; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.mono, code, time { font-family: var(--mono); }
.eyebrow { margin: 0 0 6px; color: var(--teal-dark); font: 700 11px/1.2 var(--mono); letter-spacing: .12em; }
.muted { color: var(--muted); }

/* Login */
.login-body { min-height: 100vh; background: var(--rail); color: var(--white); }
.login-body::before { content: ""; position: fixed; inset: 0; opacity: .18; pointer-events: none; background-image: repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,.08) 80px), repeating-linear-gradient(0deg, transparent 0 79px, rgba(255,255,255,.06) 80px); }
.login-shell { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(420px, .7fr); }
.login-brand { padding: clamp(34px, 7vw, 94px); display: flex; flex-direction: column; justify-content: center; border-right: 1px solid rgba(255,255,255,.16); }
.brand-lockup { display: flex; align-items: center; gap: 9px; font: 800 13px/1 var(--mono); letter-spacing: .14em; }
.brand-lockup i { color: #63bca9; font-style: normal; }
.brand-lockup strong { font-weight: 400; color: #afbbb6; }
.signal-illustration { display: flex; align-items: center; width: min(560px, 100%); margin: 18vh 0 38px; }
.signal-dot { width: 12px; height: 12px; background: #56c9ae; border-radius: 50%; box-shadow: 0 0 0 7px rgba(86,201,174,.14); animation: pulse 2.4s ease-out infinite; }
.signal-track { height: 1px; flex: 1; background: rgba(255,255,255,.28); position: relative; }
.signal-track::after { content: ""; position: absolute; left: 38%; top: -9px; width: 38px; height: 18px; border-left: 1px solid #56c9ae; border-top: 1px solid #56c9ae; border-right: 1px solid #56c9ae; transform: skewX(-35deg); }
.signal-tick { width: 5px; height: 5px; background: #56c9ae; }
.login-brand .eyebrow { color: #7ec6b5; }
.login-brand h1 { max-width: 680px; margin: 0; font-size: clamp(48px, 6vw, 86px); line-height: .98; letter-spacing: -.055em; font-weight: 650; }
.login-intro { max-width: 520px; margin: 28px 0 0; color: #bac7c2; font-size: 18px; }
.environment-cue { margin-top: 70px; color: #a8b4af; font: 600 12px var(--mono); letter-spacing: .04em; }
.environment-cue span { display: inline-block; width: 7px; height: 7px; margin-right: 8px; background: #56c9ae; border-radius: 50%; }
.login-panel { background: var(--paper); color: var(--ink); padding: clamp(34px, 6vw, 84px); display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.035em; }
.login-panel > div > p:last-child { margin: 0; color: var(--muted); }
.stack-form { margin-top: 42px; display: grid; gap: 10px; }
.stack-form > label { font-weight: 700; font-size: 13px; }
.password-field { display: flex; align-items: center; border-bottom: 2px solid var(--ink); }
.password-field input { width: 100%; border: 0; padding: 15px 0; background: transparent; font-size: 18px; outline: 0; }
.text-button { border: 0; background: transparent; color: var(--teal-dark); cursor: pointer; font-weight: 700; padding: 10px; }
.login-button { margin-top: 22px; width: 100%; justify-content: space-between; }
.login-footnote { margin-top: 28px; color: var(--muted); font-size: 12px; }

/* Compact operator access card */
body.login-body .login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 34px; }
.login-card { position: relative; width: min(920px, 100%); background: var(--paper); color: var(--ink); border: 1px solid rgba(255,255,255,.24); box-shadow: 16px 18px 0 rgba(0,0,0,.18); }
.login-card-header { min-height: 64px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.login-card-header .environment-cue { margin: 0; color: var(--muted); font-size: 10px; }
.login-card-header .brand-lockup strong, .login-card-header .brand-lockup span:last-child { color: var(--muted); }
.compact-signal { height: 28px; display: flex; align-items: center; padding: 0 26px; background: #e7e4da; border-bottom: 1px solid var(--line); }
.compact-signal .signal-dot { flex: 0 0 auto; width: 7px; height: 7px; }
.compact-signal i { flex: 1; height: 1px; margin-left: 10px; background: #96a099; }
.compact-signal b { width: 30px; height: 11px; margin-right: 28%; border-left: 1px solid var(--teal); border-top: 1px solid var(--teal); border-right: 1px solid var(--teal); transform: skewX(-35deg); }
.login-card-body { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(380px, 1.15fr); }
.login-context { padding: 42px 38px; background: var(--rail-soft); color: white; border-right: 1px solid var(--line); }
.login-context .eyebrow { color: #70c3af; }
.login-context h1 { margin: 8px 0 20px; font-size: clamp(36px, 4vw, 48px); line-height: 1.02; letter-spacing: -.045em; font-weight: 630; }
.login-context > p:last-child { max-width: 310px; margin: 0; color: #b9c7c1; }
body.login-body .login-panel { min-height: 0; padding: 42px 40px; display: block; background: var(--paper); }
body.login-body .login-panel h2 { font-size: 27px; }
body.login-body .stack-form { margin-top: 30px; }
body.login-body .login-footnote { margin: 19px 0 0; }

/* Shared controls */
.primary-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 18px; border: 1px solid transparent; text-decoration: none; padding: 10px 18px; font-weight: 750; cursor: pointer; transition: transform .18s ease, background .18s ease, color .18s ease; }
.primary-button { background: var(--teal); color: #fff; }
.primary-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.secondary-button { background: transparent; border-color: var(--line); }
.secondary-button:hover { border-color: var(--ink); background: var(--white); }
.text-link { color: var(--muted); font-weight: 700; }
.notice { margin: 18px 0; padding: 13px 16px; border-left: 4px solid var(--teal); background: var(--teal-soft); }
.notice-error { border-color: var(--coral); background: var(--coral-soft); }
.toast-region { position: fixed; right: 24px; top: 86px; z-index: 30; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 14px 16px; margin-bottom: 8px; border: 1px solid #98b9ae; background: #f8fff9; box-shadow: 0 14px 35px rgba(23,32,29,.16); animation: toast-in .25s ease-out; }
.toast.is-error { border-color: #d98c7e; background: #fff5f2; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--rail-width) 1fr; }
.utility-rail { position: fixed; inset: 0 auto 0 0; width: var(--rail-width); background: var(--rail); color: #eaf0ed; display: flex; flex-direction: column; z-index: 20; }
.rail-brand { height: 78px; display: flex; align-items: center; gap: 7px; padding: 0 28px; border-bottom: 1px solid rgba(255,255,255,.1); text-decoration: none; font: 800 12px var(--mono); letter-spacing: .12em; }
.rail-brand i { color: #60bba6; font-style: normal; }
.rail-brand strong { color: #9baba5; font-weight: 500; }
.rail-nav { padding: 24px 13px; display: grid; gap: 3px; }
.rail-link { min-height: 51px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 0 14px; color: #aebbb6; text-decoration: none; border-left: 2px solid transparent; transition: background .18s, color .18s; }
.rail-link small { font: 600 10px var(--mono); opacity: .58; }
.rail-link span { font-weight: 650; }
.rail-link b { min-width: 22px; padding: 2px 5px; text-align: center; background: var(--coral); color: white; font: 700 10px var(--mono); }
.rail-link:hover { color: white; background: rgba(255,255,255,.05); }
.rail-link.is-active { color: white; background: var(--rail-soft); border-left-color: #55bea6; }
.rail-link.is-active small { color: #67c7b0; opacity: 1; }
.rail-bottom { margin-top: auto; padding: 20px 26px 24px; border-top: 1px solid rgba(255,255,255,.1); }
.rail-environment { display: grid; grid-template-columns: 10px 1fr; align-items: center; margin-bottom: 20px; }
.rail-environment > span { width: 7px; height: 7px; background: #56c9ae; border-radius: 50%; grid-row: span 2; }
.rail-environment small { color: #70817a; font: 700 9px var(--mono); letter-spacing: .1em; }
.rail-environment strong { font: 600 12px var(--mono); }
.rail-logout { width: 100%; display: flex; justify-content: space-between; border: 0; border-top: 1px solid rgba(255,255,255,.12); padding: 14px 0 0; color: #aab7b2; background: transparent; cursor: pointer; font-weight: 650; }
.rail-logout:hover { color: white; }
.workspace { grid-column: 2; min-width: 0; }
.signal-line { position: sticky; top: 0; z-index: 15; height: 78px; display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; align-items: center; gap: 28px; padding: 0 34px; background: rgba(243,240,232,.96); border-bottom: 1px solid var(--line); }
.signal-identity { display: flex; align-items: center; gap: 13px; }
.live-dot { width: 9px; height: 9px; background: var(--teal); border-radius: 50%; box-shadow: 0 0 0 6px rgba(22,124,105,.12); animation: pulse 2.4s ease-out infinite; }
.live-dot.is-offline { background: var(--coral); box-shadow: 0 0 0 6px rgba(199,91,75,.12); animation: none; }
.signal-identity div, .signal-meta div { display: grid; }
.signal-line small { color: var(--muted); font: 650 9px var(--mono); letter-spacing: .11em; }
.signal-identity strong, .signal-meta strong { font: 700 12px var(--mono); }
.signal-trace { display: flex; align-items: center; opacity: .55; }
.signal-trace span { height: 1px; flex: 1; background: #8f9994; }
.signal-trace i { width: 35px; height: 13px; border-left: 1px solid var(--teal); border-top: 1px solid var(--teal); border-right: 1px solid var(--teal); transform: skewX(-35deg); }
.signal-meta { display: flex; align-items: center; gap: 26px; }
.signal-meta .healthy { color: var(--teal-dark); }
.signal-meta .warning { color: var(--coral); }
.unread-signal { display: grid; min-width: 65px; padding-left: 18px; border-left: 1px solid var(--line); text-decoration: none; }
.unread-signal strong { font-size: 18px; color: var(--coral); }
.content-canvas { max-width: 1540px; margin: 0 auto; padding: 42px clamp(24px, 4vw, 62px) 80px; }
.content-canvas::before { content: ""; position: fixed; inset: 78px 0 0 var(--rail-width); z-index: -1; pointer-events: none; opacity: .28; background-image: repeating-linear-gradient(90deg, transparent 0 119px, rgba(23,32,29,.08) 120px); }
.page-heading { min-height: 112px; display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.page-heading h1 { margin: 0; font-size: clamp(36px, 4vw, 56px); font-weight: 640; letter-spacing: -.052em; line-height: 1; }
.page-heading > div > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.refresh-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 600 11px var(--mono); }
.refresh-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }

/* Dashboard */
.metric-band { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--white); }
.metric-band article { min-height: 150px; padding: 23px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.metric-band article:last-child { border-right: 0; }
.metric-band small { color: var(--muted); font: 700 10px var(--mono); letter-spacing: .09em; }
.metric-band strong { margin-top: 16px; font: 600 46px/1 var(--mono); letter-spacing: -.06em; }
.metric-band span, .metric-band a { margin-top: auto; color: var(--muted); font-size: 12px; }
.metric-band a { color: var(--teal-dark); font-weight: 700; }
.metric-band .metric-accent { background: var(--teal); color: white; }
.metric-band .metric-accent small, .metric-band .metric-accent a { color: #d8f1e9; }
.dashboard-grid { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 24px; }
.operations-panel, .activity-panel { background: var(--white); border: 1px solid var(--line); }
.operations-panel > header, .activity-panel > header, .schedule-list > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 23px 25px; border-bottom: 1px solid var(--line); }
.operations-panel h2, .activity-panel h2, .schedule-list h2, .composer-panel h2, .schedule-builder h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.activity-panel header a { color: var(--teal-dark); font-weight: 700; font-size: 12px; }
.status-chip { align-self: center; padding: 5px 8px; border: 1px solid var(--line); color: var(--muted); font: 700 9px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.status-chip.is-good { border-color: #82b4a7; color: var(--teal-dark); background: var(--teal-soft); }
.status-chip.is-warn { border-color: #d8a096; color: #8c3d31; background: var(--coral-soft); }
.trace-board { position: relative; height: 152px; margin: 0 25px; border-bottom: 1px solid var(--line); overflow: hidden; }
.trace-board::before, .trace-board::after { content: ""; position: absolute; inset: 33% 0 auto; border-top: 1px dashed #d4d6ce; }
.trace-board::after { inset: 66% 0 auto; }
.trace-axis { position: absolute; inset: 50% 0 auto; border-top: 1px solid #82908a; }
.trace-pulse { position: absolute; top: calc(50% - 31px); height: 31px; border-left: 2px solid var(--teal); border-top: 2px solid var(--teal); border-right: 2px solid var(--teal); transform: skewX(-28deg); }
.trace-pulse.p1 { left: 9%; width: 68px; }
.trace-pulse.p2 { left: 42%; width: 110px; height: 45px; top: calc(50% - 45px); }
.trace-pulse.p3 { right: 8%; width: 45px; }
.system-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; }
.system-facts div { padding: 17px 25px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.system-facts div:nth-child(even) { border-right: 0; }
.system-facts div:nth-last-child(-n+2) { border-bottom: 0; }
.system-facts dt { color: var(--muted); font-size: 11px; }
.system-facts dd { margin: 3px 0 0; font: 650 12px var(--mono); }
.activity-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 13px; padding: 16px 23px; border-bottom: 1px solid var(--line); text-decoration: none; }
.activity-row:hover { background: #f6f8f4; }
.avatar-mark { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: var(--teal-soft); color: var(--teal-dark); font: 750 12px var(--mono); border: 1px solid #b8d1c8; }
.activity-row > span:nth-child(2) { min-width: 0; display: grid; }
.activity-row small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row time { color: var(--muted); font-size: 10px; }

/* Composer */
.composer-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 25px; align-items: start; }
.composer-panel, .preview-panel, .schedule-builder, .schedule-list, .data-panel { background: var(--white); border: 1px solid var(--line); }
.composer-panel { padding: 28px; }
.composer-panel > header { display: flex; justify-content: space-between; margin-bottom: 25px; }
.step-index { color: var(--muted); font: 700 11px var(--mono); }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); margin-bottom: 24px; }
.segmented-control label { position: relative; cursor: pointer; }
.segmented-control label + label { border-left: 1px solid var(--line); }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control label > span { min-height: 67px; display: grid; align-content: center; padding: 10px 15px; border-top: 3px solid transparent; font-weight: 750; }
.segmented-control label small { color: var(--muted); font-weight: 400; }
.segmented-control input:checked + span { background: var(--teal-soft); border-top-color: var(--teal); color: var(--teal-dark); }
.field-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 700; font-size: 13px; }
.field-label span { color: var(--muted); font: 500 10px var(--mono); }
textarea, input[type="text"], input[type="password"], input[type="search"], input[type="time"], select { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.composer-panel textarea { width: 100%; resize: vertical; padding: 15px; line-height: 1.6; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 16px; }
.field-grid label, .schedule-builder > label { display: grid; gap: 7px; }
.field-grid label > span, .schedule-builder label > span, .schedule-builder legend { font-weight: 700; font-size: 12px; }
.field-grid select, .schedule-builder select, .schedule-builder input[type="time"] { width: 100%; height: 44px; padding: 0 12px; }
.upload-zone { position: relative; min-height: 110px; margin-top: 18px; border: 1px dashed #96a39d; display: grid; grid-template-columns: 40px 1fr; align-content: center; padding: 18px 22px; cursor: pointer; }
.upload-zone:hover { background: var(--teal-soft); border-color: var(--teal); }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-zone .upload-mark { grid-row: span 2; align-self: center; font-size: 28px; color: var(--teal); }
.upload-zone strong { font-size: 13px; }
.upload-zone small { color: var(--muted); }
.remove-media { display: flex; gap: 8px; margin-top: 12px; color: var(--coral); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 24px; margin-top: 24px; }
.preview-panel { position: sticky; top: 102px; padding: 23px; background: var(--paper-deep); }
.preview-panel > header { display: flex; justify-content: space-between; }
.preview-panel > header span { color: var(--muted); font: 700 10px var(--mono); }
.phone-preview { margin: 24px auto; max-width: 370px; min-height: 430px; background: #e9efe8; border: 9px solid var(--rail); box-shadow: 9px 9px 0 rgba(23,32,29,.13); }
.phone-top { height: 66px; display: flex; align-items: center; gap: 11px; padding: 0 17px; background: white; border-bottom: 1px solid #d8ddd8; }
.phone-top div { display: grid; }
.phone-top small { color: var(--muted); }
.message-preview { max-width: 82%; margin: 38px 15px 15px auto; padding: 8px; background: #d8f0e7; border: 1px solid #bbdacf; }
.preview-media { min-height: 150px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #c7d8d2; }
.preview-media.is-empty { display: none; }
.preview-media img, .preview-media video { width: 100%; height: 180px; object-fit: cover; }
.message-preview p { margin: 10px 5px 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-preview time { display: block; color: #59756c; text-align: right; font-size: 9px; }
.preview-note { color: var(--muted); font-size: 11px; }

/* Data tables */
.data-panel { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; contain: inline-size; }
.data-toolbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.filter-input { min-width: 280px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid #8b958f; }
.filter-input input { width: 100%; border: 0; background: transparent; outline: 0; padding: 9px 2px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; }
.legend-link { background: var(--teal); }
.legend-daily { background: #b78636; }
.table-scroll-hint { display: none; color: var(--teal-dark); font: 700 10px var(--mono); letter-spacing: .02em; }
.table-wrap { position: relative; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 12px 18px; color: var(--muted); background: #eeece4; border-bottom: 1px solid var(--line); font: 700 9px var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.data-table td { padding: 17px 18px; border-bottom: 1px solid #ddd9cf; vertical-align: middle; }
.data-table tbody tr:hover { background: #f7f8f3; }
.data-table td:first-child { min-width: 185px; }
.data-table td:nth-child(2) { min-width: 260px; }
.data-table td > strong, .data-table td > small { display: block; }
.data-table td > small { margin-top: 3px; color: var(--muted); }
.data-table code { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.template-kind { display: inline-block; padding: 3px 6px; color: var(--teal-dark); background: var(--teal-soft); font: 750 8px var(--mono); letter-spacing: .08em; }
.template-kind.kind-daily { color: #765415; background: #f1e6cc; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.icon-button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: transparent; text-decoration: none; cursor: pointer; }
.icon-button:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); }
.icon-button.danger:hover { border-color: var(--coral); color: var(--coral); background: var(--coral-soft); }
.user-cell { display: flex; align-items: center; gap: 11px; }
.user-cell > span:last-child { display: grid; }
.user-cell small { color: var(--muted); }

/* Schedules */
.schedule-layout { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr); gap: 24px; align-items: start; }
.schedule-builder { padding: 25px; display: grid; gap: 19px; }
.schedule-builder header p:last-child { margin: 5px 0 0; color: var(--muted); }
.schedule-builder fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.schedule-builder legend { width: 100%; margin-bottom: 8px; }
.schedule-builder legend small { float: right; color: var(--muted); font-weight: 400; }
.recipient-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); }
.recipient-list label { display: grid; grid-template-columns: 20px 34px 1fr; align-items: center; gap: 9px; padding: 10px; border-bottom: 1px solid #e2dfd6; cursor: pointer; }
.recipient-list label:hover { background: var(--teal-soft); }
.recipient-list label > span:last-child { display: grid; min-width: 0; }
.recipient-list small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.schedule-list > header > strong { color: var(--teal); font: 500 42px/1 var(--mono); }
.schedule-row { display: grid; grid-template-columns: 70px 1fr auto auto; align-items: center; gap: 18px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.schedule-row > time { font: 600 24px var(--mono); }
.schedule-row > div:nth-child(2) { display: grid; min-width: 0; }
.schedule-row > div:nth-child(2) strong { font: 650 11px var(--mono); overflow: hidden; text-overflow: ellipsis; }
.schedule-row > div:nth-child(2) span { color: var(--muted); font-size: 11px; }
.schedule-row.is-disabled { opacity: .58; }

/* Inbox */
.inbox-shell { height: calc(100vh - 78px - 42px - 112px - 30px - 80px); min-height: 590px; display: grid; grid-template-columns: minmax(280px, 35%) minmax(0, 65%); background: var(--white); border: 1px solid var(--line); }
.conversation-pane { min-width: 0; border-right: 1px solid var(--line); overflow: hidden; }
.conversation-pane > header { height: 63px; display: flex; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.conversation-pane .filter-input { min-width: 0; width: 100%; }
.conversation-list { height: calc(100% - 63px); overflow-y: auto; }
.conversation-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; padding: 14px 15px; border-bottom: 1px solid #e1ddd3; text-decoration: none; }
.conversation-row:hover, .conversation-row.is-active { background: var(--teal-soft); }
.conversation-copy { min-width: 0; display: grid; }
.conversation-copy > span { display: flex; justify-content: space-between; gap: 8px; }
.conversation-copy time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.conversation-copy > small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row > b { min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; background: var(--coral); color: white; font: 700 9px var(--mono); }
.thread-pane { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; background: #e9ece4; }
.thread-header { min-height: 64px; display: flex; align-items: center; gap: 11px; padding: 10px 18px; background: var(--white); border-bottom: 1px solid var(--line); }
.thread-header > div { display: grid; }
.thread-header small { color: var(--muted); font-size: 10px; }
.thread-header .status-chip { margin-left: auto; }
.mobile-back { display: none; text-decoration: none; }
.message-thread { overflow-y: auto; padding: 24px; }
.bubble-row { display: flex; margin: 8px 0; }
.bubble-row.is-out { justify-content: flex-end; }
.message-bubble { max-width: min(76%, 620px); padding: 10px 12px 7px; background: white; border: 1px solid #d4d8d1; }
.is-out .message-bubble { background: #d9efe7; border-color: #bad8cd; }
.message-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-bubble time { display: block; margin-top: 5px; color: var(--muted); text-align: right; font-size: 10px; }
.message-media { display: block; margin: -5px -7px 8px; }
.message-media img, .message-media video { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.reply-composer { min-width: 0; min-height: 68px; display: grid; grid-template-columns: 42px 74px minmax(0, 1fr) 44px; align-items: end; gap: 8px; padding: 10px 13px; background: var(--white); border-top: 1px solid var(--line); }
.reply-composer textarea { width: 100%; min-height: 43px; max-height: 110px; padding: 10px; resize: vertical; }
.reply-attach { position: relative; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); cursor: pointer; font-size: 22px; }
.reply-attach input { position: absolute; opacity: 0; width: 1px; }
.reply-media-type { height: 42px; padding: 0 6px; }
.send-button { width: 43px; height: 43px; border: 0; background: var(--teal); color: white; cursor: pointer; font-size: 22px; }
.send-button:hover { background: var(--teal-dark); }
.thread-empty { align-self: center; justify-self: center; max-width: 420px; padding: 35px; text-align: center; }
.thread-empty h2 { margin: 4px 0 9px; font-size: 28px; letter-spacing: -.04em; }
.thread-empty > p:last-child { color: var(--muted); }
.thread-signal { display: flex; align-items: center; margin: 0 auto 32px; max-width: 220px; }
.thread-signal span { flex: 1; height: 1px; background: #96a39d; }
.thread-signal i { width: 18px; height: 18px; border: 2px solid var(--teal); border-radius: 50%; box-shadow: 0 0 0 7px rgba(22,124,105,.1); }

.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state > span { color: var(--teal); font: 500 22px var(--mono); }
.empty-state h3 { margin: 9px 0 4px; color: var(--ink); }
.empty-state p { margin: 0 auto 12px; max-width: 360px; }
.empty-state a { color: var(--teal-dark); font-weight: 700; }
.empty-state.compact { padding: 35px 15px; }
.error-shell { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 25px; }
.error-code { margin: 50px 0 0; color: #61bca8; font: 500 86px/1 var(--mono); }
.error-shell h1 { margin: 10px 0 30px; }
.mobile-nav { display: none; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(86,201,174,.34); } 70% { box-shadow: 0 0 0 9px rgba(86,201,174,0); } 100% { box-shadow: 0 0 0 0 rgba(86,201,174,0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1100px) {
  :root { --rail-width: 205px; }
  .metric-band { grid-template-columns: 1fr 1fr; }
  .metric-band article:nth-child(2) { border-right: 0; }
  .metric-band article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid, .composer-layout, .schedule-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .phone-preview { min-height: 360px; }
  .signal-meta > div:first-child { display: none; }
  .inbox-shell { grid-template-columns: 340px minmax(0, 1fr); }
}

@media (max-width: 950px) {
  .inbox-shell { display: block; }
  .conversation-pane, .thread-pane { width: 100%; height: 100%; border-right: 0; }
  .inbox-shell:not(.has-thread) .thread-pane { display: none; }
  .inbox-shell.has-thread .conversation-pane { display: none; }
  .inbox-shell.has-thread .thread-pane { display: grid; }
  .mobile-back { display: inline-flex; align-items: center; justify-content: center; padding: 7px; font-size: 19px; }
  .reply-composer textarea { min-width: 0; }
}

@media (max-width: 760px) {
  :root { --rail-width: 0px; }
  body { font-size: 14px; }
  body.login-body .login-shell { padding: 18px; }
  .login-card { box-shadow: 8px 9px 0 rgba(0,0,0,.18); }
  .login-card-header { min-height: 55px; padding: 0 18px; }
  .login-card-header .environment-cue { display: flex; font-size: 8px; }
  .compact-signal { padding: 0 18px; }
  .login-card-body { grid-template-columns: 1fr; }
  .login-context { padding: 27px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-context h1 { margin: 5px 0 12px; font-size: 33px; }
  .login-context > p:last-child { font-size: 13px; }
  body.login-body .login-panel { padding: 27px 24px 30px; }
  body.login-body .login-panel h2 { font-size: 24px; }
  body.login-body .stack-form { margin-top: 22px; }
  .app-shell { display: block; width: 100%; min-width: 0; }
  .utility-rail { display: none; }
  .workspace { width: 100%; min-width: 0; grid-column: auto; padding-bottom: 65px; }
  .signal-line { height: 65px; padding: 0 16px; gap: 10px; grid-template-columns: auto 1fr auto; }
  .signal-trace { display: none; }
  .signal-identity small { display: none; }
  .signal-meta { gap: 12px; }
  .signal-meta > div:first-child { display: none; }
  .signal-meta > div:nth-child(2) small { display: none; }
  .unread-signal { min-width: 45px; padding-left: 10px; }
  .content-canvas { padding: 28px 15px 35px; }
  .content-canvas::before { display: none; }
  .page-heading { min-height: 100px; align-items: flex-start; margin-bottom: 20px; }
  .page-heading h1 { font-size: 38px; }
  .page-heading > div > p:last-child { font-size: 13px; }
  .page-heading .primary-button, .page-heading .secondary-button { min-width: 44px; max-width: 100px; font-size: 11px; padding: 8px; }
  .metric-band article { min-height: 124px; padding: 16px; }
  .metric-band strong { font-size: 38px; }
  .dashboard-grid { gap: 15px; }
  .system-facts { grid-template-columns: 1fr; }
  .system-facts div, .system-facts div:nth-child(even) { border-right: 0; border-bottom: 1px solid var(--line); }
  .system-facts div:last-child { border-bottom: 0; }
  .composer-panel { padding: 18px; }
  .segmented-control { grid-template-columns: 1fr; }
  .segmented-control label + label { border-left: 0; border-top: 1px solid var(--line); }
  .field-grid { grid-template-columns: 1fr; }
  .preview-panel { display: none; }
  .data-toolbar { align-items: stretch; flex-direction: column; }
  .filter-input { min-width: 0; width: 100%; }
  .legend { justify-content: flex-end; }
  .table-scroll-hint { display: block; margin-top: -4px; padding-top: 7px; border-top: 1px solid var(--line); text-align: right; }
  .data-table { min-width: 680px; }
  .user-table { min-width: 760px; }
  .schedule-row { grid-template-columns: 62px 1fr auto; gap: 10px; padding: 14px; }
  .schedule-row .status-chip { display: none; }
  .schedule-row .row-actions { grid-column: 3; grid-row: 1; }
  .schedule-row > time { font-size: 20px; }
  .inbox-shell { height: calc(100vh - 65px - 28px - 100px - 20px - 80px); min-height: 480px; display: block; }
  .conversation-pane, .thread-pane { height: 100%; border: 0; }
  .inbox-shell:not(.has-thread) .thread-pane { display: none; }
  .inbox-shell.has-thread .conversation-pane { display: none; }
  .thread-pane { display: grid; }
  .mobile-back { display: inline-block; padding: 8px; font-size: 20px; }
  .message-thread { padding: 14px 10px; }
  .message-bubble { max-width: 88%; }
  .reply-composer { grid-template-columns: 40px 1fr 43px; }
  .reply-media-type { display: none; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 25; height: 65px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: visible; background: var(--rail); color: #9fb0a9; border-top: 1px solid #354741; }
  .mobile-nav a { position: relative; min-width: 0; display: grid; place-content: center; text-align: center; text-decoration: none; border-top: 2px solid transparent; }
  .mobile-nav a small { font: 700 8px var(--mono); }
  .mobile-nav a span { font-size: 9px; white-space: nowrap; }
  .mobile-nav a b { position: absolute; top: 5px; right: max(4px, 12%); min-width: 16px; height: 16px; display: grid; place-content: center; padding: 0 3px; background: var(--coral); color: white; font: 700 8px var(--mono); }
  .mobile-nav a.is-active { color: white; background: var(--rail-soft); border-top-color: #55bea6; }
  .toast-region { right: 10px; top: 72px; }
}

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