:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef2f3;
  --text: #172126;
  --muted: #66747b;
  --border: #d8e0e3;
  --primary: #176b60;
  --primary-hover: #10574e;
  --accent: #c77921;
  --danger: #a33a32;
  --warning: #94610f;
  --info: #315f8a;
  --success-bg: #e7f5ef;
  --danger-bg: #fbecea;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
.demo-data-banner { min-height: 34px; display: grid; place-items: center; padding: 7px 16px; background: #fff4dc; border-bottom: 1px solid #dcbf82; color: #65470e; font-size: 12px; font-weight: 800; text-align: center; }
button, input, select { font: inherit; }
button, select, input { min-height: 40px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; letter-spacing: 0; }
h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: 0; }
h3 { margin: 3px 0 4px; font-size: 17px; letter-spacing: 0; }

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: #1d2a2e; color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 30px; }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; background: var(--primary); color: #fff; border-radius: 6px; font-weight: 800; }
.nav-item { display: block; color: #cfdbde; padding: 10px 12px; text-decoration: none; border-radius: 5px; }
.nav-item.active { background: #2b3c41; color: #fff; }
.nav-group-label { display: block; margin: 18px 12px 6px; color: #819399; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid #405157; display: grid; gap: 10px; }
.signed-in-user { color: #d8e2e4; overflow-wrap: anywhere; }
.content { width: 100%; max-width: 1440px; padding: 30px 34px 60px; }
.calm-content { max-width: 1120px; padding-top: 72px; }
.calm-header { margin-bottom: 38px; }
.lead { max-width: 720px; margin: 9px 0 0; color: var(--muted); line-height: 1.55; }
.area-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.area-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; min-height: 170px; padding: 26px; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; transition: transform .16s ease, border-color .16s ease; }
.area-card:hover { transform: translateY(-2px); border-color: #9eb6b2; }
.area-card h2 { margin: 0 0 7px; }
.area-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.area-card > strong { color: var(--primary); font-size: 30px; }
.area-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 12px; background: #e7f2ef; color: var(--primary); font-size: 20px; font-weight: 900; }
.quiet-panel { display: flex; align-items: center; gap: 42px; margin-top: 22px; padding: 22px 26px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.65); }
.quiet-panel div { display: grid; gap: 3px; }
.quiet-panel span { color: var(--muted); font-size: 12px; }
.quiet-panel strong { font-size: 24px; }
.quiet-panel .text-link { margin-left: auto; }
.text-link, .back-link { color: var(--primary); font-weight: 700; text-decoration: none; }
.back-link { display: inline-block; margin-bottom: 18px; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, 260px) auto auto; gap: 10px; margin-bottom: 18px; }
.data-panel { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.data-panel td small, .simple-list span, .assignment-row span { display: block; margin-top: 4px; color: var(--muted); }
.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.entity-card { padding: 22px; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; text-decoration: none; }
.entity-card h2 { margin: 12px 0 6px; }
.entity-card > p { color: var(--muted); }
.card-topline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #a9b4b7; }
.status-dot.active { background: var(--primary); }
.compact-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.compact-facts dt { color: var(--muted); font-size: 11px; }
.compact-facts dd { margin: 4px 0 0; font-weight: 800; }
.form-dialog { width: min(620px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 24px 70px rgba(10,25,30,.25); }
.form-dialog::backdrop { background: rgba(15,28,33,.55); }
.stack-form { display: grid; gap: 12px; padding: 26px; }
.stack-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.stack-form textarea { width: 100%; padding: 10px; border: 1px solid #bfcace; border-radius: 5px; font: inherit; }
.address-fieldset { display: grid; gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 7px; }
.address-fieldset legend { padding: 0 6px; color: var(--text); font-size: 13px; font-weight: 800; }
.inline-action-form { display: inline; margin: 0; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-muted); cursor: pointer; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.detail-hero { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.detail-hero p { margin: 8px 0 0; color: var(--muted); }
.tab-nav { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; padding: 10px 0; background: var(--bg); }
.tab-nav a { padding: 8px 11px; color: var(--primary); background: #e8f1ef; border-radius: 5px; font-size: 13px; font-weight: 800; text-decoration: none; }
.tab-nav a.active { color: #fff; background: var(--primary); }
.customer-tab-panel[hidden], [data-removed-on-field][hidden] { display: none !important; }
.customer-detail-page .detail-section { min-height: 260px; }
.detail-section { padding: 28px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 70px; }
.detail-section > h2 { margin-bottom: 18px; }
.section-intro { color: var(--muted); }
.simple-list { display: grid; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.simple-list > * { padding: 14px 16px; color: inherit; text-decoration: none; }
.simple-list > * + * { border-top: 1px solid var(--border); }
.assignment-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(400px, 1.2fr); gap: 20px; align-items: center; padding: 16px; border: 1px solid var(--border); background: var(--surface); }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.filter-chips span { padding: 6px 9px; background: var(--surface-muted); border-radius: 4px; font-size: 12px; }
.installed-filter-list { display: grid; gap: 10px; margin-top: 14px; }
.installed-filter { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(360px, 1.25fr); gap: 18px; align-items: end; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: #f9fbfb; }
.installed-filter-main { display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: baseline; }
.installed-filter-main strong { flex-basis: 100%; }
.installed-filter-main span { color: var(--muted); font-size: 12px; }
.installed-filter-invalid { border-color: #d8a49f; background: var(--danger-bg); }
.invalid-date-warning { display: grid; gap: 3px; color: var(--danger); font-size: 12px; }
.filter-action-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 8px; align-items: end; }
.filter-action-form label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.filter-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.filter-history { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.filter-history > summary { cursor: pointer; color: var(--primary); font-weight: 800; }
.filter-history > summary span { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-history .data-panel { margin-top: 12px; }
.standard-filter-picker { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 7px; }
.standard-filter-picker legend { padding: 0 5px; color: var(--text); font-size: 13px; font-weight: 800; }
.standard-filter-picker .field-help { display: block; margin-bottom: 10px; }
[data-standard-filter-options] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.standard-filter-option { padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-muted); color: var(--text) !important; }
.device-partner-editor { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.device-partner-editor > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.confirmation-panel { margin-top: 14px; padding: 16px; border: 1px solid #bed3cd; border-radius: 7px; background: #f1f8f6; }
.confirmation-panel h4 { margin: 0 0 12px; }
.confirmation-status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.confirmation-status-grid div { display: grid; gap: 2px; }
.confirmation-status-grid span { color: var(--muted); font-size: 11px; }
.manual-confirmation { margin-top: 12px; }
.manual-confirmation summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.compact-form { padding: 12px 0 0; }
.narrow-content { max-width: 900px; }
.link-panel { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-bottom: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; }
.link-panel label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.privacy-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.public-confirmation { min-height: calc(100vh - 34px); display: grid; place-items: center; padding: 24px; }
.confirmation-card { width: min(100%, 560px); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 45px rgba(12,31,36,.1); }
.confirmation-card .brand-mark { margin-bottom: 24px; }
.confirmation-facts { margin: 22px 0; display: grid; gap: 10px; }
.confirmation-facts div { display: grid; grid-template-columns: 100px 1fr; gap: 12px; }
.confirmation-facts dt { color: var(--muted); }
.confirmation-facts dd { margin: 0; font-weight: 800; }
.confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.operational-content { max-width: 1560px; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.summary-count, .device-count { color: var(--muted); font-size: 13px; }
.customer-section { border-top: 1px solid var(--border); padding: 24px 0 8px; }
.customer-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.record-id { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; }
.identity-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.device-list { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.device-row { padding: 20px; }
.device-row + .device-row { border-top: 1px solid var(--border); }
.device-heading { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(320px, 520px); gap: 28px; align-items: start; }
.asset-facts { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 0; }
.asset-facts div { min-width: 120px; }
.asset-facts dt, .field-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.asset-facts dd { margin: 3px 0 0; font-weight: 700; }
.field-label { display: block; margin-bottom: 3px; }
.field-label-spaced { margin-top: 14px; }
.asset-notes { margin-top: 14px; color: var(--muted); }
.asset-notes summary { cursor: pointer; font-weight: 700; }
.asset-notes p { margin: 8px 0 0; white-space: pre-wrap; }
.checkbox-label { grid-template-columns: auto 1fr; align-items: center; }
.checkbox-label input { width: auto; min-height: auto; }
.address { margin-bottom: 0; color: var(--muted); }
.partner-control label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.partner-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
select, input { width: 100%; border: 1px solid #bfcace; border-radius: 5px; background: #fff; color: var(--text); padding: 8px 10px; }
select:focus, input:focus, button:focus-visible { outline: 3px solid rgba(23, 107, 96, .22); outline-offset: 1px; }
.button { border: 0; border-radius: 5px; padding: 8px 14px; cursor: pointer; font-weight: 700; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { background: #edf2f3; color: #26363b; border: 1px solid #bcc9cd; }
.button-secondary:hover { background: #e2e9eb; }
.button-danger { background: #fff; color: var(--danger); border: 1px solid #d6a39e; }
.button-quiet { background: transparent; color: #fff; border: 1px solid #587078; width: 100%; }
.due-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 12px; margin: 18px 0; }
.due-item { padding-left: 12px; border-left: 3px solid var(--accent); display: grid; gap: 3px; }
.due-label { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); background: var(--surface-muted); font-size: 12px; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.empty-state { color: var(--muted); margin: 18px 0 4px; }
.work-section { padding: 25px 0 34px; border-top: 1px solid var(--border); scroll-margin-top: 12px; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-heading h2 { margin: 0 0 4px; }
.section-heading p { margin: 0; color: var(--muted); }
.case-table-wrap { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.case-table th { position: sticky; top: 0; z-index: 1; }
.case-table td { vertical-align: top; min-width: 145px; white-space: normal; }
.case-table td:nth-child(2) { min-width: 220px; }
.case-table td:nth-child(6) { min-width: 210px; }
.case-row.selected td { background: #f0f8f5; }
.case-row.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.case-link { display: block; width: fit-content; color: var(--primary); font-weight: 700; text-decoration: none; }
.case-link:hover { text-decoration: underline; }
.case-customer-link { display: inline-block; color: var(--text); font-size: 16px; font-weight: 800; text-decoration: none; }
.case-customer-link:hover { color: var(--primary); text-decoration: underline; }
.due-date, .cell-secondary, .filter-summary, .next-action { display: block; margin-top: 5px; }
.cell-secondary, .filter-summary, .next-action { color: var(--muted); font-size: 13px; }
.filter-summary { display: grid; gap: 3px; }
.filter-summary span { display: grid; }
.filter-summary small { color: var(--muted); font-family: Consolas, monospace; font-size: 11px; }
.case-reason { display: inline-block; margin-top: 8px; padding: 4px 7px; border-radius: 4px; background: var(--surface-muted); color: #4c5d62; font-size: 11px; font-weight: 800; }
.case-reason-request { background: #e8f1fa; color: var(--info); }
.status-badge { display: inline-block; max-width: 190px; padding: 4px 7px; border-radius: 4px; font-size: 12px; font-weight: 800; line-height: 1.25; }
.status-overdue, .status-customer-declined { background: #fbe8e6; color: #8d2f28; }
.status-customer-contact-required { background: #fff0d8; color: #80530c; }
.status-customer-response-pending { background: #e9f0f8; color: #315f8a; }
.status-planning-required { background: #f6eedb; color: #755314; }
.status-scheduled { background: #e5f3ed; color: #17604f; }
.status-dispatch-required { background: #fff0d8; color: #80530c; }
.status-confirmation-pending { background: #e9f0f8; color: #315f8a; }
.status-confirmed { background: #dff2e9; color: #125a48; }
.status-appointment-declined { background: #fbe8e6; color: #8d2f28; }
.status-no-service { background: #fbe8e6; color: #8d2f28; }
.status-completed { background: #e8eeee; color: #4f5d61; }
.status-cancelled { background: #ececed; color: #606267; }
.compact-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.compact-actions .button, .case-table .button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.inline-button { display: inline-flex; align-items: center; width: fit-content; margin-top: 9px; text-decoration: none; }
.process-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
.process-summary article { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 16px; border: 1px solid var(--border); border-top: 3px solid var(--warning); border-radius: 7px; background: var(--surface); }
.process-summary span { color: var(--muted); font-size: 12px; font-weight: 800; }
.process-summary strong { grid-row: 1 / span 2; grid-column: 2; font-size: 27px; }
.process-summary small { color: var(--muted); line-height: 1.35; }
.process-summary .summary-confirmed { border-top-color: var(--primary); }
.workflow-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0 0 16px; padding: 0; list-style: none; }
.workflow-steps li { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; min-width: 0; padding-right: 14px; color: var(--muted); }
.workflow-steps li::after { content: ""; position: absolute; top: 14px; left: 30px; right: 0; height: 2px; background: var(--border); }
.workflow-steps li:last-child::after { display: none; }
.workflow-steps li > span { position: relative; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid var(--border); border-radius: 50%; background: var(--surface); font-size: 11px; font-weight: 900; }
.workflow-steps li div { min-width: 0; }
.workflow-steps li strong, .workflow-steps li small { display: block; }
.workflow-steps li strong { color: var(--text); font-size: 12px; }
.workflow-steps li small { margin-top: 3px; font-size: 10px; line-height: 1.35; }
.workflow-steps li.done > span { border-color: var(--primary); background: var(--primary); color: #fff; }
.workflow-steps li.done::after { background: var(--primary); }
.workflow-steps li.current > span { border-color: var(--warning); color: var(--warning); }
.selected-status { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: center; margin-bottom: 12px; padding: 16px 18px; border: 1px solid #e0c78d; border-left: 4px solid var(--warning); border-radius: 7px; background: #fff8e9; }
.selected-status > div { display: grid; gap: 3px; }
.selected-status span { color: var(--muted); font-size: 11px; font-weight: 800; }
.selected-status.status-panel-confirmed { border-color: #9fcdb9; border-left-color: var(--primary); background: var(--success-bg); }
.selected-status.status-panel-confirmation-pending { border-color: #b7cbe0; border-left-color: var(--info); background: #f0f5fb; }
.selected-status.status-panel-appointment-declined { border-color: #e5b6b0; border-left-color: var(--danger); background: var(--danger-bg); }
.planning-editor { width: 100%; }
.planning-editor > summary { cursor: pointer; color: var(--primary); font-weight: 800; }
.planning-editor-fields { display: grid; gap: 8px; margin-top: 14px; }
.partner-workload-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.partner-workload { min-width: 0; padding: 18px; }
.partner-workload + .partner-workload { border-left: 1px solid var(--border); }
.partner-workload h3 { margin-top: 5px; overflow-wrap: anywhere; }
.partner-workload dl { margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.partner-workload dl div { display: grid; gap: 3px; }
.partner-workload dt { color: var(--muted); font-size: 12px; }
.partner-workload dd { margin: 0; font-size: 21px; font-weight: 800; }
.planning-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.planning-context, .planning-form { padding: 22px; min-width: 0; }
.planning-form { border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.planning-form label, .field-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.planning-form label:not(:first-child) { margin-top: 10px; }
.planning-title-row { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.facts-list { margin: 18px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 13px 20px; }
.facts-list div { min-width: 0; }
.facts-list dt { color: var(--muted); font-size: 12px; }
.facts-list dd { margin: 3px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.case-filter-list { border-top: 1px solid var(--border); padding-top: 14px; }
.case-filter-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.case-filter-list small, .device-partner-suggestion small, .facts-list .record-id { display: block; margin-top: 3px; }
.field-help { color: var(--muted); font-size: 12px; }
.device-partner-suggestion { margin-top: 4px; padding: 10px; background: var(--surface-muted); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.device-partner-suggestion .button { flex: 0 0 auto; }
.planning-note { margin: 5px 0; padding: 10px; border-left: 3px solid var(--warning); background: #fff8ec; color: #69490f; }
.planning-blocked { padding: 16px; border-left: 3px solid var(--danger); background: var(--danger-bg); }
.planning-blocked p { margin: 7px 0 0; color: #71332e; }
.email-status-panel { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.email-status-panel h4 { margin: 0 0 2px; font-size: 14px; }
.email-status-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.email-status-row span { color: var(--muted); font-size: 12px; }
.email-status-row strong { font-size: 13px; }
.alert { position: sticky; top: 12px; z-index: 10; margin-bottom: 16px; padding: 12px 14px; border: 1px solid transparent; border-radius: 5px; }
.alert-success { background: var(--success-bg); border-color: #9fcdb9; color: #155944; }
.alert-error { background: var(--danger-bg); border-color: #e5b6b0; color: var(--danger); }
.login-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e9eef0; }
.login-panel { width: min(100%, 390px); padding: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 12px 32px rgba(23, 33, 38, .08); }
.login-panel .brand-mark { margin-bottom: 22px; }
.login-form { display: grid; gap: 8px; margin-top: 22px; }
.login-form label { margin-top: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.login-form .button { margin-top: 14px; }
.customer-list-section { margin-top: 4px; }
.customer-list-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 10px; }
.customer-list-heading h2 { margin: 0; }
.customer-list-heading p, .section-intro { margin: 4px 0 0; color: var(--muted); }
.customer-list-heading > span { color: var(--primary); font-size: 22px; font-weight: 800; }
.customer-list-table td:nth-child(5) { min-width: 235px; white-space: normal; }
.inactive-customer-section { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.inactive-customer-section > summary { display: flex; align-items: center; gap: 10px; width: fit-content; color: var(--danger); cursor: pointer; font-size: 17px; font-weight: 800; }
.inactive-customer-section > summary strong { min-width: 26px; padding: 3px 8px; border-radius: 999px; background: var(--danger-bg); text-align: center; font-size: 12px; }
.inactive-customer-section .data-panel { margin-top: 12px; }
.customer-row-inactive td { background: #fffafa; }
.customer-hero-status { display: grid; justify-items: end; gap: 8px; }
.customer-status-form { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 16px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.customer-status-form p { max-width: 760px; margin: 4px 0 0; color: var(--muted); }

@media (max-width: 820px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; width: 100%; height: auto; padding: 10px 14px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; box-shadow: 0 4px 14px rgba(10,25,30,.14); }
  .brand { margin: 0; }
  .sidebar-footer { margin: 0; padding: 0; border: 0; display: flex; align-items: center; }
  .signed-in-user { display: none; }
  .sidebar nav { grid-column: 1 / -1; display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
  .sidebar .nav-group-label { display: none; }
  .sidebar .nav-item { flex: 0 0 auto; padding: 8px 10px; white-space: nowrap; }
  .sidebar-footer .button { min-height: 34px; padding: 6px 10px; }
  .content { padding: 20px 16px 48px; }
  .device-heading { grid-template-columns: 1fr; gap: 16px; }
  .device-due-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
  .field-label-spaced { margin-top: 0; }
  .partner-workload-grid { grid-template-columns: 1fr; }
  .partner-workload + .partner-workload { border-left: 0; border-top: 1px solid var(--border); }
  .planning-layout { grid-template-columns: 1fr; }
  .planning-form { border-left: 0; border-top: 1px solid var(--border); }
  .area-grid, .entity-grid { grid-template-columns: 1fr; }
  .quiet-panel { align-items: stretch; flex-direction: column; gap: 16px; }
  .quiet-panel .text-link { margin-left: 0; }
  .filter-bar, .assignment-row { grid-template-columns: 1fr; }
  .installed-filter { grid-template-columns: 1fr; align-items: stretch; }
  .tab-nav { top: 94px; flex-wrap: nowrap; overflow-x: auto; padding: 8px 0; }
  .tab-nav a { flex: 0 0 auto; white-space: nowrap; }
  .responsive-table { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: grid; gap: 10px; padding: 10px; }
  .responsive-table tr { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
  .responsive-table td { display: grid; grid-template-columns: minmax(105px, .42fr) minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800; }
  .responsive-table td.card-action::before, .responsive-table td[colspan]::before { display: none; }
  .responsive-table td.card-action { display: block; padding-top: 6px; border-top: 1px solid var(--border); }
  .case-table-wrap { border: 0; background: transparent; }
  .case-table { display: block; }
  .case-table thead { display: none; }
  .case-table tbody { display: grid; gap: 12px; }
  .case-table tr { display: grid; gap: 11px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
  .case-table td, .case-table td:nth-child(2), .case-table td:nth-child(6) { display: grid; grid-template-columns: minmax(112px, .38fr) minmax(0, 1fr); gap: 10px; min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .case-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800; }
  .case-row.selected td { background: transparent; }
  .case-row.selected { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
  .case-row.selected td:first-child { box-shadow: none; }
  .process-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-steps { grid-template-columns: 1fr; gap: 8px; }
  .workflow-steps li { grid-template-columns: 30px 1fr; padding: 0; }
  .workflow-steps li::after { top: 28px; bottom: -8px; left: 14px; right: auto; width: 2px; height: auto; }
  .selected-status { grid-template-columns: 1fr 1fr; }
  .selected-status .button { grid-column: 1 / -1; width: 100%; }
  .customer-status-form { align-items: stretch; flex-direction: column; }
  .customer-status-form .button { width: 100%; }
}

@media (max-width: 540px) {
  .content { padding: 16px 12px 40px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 30px; height: 30px; }
  .page-header, .customer-header, .section-heading, .detail-hero { align-items: stretch; flex-direction: column; }
  .customer-hero-status { justify-items: start; }
  .page-header .button, .section-heading .button { width: 100%; }
  .detail-hero { padding: 18px; }
  .summary-count, .device-count { white-space: nowrap; }
  .partner-actions, .due-grid, .inline-form, .filter-action-form, .form-grid { grid-template-columns: 1fr; }
  .facts-list { grid-template-columns: 1fr; }
  .case-filter-list > div { grid-template-columns: 1fr; gap: 3px; }
  .device-partner-suggestion { align-items: stretch; flex-direction: column; }
  .device-row { padding: 16px; }
  .device-due-dates { grid-template-columns: 1fr; gap: 3px; padding: 12px; background: var(--surface-muted); border-radius: 6px; }
  .device-due-dates .field-label-spaced { margin-top: 10px; }
  .filter-section-heading { align-items: stretch; flex-direction: column; }
  .filter-section-heading .button { width: 100%; }
  .installed-filter-main { display: grid; }
  .responsive-table td, .case-table td, .case-table td:nth-child(2), .case-table td:nth-child(6) { grid-template-columns: 1fr; gap: 3px; }
  .responsive-table td::before, .case-table td::before { margin-top: 4px; }
  .form-dialog { width: 100%; max-width: none; min-height: 100dvh; margin: 0; border-radius: 0; }
  .stack-form { padding: 20px 16px; }
  .confirmation-actions { grid-template-columns: 1fr; }
  .process-summary, .selected-status { grid-template-columns: 1fr; }
  .selected-status .button { grid-column: auto; }
  [data-standard-filter-options] { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}
