:root {
  --ink: #132238;
  --muted-reference: #6a788c;
  --muted: #5f6e82;
  --paper: #f3f6fa;
  --surface: #ffffff;
  --line: #d8e0eb;
  --green: #071d3d;
  --green-2: #123f8c;
  --green-soft: #e9f0fb;
  --lime: #f26a21;
  --amber: #d95813;
  --amber-soft: #fff0e7;
  --red: #a23d3d;
  --red-soft: #fae5e2;
  --blue: #2458a7;
  --blue-soft: #eaf1fc;
  --shadow: 0 2px 10px rgba(7, 29, 61, .05);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 232px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid #2458a7; outline-offset: 2px; }
.skip-link { position: fixed; z-index: 1000; left: 1rem; top: -5rem; padding: .75rem 1rem; background: var(--ink); color: white; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.centered { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 25px 18px 18px; display: flex; flex-direction: column; color: #f9fbfa; background: var(--green); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--lime); color: var(--green); font-weight: 900; letter-spacing: -.06em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.06rem; }
.brand small { margin-top: 1px; color: rgba(255,255,255,.64); font-size: .69rem; letter-spacing: .04em; text-transform: uppercase; }
.nav-list { display: grid; gap: 6px; margin-top: 43px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; color: rgba(255,255,255,.74); font-size: .9rem; font-weight: 650; text-decoration: none; }
.nav-link:hover { background: rgba(255,255,255,.07); color: white; }
.nav-link.is-active { color: var(--green); background: var(--lime); }
.nav-link > span { width: 19px; text-align: center; font-size: 1.07rem; }
.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.13); }
.user-chip { display: flex; align-items: center; gap: 10px; margin: 0 7px 14px; }
.user-chip .avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.13); font-weight: 800; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: .86rem; }
.user-chip small { margin-top: 2px; color: rgba(255,255,255,.59); font-size: .72rem; }

