:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #17231f;
  --muted: #62706a;
  --line: #dce5e0;
  --paper: #ffffff;
  --wash: #f3f7f4;
  --green: #0b6b4f;
  --green-dark: #07503b;
  --amber: #a85c00;
  --red: #a13232;
  --shadow: 0 12px 30px rgba(24, 47, 38, .09);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--wash); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-button { padding: 7px 10px; color: white; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: transparent; font-weight: 700; }
.topbar-button:hover { background: rgba(255,255,255,.1); }
.hidden { display: none !important; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 12px 24px; color: white; background: #143c30; }
.topbar h1, .topbar p { margin: 0; }
.topbar h1 { font-size: 24px; letter-spacing: -.02em; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .72; }
.status { padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.13); font-size: 13px; }
.status.ok { background: #d9f4e7; color: #145a43; }
.status.bad { background: #ffe4e1; color: #8b2f2f; }
.dependency-alert { padding: 11px 24px; color: #6f2b14; border-bottom: 1px solid #e2aa91; background: #fff0e8; font-weight: 750; }
.lanes { display: flex; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--paper); }
.lane { border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; color: var(--muted); background: white; font-weight: 750; }
.lane span { display: inline-grid; min-width: 23px; height: 23px; margin-left: 7px; place-items: center; border-radius: 999px; background: var(--wash); font-size: 12px; }
.lane.active { color: white; border-color: var(--green); background: var(--green); }
.lane.active span { color: var(--green); background: white; }
.workspace { display: grid; grid-template-columns: minmax(290px, 370px) 1fr; min-height: calc(100vh - 132px); }
.list-pane { padding: 18px; border-right: 1px solid var(--line); background: #f8faf9; }
.detail-pane { padding: 24px; overflow: auto; }
.list-heading, .detail-heading, .section-heading, .dialog-title, .dialog-actions, .action-row, .search-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-heading h2, .detail-heading h2, .section h3 { margin: 0; }
.person-list { display: grid; gap: 9px; margin-top: 14px; }
.person-list.directory-list { max-height: calc(100vh - 270px); padding-right: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.person-card { display: grid; gap: 3px; width: 100%; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 2px 10px rgba(27,50,41,.03); }
.person-card:hover, .person-card.selected { border-color: #7bad99; box-shadow: 0 5px 16px rgba(27,50,41,.1); }
.person-name { font-weight: 800; }
.person-lane { width: fit-content; padding: 3px 7px; border-radius: 999px; color: #365248; background: #e9f0ec; font-size: 11px; font-weight: 750; }
.person-reason { color: var(--green-dark); font-size: 14px; font-weight: 650; }
.person-meta, .muted { color: var(--muted); font-size: 13px; }
.empty-state { max-width: 520px; margin: 12vh auto 0; padding: 34px; text-align: center; border: 1px dashed #aec1b8; border-radius: 18px; background: rgba(255,255,255,.7); }
.detail-card { max-width: 980px; margin: 0 auto; }
.detail-heading { align-items: flex-start; margin-bottom: 14px; }
.detail-heading h2 { font-size: clamp(25px, 4vw, 36px); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.chip { padding: 5px 8px; border-radius: 999px; background: #e9f0ec; color: #365248; font-size: 12px; font-weight: 700; }
.next-action { margin: 14px 0; padding: 18px; border-left: 5px solid var(--green); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.next-action p { margin: 5px 0 0; }
.section { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.section-heading { margin-bottom: 12px; }
.requests { display: grid; gap: 8px; }
.request { padding: 14px; border: 1px solid transparent; border-radius: 12px; background: var(--wash); }
.request + .request { margin-top: 2px; }
.request strong { display: block; }
.request-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.request-id { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.request-next { margin: 9px 0 4px; font-weight: 680; }
.request-meta { color: var(--muted); font-size: 12px; }
.request-actions { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.closed-request { background: #fafbfa; opacity: .78; }
.timeline { display: grid; gap: 10px; }
.message { max-width: 85%; padding: 10px 12px; overflow-wrap: anywhere; border-radius: 12px; background: #edf1ef; }
.message.outbound { margin-left: auto; background: #dff1e9; }
.message-warning { border: 1px solid #dfb579; background: #fff5e8 !important; }
.message .meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.primary, .secondary, .danger { border-radius: 9px; padding: 9px 13px; font-weight: 750; }
.primary { color: white; border: 1px solid var(--green); background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--ink); border: 1px solid var(--line); background: white; }
.secondary:hover { border-color: #8aa99c; background: #f9fbfa; }
.danger { color: white; border: 1px solid var(--red); background: var(--red); }
.subtle-danger { color: var(--red); }
.compact { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.primary-action { min-height: 44px; padding: 10px 16px; font-size: 16px; }
.action-row { justify-content: flex-start; flex-wrap: wrap; }
label { display: grid; gap: 5px; margin: 10px 0; color: #3e4e47; font-size: 13px; font-weight: 700; }
.check-label { grid-template-columns: auto 1fr; align-items: start; gap: 8px; }
.check-label input { width: auto; margin-top: 2px; }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid #bbc9c2; border-radius: 8px; background: white; color: var(--ink); }
textarea { min-height: 100px; resize: vertical; }
.search-wrap { margin-bottom: 15px; padding: 12px; border-radius: 12px; background: white; }
.search-row input { flex: 1; }
.search-row button { padding: 10px 12px; border: 0; border-radius: 8px; color: white; background: var(--green); }
.attach-results { display: grid; gap: 7px; max-height: 230px; overflow: auto; }
.attach-result { display: grid; gap: 3px; width: 100%; padding: 10px 11px; text-align: left; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: white; }
.attach-result:hover { border-color: #7bad99; background: #f9fbfa; }
.attach-result span { color: var(--muted); font-size: 12px; }
dialog { width: min(620px, calc(100vw - 24px)); border: 0; border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
dialog[open] { max-height: min(86vh, 820px); overflow: auto; }
.settings-dialog { width: min(940px, calc(100vw - 24px)); }
.settings-eyebrow { color: var(--green-dark); }
.fixed-rules { margin: 12px 0 16px; padding: 13px; color: #563900; border: 1px solid #e3bd79; border-radius: 10px; background: #fff4df; }
.fixed-rules p { margin: 4px 0 0; font-size: 13px; }
.delete-preview { border: 1px solid #dfb3b3; background: #fff7f7; }
.delete-confirmation { display: grid; gap: 10px; margin: 12px 0; padding: 14px; border: 1px solid #d59595; border-radius: 12px; background: #fff4f3; }
.delete-confirmation > p { margin: 0; color: var(--red); }
.delete-confirmation .check-label { padding: 10px; border: 1px solid #e4c3c3; border-radius: 9px; background: white; }
.settings-body { display: grid; gap: 14px; }
.settings-section { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.settings-section h3 { margin: 0 0 8px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.service-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.service-setting { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.service-setting-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.settings-checks { margin-top: 8px; }
.settings-checks label { font-weight: 600; }
code { padding: 2px 4px; border-radius: 4px; background: #e8eeeb; }
dialog::backdrop { background: rgba(10,26,20,.5); }
.icon-button { border: 0; background: transparent; font-size: 30px; line-height: 1; }
.dialog-actions { justify-content: flex-end; margin-top: 18px; }
.form-error { padding: 9px; color: #8c2c2c; border-radius: 8px; background: #fee9e7; }
.form-warning { padding: 10px; color: #774000; border: 1px solid #e8c18b; border-radius: 9px; background: #fff4e5; }
.caller-said-review { border-color: #d9b06e; background: #fffdf8; }
.caller-said-review .form-warning { margin: 10px 0; }
.review-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.review-facts div { padding: 10px; border: 1px solid #ead5af; border-radius: 9px; background: white; }
.review-facts dt { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.review-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 750; }
.caller-said-dialog { margin: 12px 0; padding: 12px; color: #684000; border: 1px solid #d9a85c; border-radius: 10px; background: #fff8e8; }
.caller-said-dialog p { margin: 5px 0 0; font-size: 13px; }
.empty-list { padding: 24px 12px; color: var(--muted); text-align: center; }
.context-box, .fixed-policy { display: grid; gap: 3px; margin: 10px 0; padding: 12px; border-radius: 10px; background: var(--wash); }
.context-box span, .context-box small, .fixed-policy span { color: var(--muted); font-size: 12px; }
.status-badge { display: inline-flex; width: fit-content; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.status-badge.success { color: #145a43; background: #d9f4e7; }
.status-badge.warning { color: #7a4300; background: #fff0d8; }
.status-badge.neutral { color: #40544b; background: #e6ece9; }
.warning-chip { color: #7a4300; background: #fff0d8; }
.delivery-section { border-color: #d9b06e; }
.delivery-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.delivery-row:last-child { border-bottom: 0; }
.delivery-row p { margin: 3px 0 0; }
.delivery-controls { display: flex; align-items: center; gap: 8px; }
.record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.record-list { display: grid; gap: 8px; }
.record-item { display: grid; gap: 2px; padding: 10px; color: inherit; border: 1px solid var(--line); border-radius: 9px; background: #fafcfb; text-decoration: none; }
a.record-item:hover { border-color: #7bad99; }
.record-item span { color: var(--muted); font-size: 12px; }
.appointment-section p { margin: 6px 0; }
.back-button { margin-bottom: 6px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(420px, calc(100vw - 36px)); padding: 12px 15px; color: white; border-radius: 11px; background: #1d4f3f; box-shadow: 0 14px 36px rgba(0,0,0,.22); font-weight: 700; }
.toast.bad { background: var(--red); }
@media (max-width: 760px) {
  .topbar { padding: 10px 14px; }
  .topbar-actions { gap: 5px; }
  .topbar-button { padding: 7px 8px; font-size: 12px; }
  .topbar .status { display: none; }
  .lanes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    overflow-x: hidden;
    padding: 10px 12px;
  }
  .lane { width: 100%; min-width: 0; min-height: 44px; padding: 8px 4px; white-space: nowrap; font-size: 12px; }
  .lane span { min-width: 20px; height: 20px; margin-left: 4px; }
  .workspace { display: block; }
  .list-pane { border-right: 0; }
  .person-list.directory-list { max-height: calc(100vh - 285px); }
  .detail-pane { padding: 14px; }
  body.detail-open .list-pane { display: none; }
  body:not(.detail-open) .detail-pane { display: none; }
  .message { max-width: 95%; }
  .detail-heading { gap: 8px; }
  .detail-heading > .secondary { padding: 8px 9px; }
  .section, .next-action { padding: 14px; }
  .section-heading { align-items: flex-start; }
  .request-actions .primary, .request-actions .secondary { flex: 1 1 145px; min-height: 42px; }
  .record-grid { grid-template-columns: 1fr; gap: 0; }
  .review-facts { grid-template-columns: 1fr; }
  .settings-grid, .service-settings { grid-template-columns: 1fr; }
  .delivery-row { align-items: flex-start; }
  .delivery-controls { flex-direction: column; align-items: flex-end; }
  dialog { width: calc(100vw - 16px); margin: auto; padding: 16px; }
  .dialog-actions { position: sticky; bottom: -16px; margin: 16px -16px -16px; padding: 12px 16px; border-top: 1px solid var(--line); background: white; }
}
