:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #17221d;
  --muted: #64736c;
  --line: #dbe4df;
  --green: #1f7a3f;
  --green-dark: #155c2e;
  --blue: #2368a2;
  --amber: #a96812;
  --red: #a83b33;
  --shadow: 0 18px 45px rgba(30, 48, 38, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.loading-screen,
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loading-screen {
  gap: 8px;
  color: var(--muted);
}

.loading-screen strong {
  color: var(--ink);
  font-size: 26px;
}

.login-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.login-logo {
  width: 156px;
  max-width: 72%;
  height: auto;
  margin: 0 auto 4px;
}

.sidebar-logo {
  width: 48px;
  height: 54px;
  flex: 0 0 48px;
}

.login-card h1 {
  margin-top: 18px;
  font-size: 32px;
  line-height: 1.05;
}

.login-card p,
.login-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  text-align: left;
  font-weight: 800;
}

.sidebar-nav button.active,
.sidebar-nav button:hover {
  background: #e8f4ec;
  color: var(--green-dark);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.offline-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid #d3a44c;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff8e7;
  color: #67490d;
}

.offline-banner span {
  font-size: 13px;
}

.topbar h1,
.portal-header h1 {
  font-size: 30px;
  line-height: 1.1;
}

.topbar p,
.portal-header p,
.panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar input {
  width: min(360px, 34vw);
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  line-height: 1.3;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.settings-board {
  display: block;
}

.setup-overview {
  margin-bottom: 16px;
}

.setup-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}

.setup-checklist > div {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.setup-checklist > div.done {
  border-color: #9acbab;
  background: #f0f8f2;
}

.setup-checklist span {
  grid-row: 1 / span 2;
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 900;
}

.setup-checklist strong,
.setup-checklist small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  margin-bottom: 16px;
  background: var(--bg);
}

.settings-tabs {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.settings-tabs button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.settings-tabs button:last-child {
  border-right: 0;
}

.settings-tabs button.active {
  background: #e4f4e8;
  color: var(--green-dark);
}

.settings-page [data-settings-group] {
  display: none;
}

.settings-page.settings-group-business [data-settings-group="business"],
.settings-page.settings-group-billing [data-settings-group="billing"],
.settings-page.settings-group-privacy [data-settings-group="privacy"],
.settings-page.settings-group-security [data-settings-group="security"] {
  display: block;
}

.legal-disclosures {
  width: min(680px, calc(100% - 32px));
  margin: 16px auto 0;
  color: var(--muted);
}

.legal-disclosures details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.legal-disclosures summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.legal-disclosures details > div {
  max-height: 42vh;
  overflow: auto;
  padding: 8px 4px 0;
}

.legal-disclosures section {
  margin-top: 12px;
}

.legal-disclosures p {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.compliance-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-left: 4px solid #a66a00;
  padding: 14px 16px;
  background: #fff8e8;
}

.compliance-alert.blocked {
  border-left-color: #a93030;
  background: #fff1f1;
}

.compliance-alert span,
.compliance-alert p,
.compliance-alert h2 {
  display: block;
  margin: 0;
}

.compliance-alert span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.compliance-fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 14px;
}

.compliance-fieldset legend {
  padding: 0 6px;
  font-weight: 900;
}

.billing-profile-summary,
.invoice-tax-summary,
.privacy-action {
  display: grid;
  gap: 6px;
  border-left: 4px solid #a66a00;
  padding: 12px 14px;
  background: #fff8e8;
}

.billing-profile-summary.ready,
.invoice-tax-summary {
  border-left-color: var(--green);
  background: #f0f8f2;
}

.billing-profile-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.billing-profile-summary span,
.invoice-tax-summary small,
.privacy-action span {
  color: var(--muted);
}

.privacy-action button {
  justify-self: start;
}