.workspace { grid-column: 2; min-width: 0; }
.topbar { min-height: 108px; padding: 28px clamp(30px, 4vw, 66px) 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: rgba(244,243,238,.88); backdrop-filter: blur(15px); }
.topbar h1 { margin: 4px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.75rem, 2.5vw, 2.35rem); line-height: 1.05; letter-spacing: -.025em; font-weight: 600; }
.eyebrow { margin: 0; color: var(--green-2); font-size: .67rem; letter-spacing: .14em; font-weight: 850; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.date-chip { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-size: .83rem; }
.berlin-clock { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: .74rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.content { min-width: 0; padding: 28px clamp(30px, 4vw, 66px) 60px; }

.button { min-height: 40px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: .84rem; font-weight: 760; text-decoration: none; transition: transform .12s ease, background .12s ease, border-color .12s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; pointer-events: none; }
.button-primary { color: white; background: var(--green); }
.button-primary:hover { background: var(--green-2); }
.button-secondary { border-color: #cbd5ce; color: var(--green); background: white; }
.button-secondary:hover { border-color: var(--green-2); }
.button-quiet { border-color: transparent; color: inherit; background: rgba(255,255,255,.08); }
.content .button-quiet { color: var(--green); background: var(--green-soft); }
.button-full { width: 100%; }
.text-link, .text-button { color: var(--green-2); font-size: .83rem; font-weight: 750; text-decoration: none; }
.text-link:hover, .text-button:hover { text-decoration: underline; }
.text-button { padding: 0; border: 0; background: none; cursor: pointer; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--paper); cursor: pointer; font-size: 1.4rem; }

.panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 0 rgba(24,37,31,.02); }
.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { margin: 4px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.38rem; line-height: 1.12; font-weight: 600; }
.panel-accent { border-left: 5px solid var(--lime); }
.narrow-panel { max-width: 820px; margin-inline: auto; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { min-height: 126px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.metric-card > span { color: var(--muted); font-size: .76rem; font-weight: 700; }
.metric-card strong { margin-top: auto; font-family: Georgia, serif; font-size: 2.15rem; font-weight: 500; }
.metric-card small { color: var(--muted); font-size: .73rem; }
.metric-card.metric-attention { color: #1a3228; border-color: #b9d160; background: linear-gradient(135deg, #f5fadc, #e7f2b3); }
.dashboard-layout { min-width: 0; display: grid; grid-template-columns: minmax(0,1.65fr) minmax(310px,.7fr); gap: 20px; align-items: start; }
.dashboard-layout > .panel { margin-top: 0; }
.dashboard-layout > * { min-width: 0; }

.contact-list, .offer-list, .review-list { display: grid; gap: 9px; }
.contact-row, .offer-row, .review-card { padding: 14px 15px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fcfdfc; }
.contact-row.is-overdue { border-left: 4px solid var(--red); }
.contact-title { display: flex; align-items: center; gap: 9px; }
.contact-main p, .offer-row p, .review-card p { margin: 5px 0; color: var(--muted); font-size: .82rem; }
.meta-line { display: flex; gap: 8px; color: var(--muted); font-size: .73rem; }
.meta-line time { font-weight: 760; color: var(--ink); }
.offer-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.offer-actions time { color: var(--red); font-size: .78rem; font-weight: 800; }
.allocation-panel > p { color: var(--muted); font-size: .87rem; line-height: 1.55; }
.allocation-form { display: grid; gap: 12px; margin: 19px 0 10px; }
.allocation-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.allocation-quick legend { width: 100%; margin-bottom: 2px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.allocation-quick label { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .76rem; font-weight: 750; cursor: pointer; }
.appointment-calendar { margin-bottom: 14px; }
.month-count { padding: 5px 8px; border-radius: 999px; color: #123f8c; background: #eaf1fc; font-size: .7rem; font-weight: 780; white-space: nowrap; }
.week-calendar { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; overflow-x: auto; }
.calendar-day { min-width: 120px; min-height: 122px; padding: 9px; border: 1px solid #d8e0eb; border-radius: 8px; background: #fbfcfe; }
.calendar-day.is-today { border-color: #f26a21; box-shadow: inset 0 0 0 1px #f26a21; }
.calendar-day h3 { margin: 0 0 8px; color: #5f6e82; font-size: .7rem; }
.calendar-appointment { display: grid; gap: 2px; margin-top: 6px; padding: 6px; border-radius: 6px; color: #071d3d; background: #eaf1fc; font-size: .7rem; font-weight: 750; text-decoration: none; overflow-wrap: anywhere; }
.calendar-appointment:hover { background: #dce9fb; }
.calendar-appointment time { color: #2458a7; font-variant-numeric: tabular-nums; }
.calendar-appointment small { color: #5f6e82; font-weight: 500; }
.calendar-empty { margin: 14px 0; color: #9aa6b7; text-align: center; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: .67rem; font-weight: 800; white-space: nowrap; }
.badge-neutral { color: #58645d; background: #edf0ee; }
.badge-success, .badge-positive { color: #286044; background: #dff1e5; }
.badge-warning, .badge-pending { color: #8b5812; background: var(--amber-soft); }
.badge-danger, .badge-blocked { color: var(--red); background: var(--red-soft); }
.badge-info { color: var(--blue); background: var(--blue-soft); }
.count-badge { padding: 1px 6px; border-radius: 99px; background: var(--red-soft); color: var(--red); font-size: .69rem; }

.stack { display: grid; gap: 15px; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field { display: grid; gap: 6px; color: var(--ink); font-size: .77rem; font-weight: 760; }
.field input, .field select, .field textarea, .search-field input, .select-field select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cfd7d1; border-radius: 9px; color: var(--ink); background: white; font-size: .86rem; font-weight: 450; }
.field textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .search-field input:focus, .select-field select:focus { border-color: var(--green-2); outline: 3px solid rgba(40,97,72,.12); }
.field-small { max-width: 90px; }
.field-help { margin: -7px 0 0; color: var(--muted); font-size: .75rem; }
.warning-text { color: var(--red); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 11px; padding-top: 15px; border-top: 1px solid var(--line); }
.form-actions .inline-result { margin-right: auto; }
.toolbar { display: flex; align-items: end; gap: 9px; margin-bottom: 17px; }
.toolbar-wrap { flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search-field { min-width: 250px; flex: 1; }
.select-field { display: grid; gap: 4px; min-width: 140px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.choice-group { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 0; border: 0; }
.choice-group legend, fieldset > legend { grid-column: 1/-1; margin-bottom: 8px; font-size: .8rem; font-weight: 800; }
.choice-card { position: relative; display: block; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card span { min-height: 68px; padding: 11px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { overflow-wrap: anywhere; hyphens: auto; font-size: .82rem; }
.choice-card small { margin-top: 3px; color: var(--muted); font-size: .68rem; line-height: 1.3; }
.choice-card input:checked + span { border-color: var(--green-2); box-shadow: inset 0 0 0 1px var(--green-2); background: var(--green-soft); }
.choice-card input:focus-visible + span { outline: 3px solid #2458a7; outline-offset: 2px; }
.conditional-fields { display: grid; gap: 13px; padding: 16px; border-radius: 12px; background: var(--paper); }
.js .conditional-fields { display: none; }
.js .conditional-fields.is-visible { display: grid; }
.radio-line { display: flex; gap: 20px; }

.contact-detail-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,.65fr); gap: 20px; align-items: start; }
.contact-detail-grid > .panel { margin: 0; }
.next-step-panel { grid-column: 1; }
.positive-panel { grid-column: 2; display: grid; gap: 18px; border-color: #bbd467; background: linear-gradient(145deg,#fbfee8,#f2f8d7); }
.positive-panel h2 { margin: 4px 0 8px; font-family: Georgia, serif; }
.positive-panel p { font-size: .84rem; line-height: 1.55; }
.sla-box { padding: 11px; display: flex; justify-content: space-between; border-radius: 9px; background: rgba(255,255,255,.74); font-size: .8rem; }
.definition-list { margin: 0; display: grid; gap: 10px; }
.definition-list > div { padding-bottom: 9px; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.definition-list dt { color: var(--muted); font-size: .76rem; }
.definition-list dd { margin: 0; text-align: right; font-size: .79rem; font-weight: 720; }
.definition-list.compact { margin-top: 16px; }
.timeline { margin-top: 20px; display: grid; }
.timeline article { position: relative; padding: 0 0 17px 19px; border-left: 1px solid var(--line); }
.timeline-dot { position: absolute; left: -4px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--green-2); }
.timeline article p { margin: 4px 0; color: var(--muted); font-size: .77rem; }
.timeline article small { color: var(--muted); font-size: .68rem; }
.quote-box { padding: 15px; border-left: 4px solid var(--green-2); border-radius: 8px; background: var(--paper); }
.quote-box blockquote { margin: 10px 0 0; white-space: pre-wrap; font-size: .85rem; line-height: 1.55; }

.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
.table-scroll { max-height: calc(100vh - 300px); }
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table th { position: sticky; top: 0; z-index: 2; padding: 10px 11px; text-align: left; color: var(--muted); background: #f7f8f6; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: .69rem; letter-spacing: .025em; }
.data-table th a { text-decoration: none; }
.data-table td { padding: 11px; border-bottom: 1px solid #edf0ed; vertical-align: middle; }
.data-table tbody tr:hover { background: #fafcf9; }
.data-table td > strong, .data-table td > small { display: block; }
.data-table td > small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.admin-table { min-width: 1050px; }
.inline-edit { display: flex; align-items: center; min-width: 150px; }
.inline-edit input { width: 100%; padding: 6px 7px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: .78rem; }
.inline-edit:hover input, .inline-edit input:focus { border-color: var(--line); background: white; }
.inline-edit button { visibility: hidden; width: 27px; height: 27px; border: 0; border-radius: 6px; color: white; background: var(--green-2); cursor: pointer; }
.inline-edit:focus-within button, .inline-edit:hover button { visibility: visible; }
.pagination { padding-top: 15px; display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--muted); font-size: .77rem; }
.section-tabs { margin-bottom: 16px; display: flex; align-items: center; gap: 5px; border-bottom: 1px solid var(--line); }
.section-tabs a { padding: 10px 13px; border-bottom: 2px solid transparent; color: var(--muted); font-size: .78rem; font-weight: 760; text-decoration: none; }
.section-tabs a.is-active { color: var(--green); border-color: var(--green); }
.saved-view-bar { margin: 0 -22px 12px; padding: 9px 22px; display: flex; align-items: center; gap: 8px; border-block: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.view-chip { padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); text-decoration: none; font-weight: 700; }
.view-chip.is-active { color: white; background: var(--green); }
.popover { position: absolute; z-index: 50; right: 35px; top: 180px; width: 220px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.popover label { padding: 5px; display: block; font-size: .78rem; }
.pool-row { padding: 11px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; }
.pool-row > label:first-child { display: flex; align-items: center; gap: 8px; }
.pool-row strong, .pool-row small { display: block; }
.pool-row small { color: var(--muted); font-size: .68rem; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }

.alert { margin-bottom: 15px; padding: 11px 13px; border: 1px solid transparent; border-radius: 9px; font-size: .8rem; line-height: 1.45; }
.alert-info { color: var(--blue); border-color: #bfd8e7; background: var(--blue-soft); }
.alert-success { color: #286044; border-color: #b9dcc5; background: #e3f3e8; }
.alert-warning { color: #80500f; border-color: #f0d39d; background: var(--amber-soft); }
.alert-error { color: var(--red); border-color: #ecc0ba; background: var(--red-soft); }
.inline-result { min-height: 18px; color: var(--green-2); font-size: .75rem; }
.empty-inline { padding: 25px; text-align: center; color: var(--muted); font-size: .82rem; }
.empty-inline p { margin: 4px 0 0; }
.empty-state { min-height: 60vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-state h1, .empty-state h2 { margin: 8px; font-family: Georgia, serif; }
.empty-state p { max-width: 540px; color: var(--muted); }
.empty-code { color: var(--green-2); font-family: Georgia, serif; font-size: 4rem; }
.public-error { min-height: 100vh; }

.auth-page { min-width: 900px; background: var(--green); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(430px,.8fr); }
.auth-intro { position: relative; padding: 48px clamp(45px,7vw,110px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; color: white; background: var(--green); }
.auth-intro::after { content: ""; position: absolute; right: -140px; bottom: -180px; width: 520px; height: 520px; border: 1px solid rgba(199,227,109,.24); border-radius: 50%; box-shadow: 0 0 0 90px rgba(199,227,109,.04), 0 0 0 180px rgba(199,227,109,.025); }
.auth-intro > * { position: relative; z-index: 1; }
.auth-intro h1 { max-width: 720px; margin: 13px 0 18px; font-family: Georgia, serif; font-size: clamp(2.7rem,5vw,5.2rem); line-height: .98; font-weight: 500; letter-spacing: -.045em; }
.auth-intro > div > p:not(.eyebrow) { max-width: 600px; color: rgba(255,255,255,.66); line-height: 1.65; }
.auth-note { color: rgba(255,255,255,.5); font-size: .72rem; }
.brand-large .brand-mark { width: 49px; height: 49px; }
.auth-card { align-self: center; width: min(440px, calc(100% - 80px)); margin: 40px auto; padding: 38px; display: grid; gap: 27px; border-radius: 22px; background: white; box-shadow: 0 30px 70px rgba(4,20,13,.25); }
.auth-card h1, .auth-card h2 { margin: 5px 0 8px; font-family: Georgia, serif; font-size: 2rem; font-weight: 550; }
.auth-card p { line-height: 1.5; font-size: .86rem; }
.auth-shell-single { grid-template-columns: 1fr; background: radial-gradient(circle at 50% 20%, #2b5e49, var(--green) 52%); }
.brand-centered { justify-content: center; color: var(--green); }
.brand-centered small { color: var(--muted); }
.code-input { text-align: center; font-size: 1.6rem !important; letter-spacing: .35em; font-weight: 800 !important; }
.recovery-details { padding-top: 4px; border-top: 1px solid var(--line); }
.recovery-details summary { padding: 10px 0; color: var(--green-2); cursor: pointer; text-align: center; font-size: .8rem; font-weight: 750; }
.recovery-details form { margin-top: 10px; }

dialog { width: min(460px,calc(100% - 40px)); padding: 24px; border: 0; border-radius: 16px; box-shadow: 0 30px 90px rgba(15,30,22,.3); }
dialog::backdrop { background: rgba(12,25,19,.55); backdrop-filter: blur(2px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; }
.dialog-heading h2 { margin: 0; font-family: Georgia, serif; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 8px; }
.toast { max-width: 380px; padding: 12px 15px; border-radius: 10px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: .8rem; }
.htmx-request { opacity: .62; pointer-events: none; }
.config-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.config-stack > .panel { min-width: 0; margin-top: 0; scroll-margin-top: 18px; }
.config-create, .config-item { border: 1px solid var(--line); border-radius: 11px; background: #fcfdfc; }
.config-create { margin-top: 15px; }
.config-create > summary, .config-item > summary { padding: 12px 14px; cursor: pointer; color: var(--green); font-size: .8rem; font-weight: 760; }
.config-create > form, .config-item > form { padding: 4px 14px 15px; }
.config-row { grid-template-columns: minmax(180px,1fr) auto minmax(220px,1.2fr) auto; align-items: end; }
.config-row input, .config-row select { min-height: 38px; padding: 7px 9px; border: 1px solid #cfd7d1; border-radius: 8px; background: white; }
.checkbox-line { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; font-size: .78rem; font-weight: 720; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.button-small { min-height: 32px; padding: 5px 9px; }
.break-all { overflow-wrap: anywhere; word-break: break-word; }
details, summary { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; padding: 14px; gap: 12px; }
  .nav-list { margin-top: 2px; display: flex; overflow-x: auto; padding-bottom: 4px; }
  .nav-link { flex: 0 0 auto; }
  .sidebar-foot { margin-top: 0; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
  .sidebar-foot .user-chip { margin: 0; }
  .sidebar-foot form { min-width: 135px; }
  .workspace { display: block; }
  .topbar { min-height: 88px; padding: 20px; align-items: center; }
  .content { padding: 20px 16px 45px; }
  .dashboard-layout, .contact-detail-grid { grid-template-columns: 1fr; }
  .next-step-panel, .positive-panel { grid-column: 1; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three, .choice-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-row { grid-template-columns: 1fr 1fr; }
  .section-tabs, .saved-view-bar { overflow-x: auto; }
  .section-tabs a, .view-chip { flex: 0 0 auto; }
  .auth-page { min-width: 320px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-card { width: min(440px, calc(100% - 32px)); margin: 24px auto; padding: 28px; }
}

@media (max-width: 580px) {
  .brand small, .nav-link > span, .user-chip small { display: none; }
  .sidebar { padding-inline: 10px; }
  .nav-link { padding: 9px 10px; }
  .sidebar-foot { align-items: stretch; }
  .topbar { padding: 16px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .metric-grid, .form-grid.two, .form-grid.three, .choice-group, .checkbox-grid, .config-row { grid-template-columns: 1fr; }
  .panel { padding: 16px; border-radius: 14px; }
  .panel-heading, .contact-row, .offer-row, .review-card, .form-actions { align-items: stretch; flex-direction: column; }
  .offer-actions, .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar > *, .search-field, .select-field { width: 100%; min-width: 0; }
  .definition-list > div { display: grid; }
  .definition-list dd { text-align: left; }
  .saved-view-bar { margin-inline: -16px; padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print { .sidebar, .topbar-actions, .toolbar, .section-tabs, .button, .saved-view-bar { display: none !important; } .app-shell { display: block; } .workspace { display: block; } .panel { box-shadow: none; } }

/* Compact JK workbench layer: no external assets or fonts. */
.sidebar { padding: 18px 12px 14px; background: #071d3d; }
.brand { padding: 4px 6px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: #f26a21; color: #fff; font-size: .84rem; }
.brand small { color: rgba(255,255,255,.52); }
.nav-list { gap: 3px; margin-top: 28px; }
.nav-link { padding: 9px 10px; border-radius: 7px; font-size: .82rem; }
.nav-link.is-active { color: #fff; background: #123f8c; box-shadow: inset 3px 0 #f26a21; }
.sidebar-foot { padding-top: 12px; }
.workspace { background: #f3f6fa; }
.page-commandbar { min-height: 76px; padding: 16px clamp(20px, 3vw, 42px); align-items: center; background: rgba(255,255,255,.92); }
.topbar h1, .panel-heading h2, .metric-card strong, .positive-panel h2, .empty-state h1, .empty-state h2 { font-family: inherit; font-weight: 720; letter-spacing: -.02em; }
.topbar h1 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.eyebrow { color: #2458a7; font-size: .62rem; letter-spacing: .12em; }
.workspace-content { padding: 20px clamp(20px, 3vw, 42px) 44px; }
.surface, .panel { min-width: 0; border-color: #d8e0eb; border-radius: 9px; box-shadow: 0 1px 2px rgba(7,29,61,.025); }
.panel { padding: 18px; }
.panel-heading { margin-bottom: 14px; }
.panel-heading h2 { font-size: 1.08rem; }
.button { min-height: 36px; border-radius: 7px; font-size: .78rem; }
.button-primary { background: #123f8c; }
.button-primary:hover { background: #082b63; }
.button-secondary { border-color: #c9d5e5; color: #123f8c; }
.content .button-quiet { color: #123f8c; background: #edf3fb; }
.badge { min-height: 20px; padding: 2px 7px; font-size: .62rem; border: 1px solid transparent; }
.badge-success, .badge-positive { color: #123f8c; background: #eaf1fc; border-color: #cbdcf5; }
.badge-warning, .badge-pending { color: #a53f0c; background: #fff0e7; border-color: #ffd2bb; }
.badge-danger, .badge-blocked { color: #a23d3d; background: #fff0f0; border-color: #f0cccc; }
.metric-grid { gap: 10px; margin-bottom: 14px; }
.metric-card { min-height: 96px; padding: 14px; border-radius: 9px; }
.metric-card strong { font-size: 1.65rem; }
.metric-card.metric-attention { color: #071d3d; border-color: #ffd0b7; background: #fff4ed; }
.filter-strip { padding: 10px; border: 1px solid #d8e0eb; border-radius: 8px; background: #f8fafd; }
.field input, .field select, .field textarea, .search-field input, .select-field select { min-height: 38px; border-color: #cbd6e4; border-radius: 7px; }
.field input:focus, .field select:focus, .field textarea:focus, .search-field input:focus, .select-field select:focus { border-color: #2458a7; outline: 3px solid #2458a7; outline-offset: 2px; }
.data-table th { background: #f7f9fc; color: #5f6e82; }
.data-table tbody tr:hover { background: #f4f8fe; }
.contact-row, .offer-row, .review-card { border-radius: 8px; background: #fff; }
.contact-row > *, .offer-row > *, .review-card > *, .metric-card, .choice-card { min-width: 0; }
.contact-main, .contact-title, .definition-list dd, .quote-box blockquote { min-width: 0; overflow-wrap: anywhere; }
.record-layout { min-width: 0; grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); gap: 14px; }
.record-layout > * { min-width: 0; }
.record-layout > .record-aside { grid-column: 1; grid-row: 1 / span 5; align-self: start; }
.record-layout > .record-feed { grid-column: 2; }
.record-aside .form-grid.two { grid-template-columns: 1fr; }
.record-aside .form-actions .button { width: 100%; }
.context-panel { display: grid; grid-template-columns: minmax(220px,.48fr) minmax(0,1fr); gap: 18px; }
.context-panel .panel-heading { grid-column: 1 / -1; margin-bottom: 0; }
.context-panel .timeline { margin-top: 0; }
.activity-composer { position: sticky; top: 14px; z-index: 3; border-color: #f6b28b; box-shadow: 0 6px 20px rgba(242,106,33,.10); }
.activity-composer .panel-heading { padding-bottom: 11px; border-bottom: 1px solid #ffe0cf; }
.activity-composer .choice-group { grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); }
.activity-composer .choice-card span { min-height: 60px; }
.activity-composer .form-actions { position: sticky; bottom: 0; padding: 12px 0 0; background: #fff; }
.positive-panel { border-color: #cbdcf5; background: #f6f9fe; }
.auth-page { min-width: 0; background: #071d3d; }
.auth-intro, .auth-shell-single { background: #071d3d; }
.auth-intro h1, .auth-card h1, .auth-card h2 { font-family: inherit; font-weight: 730; }
.auth-card { border-radius: 10px; box-shadow: 0 12px 34px rgba(7,29,61,.22); }
.auth-intro::after { border-color: rgba(242,106,33,.3); box-shadow: 0 0 0 90px rgba(36,88,167,.14), 0 0 0 180px rgba(36,88,167,.07); }
.empty-state h1, .empty-state h2, .empty-code, .dialog-heading h2 { font-family: inherit; }
.empty-code { color: #123f8c; }
.soft-rule { border: 0; border-top: 1px solid #d8e0eb; }
.page-commandbar.section-tabs { min-height: 0; margin: 0 0 14px; padding: 0 0 0 2px; background: transparent; }
.page-commandbar.section-tabs a { padding: 9px 11px; border-radius: 7px 7px 0 0; }
.page-commandbar.section-tabs a.is-active { color: #123f8c; border-color: #f26a21; background: #fff; }
.toolbar-wrap, .filter-strip { flex-wrap: wrap; align-items: end; }
.filter-strip .search-field { min-width: min(280px, 100%); }
.filter-strip .select-field { min-width: 150px; }
.surface > .table-wrap, .panel > .table-wrap { width: calc(100% + 36px); max-width: calc(100% + 36px); margin-inline: -18px; }
.surface > .table-wrap .data-table, .panel > .table-wrap .data-table { min-width: 660px; }
.table-wrap { border-top: 1px solid #d8e0eb; border-bottom: 1px solid #d8e0eb; overscroll-behavior-inline: contain; }
.table-scroll { border-radius: 0 0 9px 9px; }
.admin-grid-panel { padding-bottom: 0; }
.admin-grid-panel .filter-strip { margin-bottom: 12px; }
.record-layout .record-feed .table-wrap { width: 100%; max-width: 100%; margin-inline: 0; }
.record-layout .record-feed { min-width: 0; }
.config-stack { gap: 12px; }
.config-stack > *, .config-create, .config-item { min-width: 0; max-width: 100%; }
.config-create, .config-item, .pool-row { border-color: #d8e0eb; border-radius: 8px; background: #fff; }
.config-create > summary, .config-item > summary { color: #123f8c; }
.config-row { gap: 10px; }
.review-card, .pool-row { box-shadow: 0 1px 1px rgba(7,29,61,.02); }
.row-actions { flex-wrap: wrap; justify-content: flex-end; }
.inline-edit input { min-height: 34px; border-color: #d8e0eb; background: #fff; }
.inline-edit button { background: #123f8c; }
.popover { border-color: #d8e0eb; border-radius: 8px; box-shadow: 0 10px 25px rgba(7,29,61,.12); }
.choice-card input:checked + span { border-color: #2458a7; box-shadow: inset 0 0 0 1px #2458a7; background: #eaf1fc; }
.radio-line { flex-wrap: wrap; }
.radio-line label, .checkbox-line { min-height: 40px; display: inline-flex; align-items: center; }
.choice-group-compact { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.quick-dates { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -3px; }
.quick-dates .text-button { padding: 4px 7px; border: 1px solid #d8e0eb; border-radius: 999px; background: #fff; }
.undo-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #ffd2bb; border-radius: 8px; color: #7f390d; background: #fff4ed; font-size: .78rem; }
.undo-notice button { flex: 0 0 auto; }
.confetti-pop { animation: confetti-pop .55s ease-out both; }
@keyframes confetti-pop { 0% { transform: scale(.92); } 45% { transform: scale(1.08) rotate(-2deg); background: #fff0e7; } 100% { transform: scale(1); } }
.danger-zone { border-color: #f0cccc; }
.compact-delete { margin-top: 14px; padding-top: 10px; border-top: 1px solid #d8e0eb; }
.compact-delete summary { color: #a23d3d; cursor: pointer; font-size: .74rem; font-weight: 760; }
.compact-delete .stack { margin-top: 10px; }
.compact-positive { margin-top: 14px; padding: 12px; border: 1px solid #cbdcf5; border-radius: 8px; background: #f6f9fe; }
.compact-positive h2 { margin: 4px 0 7px; font-size: .95rem; }
.compact-positive p { margin: 0 0 10px; font-size: .76rem; line-height: 1.45; }
.completion-pending-placeholder { display: grid; min-height: 210px; place-items: center; border: 1px dashed #f26a21; border-radius: 8px; color: #123f8c; background: #fff8f3; font-weight: 740; }
.completion-form.is-undo-pending > :not(.undo-notice):not(.form-actions) { display: none; }
.completion-form.is-undo-pending .form-actions { display: none; }
.appointment-celebration { position: relative; min-height: 42px; margin-bottom: 12px; padding: 11px 13px; overflow: hidden; border: 1px solid #f26a21; border-radius: 8px; color: #071d3d; background: #fff4ed; font-size: .82rem; font-weight: 780; }
.appointment-celebration.is-static { border-color: #2458a7; background: #eaf1fc; }
.confetti-layer { position: absolute; inset: 0; pointer-events: none; }
.confetti-layer i { position: absolute; left: 50%; top: 4px; width: 8px; height: 12px; border: 1px solid rgba(7,29,61,.12); animation: jk-confetti 1.75s ease-out both; }
@keyframes jk-confetti { to { transform: translate(var(--confetti-x), 64px) rotate(var(--confetti-r)); opacity: 0; } }
@media (max-width: 900px) {
  .page-commandbar.section-tabs { padding-bottom: 3px; overflow-x: auto; }
  .filter-strip .search-field { flex-basis: 100%; }
  .filter-strip .select-field { flex: 1 1 150px; }
  .surface > .table-wrap, .panel > .table-wrap { width: calc(100% + 32px); max-width: calc(100% + 32px); margin-inline: -16px; }
  .record-layout .record-aside { position: static; }
  .config-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-calendar { grid-template-columns: repeat(7, minmax(105px, 1fr)); }
}
@media (max-width: 580px) {
  .page-commandbar { padding: 14px 16px; }
  .page-commandbar .topbar-actions { width: 100%; justify-content: flex-start; }
  .filter-strip { align-items: stretch; }
  .filter-strip .select-field, .filter-strip .button { width: 100%; }
  .surface > .table-wrap, .panel > .table-wrap { width: calc(100% + 32px); max-width: calc(100% + 32px); margin-inline: -16px; }
  .data-table th, .data-table td { padding: 10px; }
  .row-actions { justify-content: flex-start; }
  .config-row { grid-template-columns: 1fr; }
  .button, .icon-button { min-height: 40px; }
}
@media (max-width: 900px) {
  .record-layout { grid-template-columns: 1fr; }
  .record-layout > .record-aside, .record-layout > .record-feed { grid-column: 1; grid-row: auto; }
  .context-panel { grid-template-columns: 1fr; }
  .context-panel .panel-heading { grid-column: auto; }
  .activity-composer { position: static; }
}