.section-tabs {
  display: inline-flex;
  max-width: 100%;
  margin-bottom: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-tabs button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 15px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.section-tabs button:last-child {
  border-right: 0;
}

.section-tabs button.active {
  background: #e4f4e8;
  color: var(--green-dark);
}

.create-panel {
  padding: 0;
}

.create-panel > summary {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

.create-panel > summary::-webkit-details-marker {
  display: none;
}

.create-panel > summary::after {
  content: "+";
  color: var(--green-dark);
  font-size: 24px;
  font-weight: 800;
}

.create-panel[open] > summary::after {
  content: "−";
}

.create-panel > summary span,
.create-panel > summary strong,
.create-panel > summary small {
  display: block;
}

.create-panel > summary small {
  margin-top: 4px;
  color: var(--muted);
}

.create-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.create-form {
  padding: 0 18px 18px;
}

.form-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-span {
  grid-column: 1 / -1;
}

.form-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-submit-row small {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.4;
}

.backup-note {
  margin-top: 12px;
}

.settings-actions {
  margin-top: 12px;
}

.settings-security-grid {
  margin-top: 16px;
}

.revenue-panel {
  margin-bottom: 18px;
}

.revenue-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.revenue-presets {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.revenue-presets button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 13px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
}

.revenue-presets button:last-child {
  border-right: 0;
}

.revenue-presets button.active {
  background: #e4f4e8;
  color: var(--green-dark);
}

.revenue-controls label {
  min-width: 156px;
}

.revenue-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.revenue-metrics > div {
  display: grid;
  gap: 5px;
  min-height: 106px;
  align-content: center;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.revenue-metrics > div:nth-child(3n) {
  border-right: 0;
}

.revenue-metrics > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.revenue-metrics span,
.revenue-metrics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.revenue-metrics strong {
  font-size: 23px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(30, 48, 38, 0.05);
}

.kpi-card {
  min-height: 112px;
  width: 100%;
  border: 1px solid var(--line);
  padding: 16px;
  color: var(--ink);
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.kpi-card:hover,
.kpi-card:focus-visible {
  border-color: #a9c8b2;
  box-shadow: 0 10px 26px rgba(30, 48, 38, 0.1);
  transform: translateY(-1px);
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.kpi-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.72fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.portal-deletion-alerts {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid #d8a44f;
  border-left: 4px solid #b77a13;
  border-radius: 6px;
  padding: 16px;
  background: #fffaf0;
}

.portal-deletion-alerts > header,
.portal-deletion-alerts article {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.portal-deletion-alerts > header span,
.portal-deletion-alerts article span {
  display: block;
}

.portal-deletion-alerts > header > div > span {
  color: #74500c;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-deletion-alerts h2 {
  margin: 3px 0;
  font-size: 18px;
}

.portal-deletion-alerts p,
.portal-deletion-alerts article span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.portal-deletion-alerts > div {
  display: grid;
  border-top: 1px solid #ead7b3;
}

.portal-deletion-alerts article {
  padding: 12px 0;
  border-bottom: 1px solid #ead7b3;
}

.portal-deletion-alerts article:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.dashboard-jobs,
.dashboard-tasks {
  min-width: 0;
}

.dashboard-job-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.dashboard-job-row {
  width: 100%;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto 92px;
  gap: 12px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.dashboard-job-row:hover,
.dashboard-job-row.selected {
  background: #f2f8f4;
}

.dashboard-job-row > span,
.dashboard-job-row small {
  display: block;
}

.dashboard-job-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-job-amount {
  text-align: right;
}

.mobile-field-day,
.mobile-nav,
.mobile-job-tools {
  display: none;
}

.field-job-list {
  display: grid;
  gap: 10px;
}

.field-job-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface);
}

.field-job-card.in_progress {
  border-color: #7eb0d4;
  box-shadow: inset 3px 0 0 var(--blue);
}

.field-job-time {
  display: grid;
  align-content: start;
  gap: 2px;
  color: var(--muted);
}

.field-job-time strong {
  color: var(--ink);
  font-size: 20px;
}

.field-job-time span,
.field-job-copy p,
.field-job-copy address {
  font-size: 12px;
}

.field-job-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.field-job-copy .status {
  width: fit-content;
}

.field-job-copy h3 {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.field-job-copy p,
.field-job-copy address {
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.field-job-copy address {
  font-style: normal;
}

.field-job-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field-job-actions > * {
  width: 100%;
}

.field-day-empty {
  display: grid;
  gap: 3px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
}

.field-day-empty strong {
  color: var(--ink);
}

.task-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.task-item div,
.task-item span,
.task-item strong,
.task-item small {
  display: block;
}

.task-item span,
.task-item small {
  color: var(--muted);
  font-size: 12px;
}

.task-item strong {
  margin: 3px 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.55fr);
  gap: 16px;
  align-items: start;
}

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

.panel.wide {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 19px;
  line-height: 1.2;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.text-btn,
.secondary-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.primary-btn {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

.secondary-btn,
.secondary-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
}

.danger-btn {
  border: 1px solid #e6b3ad;
  background: #fff5f4;
  color: var(--red);
}

.danger-btn:hover {
  background: #ffe9e6;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.text-btn {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  padding: 0 2px;
}

.full {
  width: 100%;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr[data-select-customer],
tr[data-select-job] {
  cursor: pointer;
}

tbody tr:hover,
tr.selected {
  background: #f2f8f4;
}

td small {
  color: var(--muted);
}

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf3ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.status.in_progress,
.status.portal_sent,
.status.sent {
  background: #e6f0fb;
  color: var(--blue);
}

.status.documented,
.status.draft,
.status.open {
  background: #fff3df;
  color: var(--amber);
}

.status.done,
.status.planned,
.status.ready,
.status.paid,
.status.delivered,
.status.externally_confirmed {
  background: #e4f4e8;
  color: var(--green-dark);
}

.status.failed,
.status.send_failed,
.status.bounced {
  background: #fbe8e6;
  color: var(--red);
}

.status.unpaid,
.status.partial,
.status.submitted,
.status.unknown,
.status.overdue {
  background: #fff3df;
  color: var(--amber);
}

.detail-card {
  display: grid;
  gap: 12px;
}

.detail-card h3 {
  font-size: 21px;
  line-height: 1.2;
}

.detail-card p,
.detail-card small,
.hint-line {
  color: var(--muted);
  line-height: 1.45;
}

.documentation-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.published-documentation {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-left: 3px solid #b7dfc0;
  background: var(--surface-soft);
}

.published-documentation > div {
  display: grid;
  gap: 3px;
}

.published-documentation span,
.published-documentation small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.published-documentation p {
  margin: 0;
  line-height: 1.45;
}

.inline-head {
  margin-bottom: 0;
}

.inline-head h3 {
  font-size: 17px;
}

.detail-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.detail-actions,
.button-row,
.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 0 12px;
}

.segmented-control button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 750;
}

.segmented-control button.active {
  border-color: var(--green);
  background: #e8f4ec;
  color: var(--green-dark);
}

.workflow-guide {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.workflow-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.workflow-head span {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 850;
}

.workflow-guide ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-guide li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.workflow-guide li > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.workflow-guide li div {
  display: grid;
  gap: 2px;
}

.workflow-guide li small {
  color: var(--muted);
  line-height: 1.35;
}

.workflow-guide li.done > span {
  border-color: #b7dfc0;
  background: #e4f4e8;
  color: var(--green-dark);
}

.workflow-guide li.current > span {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.workflow-guide li.pending {
  opacity: 0.64;
}

.delivery-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.delivery-steps > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.delivery-steps > div:last-child {
  border-right: 0;
}

.delivery-steps span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.delivery-callout {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1.55fr);
  gap: 14px;
  padding: 12px;
  border-left: 3px solid var(--green);
  background: var(--surface-soft);
}

.delivery-callout span {
  color: var(--muted);
  line-height: 1.45;
}

.delivery-callout b {
  color: var(--ink);
}

.process-details {
  margin-top: 12px;
}

.process-details summary {
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 800;
}

.process-details[open] summary {
  margin-bottom: 12px;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.photo-box {
  position: relative;
  min-height: 148px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ef;
}

.photo-box img {
  width: 100%;
  height: 100%;
  min-height: 148px;
  display: block;
  object-fit: cover;
}

.photo-box.empty::before {
  content: "Foto fehlt";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 850;
}

.photo-box figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 8px;
  padding: 5px 9px;
  background: rgba(18, 30, 24, 0.76);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.message-list {
  display: grid;
  gap: 10px;
}

.message-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.message-item.incoming {
  border-color: #efc077;
  background: #fffaf2;
}

.message-item strong,
.message-item span,
.message-item p {
  display: block;
}

.message-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.message-item p {
  margin-top: 8px;
  line-height: 1.4;
}

.message-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.empty-block {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #c8d5ce;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
}

.empty-block strong {
  color: var(--ink);
}

.invoice-preview,
.invoice-list {
  display: grid;
  gap: 8px;
}

.invoice-preview span,
.invoice-preview strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.invoice-preview strong {
  color: var(--green-dark);
}

.invoice-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.invoice-list > div small,
.invoice-list > div a {
  grid-column: 1 / -1;
}

.invoice-list > div small {
  color: var(--muted);
  line-height: 1.4;
}

.invoice-list > div a {
  justify-self: start;
}

.invoice-candidate-list {
  display: grid;
  gap: 10px;
}

.invoice-candidate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.invoice-candidate strong,
.invoice-candidate span {
  display: block;
}

.invoice-candidate span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.invoice-candidate.blocked {
  background: #fffaf1;
}

.invoice-dummy-card {
  display: grid;
  gap: 14px;
}

.invoice-dummy-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.invoice-logo {
  width: 54px;
  height: 60px;
  flex: 0 0 54px;
}

.invoice-dummy-head span,
.invoice-meta-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.invoice-dummy-head h3 {
  margin-top: 3px;
}

.invoice-dummy-head p,
.invoice-meta-grid small,
.invoice-lines small,
.invoice-disclaimer {
  color: var(--muted);
  line-height: 1.4;
}

.job-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.job-facts > div,
.delete-confirm,
.readiness-warning {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 12px;
  border-radius: 6px;
}

.job-facts span,
.job-facts strong,
.delete-confirm span {
  display: block;
}

.job-facts span,
.delete-confirm span {
  color: var(--muted);
  font-size: 0.82rem;
}

.edit-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.edit-panel summary {
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 800;
}

.edit-panel[open] summary {
  margin-bottom: 12px;
}

.delete-confirm {
  border-color: #e5b7b3;
  background: #fff7f6;
  display: grid;
  gap: 10px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.text-link {
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.readiness-warning {
  border-color: #e5c58d;
  background: #fffaf0;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-list > div {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(160px, 2fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.audit-list span,
.audit-list small {
  color: var(--muted);
}

.history-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.history-tools label {
  flex: 1;
}

.history-more {
  margin-top: 14px;
}

.history-count,
.process-empty {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.inline-process {
  margin-top: 10px;
}

.inline-process summary,
.process-history summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.compact-process-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.process-stack {
  display: grid;
  gap: 22px;
}

.process-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.process-summary > div {
  display: grid;
  gap: 4px;
}

.process-summary span,
.process-summary small {
  color: var(--muted);
  font-size: 12px;
}

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

.process-block + .process-block {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.process-block h3,
.process-history h4 {
  margin-bottom: 6px;
}

.process-block > p {
  color: var(--muted);
  line-height: 1.45;
}

.process-history {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

.process-history article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.process-history article > div,
.process-history article span,
.process-history article small {
  display: grid;
  gap: 3px;
}

.process-history article span,
.process-history article small {
  color: var(--muted);
  font-size: 12px;
}

.process-history article.voided {
  opacity: 0.72;
}

.success-note {
  display: grid;
  gap: 3px;
  margin-top: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--green-dark);
}

.success-note.attention {
  border-color: #d8a44f;
  color: #74500c;
}

.revision-list {
  display: grid;
  gap: 8px;
}

.revision-list > details {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.revision-list summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.revision-list summary span:first-child {
  display: grid;
  gap: 3px;
}

.revision-list summary small,
.revision-list summary > span:last-child {
  color: var(--muted);
}

.revision-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-left: 16px;
  border-left: 3px solid #dce9df;
}

.revision-grid > div {
  display: grid;
  grid-template-columns: minmax(140px, 0.5fr) minmax(0, 1.5fr);
  gap: 12px;
}

.revision-grid span {
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
}

.revision-grid del {
  color: var(--red);
}

.revision-grid ins {
  color: var(--green-dark);
  text-decoration: none;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.invoice-meta-grid div,
.invoice-open-list div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.invoice-lines {
  display: grid;
  gap: 8px;
}

.invoice-lines div,
.invoice-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.invoice-lines small {
  grid-column: 1;
}

.invoice-lines strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--ink);
}

.invoice-total {
  background: #eef8f0;
  color: var(--green-dark);
  font-weight: 900;
}

.invoice-open-list {
  display: grid;
  gap: 8px;
}

.invoice-open-list span {
  color: var(--muted);
  line-height: 1.35;
}

.invoice-disclaimer {
  padding: 10px;
  border: 1px solid #efc077;
  border-radius: 8px;
  background: #fffaf2;
}

.info-list {
  display: grid;
  gap: 12px;
}

.info-list div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.info-list span {
  color: var(--muted);
  line-height: 1.4;
}

.danger-zone {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e6b3ad;
  border-radius: 8px;
  background: #fff8f7;
}

.danger-zone p {
  color: var(--muted);
  line-height: 1.4;
}

.code-note {
  margin-top: 14px;
  border: 1px solid #b7dfc0;
  border-radius: 8px;
  padding: 12px;
  background: #f1fbf4;
  color: var(--green-dark);
}

.portal-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 22px 42px;
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.portal-report {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.portal-report + .portal-report {
  margin-top: 10px;
}

.portal-report-summary {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.portal-report-summary::-webkit-details-marker {
  display: none;
}

.portal-report-summary p {
  margin-top: 4px;
  color: var(--muted);
}

.portal-report-summary .status {
  align-self: flex-start;
}

.portal-report[open] .portal-report-summary {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.portal-report-body {
  display: grid;
  gap: 12px;
}

.portal-report-copy {
  display: grid;
  gap: 4px;
  border-left: 3px solid #b7dfc0;
  padding-left: 10px;
}

.portal-report-copy p {
  margin: 0;
  line-height: 1.45;
  white-space: pre-line;
}

.portal-message-form {
  margin-top: 0;
}

.portal-message-history {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.contact-list {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.contact-list a {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.contact-list a:last-child {
  border-bottom: 0;
}

.contact-list span {
  color: var(--green-dark);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: 380px;
  padding: 13px 15px;
  border-radius: 8px;
  background: #14231b;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.planner-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.planner-customers,
.planner-main {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.planner-customers {
  position: sticky;
  top: 20px;
  padding: 14px;
}

.planner-side-head,
.planner-toolbar > div:first-child {
  display: grid;
  gap: 4px;
}

.planner-side-head h2,
.planner-toolbar h2 {
  font-size: 19px;
}

.planner-side-head p,
.planner-toolbar p,
.planner-footnote {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.planner-customer-list {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.planner-customer {
  min-width: 0;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}

.planner-customer span,
.planner-customer small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planner-customer.selected {
  border-color: #77ad87;
  background: #e8f4ec;
  color: var(--green-dark);
}

.planner-main {
  overflow: hidden;
}

.planner-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.planner-exact-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.planner-exact-form label {
  min-width: 0;
}

.planner-exact-form input,
.planner-exact-form select {
  width: 100%;
}

.planner-exact-heading {
  grid-column: span 2;
  align-self: center;
  display: grid;
  gap: 3px;
}

.planner-exact-title {
  grid-column: span 5;
}

.planner-exact-heading span {
  color: var(--muted);
  font-size: 12px;
}

.planner-block-editor {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
}

.planner-block-editor > summary {
  cursor: pointer;
  color: var(--green-dark);
  font-weight: 800;
}

.planner-block-editor .planner-exact-form {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin: 10px -12px 8px;
  border-bottom: 0;
}

.planner-block-editor > small {
  color: var(--muted);
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
}

.calendar-day {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.calendar-day:last-child {
  border-right: 0;
}

.calendar-day.today {
  background: #f0f8f2;
}

.calendar-day > header {
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 3px 2px 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.calendar-day > header strong {
  color: var(--ink);
}

.calendar-appointments,
.calendar-slots {
  display: grid;
  gap: 6px;
}

.calendar-appointment {
  min-width: 0;
  display: grid;
  gap: 2px;
  border: 1px solid #b9d7c2;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  padding: 8px;
  background: #eff8f1;
  color: var(--ink);
  text-align: left;
}

.calendar-block {
  min-width: 0;
  display: grid;
  gap: 2px;
  border: 1px solid #d7c891;
  border-left: 4px solid #b68a26;
  border-radius: 6px;
  padding: 8px;
  background: #fff9e7;
  color: var(--ink);
}

.calendar-block.travel {
  border-color: #b8cadd;
  border-left-color: var(--blue);
  background: #f0f6fb;
}

.calendar-block.vacation {
  border-color: #d3b9b7;
  border-left-color: #a7524b;
  background: #fff4f3;
}

.calendar-block span,
.calendar-block small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.calendar-block .text-btn {
  justify-self: start;
  min-height: 30px;
  padding: 3px 0;
  font-size: 11px;
}

.calendar-appointment span,
.calendar-appointment small,
.calendar-appointment em {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.calendar-appointment.documented,
.calendar-appointment.portal_sent,
.calendar-appointment.done {
  border-color: #abc9df;
  border-left-color: var(--blue);
  background: #f0f6fb;
}

.calendar-slots {
  margin-top: 8px;
}

.calendar-slot {
  min-height: 38px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  border: 1px dashed #c6d3cb;
  border-radius: 6px;
  padding: 5px 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}

.calendar-slot strong {
  overflow: hidden;
  color: var(--green-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-slot:hover {
  border-color: var(--green);
  background: #eef8f0;
}

.planner-footnote {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.invoice-customer-groups,
.subscription-list,
.portal-subscription-list,
.portal-appointment-list {
  display: grid;
  gap: 10px;
}

.invoice-customer-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.invoice-group-head,
.subscription-row,
.portal-appointment {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.invoice-group-head > div,
.subscription-row > div:first-child,
.portal-appointment > div {
  display: grid;
  gap: 3px;
}

.invoice-group-head span,
.subscription-row small,
.portal-appointment span {
  color: var(--muted);
  font-size: 12px;
}

.appointment-response {
  grid-column: 1 / -1;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.appointment-response > summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.appointment-response.prominent {
  margin-top: 12px;
}

.appointment-response-state {
  margin: 8px 0;
  color: var(--muted);
}

.subscription-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.subscription-row .upcoming-price {
  color: var(--blue);
  font-weight: 800;
}

.invoice-candidate.selectable label {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.invoice-candidate.selectable label span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.invoice-candidate.selectable input {
  width: 20px;
  height: 20px;
}

.subscription-admin {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.subscription-row,
.portal-subscription-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.portal-subscription-card,
.portal-subscription-card > div {
  display: grid;
  gap: 8px;
}

.portal-subscription-card p,
.portal-subscription-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status.active {
  background: #e4f4e8;
  color: var(--green-dark);
}

.status.offered,
.status.paused {
  background: #fff3df;
  color: var(--amber);
}

.status.cancelled {
  background: #f0f1f0;
  color: var(--muted);
}

.portal-next .next-appointment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  align-items: center;
}

.next-appointment > span,
.next-appointment > small {
  color: var(--muted);
}

.next-appointment > strong {
  font-size: 24px;
}

.next-appointment > em {
  grid-column: 2;
  grid-row: 1 / span 3;
  font-style: normal;
}

.portal-appointment-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.portal-appointment-columns > section {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: start;
}

.portal-appointment-columns h3 {
  font-size: 15px;
}

.portal-appointment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.portal-appointment > div {
  min-width: 0;
}

.portal-appointment:last-child {
  border-bottom: 0;
}

.portal-appointment small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.appointment-more {
  display: block;
  padding-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.delete-confirm.neutral {
  border-color: #b7d3bf;
  background: #f1f8f3;
}

.photo-upload-zone {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 7px;
  border: 1px dashed transparent;
  border-radius: 8px;
}

.photo-upload-zone[data-photo-drop] {
  border-color: #c2d3c7;
}

.photo-upload-zone .photo-box {
  width: 100%;
}

.message-actions,
.message-reply,
.message-reply form {
  min-width: min(100%, 280px);
}

.message-reply summary {
  color: var(--green-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.invoice-draft-editor {
  display: grid;
  gap: 18px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.invoice-draft-form,
.correction-form {
  display: grid;
  gap: 14px;
}

.invoice-tax-grid,
.invoice-item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.invoice-draft-item {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.invoice-draft-item legend {
  padding: 0 6px;
  color: var(--green-dark);
  font-weight: 850;
}

.invoice-item-grid .item-description,
.invoice-item-grid .item-details {
  grid-column: span 2;
}

.invoice-item-grid .item-remove {
  align-self: end;
  min-height: 44px;
}

.draft-discard-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #e5b7b3;
}

.success-note.neutral {
  color: var(--ink);
}

.readiness-warning.compact {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #e5c58d;
  border-radius: 6px;
}

.photo-consent-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5faf6;
}

.photo-consent-block > div,
.photo-consent-block > small {
  display: grid;
  gap: 3px;
  color: var(--muted);
}

.photo-consent-block strong {
  color: var(--ink);
}

.photo-consent-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

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

@media (max-width: 1080px) {
  .planner-exact-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .planner-block-editor .planner-exact-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planner-exact-heading,
  .planner-exact-title {
    grid-column: span 2;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .sidebar-nav {
    display: flex;
    min-width: max-content;
  }

  .ghost-btn.full {
    width: auto;
    margin-left: auto;
  }

  .work-grid,
  .portal-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-column: auto;
  }

  .planner-layout {
    grid-template-columns: 1fr;
  }

  .planner-customers {
    position: static;
  }

  .planner-customer-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-week {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-day {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .portal-deletion-alerts > header,
  .portal-deletion-alerts article {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-deletion-alerts .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .invoice-tax-grid,
  .invoice-item-grid,
  .draft-discard-form,
  .photo-consent-form,
  .exception-grid {
    grid-template-columns: 1fr;
  }

  .invoice-item-grid .item-description,
  .invoice-item-grid .item-details {
    grid-column: auto;
  }

  button,
  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .danger-btn,
  .text-btn,
  .secondary-link,
  .calendar-slot {
    min-height: 44px;
  }

  .workspace,
  .portal-shell {
    padding: 16px;
  }

  .app-shell {
    display: block;
  }

  .app-shell .workspace {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .app-shell > .sidebar {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    min-height: calc(64px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(30, 48, 38, 0.1);
  }

  .mobile-nav > button,
  .mobile-nav-more > summary {
    min-width: 0;
    min-height: 50px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    padding: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1.15;
    text-align: center;
  }

  .mobile-nav > button.active,
  .mobile-nav-more.active > summary,
  .mobile-nav-more[open] > summary {
    background: #e8f4ec;
    color: var(--green-dark);
  }

  .mobile-nav > button span {
    min-width: 18px;
    min-height: 18px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    padding: 1px 5px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
  }

  .mobile-nav-more {
    position: relative;
  }

  .mobile-nav-more > summary {
    list-style: none;
    cursor: pointer;
  }

  .mobile-nav-more > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-nav-more > div {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: min(244px, calc(100vw - 20px));
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .mobile-nav-more > div button {
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    padding: 0 12px;
    background: var(--surface-soft);
    color: var(--ink);
    font-weight: 800;
    text-align: left;
  }

  .mobile-field-day {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    border: 1px solid #b9d7c1;
    border-radius: 8px;
    padding: 14px;
    background: #f6fbf7;
  }

  .mobile-field-day > header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
  }

  .mobile-field-day > header span,
  .mobile-field-day > header p {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
  }

  .mobile-field-day > header h2 {
    margin: 3px 0;
    font-size: 22px;
  }

  .mobile-field-day > header .text-btn {
    flex: 0 0 auto;
  }

  .mobile-job-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }

  .mobile-job-tools > * {
    width: 100%;
  }

  .dashboard-jobs {
    display: none;
  }

  .topbar,
  .portal-header,
  .panel-head,
  .message-item,
  .detail-title,
  .portal-report-summary,
  .planner-toolbar,
  .invoice-group-head,
  .subscription-row {
    flex-direction: column;
    align-items: stretch;
  }

  .subscription-actions {
    justify-items: stretch;
  }

  .topbar-actions,
  .form-row,
  .form-grid-two,
  .photo-strip,
  .invoice-meta-grid,
  .invoice-candidate,
  .job-facts,
  .audit-list > div,
  .process-grid,
  .process-summary,
  .compact-process-form,
  .revision-grid > div {
    grid-template-columns: 1fr;
    display: grid;
  }

  .planner-customer-list,
  .calendar-week,
  .portal-appointment-columns {
    grid-template-columns: 1fr;
  }

  .planner-exact-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planner-block-editor .planner-exact-form {
    grid-template-columns: 1fr;
  }

  .planner-exact-heading,
  .planner-exact-title,
  .planner-exact-form .primary-btn {
    grid-column: 1 / -1;
  }

  .calendar-day {
    border-right: 0;
  }

  .calendar-appointments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process-block + .process-block {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 20px;
    padding-left: 0;
  }

  .history-tools,
  .revision-list summary,
  .process-history article {
    align-items: stretch;
    flex-direction: column;
  }

  .form-span {
    grid-column: auto;
  }

  .form-submit-row,
  .delivery-callout {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .form-submit-row button {
    width: 100%;
  }

  .settings-toolbar,
  .workflow-head {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .compliance-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-tabs button {
    min-height: 52px;
    padding: 6px 8px;
    line-height: 1.2;
    white-space: normal;
  }

  .section-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .section-tabs button {
    min-height: 44px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }

  .section-tabs button:last-child {
    border-bottom: 0;
  }

  .delivery-steps {
    grid-template-columns: 1fr;
  }

  .revenue-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .revenue-presets {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .revenue-presets button {
    padding: 0 6px;
  }

  .revenue-controls label {
    min-width: 0;
  }

  .revenue-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .kpi-card {
    min-height: 98px;
    padding: 12px;
  }

  .kpi-card strong {
    margin: 7px 0 6px;
    font-size: 23px;
  }

  .kpi-card span,
  .kpi-card small {
    font-size: 11px;
  }

  .dashboard-job-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 12px 4px;
  }

  .dashboard-job-date {
    grid-column: 1;
    grid-row: 1;
  }

  .dashboard-job-row .status {
    grid-column: 2;
    grid-row: 1;
  }

  .dashboard-job-main {
    grid-column: 1;
    grid-row: 2;
  }

  .dashboard-job-amount {
    grid-column: 2;
    grid-row: 2;
  }

  .responsive-table {
    overflow: visible;
  }

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

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 10px;
  }

  .responsive-table tbody tr {
    display: grid;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
  }

  .responsive-table tbody tr.selected {
    border-color: #a9c8b2;
    background: #eef8f0;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 2px;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
  }

  .responsive-table td[data-label=""] {
    grid-template-columns: 1fr;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .responsive-table td[data-label=""]::before {
    display: none;
  }

  .responsive-table .table-actions {
    min-width: 0;
    display: grid;
    justify-items: stretch;
  }

  .responsive-table .table-actions .text-btn,
  .responsive-table .table-actions .text-link,
  .responsive-table td[data-label=""] .text-btn {
    min-height: 44px;
    justify-content: flex-start;
  }

  .revenue-metrics > div,
  .revenue-metrics > div:nth-child(3n),
  .revenue-metrics > div:nth-last-child(-n + 3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .revenue-metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .revenue-metrics > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .delivery-steps > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .delivery-steps > div:last-child {
    border-bottom: 0;
  }

  .topbar input {
    width: 100%;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px 12px;
    padding: 12px;
    overflow: visible;
  }

  .sidebar-brand strong {
    display: none;
  }

  .sidebar-nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 4px;
  }

  .sidebar-nav button {
    min-height: 44px;
    padding: 4px 6px;
    text-align: center;
    white-space: normal;
    font-size: 12px;
    line-height: 1.2;
  }

  .ghost-btn.full {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-left: 0;
  }

  .login-card {
    padding: 22px;
  }
}
