:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --panel: #ffffff;
  --ink: #171a19;
  --muted: #66706c;
  --line: #d9dfdc;
  --soft: #eef2ef;
  --filter-surface: #eef0ee;
  --filter-surface-line: #dde2df;
  --accent: #1b6f5b;
  --accent-2: #d8b45b;
  --danger: #b42318;
  --shadow: 0 12px 34px rgba(28, 35, 32, .08);
}

.document-edit-actions { display: inline-flex; position: relative; align-items: stretch; gap: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); vertical-align: middle; }
.document-edit-actions > button.ghost { margin: 0; border: 0; border-radius: 0; }
.document-edit-actions > button.ghost:first-child { border-radius: 6px 0 0 6px; }
.document-edit-actions > button.document-edit-toggle { min-width: 30px; padding-inline: 8px; border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; }
.document-edit-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; display: grid; gap: 5px; min-width: 150px; padding: 7px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.final-pdf-modal { z-index: 2500; }
.modal.final-pdf-modal .modal-card.final-pdf-card { width: min(1100px, 96vw); max-width: 96vw; height: 94vh; max-height: 94vh; display: flex; flex-direction: column; }
.final-pdf-pages { flex: 1; min-height: 0; overflow: auto; background: #dce1e4; padding: 12px; }
.final-pdf-pages img { display: block; width: 100%; height: auto; margin: 0 auto 12px; box-shadow: 0 2px 8px #0002; }
.final-pdf-metadata { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 10px; margin-bottom: 8px; }
.final-pdf-status:empty { display: none; }
.final-pdf-status { margin: 0 0 8px; }
@media (max-width: 700px) { .final-pdf-metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.final-pdf-card iframe { width: 100%; flex: 1; min-height: 240px; border: 1px solid var(--line); background: #e8ebed; }
.final-pdf-actions { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; flex-wrap: wrap; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.42 "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea {
  font: inherit;
}
button {
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  padding: 7px 11px;
  cursor: pointer;
  min-height: 32px;
  line-height: 1.1;
}
button:hover { filter: brightness(.96); }
button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
.readonly-disabled {
  cursor: not-allowed;
  opacity: .55;
}
body.role-worker .view#create,
body.role-worker .view#drivelog,
body.role-worker .view#finance,
body.role-worker .view#stats,
body.role-worker .view#exports,
body.role-worker .view#settings,
body.role-worker .worker-hidden {
  display: none !important;
}
button.ghost {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 11px;
  border-radius: 7px;
  text-decoration: none;
  line-height: 1.1;
}
.button-link.ghost {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 9px;
  outline: none;
}
textarea { resize: vertical; }
.date-picker-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  position: relative;
}
.date-picker-btn {
  min-width: 36px;
  padding: 7px 0;
}
.native-date-picker {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
label input, label select, label textarea {
  color: var(--ink);
  font-weight: 400;
  font-size: 13px;
}
#estimateForm .estimate-customer-grid input,
#estimateForm .estimate-customer-grid textarea {
  font-size: 14px;
}

#estimateForm .estimate-customer-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#estimateForm .estimate-customer-grid,
.case-filters,
.calendar-filters,
.finance-import,
.stats-filter,
.panel.stats-filter {
  background: var(--filter-surface);
  border-radius: 8px;
  box-shadow: 0 0 0 8px var(--filter-surface);
}

#estimateForm .estimate-customer-grid,
.case-filters,
.calendar-filters,
.finance-import {
  border: 1px solid var(--filter-surface-line);
}

.calendar-sync-help {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--filter-surface-line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: var(--filter-surface);
  color: var(--muted);
  font-size: 14px;
}

.calendar-sync-help strong {
  color: var(--text);
  font-size: 15px;
}

.calendar-sync-help b {
  color: var(--text);
}

#estimateForm .estimate-customer-grid input,
#estimateForm .estimate-customer-grid select,
#estimateForm .estimate-customer-grid textarea {
  padding: 7px 8px;
}
#estimateForm .estimate-customer-grid label {
  grid-column: span 1;
  gap: 0;
  font-size: 0;
}
#estimateForm .estimate-customer-grid label > input,
#estimateForm .estimate-customer-grid label > select,
#estimateForm .estimate-customer-grid label > textarea {
  font-size: 14px;
}
#estimateForm .estimate-customer-grid input::placeholder,
#estimateForm .estimate-customer-grid textarea::placeholder {
  color: #8a97a4;
  opacity: 1;
}

.delivery-address-panel {
  margin-top: 10px;
  border: 1px solid var(--filter-surface-line);
  border-radius: 8px;
  background: var(--filter-surface);
  padding: 9px 10px 11px;
}
.delivery-address-panel.wide {
  grid-column: 1 / -1;
}
.delivery-address-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}
.delivery-address-panel .delivery-toggle {
  margin: 8px 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.delivery-address-panel .delivery-toggle input {
  width: auto;
}
.delivery-address-panel .form-grid {
  margin-top: 8px;
}

.estimate-section {
  margin-top: 14px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  background: #f4f6f5;
  overflow: hidden;
}

.estimate-section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  background: #e4e8e6;
  border-bottom: 1px solid #d4dcda;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.estimate-section-title small {
  color: var(--muted);
  font-weight: 700;
}

.estimate-section > .form-grid,
.estimate-section > .estimate-note-warning-row,
.estimate-section > .quick-price-preview,
.estimate-section > .quick-grid,
.estimate-section > .labor-quick,
.estimate-section > .estimate-note-grid,
.estimate-section > .quick-create {
  margin: 12px;
}

.estimate-note-warning-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.estimate-note-warning-row .public-note-field,
.estimate-note-warning-row .private-warning-field {
  font-size: 0;
  gap: 0;
  padding: 8px;
  border-radius: 8px;
}

.public-note-field {
  background: #eefbf3;
  border: 2px solid #16a34a;
  box-shadow: inset 5px 0 0 #15803d;
  color: #14532d;
}

.private-warning-field {
  background: #fff1f2;
  border: 2px solid #dc2626;
  box-shadow: inset 5px 0 0 #b91c1c;
  color: #7f1d1d;
}

.public-note-field small,
.private-warning-field small {
  display: none;
}
.estimate-note-warning-row .public-note-field textarea,
.estimate-note-warning-row .private-warning-field textarea {
  font-size: 13px;
}
.estimate-note-warning-row .public-note-field textarea,
.estimate-note-warning-row .private-warning-field textarea {
  min-height: 54px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  background: #111413;
  color: #fff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.brand:hover,
.brand:focus-visible {
  background: #1d2521;
  border-color: #2a3933;
}
.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  background: #fff;
  border-radius: 7px;
}
.brand strong, .brand span { display: block; }
.brand span { color: #b8c1bd; font-size: 12px; }
nav { display: grid; gap: 6px; }
.nav {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #dfe5e2;
  border: 1px solid transparent;
}
.nav.active, .nav:hover {
  background: #202623;
  border-color: #323b37;
  color: #fff;
}
.sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid #2d3531;
  color: #aeb8b4;
  display: grid;
  gap: 2px;
  font-size: 12px;
}
.sidebar-foot strong { color: #fff; }
.shell {
  margin-left: 244px;
  padding: clamp(12px, 1.5vw, 24px);
  max-width: none;
  width: auto;
  overflow-x: hidden;
}
.topbar {
  max-width: none;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}
.topbar h1 {
  font-size: 24px;
  line-height: 1.1;
  margin: 0 0 5px;
}
.topbar p { margin: 0; color: var(--muted); }
.topbar > div:first-child {
  flex: 1 1 auto;
  min-width: 220px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 780px;
  min-width: 0;
}
.top-search-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
}
.top-search {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  color: var(--ink);
}
.top-search-suggestions {
  position: absolute;
  z-index: 100;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 5px;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.top-search-suggestions.hidden { display: none; }
.deadline-bell {
  position: relative;
  min-width: 46px;
  padding-inline: 12px;
}
.deadline-bell.has-deadlines {
  border-color: #d97706;
  background: #fff7e5;
}
.deadline-badge {
  position: absolute;
  top: -7px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #c91f1a;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.top-search-result {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(90px, auto);
  gap: 4px 10px;
  width: 100%;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
}
.top-search-result:hover,
.top-search-result:focus {
  background: #f4f8f8;
  border-color: var(--line);
}
.top-search-result small {
  grid-column: 1 / -1;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-search-result span {
  justify-self: end;
  color: #176b87;
}
.top-search-empty {
  padding: 8px 10px;
  color: var(--muted);
}
button.danger {
  background: var(--danger);
  color: #fff;
}
.view {
  display: none;
  max-width: none;
  width: 100%;
  min-width: 0;
}
.view.active { display: grid; gap: 14px; }
#settings.view.active { gap: 4px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}
#cases .panel {
  overflow: visible;
}
#calendar .calendar-panel,
#drivelog > .panel,
#finance > .panel,
#stats .panel.stats-filter,
.panel:has(.case-filters),
.panel:has(.calendar-filters),
.panel:has(.finance-import) {
  overflow: visible;
}
.muted {
  color: var(--muted);
  margin: 0;
}
.admin-panel {
  border-color: #d8b45b;
}
.document-text-bubbles {
  display: grid;
  gap: 4px;
}
.mail-template-bubbles {
  display: grid;
  gap: 4px;
}
.settings-bubble {
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  border-radius: 8px;
  background: #f8faf9;
  padding: 0;
  overflow: hidden;
}
.settings-bubble h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef3f1;
  font-size: 15px;
  color: #17202a;
}
.mail-template-bubbles .settings-bubble h4 {
  color: #13677b;
}
.settings-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.settings-section,
.settings-outer-section {
  border: 1px solid var(--line);
  border-left: 5px solid #59636b;
  border-radius: 8px;
  background: #f8faf9;
  overflow: hidden;
}
#settingsForm .settings-section,
#settingsForm .settings-bubble {
  margin-top: 5px;
}
#settingsForm.panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  overflow: visible;
}
#settingsForm > .panel-head {
  margin-bottom: 14px;
}
.settings-outer-section {
  padding: 0;
}
#settings .settings-collapsible {
  margin-top: 4px;
  margin-bottom: 4px;
  border-radius: 8px;
  overflow: hidden;
}
#settings .settings-section,
#settings .settings-bubble,
#settings .settings-outer-section {
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  background: #fff;
}
#settings .settings-outer-section,
#settings .settings-section {
  box-shadow: none;
}
#settings .settings-primary-section,
#settings .settings-footer-section,
#settings .settings-outer-section {
  border-left-color: #59636b;
}
.settings-outer-section > :not(summary),
.settings-footer-section > .footer-settings {
  margin: 0;
  padding: 12px;
  background: #fff;
}
.settings-outer-section > .panel-head {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f5f7f6;
}
.settings-footer-section > .footer-settings {
  border-top: 1px solid var(--line);
}
.settings-section + .settings-section,
.settings-outer-section + .settings-outer-section,
#settings .settings-collapsible + .settings-collapsible {
  margin-top: 4px;
}
.settings-section-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
  background: #eef3f1;
  color: #17202a;
  font-size: 15px;
  font-weight: 800;
  list-style: none;
}
.settings-section-summary span {
  grid-column: 1;
  text-align: left;
}
.settings-section-summary::-webkit-details-marker {
  display: none;
}
.settings-section-summary::marker {
  content: "";
}
.settings-section-summary::after {
  content: "";
  grid-column: 3;
  justify-self: end;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 3px solid #59636b;
  border-bottom: 3px solid #59636b;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.settings-summary-actions {
  grid-column: 2;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.settings-summary-actions .pill {
  align-self: center;
}
.settings-collapsible[open] > .settings-section-summary::after {
  transform: rotate(-135deg);
}
.settings-section-summary small {
  grid-column: 1 / -1;
  justify-self: start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.settings-major-title,
.settings-group-title {
  margin: 3px 0 2px;
  padding: 4px 2px 4px;
  border: 0;
  border-bottom: 2px solid #cfd8d4;
  border-radius: 0;
  background: transparent !important;
  color: #c81e1e;
  font-size: 16px;
  font-weight: 900;
  text-align: left;
}
#settingsForm > h3.settings-major-title,
#settingsForm > h3.settings-group-title {
  display: block;
  margin: 3px 0 2px;
  padding: 4px 2px 4px;
  border: 0;
  border-bottom: 2px solid #cfd8d4;
  border-radius: 0;
  background: transparent !important;
  color: #c81e1e;
  font-size: 16px;
  font-weight: 900;
  text-align: left;
}
.settings-group-title {
  border-left: 0;
}
.settings-major-title {
  border-left: 0;
}
.settings-primary-section {
  border-left-color: #59636b;
}
.settings-primary-section > .settings-section-summary {
  background: #eef3f1;
  font-size: 15px;
}
.settings-group-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 3px 0 2px;
  padding: 4px 2px 4px;
  border: 0;
  border-bottom: 2px solid #cfd8d4;
  border-radius: 0;
  background: transparent !important;
}
.settings-group-title-row h3 {
  grid-column: 1;
  justify-self: start;
  font-size: 16px;
  font-weight: 900;
}
.settings-group-title-row button {
  grid-column: 2;
  justify-self: end;
}
#settingsForm > h3 {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid #59636b;
  border-radius: 8px 8px 0 0;
  background: #eef0ee;
  font-size: 15px;
}
#settingsForm > h3 + .form-grid,
.settings-section > .form-grid,
.settings-bubble .form-grid {
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
  overflow: hidden;
}
.settings-bubble .form-grid {
  border: 0;
  border-radius: 0;
}
#settingsForm > h3 + .form-grid label,
.settings-section > .form-grid label,
.settings-bubble .form-grid label {
  gap: 7px;
  min-height: 58px;
  padding: 10px 12px;
  border-right: 1px solid #e1e6e3;
  border-bottom: 1px solid #e1e6e3;
  background: #fff;
}
#settingsForm > h3 + .form-grid label:nth-child(4n),
.settings-section > .form-grid label:nth-child(4n),
.settings-bubble .form-grid label:nth-child(4n) {
  border-right: 0;
}
#settingsForm > h3 + .form-grid.compact label:nth-child(4n),
.settings-section > .form-grid.compact label:nth-child(4n),
.settings-bubble .form-grid.compact label:nth-child(4n) {
  border-right: 1px solid #e1e6e3;
}
#settingsForm > h3 + .form-grid.compact label:nth-child(6n),
.settings-section > .form-grid.compact label:nth-child(6n),
.settings-bubble .form-grid.compact label:nth-child(6n) {
  border-right: 0;
}
#settingsForm > h3 + .form-grid label.wide,
.settings-section > .form-grid label.wide,
.settings-bubble .form-grid label.wide {
  border-right: 0;
}
#settingsForm > h3 + .form-grid input,
#settingsForm > h3 + .form-grid select,
#settingsForm > h3 + .form-grid textarea,
.settings-section > .form-grid input,
.settings-section > .form-grid select,
.settings-section > .form-grid textarea,
.settings-bubble .form-grid input,
.settings-bubble .form-grid select,
.settings-bubble .form-grid textarea {
  background: #fbfcfc;
}
.inline-copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.inline-copy-field input {
  min-width: 0;
}
#networkShareHint {
  padding: 0 12px 12px;
  border-bottom: 1px solid #e1e6e3;
}
#settingsForm > .footer-settings + .form-grid {
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
#settingsForm > .footer-settings + .form-grid label {
  min-height: 58px;
  padding: 10px 12px;
  border-right: 1px solid #e1e6e3;
  border-bottom: 1px solid #e1e6e3;
  background: #fff;
}
#settingsForm > .footer-settings + .form-grid label:nth-child(4n) {
  border-right: 0;
}
#settingsForm > .footer-settings + .form-grid input {
  background: #fbfcfc;
}
.settings-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.settings-title-row h3 { margin: 0; }
.settings-group-bubble {
  margin-top: 4px;
  margin-bottom: 4px;
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.settings-group-bubble-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef3f1;
  cursor: pointer;
  list-style: none;
}
.settings-group-bubble-title::-webkit-details-marker {
  display: none;
}
.settings-group-bubble-title::marker {
  content: "";
}
.settings-group-bubble-title::after {
  content: "";
  grid-column: 2;
  justify-self: end;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 3px solid #59636b;
  border-bottom: 3px solid #59636b;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.settings-group-bubble:not([open]) > .settings-group-bubble-title {
  border-bottom: 0;
}
.settings-group-bubble[open] > .settings-group-bubble-title::after {
  transform: rotate(-135deg);
}
.settings-group-bubble-title strong {
  grid-column: 1;
  justify-self: start;
  font-size: 16px;
  font-weight: 900;
  color: #17202a;
}
.settings-group-action {
  grid-column: 2;
  justify-self: end;
  margin-right: 24px;
}
.settings-group-bubble-body {
  display: grid;
  gap: 0;
  background: #eef3f1;
}
.settings-group-bubble-body > .settings-collapsible {
  margin: 0 !important;
  border: 0;
  border-left: 5px solid #176b87;
  border-radius: 0;
  box-shadow: none;
}
.settings-group-bubble-body > .settings-collapsible + .settings-collapsible {
  border-top: 1px solid var(--line);
}
.settings-group-bubble-body > .settings-collapsible > .settings-section-summary {
  border-radius: 0;
}
.settings-group-bubble-body > .settings-outer-section > :not(summary) {
  padding: 12px;
}
.settings-activity-panel {
  padding: 0;
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.settings-activity-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: #eef3f1;
  border-left: 0;
  list-style: none;
}
.settings-activity-summary h2 {
  margin: 0;
  font-size: 16px;
}
.settings-activity-summary small {
  color: var(--muted);
  font-weight: 700;
}
.settings-activity-summary::-webkit-details-marker {
  display: none;
}
.settings-activity-summary::marker {
  content: "";
}
.settings-activity-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 3px solid #59636b;
  border-bottom: 3px solid #59636b;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.settings-activity-panel[open] .settings-activity-summary::after {
  transform: rotate(-135deg);
}
.settings-group-bubble-body > .settings-activity-panel {
  margin: 0 !important;
  border: 0;
  border-left: 5px solid #176b87;
  border-radius: 0;
  box-shadow: none;
}
.settings-activity-panel > .settings-activity-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
  border-left: 0;
  background: #eef3f1;
}
.settings-activity-panel > .settings-activity-summary::after {
  content: "";
  grid-column: 2;
  justify-self: end;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 3px solid #59636b;
  border-bottom: 3px solid #59636b;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.settings-activity-panel[open] > .settings-activity-summary::after {
  transform: rotate(-135deg);
}
.settings-activity-summary small {
  display: inline;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.settings-activity-table-wrap {
  overflow-x: hidden;
  background: #fff;
}
.settings-activity-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) minmax(180px, 240px);
  gap: 8px;
  padding: 12px;
  background: #f5f7f6;
  border-top: 1px solid var(--line);
}
.settings-activity-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}
.settings-activity-table th,
.settings-activity-table td {
  padding: 7px 8px;
  border-top: 1px solid #e1e6e3;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  line-height: 1.25;
}
.settings-activity-table th {
  background: #f5f7f6;
  color: #39433f;
  font-size: 12px;
}
.settings-activity-table th:first-child,
.settings-activity-table td:first-child {
  width: 125px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
}
.settings-activity-table th:nth-child(2),
.settings-activity-table td:nth-child(2) {
  width: 95px;
  word-break: break-word;
}
.settings-activity-table th:nth-child(3),
.settings-activity-table td:nth-child(3) {
  width: 190px;
}
.settings-activity-table td:nth-child(4) {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.settings-activity-table small {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}
.settings-activity-table tr.is-muted {
  opacity: 0.6;
}
.settings-activity-table button:disabled {
  cursor: default;
  opacity: 0.65;
}
.item-locks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 9px 10px;
  margin: 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  color: var(--muted);
}
.item-locks span {
  font-weight: 700;
  color: var(--ink);
}
.item-locks label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}
.item-locks input {
  width: auto;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h2, .subhead h3 {
  margin: 0;
  font-size: 16px;
}
.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kpis div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.kpis strong { font-size: 23px; }
.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(0, 1.5fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px;
  color: #f8fbfc;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 203, 107, .42), transparent 28%),
    linear-gradient(135deg, #0d4f5d 0%, #176b87 42%, #12805f 100%);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(23, 107, 135, .22);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto -70px -80px auto;
  width: 240px;
  height: 240px;
  background: rgba(255, 255, 255, .15);
  transform: rotate(26deg);
  border-radius: 48px;
  animation: dashboardFloat 7s ease-in-out infinite;
}
.dashboard-eyebrow {
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #d8f7ef;
}
.dashboard-hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
}
.dashboard-hero p:last-child {
  margin: 8px 0 0;
  color: #e4f4f2;
}
.dashboard-status-rail {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.dashboard-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px;
  text-align: left;
  color: #eef8f7;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px;
  backdrop-filter: blur(6px);
}
.dashboard-step span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  font-weight: 800;
}
.dashboard-step.active {
  color: #0d1b1e;
  background: #fff7d7;
  border-color: #ffd166;
  transform: translateY(-1px);
}
.dashboard-step.active span {
  background: #176b87;
  color: #fff;
}
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(340px, .95fr);
  gap: 16px;
  align-items: start;
}
.dashboard-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.dashboard-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.dashboard-actions button {
  width: 100%;
}
.dashboard-actions button:first-child {
  background: #176b87;
}
.dashboard-panel-accent {
  border-top: 4px solid #16a085;
}
.dashboard-compact-list {
  display: grid;
  gap: 8px;
}
.dashboard-mini-card,
.dashboard-task,
.dashboard-empty {
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
}
.dashboard-mini-card {
  display: grid;
  grid-template-columns: 150px minmax(120px, .45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.dashboard-mini-card:hover,
.dashboard-task:hover,
.dashboard-case-row:hover {
  border-color: #9ad8cf;
  box-shadow: 0 8px 22px rgba(23, 107, 135, .12);
  transform: translateY(-1px);
}
.dashboard-mini-card span,
.dashboard-mini-card small,
.dashboard-task span,
.dashboard-task small {
  color: var(--muted);
}
.dashboard-mini-card strong,
.dashboard-task strong {
  color: var(--ink);
}
.dashboard-appointment-time {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 96px;
  line-height: 1.2;
}
.dashboard-appointment-time b {
  display: block;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.dashboard-appointment-time em {
  display: block;
  color: var(--muted);
  font-style: normal;
  white-space: nowrap;
}
.dashboard-mini-card.type-montage { border-left-color: #2e8f43; }
.dashboard-mini-card.type-aufmass { border-left-color: #176b87; }
.dashboard-mini-card.type-beratung { border-left-color: #6b5fd3; }
.dashboard-mini-card.type-nacharbeit { border-left-color: #d88921; }
.dashboard-task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.dashboard-task {
  display: grid;
  gap: 3px;
  border-left-color: #bac7c3;
}
.dashboard-task.active {
  background: #fffaf0;
  border-left-color: #d88921;
}
.dashboard-empty {
  display: grid;
  place-items: center start;
  color: var(--muted);
  border-left-color: #bac7c3;
}
.dashboard-case-row {
  width: 100%;
  color: var(--ink);
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.dashboard-case-content {
  min-width: 0;
}
.dashboard-case-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.dashboard-case-title .pill {
  margin-left: 2px;
}
.doc-number-chain {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
}
.doc-number-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.doc-number-icon {
  display: inline-block;
  line-height: 1;
}
.doc-number-separator {
  color: var(--muted);
  font-weight: 700;
}
.doc-token-kv-skipped {
  color: #808986;
}
.doc-token-warning {
  color: #b66a00;
}
.doc-token-final {
  color: #b91c1c;
}
.dashboard-case-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.dashboard-case-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.dashboard-case-row:hover {
  background: #f8fbfc;
}

.dashboard-case-overview {
  grid-template-columns: 22px 42px minmax(180px, .9fr) minmax(260px, 1.6fr);
  width: 100%;
  cursor: pointer;
}

.dashboard-case-overview .case-status-strip {
  min-height: 74px;
}

.dashboard-case-overview .case-card-docs {
  align-content: center;
}

.dashboard-case-note {
  flex-basis: 100%;
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-case-overview:hover {
  background: #f8fbff;
  border-color: #cfe0f4;
}
@keyframes dashboardFloat {
  0%, 100% { transform: translateY(0) rotate(26deg); }
  50% { transform: translateY(-12px) rotate(30deg); }
}
.dashboard-calendar-stack {
  display: grid;
  gap: 14px;
}
.dashboard-month {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dashboard-month-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: #176b87;
}
.dashboard-month-head span {
  color: var(--muted);
  font-weight: 400;
}
.dashboard-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.dashboard-weekday {
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.dashboard-day {
  min-height: 58px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.dashboard-day.outside {
  background: #fafafa;
  color: #9aa5ad;
}
.dashboard-day-number {
  font-weight: 700;
  line-height: 1;
}
.dashboard-calendar-event {
  display: block;
  margin-top: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: #d9eef8;
  color: #17202a;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1180px) {
  .dashboard-hero,
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-status-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .dashboard-task-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .dashboard-hero {
    padding: 14px;
  }
  .dashboard-hero h2 {
    font-size: 22px;
  }
  .dashboard-status-rail,
  .dashboard-task-grid,
  .dashboard-actions {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-mini-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
}
.stat-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.stat-kpi {
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 58px;
  box-shadow: none;
}
.stat-kpi span,
.stat-kpi small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.stat-kpi strong {
  display: block;
  margin: 4px 0 2px;
  font-size: 18px;
  line-height: 1.12;
  color: #17202a;
}
@media (max-width: 1500px) {
  .stat-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 9px;
  }
  .stat-kpi {
    padding: 7px 9px;
    min-height: 54px;
  }
  .stat-kpi span,
  .stat-kpi small {
    font-size: 11px;
  }
  .stat-kpi strong {
    margin: 3px 0 1px;
    font-size: 17px;
    line-height: 1.15;
  }
}
.stats-filter {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
}
.stats-filter label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: var(--muted);
}
.stats-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  align-items: center;
}
.stats-tab {
  background: #eef3f1;
  color: var(--ink);
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid #d8e1dd;
  font-size: 13px;
  font-weight: 700;
}
.stats-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.stats-pane {
  display: none;
}
.stats-pane.active {
  display: block;
}
.stat-bars {
  display: grid;
  gap: 8px;
}
.stat-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) minmax(72px, auto);
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.stat-bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}
.stat-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.stat-pie-wrap {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.stat-pie {
  width: 140px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.combo-bars {
  display: grid;
  gap: 9px;
}
.combo-row {
  display: grid;
  grid-template-columns: 72px minmax(90px, 1fr) 58px minmax(90px, 1fr) 92px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.combo-track {
  height: 11px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}
.combo-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.money-combo-bars {
  display: grid;
  gap: 8px;
}
.money-combo-row {
  display: grid;
  grid-template-columns: 72px 18px minmax(90px, 1fr) 86px 18px minmax(90px, 1fr) 86px 18px minmax(90px, 1fr) 86px;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}
.money-combo-row small {
  color: var(--muted);
  text-align: right;
}
.stat-kpi.inline {
  margin-bottom: 10px;
}
.stat-note {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}
#appointmentStats h4 {
  margin: 8px 0 6px;
  color: #13677b;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.danger-zone {
  margin: 18px 16px 20px;
  padding: 20px 22px;
  border: 1px solid #f0c8c3;
  border-left: 6px solid #b42318;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffafa, #fff6f4);
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.03);
}
.danger-zone h3 {
  margin: 0 0 8px;
  color: #8f1d14;
}
.danger-zone p {
  max-width: 1320px;
  margin: 0 0 14px;
  line-height: 1.45;
}
.danger-zone .danger {
  margin-top: 2px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.form-grid.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
.field-label-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 14px;
  line-height: 14px;
  width: 100%;
  max-width: 100%;
}
.settings-info-button {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  min-height: 13px;
  min-width: 13px;
  max-width: 13px;
  max-height: 13px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #9fb2b8;
  background: transparent;
  color: #176b87;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  appearance: none;
  cursor: help;
  flex: 0 0 13px;
}
.settings-info-button:hover,
.settings-info-button:focus-visible {
  background: #e9f5f7;
  border-color: #176b87;
}
.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}
.items { display: grid; gap: 8px; }
.estimate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
#savePreviewEstimateBtn {
  background: var(--accent);
}
#saveDirectOfferBtn.offer-direct-btn {
  background: #f28c28;
  border-color: #d97816;
  color: #fff;
}
.quick-box {
  margin-top: 14px;
  overflow-anchor: none;
}
.quick-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.section-title-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.section-title-actions h3 {
  margin: 0;
}
.estimate-note-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}
.estimate-note-box.estimate-section {
  padding: 0;
  background: #f4f6f5;
}
.estimate-note-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.estimate-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
}
.estimate-note-grid section {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.estimate-note-grid h4 {
  margin: 0 0 8px;
  color: var(--accent);
}
.estimate-note-options {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.estimate-note-options label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f7;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}
.estimate-note-options label:hover {
  border-color: var(--accent);
  background: #eef8fb;
}
.estimate-note-options input {
  width: auto;
  margin-top: 2px;
  flex: 0 0 auto;
}
.estimate-note-grid textarea {
  width: 100%;
  min-height: 58px;
}
.estimate-notes-summary {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.estimate-notes-summary strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}
.estimate-notes-summary ul {
  margin: 0;
  padding-left: 18px;
}
.estimate-notes-summary li {
  margin: 3px 0;
  line-height: 1.35;
}

.labor-quick {
  display: grid;
  gap: 10px;
}

.labor-quick h4 {
  margin: 0 0 10px;
}

.labor-summary {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-left: 6px solid var(--accent);
  background: #eaf6f8;
  border-radius: 8px;
}

.labor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.labor-group {
  display: grid;
  gap: 8px;
  align-content: start;
}

.labor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 74px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
}

.labor-row input[type="number"] {
  min-width: 0;
}
.quick-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}
.quick-travel-credit-option {
  margin-left: 14px;
  padding: 9px 12px;
  border: 1px solid #bfd7dd;
  border-radius: 6px;
  background: #eef7f9;
  color: #176b87;
}
.estimate-accessory-section > .quick-create.accessory-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 16px 24px;
  padding: 16px 4px 4px;
}
.accessory-create > .quick-accessory-price {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}
.accessory-create > #addAccessoryPositionBtn { grid-column: 1; grid-row: 2; justify-self: start; min-height: 40px; padding: 10px 16px; }
.quick-accessory-price #quickRequiredPriceHint { grid-column: 1 / -1; min-height: 0; padding: 0; gap: 8px; font-size: 13px; font-weight: 600; }
.quick-accessory-price #quickRequiredPriceHint strong { color: var(--ink); font-size: 20px; font-weight: 700; }
.estimate-accessory-section .quick-accessory-price .quick-travel-credit-option { grid-column: 1 / -1; margin: 0; padding: 4px 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 500; }
.quick-accessory-price #accessoryTravelCredit { accent-color: var(--accent); }
.quick-accessory-price #quickAccessoryDiscountHint { color: var(--accent); font-size: 13px; font-weight: 600; }
.quick-accessory-price #quickAccessoryDiscountHint:empty { display: none; }
.quick-accessory-price [data-quick-discount-edit] { padding: 5px 9px; min-height: 28px; font-size: 12px; }
@media (max-width: 700px) {
  .estimate-accessory-section > .quick-create.accessory-create { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .accessory-create > #addAccessoryPositionBtn { grid-column: 1; grid-row: 2; width: 100%; }
}
.quick-discount-modal { z-index: 2600; }
.modal.quick-discount-modal .quick-discount-card { width: min(480px, 94vw); }
.quick-discount-error { color: var(--danger); }
.quick-option input {
  width: auto;
}
.quick-price-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 8px;
  background: #eef8fb;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.quick-price-preview strong {
  color: #13677b;
}
.quick-price-main,
.quick-rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.quick-rule {
  border: 1px solid #cfe0e4;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 3px 8px;
}
.quick-rule.fixed {
  border-color: #176b87;
  color: #13677b;
  font-weight: 700;
}
.quick-rule.surcharge {
  border-color: #d8b05d;
  color: #7a5710;
  font-weight: 700;
}
.quick-price-preview em {
  color: #a35b00;
  font-style: normal;
  font-weight: 700;
}
.quick-required-price {
  display: grid;
  grid-template-columns: minmax(180px, 420px) minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px 10px;
  margin: 8px 0;
}
.quick-required-price label {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.quick-required-price input {
  height: 36px;
  font-size: 15px;
  font-weight: 700;
}
.quick-manual-result {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
}
.quick-manual-result span {
  font-size: 13px;
  font-weight: 700;
}
.quick-manual-result strong {
  color: #13677b;
  font-size: 16px;
}
.quick-manual-choice {
  display: grid;
  gap: 8px;
  width: 100%;
}
.quick-manual-choice label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.quick-manual-choice input[type="radio"] {
  width: 16px;
  height: 16px;
}
.quick-manual-calc {
  display: block;
}
.quick-manual-custom input[type="text"],
.quick-manual-custom input:not([type]) {
  width: 120px;
  max-width: 100%;
  height: 30px;
  font-size: 13px;
  font-weight: 800;
}
.quick-manual-final {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.quick-bottom-price-hint {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}
.quick-required-price span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.quick-rule.manual {
  border-color: #15803d;
  color: #15803d;
  font-weight: 800;
}
.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}
.quick-main-fields {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}
.quick-wizard {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}
.quick-wizard-step {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.quick-wizard-step.active {
  border-color: #8bc4d1;
  background: #fff;
  box-shadow: inset 4px 0 0 var(--accent);
}
.quick-wizard-step.complete:not(.active) {
  background: #ecfdf3;
  border-color: #16a34a;
  box-shadow: inset 5px 0 0 #15803d;
}
.quick-wizard-head {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.quick-wizard-head span {
  color: #4b5c58;
  font-weight: 800;
}
.quick-wizard-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-wizard-check {
  display: none;
  justify-self: end;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #15803d;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}
.quick-wizard-step.complete .quick-wizard-check {
  display: inline-flex;
}
.quick-wizard-panel {
  border-top: 1px solid var(--line);
  padding: 10px;
  background: #fff;
}
.quick-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.quick-room-panel,
.quick-fabric-panel {
  display: grid;
  gap: 10px;
}
.quick-fabric-panel {
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
}
.quick-col {
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: #fff;
  display: grid;
  align-content: start;
  gap: 6px;
}
.quick-col h4 {
  margin: 0;
  font-size: 13px;
}
.quick-col h4 small {
  color: var(--muted);
  font-weight: 600;
}
.quick-col-wide {
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.quick-col-wide h4 {
  grid-column: 1 / -1;
}
.quick-col-wide > small {
  grid-column: 1 / -1;
}
.quick-item {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  gap: 2px;
  text-align: left;
  background: #fbfcfc;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 6px 8px;
}
.quick-wizard-step.active .quick-item {
  border-color: #f2bd5d;
  background: #fff5dc;
  box-shadow: inset 4px 0 0 #f6a400;
}
.quick-wizard-step.active .quick-item:hover,
.quick-wizard-step.active .quick-item:focus-visible {
  border-color: #d97706;
  background: #ffedc2;
  outline: none;
}
.quick-item.selected {
  border-color: #16a34a;
  background: #dcfce7;
  box-shadow: inset 4px 0 0 #15803d;
}
.quick-wizard-step.active .quick-item.selected {
  border-color: #16a34a;
  background: #dcfce7;
  box-shadow: inset 4px 0 0 #15803d;
}
.quick-item strong {
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.quick-item span {
  color: #53625d;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.quick-room-extra {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  font-size: 13px;
}
.quick-create {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
  padding-top: 0;
  border-top: 1px solid #d7dfdd;
  padding-top: 12px;
}
.estimate-accessory-section {
  margin: 0;
  background: #f7f8f8;
}
.estimate-accessory-section .quick-option {
  margin: 12px 12px 0;
}
.quick-accessory-grid {
  display: grid;
  gap: 10px;
  margin: 12px;
}
.quick-accessory-grid .quick-col {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.quick-accessory-grid .quick-col h4 {
  display: none;
}
.quick-accessory-grid .quick-col > small {
  grid-column: 1 / -1;
}
.item-row {
  display: grid;
  gap: 9px;
  padding: 12px;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}
.item-main,
.item-detail {
  display: grid;
  gap: 8px;
}
.item-main {
  grid-template-columns: minmax(118px, 1fr) minmax(92px, .75fr) minmax(170px, 1.35fr) minmax(118px, 1fr) minmax(58px, .45fr) minmax(70px, .55fr) minmax(84px, .65fr) 42px;
}
.item-detail {
  grid-template-columns: minmax(76px, .45fr) minmax(76px, .45fr) minmax(112px, .75fr) minmax(132px, .95fr) minmax(150px, 1.05fr) minmax(150px, max-content);
}
.item-main input,
.item-main select,
.item-detail input,
.item-detail textarea {
  min-height: 38px;
  font-size: clamp(12px, .9vw, 14px);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.item-detail textarea {
  resize: vertical;
}
.item-row.service-item .item-main {
  grid-template-columns: minmax(170px, 1.7fr) minmax(72px, .35fr) minmax(82px, .45fr) minmax(92px, .5fr) 42px;
}
.item-row.service-item .item-main [name="element_type"],
.item-row.service-item .item-main [name="wing_type"],
.item-row.service-item .item-main [name="room"] {
  display: none;
}
.item-row.service-item .item-detail {
  grid-template-columns: minmax(220px, 1fr) max-content minmax(82px, max-content);
  align-items: center;
}
.item-row.service-item .item-detail [name="room"],
.item-row.service-item .item-detail [name="width"],
.item-row.service-item .item-detail [name="height"],
.item-row.service-item .item-detail [name="color"],
.item-row.service-item .item-detail [name="mounting_note"] {
  display: none;
}
.item-tools {
  display: grid;
  grid-template-columns: repeat(2, 38px);
  gap: 5px;
  align-items: stretch;
  justify-content: end;
  min-width: 0;
}
.item-tools button {
  min-width: 0;
  min-height: 34px;
  padding: 5px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-tools [data-item-copy] {
  display: none;
}
.item-row .remove-item {
  background: #bf2118;
  border: 1px solid #bf2118;
  color: #fff;
  padding: 0;
  font-weight: 800;
  font-size: 16px;
}
.credit-item {
  border-left-color: #0f766e;
  background: #f6fbfa;
}
.credit-line {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(190px, 1fr) minmax(90px, 120px) minmax(130px, 160px) minmax(130px, 160px) 42px;
  gap: 8px;
  align-items: end;
}
.credit-line strong {
  align-self: center;
  font-size: 16px;
}
.credit-line label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.credit-line input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
}
.credit-line input[readonly] {
  background: #eef5f1;
  color: #8f1d14;
  font-weight: 800;
}
.estimate-live-total {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.estimate-live-total strong {
  color: #13677b;
  font-size: 16px;
}
.list, .case-list {
  display: grid;
  gap: 8px;
}
.case-filters {
  display: grid;
  gap: 8px;
  margin: 4px 0 14px;
  position: relative;
  z-index: 30;
}
.case-filter-advanced {
  display: grid;
  gap: 8px;
}
.case-filter-row {
  display: grid;
  gap: 7px;
  align-items: center;
}
.case-filter-row.fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.case-filter-row.search-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.case-filter-row.date-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: start;
}
.case-filter-row.status-row {
  grid-template-columns: minmax(230px, auto) minmax(0, 1fr);
  justify-content: start;
}
.case-filters input,
.case-filters select,
.case-filters button,
.filter-menu summary {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
}
.case-filters input::placeholder {
  color: #8a97a4;
}
.case-filter-row.date-row label:not(.check-label) {
  display: grid;
  grid-template-columns: 32px 145px;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}
#caseFilters,
#caseFilters .case-filter-row,
#caseFilters input,
#caseFilters select,
#caseFilters button,
#caseFilters label,
#caseFilters .date-picker-line {
  max-width: 100%;
  min-width: 0;
}
#caseFilters .check-label {
  white-space: nowrap;
}
#clearCaseFilters {
  background: #d21f17;
  border-color: #d21f17;
  color: #fff;
  font-weight: 800;
  width: 100%;
}
#clearCaseFilters:hover,
#clearCaseFilters:focus-visible {
  background: #b91c15;
  border-color: #b91c15;
}
.case-status-checks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.case-status-checks .check-label {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}
.case-status-checks input {
  width: auto;
  min-height: 0;
  margin-right: 4px;
}
@media (max-width: 1700px) {
  #caseFilters .case-filter-row.fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #caseFilters .case-filter-row.search-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #caseFilters .case-filter-row.date-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #caseFilters .case-filter-row.date-row label:not(.check-label) {
    grid-template-columns: 32px minmax(0, 1fr);
  }
}
.finance-top {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, .7fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}
.finance-controls,
.finance-overview {
  min-width: 0;
}
.finance-controls {
  display: grid;
  align-content: start;
}
.finance-head {
  gap: 12px;
  margin-bottom: 8px;
}
.finance-head h2 {
  white-space: nowrap;
}
.finance-head small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.finance-import {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
  position: relative;
  z-index: 31;
}
.finance-import input {
  flex: 1 1 260px;
  min-width: 180px;
}
.finance-import-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
}
.finance-import-status.running {
  color: #6d4b00;
  background: #fff7df;
  border-color: #e8cf89;
}
.finance-import-status.ok {
  color: #146c43;
  background: #e8f6ee;
  border-color: #bfe4cf;
}
.finance-import-status.warn {
  color: #7a5200;
  background: #fff4d8;
  border-color: #e7cb7f;
}
.finance-import-status.bad {
  color: #9f1f17;
  background: #fff0ee;
  border-color: #e9bbb6;
}
.finance-import-log {
  margin: 0 0 8px;
}
.finance-import-log details {
  border: 1px solid #d8e1dc;
  border-radius: 8px;
  background: #fbfdfc;
}
.finance-import-log summary {
  cursor: pointer;
  padding: 8px 10px;
  font-weight: 800;
  color: var(--ink);
}
.finance-import-log-list {
  display: grid;
  gap: 1px;
  border-top: 1px solid #e1e7e4;
}
.finance-import-log-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, auto);
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  background: #fff;
}
.finance-import-log-row.has-warning {
  background: #fff9e8;
}
.finance-import-log-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.finance-import-log-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.finance-import-log-row small {
  display: inline;
  color: var(--muted);
  white-space: nowrap;
}
.finance-import-log-row > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.finance-import-log-row span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: #39413e;
}
.finance-import-log-warning {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.finance-import-log-warning span {
  background: #fff0c2;
  color: #6b4b00;
  font-size: 12px;
}
.finance-import-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid #e1e7e4;
}
.finance-import-pager span {
  color: var(--muted);
  font-weight: 700;
}
.finance-overview {
  padding: 8px 12px 10px;
  border: 1px solid #dce7e1;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbf9 100%);
}
.finance-overview h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.finance-overview-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 4px;
  text-align: center;
}
.finance-overview-kpis div {
  min-width: 0;
}
.finance-overview-kpis span {
  display: block;
  color: #8a928e;
  font-size: 11px;
  font-weight: 700;
}
.finance-overview-kpis strong {
  display: block;
  overflow: hidden;
  color: #49524e;
  font-size: clamp(13px, 1.35vw, 22px);
  line-height: 1.12;
  letter-spacing: 0;
  text-overflow: clip;
  white-space: nowrap;
}
.finance-overview-chart {
  min-height: 205px;
}
.finance-overview-chart svg {
  display: block;
  width: 100%;
  height: 205px;
}
.finance-chart-grid {
  stroke: #e9eeeb;
  stroke-width: 1;
}
.finance-chart-axis,
.finance-chart-axis-tick {
  stroke: #cfd8d4;
  stroke-width: 1;
}
.finance-chart-y-label,
.finance-chart-x-label {
  fill: #73807a;
  font-size: 11px;
}
.finance-chart-y-label {
  font-weight: 700;
}
.finance-chart-income-area {
  fill: rgba(47, 157, 101, .16);
}
.finance-chart-expense-area {
  fill: rgba(191, 67, 67, .14);
}
.finance-chart-income-line {
  fill: none;
  stroke: #2f9d65;
  stroke-width: 2.8;
}
.finance-chart-expense-line {
  fill: none;
  stroke: #d74f4f;
  stroke-width: 2.4;
}
.finance-chart-dot-income {
  fill: #2f9d65;
}
.finance-chart-dot-expense {
  fill: #d74f4f;
}
.finance-chart-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: -12px;
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}
.finance-chart-legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.finance-chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.finance-chart-legend .income i {
  border: 1px solid #65b98d;
  background: rgba(47, 157, 101, .2);
}
.finance-chart-legend .expense i {
  border: 1px solid #e28a8a;
  background: rgba(215, 79, 79, .18);
}
.finance-chart-empty {
  display: grid;
  min-height: 210px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.finance-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.finance-bookings-wrap {
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-width: 100%;
}
.finance-table,
.finance-category-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
.finance-bookings-wrap .finance-table {
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 0;
  max-width: 100%;
}
.finance-table th,
.finance-category-table th {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  background: #f5f7f6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}
.finance-bookings-wrap .finance-table th {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  background: #f5f7f6;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.finance-table td,
.finance-category-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #e1e7e4;
  background: #fff;
  vertical-align: middle;
}
.finance-bookings-wrap .finance-table td {
  padding: 9px 8px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #e1e7e4;
  background: #fff;
  min-width: 0;
  overflow: hidden;
}
.finance-bookings-wrap .finance-table td:first-child {
  border-left: 0;
  border-radius: 0;
}
.finance-bookings-wrap .finance-table td:last-child {
  border-right: 0;
  border-radius: 0;
  overflow: hidden;
}
.finance-table tbody tr:nth-child(even) td,
.finance-category-table tbody tr:nth-child(even) td {
  background: #fbfcfc;
}
.finance-table tbody tr.finance-row-imported td {
  background: #f1f4f3;
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-imported td,
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked td {
  background: #f1f5f4;
  color: var(--ink);
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked {
  cursor: pointer;
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked:focus-visible td {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.finance-cell-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.finance-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.finance-table tbody tr.finance-row-locked input,
.finance-table tbody tr.finance-row-locked select {
  color: var(--ink);
  cursor: default;
  opacity: 1;
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked input,
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked select {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  cursor: default;
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked input {
  cursor: text;
}
.finance-table tbody tr.finance-row-locked input:disabled,
.finance-table tbody tr.finance-row-locked select:disabled {
  -webkit-text-fill-color: var(--ink);
}
.finance-table tbody tr.finance-row-locked input:read-only {
  -webkit-text-fill-color: var(--ink);
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked input:disabled,
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked select:disabled {
  -webkit-text-fill-color: var(--ink);
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked input:read-only {
  -webkit-text-fill-color: var(--ink);
}
.finance-table tbody tr td:first-child {
  box-shadow: inset 4px 0 0 var(--finance-category-color, transparent);
}
.finance-table tbody tr:hover td,
.finance-category-table tbody tr:hover td {
  background: #eef7f5;
}
.finance-bookings-wrap .finance-table tbody tr.finance-row-locked:hover td,
.finance-bookings-wrap .finance-table tbody tr.finance-row-imported:hover td {
  background: #eef7f5;
}
.finance-table input,
.finance-table select,
.finance-category-table input,
.finance-category-table select {
  min-height: 30px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  padding: 5px 6px;
}
.finance-bookings-wrap .finance-table input,
.finance-bookings-wrap .finance-table select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 4px 5px;
  font: inherit;
  font-size: 12px;
  text-overflow: ellipsis;
}
.finance-bookings-wrap .finance-table th:nth-child(1),
.finance-bookings-wrap .finance-table td:nth-child(1) { width: 7.5%; }
.finance-bookings-wrap .finance-table th:nth-child(2),
.finance-bookings-wrap .finance-table td:nth-child(2) { width: 19%; }
.finance-bookings-wrap .finance-table th:nth-child(3),
.finance-bookings-wrap .finance-table td:nth-child(3) { width: 28%; }
.finance-bookings-wrap .finance-table th:nth-child(4),
.finance-bookings-wrap .finance-table td:nth-child(4) { width: 7.5%; }
.finance-bookings-wrap .finance-table th:nth-child(5),
.finance-bookings-wrap .finance-table td:nth-child(5) { width: 8%; }
.finance-bookings-wrap .finance-table th:nth-child(6),
.finance-bookings-wrap .finance-table td:nth-child(6) { width: 8%; }
.finance-bookings-wrap .finance-table th:nth-child(7),
.finance-bookings-wrap .finance-table td:nth-child(7) { width: 15%; }
.finance-bookings-wrap .finance-table td.trip-actions {
  display: table-cell;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}
.icon-action-btn,
.finance-bookings-wrap .finance-table td.trip-actions button,
.trip-table td.trip-actions button {
  display: inline-block;
  width: 32px;
  height: 32px;
  min-width: 0;
  min-height: 32px;
  margin: 0 1px;
  padding: 0;
  overflow: hidden;
  font-size: 17px;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}
.finance-bookings-wrap .finance-table td.trip-actions button:first-child:last-child {
  width: 32px;
}
.finance-bookings-wrap .finance-table td.finance-category-cell {
  display: table-cell;
  white-space: nowrap;
}
.finance-bookings-wrap .finance-table .finance-category-swatch {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.finance-bookings-wrap .finance-table .finance-category-cell select {
  display: inline-block;
  width: calc(100% - 24px);
  vertical-align: middle;
}
.finance-bookings-wrap .finance-table .finance-category-cell .finance-cell-text {
  display: inline-block;
  width: calc(100% - 24px);
  vertical-align: middle;
}
.finance-table input:focus,
.finance-table select:focus,
.finance-category-table input:focus,
.finance-category-table select:focus {
  border-color: var(--accent);
  background: #fff;
}
.finance-category-cell {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}
.finance-category-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: var(--finance-category-color, #e5e7eb);
}
.finance-category-table input[type="color"] {
  width: 38px;
  min-width: 38px;
  height: 30px;
  padding: 2px;
  border-color: var(--line);
  background: #fff;
}
.finance-filters input,
.finance-filters select,
.finance-filters button,
.finance-filters .button {
  width: 100%;
  min-width: 0;
}
.finance-controls .finance-filters {
  margin-bottom: 0;
}
.finance-filters label:not(.check-label) {
  display: grid;
  grid-template-columns: auto minmax(105px, 1fr);
  gap: 6px;
  align-items: center;
  color: var(--muted);
}
.finance-filters .check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  white-space: nowrap;
}
.finance-filters .check-label input {
  width: auto;
  min-height: auto;
}
#financeFilters .case-filter-row {
  display: grid;
  gap: 8px;
  align-items: center;
}
#financeFilters .finance-filter-search-row {
  grid-template-columns: minmax(260px, 1.6fr) minmax(160px, .7fr) minmax(190px, .9fr);
}
#financeFilters .finance-filter-basic-row {
  grid-template-columns: minmax(180px, 1fr) minmax(110px, .7fr) minmax(140px, .8fr) minmax(150px, .9fr);
}
#financeFilters .finance-filter-date-row {
  grid-template-columns: minmax(84px, .65fr) minmax(84px, .65fr) minmax(132px, 1fr) minmax(132px, 1fr) minmax(92px, .7fr) minmax(158px, max-content);
}
#financeFilters .finance-filter-action-row {
  grid-template-columns: minmax(112px, .75fr) minmax(92px, .55fr) minmax(130px, .85fr) minmax(124px, .8fr) minmax(126px, .75fr) minmax(84px, .52fr);
}
#financeFilters input,
#financeFilters select,
#financeFilters button,
#financeFilters .button {
  width: 100%;
  min-width: 0;
}
#financeFilters .compact-export-btn {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
#financeFilters .finance-export-menu {
  position: relative;
  min-width: 0;
}
#financeFilters .finance-export-menu summary {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}
#financeFilters .finance-export-menu summary::-webkit-details-marker {
  display: none;
}
#financeFilters .finance-export-menu summary::after {
  content: "▾";
  color: #26312d;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}
#financeFilters .finance-export-menu[open] summary {
  border-color: #176b87;
  box-shadow: 0 0 0 2px rgba(23,107,135,.12);
}
#financeFilters .finance-export-menu > div {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15,23,42,.14);
}
#financeFilters .finance-export-menu a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: #17202a;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
#financeFilters .finance-export-menu a:hover,
#financeFilters .finance-export-menu a:focus {
  background: var(--soft);
}
#financeFilters label:not(.check-label) {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}
#financeFilters .date-picker-line {
  min-width: 0;
}
#financeFilters .check-label {
  display: inline-flex;
  width: auto;
  min-width: 0;
  white-space: nowrap;
}
@media (max-width: 1700px) {
  .finance-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .finance-overview-chart,
  .finance-overview-chart svg,
  .finance-chart-empty {
    min-height: 220px;
    height: 220px;
  }
}
@media (min-width: 981px) and (max-width: 1450px) {
  .finance-overview {
    padding-left: 8px;
    padding-right: 8px;
  }
  .finance-overview-kpis {
    gap: 4px;
  }
  .finance-overview-kpis span {
    font-size: 10px;
  }
  .finance-overview-kpis strong {
    font-size: clamp(12px, 1.25vw, 18px);
  }
}
@media (max-width: 980px) {
  #financeFilters .finance-filter-search-row,
  #financeFilters .finance-filter-basic-row,
  #financeFilters .finance-filter-date-row,
  #financeFilters .finance-filter-action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #financeFilters .check-label {
    min-width: 0;
  }
}
.finance-categories-modal {
  width: min(1180px, calc(100vw - 40px));
}
.finance-categories-modal .finance-table-wrap {
  max-height: min(620px, calc(100vh - 170px));
  overflow: auto;
}
.finance-booking-modal {
  max-width: 760px;
}
.finance-detail-modal {
  max-width: 760px;
}
.finance-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.finance-detail-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}
.finance-detail-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.finance-detail-item strong {
  display: block;
  overflow-wrap: anywhere;
}
.finance-booking-modal textarea {
  resize: vertical;
  min-height: 84px;
}
.finance-booking-modal .form-grid .full {
  grid-column: 1 / -1;
}
.finance-booking-modal .modal-actions {
  margin-top: 12px;
}
.finance-categories-modal .finance-category-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 760px) {
  .finance-import-log-row {
    grid-template-columns: 1fr;
  }
  .finance-import-log-row > div:last-child {
    justify-content: flex-start;
  }
  .finance-import-log-title {
    flex-wrap: wrap;
  }
  .finance-bookings-wrap {
    overflow-x: hidden;
  }
  .finance-bookings-wrap .finance-table,
  .finance-bookings-wrap .finance-table thead,
  .finance-bookings-wrap .finance-table tbody,
  .finance-bookings-wrap .finance-table tr,
  .finance-bookings-wrap .finance-table th,
  .finance-bookings-wrap .finance-table td {
    display: block;
    width: 100%;
  }
  .finance-bookings-wrap .finance-table thead {
    display: none;
  }
  .finance-bookings-wrap .finance-table tbody tr {
    margin: 8px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--finance-category-color, var(--accent));
    border-radius: 8px;
    overflow: hidden;
  }
  .finance-bookings-wrap .finance-table tbody tr td {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
    border-right: 0;
    box-shadow: none;
  }
  .finance-bookings-wrap .finance-table tbody tr td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .finance-bookings-wrap .finance-table tbody tr td:first-child {
    box-shadow: none;
  }
  .finance-bookings-wrap .finance-table .finance-cell-text,
  .finance-bookings-wrap .finance-table .finance-category-cell .finance-cell-text {
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .finance-bookings-wrap .finance-table .finance-category-swatch {
    align-self: center;
    margin-right: 0;
  }
  .finance-bookings-wrap .finance-table td.finance-category-cell {
    grid-template-columns: 118px 14px minmax(0, 1fr);
  }
  .finance-booking-modal .form-grid,
  .finance-detail-grid {
    grid-template-columns: 1fr;
  }
}
.payment-reconcile-panel {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #cfe2d5;
  border-left: 5px solid #2f8f5b;
  border-radius: 8px;
  background: #f7fbf8;
}
.finance-trash-panel {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #d7dde0;
  border-left: 5px solid #59636b;
  border-radius: 8px;
  background: #f6f7f7;
}
.export-trash-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #d7dde0;
  border-left: 5px solid #59636b;
  border-radius: 8px;
  background: #f8faf9;
}
.export-trash-panel .panel-head {
  margin-bottom: 10px;
}
.export-trash-panel .table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}
.export-trash-panel table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.export-trash-panel th,
.export-trash-panel td {
  padding: 6px 8px;
  border-bottom: 1px solid #dfe5e2;
  vertical-align: middle;
  white-space: nowrap;
}
.export-trash-panel th {
  background: #eef3f1;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}
.export-trash-panel tbody tr:last-child td {
  border-bottom: 0;
}
.export-trash-panel tbody tr:hover {
  background: #f7faf8;
}
.export-trash-panel th:last-child,
.export-trash-panel td:last-child {
  text-align: right;
  overflow: visible;
  text-overflow: clip;
}
.export-trash-panel td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.export-trash-panel th:nth-child(1),
.export-trash-panel td:nth-child(1) { width: 14%; }
.export-trash-panel th:nth-child(2),
.export-trash-panel td:nth-child(2) { width: 8%; }
.export-trash-panel th:nth-child(3),
.export-trash-panel td:nth-child(3) {
  width: 18%;
  max-width: none;
}
.export-trash-panel th:nth-child(4),
.export-trash-panel td:nth-child(4) {
  width: 36%;
  max-width: none;
}
.export-trash-panel th:nth-child(5),
.export-trash-panel td:nth-child(5) { width: 13%; }
.export-trash-panel th:nth-child(6),
.export-trash-panel td:nth-child(6) {
  width: 96px;
  min-width: 96px;
}
.trash-date,
.trash-title,
.trash-deleted,
.trash-details {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trash-details {
  color: #27312d;
}
.trash-actions {
  display: table-cell;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}
.trash-action-buttons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 76px;
}
.trash-actions .icon-action-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
}
.cancellation-table th:nth-child(1),
.cancellation-table td:nth-child(1) { width: 18%; }
.cancellation-table th:nth-child(2),
.cancellation-table td:nth-child(2) { width: 28%; }
.cancellation-table th:nth-child(3),
.cancellation-table td:nth-child(3) { width: 14%; }
.cancellation-table th:nth-child(4),
.cancellation-table td:nth-child(4) { width: 17%; }
.cancellation-table th:nth-child(5),
.cancellation-table td:nth-child(5) {
  width: 23%;
  min-width: 0;
}
.cancellation-table .trash-action-buttons {
  max-width: 100%;
  flex-wrap: wrap;
}
.cancellation-table .trash-action-buttons button {
  min-width: 0;
  white-space: nowrap;
}
.cancellation-detail-row td {
  padding: 0;
  text-align: left;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  background: #fbfcfc;
}
.cancellation-readonly-detail {
  margin: 0;
  padding: 14px;
  border-top: 1px solid #dfe5e2;
  text-align: left;
  background: linear-gradient(90deg, rgba(89, 99, 107, 0.08), #fff 30px);
}
.cancellation-readonly-detail .customer-bubble,
.cancellation-readonly-detail .gallery-bubble,
.cancellation-readonly-detail .case-compact-status,
.cancellation-readonly-detail .timeline-row,
.cancellation-readonly-detail .timeline-subrow {
  text-align: left;
}
.cancellation-readonly-detail .section-title-actions button,
.cancellation-readonly-detail .quick-actions,
.cancellation-readonly-detail .file-upload,
.cancellation-readonly-detail .timeline-row button,
.cancellation-readonly-detail .timeline-subrow-actions button {
  display: none;
}
.cancellation-readonly-detail button[data-doc-action="open-tab"],
.cancellation-readonly-detail button[data-reminder-open-tab],
.cancellation-readonly-detail button[data-acceptance-open-tab] {
  display: inline-flex;
}
.trash-area-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  white-space: nowrap;
}
.trash-area-finance { color: #1b6f5b; background: #eef8f2; border-color: #cbe8d8; }
.trash-area-trip { color: #6d4b00; background: #fff8df; border-color: #eadca8; }
.trash-area-appointment { color: #19598a; background: #edf6ff; border-color: #c9def2; }
.trash-area-file { color: #5a426d; background: #f5effa; border-color: #ded0e8; }
.trash-area-case { color: #8f1d14; background: #fff0ee; border-color: #f0c8c3; }
.trash-area-default { color: var(--ink); background: var(--soft); }
.payment-reconcile-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--muted);
}
.payment-reconcile-summary span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.payment-reconcile-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.payment-reconcile-controls .check-label {
  margin: 0;
}
.payment-reconcile-table {
  width: 100%;
  border-collapse: collapse;
}
.payment-reconcile-table th,
.payment-reconcile-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.payment-reconcile-table th {
  background: #eef5f1;
  font-size: 12px;
  font-weight: 800;
}
.payment-reconcile-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reconcile-status {
  display: inline-block;
  padding: 5px 7px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
}
.reconcile-status.ok {
  color: #146c43;
  background: #e8f6ee;
}
.reconcile-status.warn {
  color: #8a5a00;
  background: #fff6db;
}
.reconcile-status.missing {
  color: #9f1f17;
  background: #fff0ee;
}
.reconcile-status.done {
  color: #31584a;
  background: #e9f3ee;
}
.trip-filter-row {
  grid-template-columns: 130px 130px 150px 150px auto;
  justify-content: start;
}
.trip-filter-row-wide {
  grid-template-columns: 170px repeat(3, minmax(140px, 1fr)) repeat(3, auto);
}
.trip-filter-row label:not(.check-label) {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}
.trip-summary,
.finance-summary {
  margin: 8px 0 12px;
  padding: 10px 14px;
  border: 1px solid #cfe3dc;
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #f2faf7;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  user-select: none;
}
.finance-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -2px 0 12px;
}
.finance-pager.hidden {
  display: none;
}
.finance-pager span {
  color: var(--muted);
  font-weight: 700;
}
.trip-table-wrap {
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.trip-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 0;
}
.trip-table th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  background: #f5f7f6;
  white-space: nowrap;
}
.trip-table td {
  background: #fff;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #e1e7e4;
  padding: 9px 8px;
}
.trip-table td:first-child {
  border-left: 0;
  border-radius: 0;
}
.trip-table td:last-child {
  border-right: 0;
  border-radius: 0;
  overflow: visible;
}
.trip-table input,
.trip-table select {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 5px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  text-overflow: ellipsis;
}
.trip-table th:nth-child(1),
.trip-table td:nth-child(1) { width: 4%; }
.trip-table th:nth-child(2),
.trip-table td:nth-child(2) { width: 8%; }
.trip-table th:nth-child(3),
.trip-table td:nth-child(3) { width: 18%; }
.trip-table th:nth-child(4),
.trip-table td:nth-child(4) { width: 18%; }
.trip-table th:nth-child(5),
.trip-table td:nth-child(5) { width: 10%; }
.trip-table th:nth-child(6),
.trip-table td:nth-child(6) { width: 7%; }
.trip-table th:nth-child(7),
.trip-table td:nth-child(7) { width: 7%; }
.trip-table th:nth-child(8),
.trip-table td:nth-child(8) { width: 8%; }
.trip-table th:nth-child(9),
.trip-table td:nth-child(9) { width: 20%; }
.trip-row-number {
  font-weight: 700;
  text-align: right;
}
.trip-table td.trip-actions {
  display: table-cell;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}
.trip-table tr.trip-row-locked td {
  background: #f1f5f4;
  color: var(--ink);
}
.trip-table tr.trip-row-locked {
  cursor: pointer;
}
.trip-table tr.trip-row-locked:focus-visible td {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.trip-cell-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trip-km {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.trip-table tr.trip-row-locked input,
.trip-table tr.trip-row-locked select {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  opacity: 1;
  cursor: not-allowed;
}
.trip-table tr.trip-row-locked:hover td {
  background: #eef7f5;
}
.trip-actions button:not(.icon-action-btn) {
  display: inline-block;
  margin-left: 4px;
  width: auto;
  min-width: 0;
  min-height: 28px;
  padding: 5px 7px;
  font-size: clamp(10px, 0.68vw, 12px);
  white-space: nowrap;
}
.trip-modal-card {
  width: min(900px, 100%);
}
.trip-detail-modal {
  width: min(900px, 100%);
}
.trip-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.trip-detail-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}
.trip-detail-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.trip-detail-item strong {
  display: block;
  overflow-wrap: anywhere;
}
.trip-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.trip-form-grid input,
.trip-form-grid select {
  min-height: 42px;
}
@media (max-width: 1400px) {
  .trip-table-wrap {
    margin: 0 -6px;
  }
  .trip-table th,
  .trip-table td {
    padding-left: 3px;
    padding-right: 3px;
  }
  .trip-table input,
  .trip-table select {
    min-height: 31px;
    padding-left: 5px;
    padding-right: 5px;
  }
}
.trip-row-locked td {
  background: #f1f5f4;
}
.trip-row-locked input,
.trip-row-locked select {
  color: var(--ink);
  background: transparent;
  border-color: transparent;
  cursor: not-allowed;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: var(--ink);
  white-space: nowrap;
}
.filter-menu {
  position: relative;
}
.filter-menu[open] {
  z-index: 80;
}
.filter-menu summary {
  list-style: none;
  cursor: pointer;
}
.filter-menu summary::-webkit-details-marker {
  display: none;
}
.filter-menu summary::after {
  content: "⌄";
  float: right;
  color: var(--muted);
}
.filter-menu[open] summary::after {
  content: "⌃";
}
.filter-options {
  position: absolute;
  z-index: 20;
  top: 42px;
  left: 0;
  min-width: 150px;
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.97);
  box-shadow: var(--shadow);
}
.filter-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #52606d;
}
.filter-options input,
.check-label input {
  width: 16px;
  height: 16px;
  min-height: auto;
}
.row, .case-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 10px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.dashboard-case-row {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: stretch;
  align-items: start;
  gap: 4px;
}
.dashboard-case-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-start;
}
.row small, .case-card small { color: var(--muted); }
.deadline-modal-card {
  max-width: min(1060px, calc(100vw - 28px));
}
.deadline-row {
  align-items: center;
}
.deadline-row .toolbar {
  justify-content: flex-end;
}
.case-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
}
.case-card.case-complete {
  background: #eef9f2;
  border-color: #bfe5cb;
}
.case-card.case-partial {
  background: #f4f8ff;
  border-color: #b8cdea;
}
.case-card.case-overdue {
  background: #fff0f0;
  border-color: #efc2c2;
}
.case-card.case-active {
  background: #fff7e8;
  border-color: #efcf91;
}
.case-card.case-selected {
  background: #eef4ff;
  border-color: #8bb8ff;
  border-left: 6px solid #2f6fed;
  border-bottom-color: #d7e6ff;
  border-radius: 7px 7px 0 0;
  box-shadow: 0 -1px 0 2px rgba(47, 111, 237, 0.12), 2px 0 0 0 rgba(47, 111, 237, 0.12), -2px 0 0 0 rgba(47, 111, 237, 0.12);
}
.case-card.case-selected.case-complete,
.case-card.case-selected.case-partial,
.case-card.case-selected.case-overdue,
.case-card.case-selected.case-active {
  background: #eef4ff;
  border-color: #8bb8ff;
}
.case-compact-status {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin-bottom: 10px;
  border: 1px solid #d4dcda;
  border-radius: 8px;
  overflow: hidden;
  background: #d4dcda;
}
.case-compact-status.customer-side-card {
  gap: 0;
  margin-bottom: 0;
  border-color: #d9e4f2;
  background: rgba(255,255,255,.94);
}
.case-compact-status h3,
.gallery-bubble h3,
.customer-note-title h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #07133f;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.case-compact-status h3 {
  padding: 15px 18px 10px;
  border-bottom: 1px solid #d9e4f2;
}
.case-compact-status h3 svg,
.gallery-bubble h3 svg,
.customer-note-title h3 svg {
  width: 19px;
  height: 19px;
}
.case-compact-status > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(145px, .65fr);
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  background: transparent;
  border-bottom: 1px solid #d9e4f2;
}
.case-compact-status > div:last-child,
.case-compact-status .case-compact-action {
  border-bottom: 0;
}
.detail-grid > div:last-child .case-compact-status {
  margin-bottom: 12px;
}
.detail-grid > div:last-child .case-compact-status > div {
  min-height: 58px;
}
.case-compact-status span {
  color: #42567a;
  font-size: 14px;
  font-weight: 600;
}
.case-compact-status strong {
  color: #07133f;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-compact-status .case-compact-warning {
  border-left: 5px solid #c9302c;
  background: #fff4f4;
}
.case-compact-status .case-compact-warning span,
.case-compact-status .case-compact-warning strong {
  color: #9b1c1c;
}
.case-finance-overview {
  gap: 0;
  overflow: hidden;
  border: 1px solid #d7e3f4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 35, 72, .04);
}
.case-finance-overview > .case-finance-header {
  display: flex;
  grid-template-columns: none;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid #dbe7f4;
  background: linear-gradient(180deg, #ffffff 0%, #fafdff 100%);
}
.case-finance-overview .case-finance-header h3 {
  padding: 0;
  border: 0;
  font-size: 14px;
  letter-spacing: 0;
}
.case-finance-overview .case-finance-header h3 svg {
  width: 16px;
  height: 16px;
}
.case-finance-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  max-width: 62%;
  padding: 4px 10px;
  border-radius: 999px;
  color: #064536;
  background: linear-gradient(135deg, #e8fbef 0%, #d7f5e5 100%);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-finance-status-pill svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  padding: 2px;
  border-radius: 999px;
  color: #fff;
  background: #0aa36d;
}
.case-finance-overview > .case-finance-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 12px 10px;
  border: 0;
  background: transparent;
}
.case-finance-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon label" "value value";
  align-items: center;
  column-gap: 7px;
  row-gap: 5px;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid rgba(70, 99, 137, .08);
}
.case-finance-card.finance-card-green {
  background: linear-gradient(135deg, #eefbf3 0%, #f7fffb 100%);
}
.case-finance-card.finance-card-amber {
  background: linear-gradient(135deg, #fff8e8 0%, #fffdf7 100%);
}
.case-finance-card.finance-card-blue {
  background: linear-gradient(135deg, #eef6ff 0%, #f8fbff 100%);
}
.case-finance-icon {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.finance-card-green .case-finance-icon {
  color: #07966b;
  background: #dbf7e7;
}
.finance-card-amber .case-finance-icon {
  color: #cf8a00;
  background: #fff1cc;
}
.finance-card-blue .case-finance-icon {
  color: #2d87df;
  background: #e2f1ff;
}
.case-finance-icon svg {
  width: 14px;
  height: 14px;
}
.case-finance-card small {
  grid-area: label;
  color: #2f466b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}
.case-finance-card strong {
  grid-area: value;
  color: #061548;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.18;
  white-space: normal;
  overflow-wrap: anywhere;
}
.case-finance-card.finance-card-blue strong {
  font-size: 14px;
}
.worker-finance-cards .case-finance-card strong {
  font-size: 14px;
}
@media (max-width: 900px) {
  .case-finance-overview > .case-finance-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .case-finance-status-pill {
    max-width: 100%;
  }
  .case-finance-overview > .case-finance-cards {
    grid-template-columns: 1fr;
  }
}
.case-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
.case-card-main {
  min-width: 0;
}
.case-card-summary {
  display: block;
  margin-bottom: 7px;
  line-height: 1.35;
}
.case-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 760px) {
  .trip-table-wrap {
    overflow-x: hidden;
  }
  .trip-table,
  .trip-table thead,
  .trip-table tbody,
  .trip-table tr,
  .trip-table th,
  .trip-table td {
    display: block;
    width: 100%;
  }
  .trip-table thead {
    display: none;
  }
  .trip-table tbody tr {
    margin: 8px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
  }
  .trip-table tbody tr td {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
    border-right: 0;
  }
  .trip-table tbody tr td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .trip-table .trip-cell-text {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .trip-detail-grid {
    grid-template-columns: 1fr;
  }
  .case-card {
    grid-template-columns: 1fr;
  }
  .case-card-actions {
    justify-content: flex-end;
  }
}
.case-trash-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
}
.case-cancel-btn {
  color: var(--danger);
  border-color: #f0c8c3;
  background: #fff7f5;
}
.case-cancel-btn:hover {
  background: #fff0ee;
}
.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.case-card {
  grid-template-columns: 22px 42px minmax(185px, .85fr) minmax(320px, 1.65fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 0;
  border-radius: 8px;
  border-color: #e2e8ec;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  overflow: visible;
}

.case-card::before {
  content: none;
}

.case-status-strip {
  width: 22px;
  min-height: 78px;
  align-self: stretch;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f2a100;
  color: #fff;
  overflow: hidden;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .25);
}

.case-status-strip span {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.case-card.case-active .case-status-strip { background: #35b86b; }
.case-card.case-partial .case-status-strip { background: #2f8df0; }
.case-card.case-payment-waiting .case-status-strip { background: #2f8df0; }
.case-card.case-complete .case-status-strip { background: #7b8796; }
.case-card.case-overdue .case-status-strip { background: #c8211b; }

.case-card.case-complete,
.case-card.case-partial,
.case-card.case-overdue,
.case-card.case-active {
  background: #fff;
}

.case-card.case-selected,
.case-card.case-selected.case-complete,
.case-card.case-selected.case-partial,
.case-card.case-selected.case-overdue,
.case-card.case-selected.case-active {
  background: #f8fbff;
  border-color: #b9d7ff;
  border-left: 1px solid #b9d7ff;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 1px 0 2px rgba(47, 111, 237, 0.08);
}

.case-type-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #425d7a;
  border-radius: 7px;
  background: #eef5ff;
}

.case-type-icon svg,
.case-place-icon svg,
.case-created-icon svg,
.doc-number-icon svg,
.case-toggle-icon svg,
.case-menu summary svg {
  width: 17px;
  height: 17px;
  display: block;
}

.case-type-family { color: #365d7f; background: #edf5ff; }
.case-type-person { color: #425d7a; background: #edf4ff; }
.case-type-company { color: #425d7a; background: #eef5ff; }

.case-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.case-customer-name {
  color: #071225;
  font-size: 15px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-card-place,
.case-card-created {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.case-place-icon,
.case-created-icon {
  width: 15px;
  min-width: 15px;
  color: #53677c;
}

.case-card-created {
  color: #667788;
  font-size: 12px;
}

.case-card-docs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.case-card-docs .doc-number-chain {
  gap: 7px;
}

.case-card-docs .case-meta {
  gap: 7px;
}

.case-card-docs .pill,
.doc-number-token {
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #dde8f2;
  border-left: 0;
  background: #eef5ff;
  color: #28445f;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
}

.doc-number-token.doc-token-offer {
  background: #f5edff;
  border-color: #dac4f2;
  color: #5b2f86;
}

.doc-number-token.doc-token-order {
  background: #e8fbf7;
  border-color: #bfe9df;
  color: #17695b;
}

.doc-number-token.doc-token-invoice {
  background: #eef2f4;
  border-color: #cfd8df;
  color: #374957;
}

.doc-number-token.doc-token-reminder,
.doc-number-token.doc-token-warning,
.doc-number-token.doc-token-final {
  background: #fbeaec;
  border-color: #edb8bf;
  color: #8f1f2d;
}

.doc-number-token.doc-token-kv-skipped {
  background: #f2f4f7;
  border-color: #d8dee6;
  color: #59636b;
}

.case-doc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px 2px 0;
  border-top: 1px solid #dce5ea;
  color: var(--muted);
  font-size: 12px;
}
.case-doc-legend-title {
  font-weight: 800;
  color: #425466;
}
.case-doc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.case-doc-legend .doc-number-token {
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
}

.case-card-docs .pill.gold {
  background: #eef3f0;
  color: #425d5a;
}

.case-card-docs .pill.orange,
.case-card-docs .pill.gold {
  background: #fff4df;
  color: #845414;
  border-color: #f3dfb6;
}

.case-card-docs .pill.green {
  background: #e9f7ef;
  color: #1d6b43;
  border-color: #cae8d6;
}

.case-card-docs .pill.blue {
  background: #eaf3ff;
  color: #255f9c;
  border-color: #cfe2fa;
}

.case-card-docs .pill.red {
  background: #fff0ef;
  color: #9d241d;
  border-color: #f1c7c2;
}

.case-compact-action {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.doc-number-separator {
  display: none;
}

.doc-number-icon {
  width: 17px;
  min-width: 17px;
  color: currentColor;
}

.case-card-actions {
  position: relative;
  justify-content: flex-end;
}

.case-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: #f4f8ff;
  color: #115bb7;
  font-weight: 750;
}

.case-card.case-selected .case-toggle-icon {
  transform: rotate(180deg);
}

.case-menu {
  position: relative;
}

.case-menu summary {
  list-style: none;
  width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #12213a;
  border: 1px solid #dfe7ed;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.case-menu summary::-webkit-details-marker {
  display: none;
}

.case-menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
  display: grid;
  gap: 6px;
  min-width: 150px;
  padding: 8px;
  border: 1px solid #e4d7d4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}

.case-menu-danger {
  width: 100%;
  justify-content: center;
  color: #fff;
  border-color: #bd2018;
  background: #c8211b;
}

.case-menu-danger:hover {
  background: #ad1b16;
}

@media (max-width: 980px) {
  .case-card {
    grid-template-columns: 22px 38px minmax(0, 1fr) auto;
  }

  .case-card-docs {
    grid-column: 3 / -1;
  }
}

@media (max-width: 640px) {
  .case-card {
    grid-template-columns: 20px 36px minmax(0, 1fr);
    padding-right: 10px;
  }

  .case-status-strip {
    width: 20px;
  }

  .case-status-strip span {
    font-size: 8px;
  }

  .case-card-actions {
    grid-column: 3 / -1;
    justify-content: flex-start;
    width: 100%;
  }

  .case-toggle-btn {
    flex: 1;
    justify-content: center;
  }

  .case-card-docs .pill,
  .doc-number-token {
    max-width: 100%;
    min-height: 28px;
    padding: 5px 9px;
    font-size: 12px;
  }
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: #39413e;
  font-size: 12px;
}
.pill.gold { background: #fbf1d7; color: #6f5211; }
.pill.orange { background: #fff0d6; color: #8a4a00; }
.pill.green { background: #e3f3ed; color: #155d4d; }
.pill.blue { background: #e8f0fb; color: #244b77; }
.pill.red { background: #fde6e2; color: #8f1d14; }
.pill.warn { background: #fff0d6; color: #8a4a00; }

.customer-db-list,
.customer-case-list,
.customer-suggestion-list {
  display: grid;
  gap: 8px;
}

.customer-db-entry {
  display: grid;
  gap: 8px;
}

.customer-db-card,
.customer-case-row,
.customer-suggestion {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--ink);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.customer-db-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.customer-db-type-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #eaf2ff;
  color: #234b77;
}

.customer-db-type-icon svg {
  width: 20px;
  height: 20px;
}

.customer-db-card:hover,
.customer-db-card.selected,
.customer-case-row:hover,
.customer-suggestion:hover {
  border-color: #176b87;
  background: #eef7f8;
}

.customer-db-card strong,
.customer-case-row strong,
.customer-suggestion span {
  display: block;
  font-weight: 800;
}

.customer-db-card small,
.customer-case-row small,
.customer-suggestion small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.customer-db-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.customer-toggle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-inline-detail {
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.customer-profile {
  display: grid;
  gap: 10px;
}

.customer-profile-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.customer-profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaf2ff;
  color: #0f55bf;
  font-weight: 800;
  font-size: 16px;
}

.customer-profile-title h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.customer-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: #3f4b56;
  margin-top: 4px;
  font-size: 13px;
}

.customer-profile-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.customer-profile-meta svg,
.customer-info-line svg,
.customer-info-card h3 svg {
  width: 16px;
  height: 16px;
  color: #155bd5;
}

.customer-profile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.customer-profile-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.customer-profile-actions button svg {
  width: 16px;
  height: 16px;
}

.customer-more-menu {
  position: relative;
}

.customer-more-menu summary {
  list-style: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.customer-more-menu summary::-webkit-details-marker {
  display: none;
}

.customer-more-menu summary svg {
  width: 18px;
  height: 18px;
}

.customer-more-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 240px;
  z-index: 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.customer-more-menu button {
  justify-content: flex-start;
  width: 100%;
}

.customer-more-menu small {
  color: var(--muted);
  line-height: 1.3;
}

.customer-profile-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1.05fr);
  gap: 8px;
}

.customer-info-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}

.customer-info-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 15px;
}

.customer-info-line {
  display: grid;
  grid-template-columns: 18px 78px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
}

.customer-info-line span {
  color: var(--muted);
  font-size: 12px;
}

.customer-info-line strong {
  min-width: 0;
  word-break: break-word;
}

.customer-contact-action {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  background: var(--soft);
  color: #155bd5;
  text-decoration: none;
}

.customer-contact-action svg {
  width: 16px;
  height: 16px;
}

.customer-contact-action.disabled {
  opacity: .35;
  pointer-events: none;
}

.customer-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.customer-kpis > div {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-left: 1px solid var(--line);
}

.customer-kpis > div:first-child {
  border-left: 0;
}

.customer-kpis span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: #155bd5;
}

.customer-kpis svg {
  width: 18px;
  height: 18px;
}

.customer-kpis strong {
  font-size: 18px;
}

.customer-kpis small {
  color: var(--muted);
}

.customer-empty-profile {
  border: 1px dashed var(--line);
  border-radius: 8px;
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  background: #fff;
}

.customer-empty-profile > span {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: #52637a;
}

.customer-empty-profile svg {
  width: 26px;
  height: 26px;
}

.customer-empty-profile small {
  color: var(--muted);
}

.customer-merge-card {
  width: min(980px, 100%);
}

.customer-merge-card .modal-actions {
  margin-top: 12px;
}

.customer-merge-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.customer-merge-head,
.customer-merge-label {
  font-weight: 800;
  padding: 9px 10px;
}

.customer-merge-head {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.customer-merge-label {
  align-self: stretch;
  display: grid;
  align-items: center;
}

.customer-merge-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 13px;
}

.customer-merge-choice input {
  width: auto;
}

.customer-merge-choice span {
  min-width: 0;
  word-break: break-word;
}

.customer-merge-choice.selected {
  border-color: #16a34a;
  background: #eefbf3;
  box-shadow: inset 4px 0 0 #16a34a;
}

.customer-account-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.customer-account-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 10px;
}

.customer-account-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.customer-account-box strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.customer-account-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.customer-account-notes p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.customer-account-notes .public-note-field,
.customer-account-notes .private-warning-field {
  border-radius: 8px;
  padding: 10px 12px;
}

.customer-fields-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  margin: 0;
  overflow: hidden;
}

.customer-fields-panel h3 {
  font-weight: 800;
  padding: 10px 12px;
  margin: 0;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}

.customer-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.customer-field-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.customer-field-table th,
.customer-field-table td {
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.customer-field-table th {
  width: 240px;
  color: var(--muted);
  font-weight: 700;
}

.customer-field-table td {
  font-weight: 800;
  word-break: break-word;
}

.customer-email-draft-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0 10px;
}

.customer-email-draft-tools select {
  width: 100%;
}

.customer-email-draft-tools button {
  white-space: nowrap;
}

.customer-field {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 7px 8px;
  min-width: 0;
}

.customer-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.customer-field strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  word-break: break-word;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fafafa;
}

@media (max-width: 900px) {
  .customer-profile-head {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .customer-profile-avatar {
    width: 48px;
    height: 48px;
  }
  .customer-profile-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .customer-profile-summary {
    grid-template-columns: 1fr;
  }
  .customer-account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-account-notes {
    grid-template-columns: 1fr;
  }
  .customer-merge-grid {
    grid-template-columns: 1fr;
  }
  .customer-merge-head {
    display: none;
  }
  .customer-merge-label {
    padding: 12px 0 0;
  }
  .customer-db-card,
  .customer-case-row,
  .customer-suggestion {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .customer-account-grid,
  .customer-field-grid {
    grid-template-columns: 1fr;
  }
  .customer-kpis {
    grid-template-columns: 1fr;
  }
  .customer-kpis > div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .customer-kpis > div:first-child {
    border-top: 0;
  }
  .customer-info-line {
    grid-template-columns: 18px minmax(0, 1fr);
  }
  .customer-info-line strong {
    grid-column: 2;
  }
  .customer-contact-action {
    grid-column: 2;
  }
}
.detail { margin-top: 14px; }
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(340px, .8fr);
  gap: 14px;
  align-items: start;
}
.detail-grid > * {
  min-width: 0;
}
.case-inline-detail {
  margin: -1px 0 10px;
  border-color: #8bb8ff;
  border-top: 0;
  border-left: 6px solid #2f6fed;
  border-radius: 0 0 7px 7px;
  background: linear-gradient(90deg, rgba(47, 111, 237, 0.08), #fff 28px);
}
.customer-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr);
  gap: 14px;
  align-items: start;
}
.customer-profile-left,
.customer-profile-right {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.customer-profile-hero,
.customer-side-card,
.customer-info-section {
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 26px rgba(17, 35, 68, .05);
}
.customer-profile-hero {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 148px;
  padding: 16px 20px;
}
.customer-profile-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #16366d;
}
.customer-profile-icon svg {
  width: 42px;
  height: 42px;
}
.customer-profile-main h2 {
  margin: 0 0 10px;
  color: #07133f;
  font-size: 26px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.customer-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: #365277;
  font-size: 14px;
  font-weight: 700;
}
.customer-profile-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.customer-profile-meta svg {
  width: 18px;
  height: 18px;
}
.customer-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.customer-profile-actions button {
  min-height: 34px;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
}
.customer-profile-actions svg {
  width: 18px;
  height: 18px;
}
.customer-edit-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0d63ff;
  border-color: #0b55d8;
  color: #fff;
}
.customer-review-btn {
  border-color: #a9c6ff;
  color: #0d63ff;
  background: #fff;
}
.customer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 7px 0 0;
}
.customer-info-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  gap: 10px;
}
.customer-info-sections.customer-info-public-only {
  grid-template-columns: 1fr;
}
.customer-info-section {
  padding: 14px 20px;
}
.customer-info-section h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: #07133f;
  font-size: 15px;
  font-weight: 700;
}
.customer-info-section h4 svg {
  width: 21px;
  height: 21px;
}
.customer-section-hint {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
}
.customer-info-public {
  background: rgba(255,255,255,.94);
  border-color: #d9e4f2;
}
.customer-info-public .customer-grid {
  grid-template-columns: 1fr;
  column-gap: 0;
  row-gap: 0;
}
.customer-info-public .customer-grid > div {
  grid-template-columns: minmax(180px, .32fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 0;
  border-bottom: 1px solid #d9e4f2;
  border-radius: 0;
  padding: 8px 0;
  background: transparent;
}
.customer-info-public .customer-grid > div > strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.address-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 14px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #c8d8e6;
  border-radius: 6px;
  background: #eef5f3;
  color: #123e67;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.address-nav-link:hover {
  border-color: #8db4d1;
  background: #e4f0ec;
  text-decoration: none;
}
.address-nav-link svg {
  width: 16px;
  height: 16px;
}
.customer-info-public h4 {
  color: #07133f;
}
.customer-info-internal {
  background: #fbfbfb;
  border-color: #e3e8e6;
}
.customer-info-internal h4 {
  color: #59636a;
}
.customer-internal-alert {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #efcaca;
  border-left: 5px solid #b42318;
  border-radius: 8px;
  background: #fff7f7;
}
.customer-internal-alert span {
  color: #9b2f2f;
  font-size: 12px;
  font-weight: 800;
}
.customer-internal-alert em,
.customer-grid span em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.25;
}
.customer-internal-alert em {
  color: #b65454;
}
.customer-internal-alert strong {
  color: #9b2f2f;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.customer-bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 12px;
}
.customer-bubble h3 {
  margin-top: 0;
}
.customer-grid div {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid #e7ece9;
}
.customer-grid div:last-child { border-bottom: 0; }
.customer-grid .customer-internal-alert {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-top: 7px;
  padding: 8px 10px;
  border: 1px solid #efcaca;
  border-left: 5px solid #b42318;
  border-radius: 8px;
  background: #fff7f7;
}
.customer-grid span {
  color: #42567a;
  font-size: 13px;
  font-weight: 500;
}
.customer-grid strong {
  color: #07133f;
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.customer-grid .customer-public-note {
  background: transparent;
  border-radius: 0;
  padding: 7px 0;
}

.customer-grid .customer-public-note span {
  color: #2f6942;
}
.customer-grid .customer-public-note span em {
  color: #3d8053;
}

.customer-info-internal .customer-grid div:not(.customer-internal-alert),
.customer-grid .customer-private-warning {
  background: transparent;
  border-radius: 0;
  padding: 7px 0;
}
.customer-info-internal .customer-grid div:not(.customer-internal-alert) {
  background: transparent;
}

.customer-grid .customer-private-warning span,
.customer-grid .customer-private-warning strong {
  color: #9b2f2f;
}
.case-progress {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, minmax(72px, 1fr));
  gap: 0;
  margin: 10px 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 0 6px;
  width: 100%;
  scrollbar-width: thin;
}
.case-progress::before {
  content: "";
  position: absolute;
  left: 36px;
  right: 36px;
  top: 27px;
  height: 4px;
  border-radius: 999px;
  background: #e3e6e5;
}
.case-progress-step {
  position: relative;
  z-index: 1;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 0 3px;
  text-align: center;
}
.case-progress-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #d8dcda;
  background: #f4f5f5;
  color: #17202a;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}
.case-progress-step strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 12px;
  color: #2c302f;
}
.case-progress-step.done {
  color: #17202a;
}
.case-progress-step.done span {
  background: #12875d;
  border-color: #12875d;
  color: #fff;
}
.case-progress-step.current {
  color: #17202a;
}
.case-progress-step.current span {
  background: #2f7df0;
  border-color: #cfe0ff;
  box-shadow: 0 0 0 5px rgba(47, 125, 240, .16);
  color: #fff;
}
.case-progress-step.partial {
  color: #113f73;
}
.case-progress-step.partial span {
  background: #eef5ff;
  border-color: #9fc4ff;
  color: #113f73;
}
.case-progress-step.skipped span {
  background: #eef0ef;
  border-color: #cfd5d2;
  color: #727b78;
}
.case-progress-step.skipped strong {
  color: #727b78;
}
.case-progress-step.open span {
  background: #f4f5f5;
  color: #17202a;
}
@media (max-width: 760px) {
  .customer-info-public .customer-grid {
    grid-template-columns: 1fr;
  }
  .case-progress {
    grid-template-columns: repeat(9, 68px);
    padding-top: 8px;
  }
  .case-progress::before {
    content: "";
    left: 34px;
    right: 34px;
    top: 25px;
  }
  .case-progress-step {
    gap: 5px;
    padding: 0 2px;
  }
  .case-progress-step span {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .case-progress-step strong {
    font-size: 10px;
  }
}
.gallery-bubble {
  padding: 16px 18px;
  min-height: auto;
  min-width: 0;
}
.gallery-bubble h3 {
  margin-bottom: 14px;
}
.file-upload-drop {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px dashed #7fb1ff;
  border-radius: 8px;
  background: #f8fbff;
  color: #07133f;
  text-align: center;
  cursor: pointer;
}
.file-upload-drop svg {
  width: 24px;
  height: 24px;
  color: #0d2f68;
}
.file-upload-drop span {
  font-size: 13px;
  font-weight: 500;
}
.file-upload-drop strong {
  color: #0d63ff;
  text-decoration: underline;
}
.file-upload-drop small {
  color: #61728f;
  font-size: 12px;
}
.file-upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.customer-note-stack {
  display: grid;
  gap: 10px;
}
.customer-note-card {
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 8px 26px rgba(17, 35, 68, .05);
}
.public-note-card {
  background: linear-gradient(90deg, #eefbf1, #fbfffc);
  border-color: #bfe8ca;
}
.internal-note-card {
  background: linear-gradient(90deg, #fff0f0, #fffbfb);
  border-color: #f0b9b9;
}
.customer-note-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.public-note-card .customer-note-title h3 {
  color: #087333;
}
.internal-note-card .customer-note-title h3 {
  color: #a1121f;
}
.customer-note-content {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #d9e4f2;
  border-radius: 7px;
  background: rgba(255,255,255,.75);
  color: #526685;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.icon-only {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
}
.icon-only svg {
  width: 20px;
  height: 20px;
}
.case-compact-status .case-compact-action {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .customer-profile-layout {
    grid-template-columns: 1fr;
  }
  .customer-profile-right {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .customer-profile-hero {
    grid-template-columns: 1fr;
    justify-items: start;
    padding: 14px;
  }
  .customer-profile-icon {
    width: 60px;
    height: 60px;
  }
  .customer-profile-icon svg {
    width: 34px;
    height: 34px;
  }
  .customer-profile-main h2 {
    font-size: 21px;
  }
  .customer-profile-actions {
    width: 100%;
  }
  .customer-profile-actions button {
    width: 100%;
    justify-content: center;
  }
  .customer-info-section,
  .gallery-bubble,
  .customer-note-card {
    padding: 12px;
  }
  .case-compact-status > div,
  .customer-info-public .customer-grid > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.toolbar button { font-size: 12px; min-height: 30px; padding: 6px 9px; }
.timeline-row button,
.doc-action-stack button,
.timeline-subrow-actions button,
.quick-actions button {
  min-height: 30px;
  padding: 6px 9px;
  line-height: 1.1;
  white-space: nowrap;
}
.timeline-row .next-status-btn,
.timeline-subrow-actions .next-status-btn,
.quick-actions .next-status-btn {
  border-color: #e0a92f;
  background: #fff4cc;
  color: #6f4a00;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}
.timeline-row .next-status-btn:hover,
.timeline-subrow-actions .next-status-btn:hover,
.quick-actions .next-status-btn:hover {
  background: #ffe7a3;
  border-color: #c98a12;
  filter: none;
}

.mail-btn-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mail-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  min-width: 14px;
  font-size: 14px;
  line-height: 1;
}

.mail-symbol.paperclip {
  width: 11px;
  min-width: 11px;
  margin-left: -3px;
  font-size: 12px;
}
.whatsapp-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  line-height: 1;
}
.whatsapp-symbol svg {
  width: 18px;
  height: 18px;
  display: block;
}
.mini-action {
  min-height: 26px;
  padding: 4px 8px;
  margin-left: 8px;
}
.whatsapp-btn {
  border-color: #bfe8ce;
}
.timeline-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.6fr);
  gap: 8px;
  position: relative;
  border-left: 4px solid #176b87;
  align-items: center;
}
.timeline-row.timeline-row-with-actions {
  grid-template-columns: minmax(360px, 1fr) minmax(360px, auto);
}
.timeline-row > div {
  min-width: 0;
}
.timeline-row > div:first-child:last-child {
  grid-column: 1 / -1;
}
.timeline-row .doc-action-stack {
  justify-self: end;
  width: 100%;
}
.timeline-row .toolbar {
  justify-content: flex-end;
  margin-top: 0;
}
.timeline-row .preview-wrap,
.timeline-row .einvoice-box {
  grid-column: 1 / -1;
}
.timeline-row::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #176b87;
  border: 2px solid #fff;
}
.timeline-row:has(strong) small {
  color: #52606d;
  white-space: normal;
  overflow-wrap: anywhere;
}
.timeline-row.timeline-row-cancelled {
  border-color: #f0b8b8;
  border-left-color: #b91c1c;
  background: #fff5f5;
  color: #991b1b;
}
.timeline-row.timeline-row-cancelled::before {
  background: #b91c1c;
}
.timeline-row.timeline-row-cancelled strong,
.timeline-row.timeline-row-cancelled small,
.timeline-row.timeline-row-cancelled .document-communication-status,
.timeline-row.timeline-row-cancelled .einvoice-inline-status {
  color: #991b1b;
}
.cancelled-invoice-notice {
  display: inline-block;
  margin: 6px 0;
  padding: 5px 8px;
  border: 1px solid #f0b8b8;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
}
.quick-actions {
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  overflow-x: hidden;
  gap: 8px;
}
.quick-actions button {
  background: var(--ink);
  color: #fff;
  flex: 1 1 0;
  min-width: 0;
  max-width: 220px;
  white-space: normal;
}
.workflow-actions {
  margin-top: 9px;
}
button.danger {
  background: #bf2118;
  color: #fff;
  border-color: #bf2118;
}
.calendar-panel {
  overflow: visible;
}
.calendar-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 145px 145px 150px 150px;
  gap: 8px;
  margin: 10px 0 12px;
  position: relative;
  z-index: 30;
}
.toolbar [data-calendar-mode].active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.month-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.month-card h3 {
  margin: 0;
  padding: 8px 10px;
  background: #eaf4f5;
  color: #13677b;
  font-size: 14px;
}
.calendar-day {
  min-height: 34px;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 4px 6px;
}
.calendar-day.weekend {
  background: #e9f7fb;
}
.calendar-day.holiday {
  background: #fff3d6;
}
.calendar-date {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  color: var(--ink);
  font-size: 12px;
}
.calendar-date span {
  color: var(--muted);
  font-size: 11px;
}
.calendar-events {
  display: grid;
  gap: 3px;
}
.calendar-event {
  min-height: 22px;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid #b7d4dc;
  background: #edf7fa;
  color: var(--ink);
  text-align: left;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event.type-aufmass,
.calendar-list-item.type-aufmass { background: #dff3ef; border-color: #9ed9cf; color: #17202a; }
.calendar-event.type-montage,
.calendar-list-item.type-montage { background: #e3f4df; border-color: #abd99e; color: #17202a; }
.calendar-event.type-beratung,
.calendar-list-item.type-beratung { background: #eee7ff; border-color: #c8b6ff; color: #17202a; }
.calendar-event.type-nacharbeit,
.calendar-list-item.type-nacharbeit { background: #fff0dc; border-color: #f0bf79; color: #17202a; }
.calendar-event.type-default,
.calendar-list-item.type-default { background: #edf2f7; border-color: #cbd5e1; color: #17202a; }
.calendar-day-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.calendar-list-item {
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
}
.calendar-list-item strong,
.calendar-list-item span {
  display: block;
}
.calendar-event span {
  font-weight: 800;
  margin-right: 5px;
  color: #176b87;
}
.calendar-event,
.calendar-event strong,
.calendar-event span,
.calendar-list-item,
.calendar-list-item strong,
.calendar-list-item span {
  color: #17202a;
}
.calendar-event.erledigt {
  background: #e3f3ed;
  border-color: #b7dccf;
}
.calendar-event.abgesagt {
  background: #f8e4e2;
  border-color: #efb8b3;
}
.holiday-label {
  color: #a35b00;
  font-size: 11px;
  font-weight: 800;
}
.day-mode,
.week-mode {
  grid-template-columns: 1fr;
}
.appointment-row {
  cursor: pointer;
}
.warning-box {
  border: 1px solid #f2c46d;
  background: #fff7e4;
  color: #6f5211;
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 10px;
  font-weight: 700;
}
.pdf-preview {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
  background: #fff;
}
.preview-wrap {
  flex: 0 0 100%;
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.preview-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.tablet-pdf-message {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid #c8dde4;
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: #eef8fb;
  color: var(--ink);
}
.tablet-pdf-message strong {
  font-size: 16px;
}
.tablet-pdf-message span {
  color: var(--muted);
}
.timeline-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}
.timeline-filter button.active {
  background: #176b87;
  color: #fff;
}
.status-checks {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.status-check {
  border: 1px solid var(--line);
  border-left: 4px solid #d8b45b;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  display: grid;
  gap: 2px;
}
.status-check.ok { border-left-color: #1b6f5b; }
.status-check.warn { border-left-color: #d8b45b; }
.status-check.bad { border-left-color: #b42318; }
.status-check span {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.status-check details {
  margin-top: 4px;
}
.status-check summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}
.status-check pre {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  background: #f3f5f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}
.file-upload {
  margin: 8px 0;
}
.file-upload input {
  width: 100%;
  max-width: 100%;
}
.file-grid {
  display: grid;
  gap: 6px;
}
.file-grid a {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.file-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.file-gallery-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.file-gallery-pager span {
  color: var(--muted);
  font-weight: 700;
}
.file-gallery-pager button {
  min-height: 34px;
  padding: 6px 10px;
}
.file-tile {
  display: grid;
  gap: 3px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: #fff;
  min-height: 0;
  text-align: left;
}
.file-tile img,
.file-icon {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: var(--soft);
  border: 1px solid var(--line);
}
.file-icon {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--muted);
}
.file-tile strong {
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-profile-right .file-gallery {
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 5px;
}

.customer-profile-right .file-tile img,
.customer-profile-right .file-icon {
  aspect-ratio: 5 / 3;
  max-height: 90px;
}

.customer-profile-right .file-tile {
  padding: 4px;
}

.customer-profile-right .file-tile strong {
  font-size: 9px;
  line-height: 1.15;
}

.customer-profile-right .file-gallery-pager {
  margin-top: 6px;
}

.customer-profile-right .file-gallery-pager button {
  min-height: 30px;
  padding: 5px 9px;
}
.file-gallery-empty {
  color: var(--muted);
  margin-top: 8px;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .file-gallery,
  .customer-profile-right .file-gallery {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

@media (max-width: 520px) {
  .file-gallery,
  .customer-profile-right .file-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
#appointmentModal .modal-actions {
  justify-content: space-between;
}
#appointmentModal #deleteAppointmentBtn {
  margin-right: auto;
}
.calendar-appointments-panel {
  padding: 0;
  overflow: hidden;
}
.calendar-appointments-panel > .calendar-appointments-summary {
  border-left: 5px solid #59636b;
}
.calendar-appointments-panel[open] > .calendar-appointments-summary::after {
  content: "^";
}
.calendar-appointment-list {
  padding: 12px;
}
.doc-action-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
}
.doc-action-stack .toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  row-gap: 8px;
  margin-top: 0;
}
.doc-action-stack .toolbar button + button {
  margin-left: 2px;
}
.einvoice-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #f8fbfc;
}
.einvoice-box summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand);
}
.einvoice-box .toolbar {
  justify-content: flex-end;
  margin-top: 8px;
}
.einvoice-box small {
  display: block;
  margin-top: 6px;
  text-align: right;
}
.einvoice-inline-status {
  margin-top: 8px;
  padding: 10px 12px;
  max-width: 760px;
  border-left: 4px solid #d6a100;
  border-radius: 6px;
  background: #fff8ce;
  color: #3b3420;
  font-size: 14px;
  line-height: 1.35;
}
.search { max-width: 320px; }
.calc { max-width: 360px; }

.export-center {
  display: grid;
  gap: 14px;
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.export-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 150px;
  padding: 14px;
  border: 1px solid #d4dcda;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #f6f8f7;
}
.export-card h3,
.export-card p {
  margin: 0;
}
.floating-calc {
  position: fixed;
  z-index: 1200;
  top: 96px;
  right: 28px;
  width: min(420px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(14, 24, 28, .22);
  padding: 14px;
}
.floating-calc.hidden {
  display: none;
}
.floating-calc .calc {
  max-width: none;
}
.floating-calc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: move;
  user-select: none;
  margin-bottom: 10px;
}
.floating-calc-head button {
  cursor: pointer;
}
.calc-display {
  height: 48px;
  text-align: right;
  font-size: 22px;
  margin-bottom: 10px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.calc-grid button, .factor-row button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.calc-grid button:nth-child(4n), .calc-grid button:nth-child(15) {
  background: #202623;
  color: #fff;
}
.wide-btn { grid-column: span 4; }
.factor-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.offer-items {
  display: grid;
  gap: 12px;
}
.acceptance-items {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
}
.acceptance-review-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -6px 0 14px auto;
  padding: 13px 16px;
  width: min(560px, 100%);
  border: 2px solid #f59e0b;
  border-radius: 8px;
  background: #fff3d6;
  color: #4d3300;
}
.acceptance-review-title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-weight: 800;
}
.acceptance-review-choice label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 800;
}
.acceptance-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto minmax(220px, .9fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.acceptance-item label {
  margin: 0;
}
.acceptance-item .check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
}
.acceptance-remark[hidden] {
  display: none;
}
.acceptance-remark textarea {
  min-height: 72px;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.offer-signature-grid {
  grid-template-columns: minmax(0, 1fr);
}

.mail-timeline-row {
  border-left-color: #176b87;
  background: #f7fbfc;
}

.mail-child-stack {
  display: grid;
  gap: 6px;
  margin: 4px 0 4px clamp(46px, 7vw, 130px);
}

.mail-child-stack .mail-timeline-row {
  width: min(760px, calc(100% - 10px));
}

.timeline-group-block {
  border: 1px solid var(--line);
  border-left: 5px solid #176b87;
  border-radius: 8px;
  margin: 7px 0;
  overflow: hidden;
  background: #fff;
}

.timeline-group-block > .timeline-row,
.timeline-group-summary > .timeline-row {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.timeline-group-block > .timeline-row::before,
.timeline-group-summary > .timeline-row::before {
  display: none;
}

.timeline-group-summary {
  display: block;
  list-style: none;
  cursor: pointer;
}

.timeline-group-summary::-webkit-details-marker {
  display: none;
}

details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row small,
details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row .doc-action-stack,
details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row .preview-wrap,
details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row .einvoice-box,
details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row .document-communication-status,
details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row .einvoice-inline-status {
  display: none;
}

details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row {
  min-height: 44px;
}

details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row > div:first-child {
  display: flex;
  align-items: center;
}

details.timeline-group-block:not([open]) > .timeline-group-summary .timeline-row strong::after {
  content: "Anzeigen";
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 10px;
  padding: 4px 10px;
  border: 1px solid #cfe0fa;
  border-radius: 999px;
  background: #eaf3ff;
  color: #115bb7;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

details.timeline-group-block:not([open]) > .timeline-group-summary:hover .timeline-row strong::after {
  background: #dcecff;
  border-color: #a9caf5;
  color: #0d4fa3;
}

.timeline-group-estimate { background: #f7fbfc; border-left-color: #176b87; }
.timeline-group-estimate-skipped { background: #f5f6f6; border-left-color: #aeb7b3; }
.timeline-group-offer { background: #fbfaf2; border-left-color: #b78a2b; }
.timeline-group-job { background: #f7faf6; border-left-color: #4f8d57; }
.timeline-group-invoice { background: #f9f7fc; border-left-color: #7562a8; }
.timeline-group-acceptance { background: #f7fbf9; border-left-color: #2d8b75; }
.timeline-group-reminder { background: #fff8f6; border-left-color: #c46b55; }

.timeline-subrows {
  margin: 0 14px 12px 24px;
  border-top: 1px solid rgba(23, 107, 135, .18);
}

.timeline-subrow {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(23, 107, 135, .12);
  align-items: center;
}

.timeline-subrow:last-child {
  border-bottom: 0;
}

.timeline-subrow strong {
  font-size: .9rem;
}

.timeline-subrow-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.timeline-subrow small {
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.timeline-subrow-actions {
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.timeline-subrow-actions button {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.1;
}

.timeline-subrow-actions .mail-btn-label {
  gap: 5px;
}

.timeline-subrow-actions .mail-symbol,
.timeline-subrow-actions .whatsapp-symbol {
  width: 14px;
  min-width: 14px;
  height: 14px;
  font-size: 14px;
}

.timeline-subrow-actions .whatsapp-symbol svg {
  width: 14px;
  height: 14px;
}

.timeline-subrow.sub-mail strong { color: #176b87; }
.timeline-subrow.sub-payment strong { color: #4f8d57; }
.timeline-subrow.sub-status strong { color: #5b6270; }
.timeline-subrow.sub-appointment strong { color: #8a6a18; }

.timeline-child-subrows {
  margin-left: 0;
  background: rgba(247, 251, 252, .72);
}

.timeline-child-subrows .timeline-subrow {
  padding-left: 14px;
  border-left: 3px solid rgba(23, 107, 135, .24);
}

.timeline-subrow.child-mail {
  margin-left: clamp(28px, 4vw, 72px);
  padding-left: 14px;
  border-left: 3px solid rgba(23, 107, 135, .28);
  background: rgba(247, 251, 252, .75);
}

.document-communication-status {
  display: inline-block;
  margin-top: 4px;
  color: #4f5c62;
  font-size: 13px;
  line-height: 1.35;
}

.document-communication-status strong {
  color: #176b87;
}

@media (max-width: 820px) {
  .timeline-row,
  .timeline-subrow {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline-row .doc-action-stack,
  .timeline-subrow-actions {
    justify-self: stretch;
  }

  .timeline-row .toolbar,
  .timeline-subrow-actions {
    justify-content: flex-end;
  }

  .timeline-row {
    gap: 10px;
    padding: 12px;
  }

  .timeline-row .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .timeline-row .toolbar button {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.15;
  }
}

.signature-pad {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.signature-pad canvas {
  display: block;
  width: 100%;
  height: 150px;
  margin: 8px 0;
  border: 1px dashed #9fb2bc;
  border-radius: 6px;
  background: #fff;
  touch-action: none;
}
.offer-item-row {
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.offer-item-main,
.offer-item-detail {
  display: grid;
  gap: 8px;
  align-items: start;
}
.offer-item-main {
  grid-template-columns: minmax(150px, 1.2fr) minmax(180px, 1.6fr) 80px 95px 110px 44px;
}
.offer-item-detail {
  margin-top: 8px;
  grid-template-columns: minmax(160px, 1fr) 110px 110px minmax(150px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr);
}
.offer-item-main input,
.offer-item-detail input,
.offer-item-detail select,
.offer-item-detail textarea {
  min-width: 0;
}
.travel-credit-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #176b87;
  white-space: nowrap;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid #bfd7dd;
  border-radius: 6px;
  background: #eef7f9;
  box-sizing: border-box;
}
.travel-credit-toggle input {
  width: auto;
  min-width: 0;
}
.travel-credit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  width: fit-content;
  padding: 0 10px;
  border: 1px solid #e0a3a3;
  border-radius: 6px;
  background: #fff1f1;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.template-editor {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.template-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.template-group h3 {
  margin: 0;
  padding: 10px 12px;
  background: #e4e7e5;
  color: #13677b;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.template-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.6fr) 100px 105px 75px 88px minmax(190px, 1.8fr) 104px;
  gap: 0;
  align-items: stretch;
  padding: 0;
  border-top: 1px solid #e1e6e3;
  background: #fff;
}
.template-row:first-of-type {
  border-top: 0;
}
.template-row input,
.template-row select,
.template-row textarea {
  min-height: 44px;
  border: 0;
  border-right: 1px solid #e1e6e3;
  border-radius: 0;
  background: #fbfcfc;
}
.template-row textarea {
  min-height: 44px;
  resize: vertical;
}
.template-row button {
  border: 0;
  border-radius: 0;
  background: #e7eef1;
  color: var(--ink);
}
.price-rule-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.price-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  border: 0;
  border-top: 1px solid #e1e6e3;
  border-radius: 0;
  padding: 10px 12px;
  background: #fff;
}
.price-rule-row:first-child {
  border-top: 0;
}
.price-rule-row small {
  color: var(--muted);
}
.price-rule-test {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}
.price-rule-test h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #13677b;
}
.price-rule-test-result {
  margin-top: 9px;
  border-left: 4px solid #176b87;
  border-radius: 8px;
  background: #eef8fb;
  padding: 8px 10px;
  line-height: 1.45;
}
.footer-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.footer-col {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  display: grid;
  gap: 0;
  overflow: hidden;
  background: #fff;
}
.footer-col strong {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef3f1;
  color: #17202a;
}
.footer-col label {
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  border-bottom: 1px solid #e1e6e3;
  background: #fff;
}
.footer-col label:last-child {
  border-bottom: 0;
}
.footer-col select {
  background: #fbfcfc;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  font-size: 12px;
}
.background-busy {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 13px;
  border: 1px solid #b8d8e4;
  border-radius: 7px;
  background: #eefaff;
  color: #07566f;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 800;
  transform: translate(-50%, -50%);
}
.background-busy.hidden {
  display: none;
}
.background-busy-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 3px solid #b8d8e4;
  border-top-color: #0c7696;
  border-radius: 50%;
  animation: spin .85s linear infinite;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  background: #111413;
  color: #fff;
  padding: 10px 12px;
  border-radius: 7px;
  box-shadow: var(--shadow);
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(17, 20, 19, .42);
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(17, 20, 19, .24);
  padding: 16px;
}
.quick-custom-ral-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
}
.quick-custom-ral-card h3 {
  margin: 0;
}
.quick-custom-ral-card label {
  display: grid;
  gap: 6px;
}
.quick-custom-ral-card input {
  min-height: 38px;
  font-size: 14px;
}
.loading-card {
  width: min(360px, calc(100vw - 32px));
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 28px 24px;
}
.loading-card h2 {
  margin: 0;
}
.loading-card p {
  margin: 0;
  color: var(--muted);
}
.info-card {
  width: min(560px, calc(100vw - 32px));
}
.info-card h2 {
  margin: 0 0 10px;
}
.info-card p {
  margin: 0;
  white-space: pre-line;
  line-height: 1.45;
}
.confirm-card {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
.confirm-card h2 {
  margin: 0;
  font-size: 18px;
}
.confirm-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}
.document-review-card {
  width: min(640px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
}
.document-review-card .panel-head {
  margin-bottom: 0;
}
.document-review-card h2 {
  margin: 0;
}
.document-review-card p {
  margin: 0;
}
.document-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.document-review-grid label {
  display: grid;
  gap: 5px;
  font-weight: 800;
  color: var(--muted);
}
.document-review-grid label.wide {
  grid-column: 1 / -1;
}
.document-review-grid input,
.document-review-grid textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  background: #fff;
}
.document-review-grid input[readonly],
.document-review-grid textarea[readonly] {
  background: #f7faf9;
  color: var(--muted);
}
.document-email-modal {
  width: min(880px, 100%);
  max-height: min(680px, calc(100vh - 24px));
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  gap: 8px;
  padding: 14px;
  overflow: hidden;
}
.document-email-modal .panel-head {
  margin-bottom: 0;
}
.document-email-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0;
}
.document-email-meta label,
.document-email-body-label {
  display: grid;
  gap: 4px;
  font-weight: 700;
  color: var(--muted);
}
.document-email-meta input,
.document-email-body-label textarea {
  color: var(--ink);
  font-weight: 400;
}
.document-email-body-label textarea {
  height: clamp(190px, 34vh, 360px);
  min-height: 180px;
  max-height: 40vh;
  resize: vertical;
  line-height: 1.45;
  overflow: auto;
}
.document-email-modal .modal-actions {
  margin-top: 0;
}
.confirm-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #fff4d6;
  color: #7a4c00;
  font-weight: 900;
  border: 1px solid #f0d48a;
}
.confirm-actions {
  width: 100%;
  justify-content: center;
}
.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #d8dfdc;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .85s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.image-modal-card {
  width: min(1180px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  max-height: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.image-modal-actions {
  justify-content: space-between;
}
.image-viewer {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: start;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  background: #f6f9fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
}
.image-viewer img,
.image-viewer iframe {
  width: 100%;
  min-width: 0;
  max-height: none;
  box-sizing: border-box;
  background: #fff;
  border-radius: 6px;
}
.image-viewer img {
  height: auto;
  object-fit: contain;
  align-self: start;
  justify-self: center;
}
.image-viewer iframe {
  height: 100%;
  border: 0;
  min-height: 0;
}
.image-viewer.pdf-mode {
  grid-template-columns: 1fr;
  align-items: stretch;
  overflow: hidden;
}
.image-viewer.pdf-mode iframe {
  height: 100%;
}
.image-viewer.pdf-mode .image-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  background: rgba(17, 20, 19, .92);
  color: #fff;
  border-color: rgba(17, 20, 19, .92);
}
.image-viewer.pdf-mode #fileViewerPrev {
  left: 12px;
}
.image-viewer.pdf-mode #fileViewerNext {
  right: 12px;
}
.image-nav {
  position: sticky;
  top: 50%;
  transform: translateY(-50%);
  min-height: 44px;
  width: 44px;
  padding: 0;
  font-size: 28px;
  display: grid;
  place-items: center;
  align-self: start;
  z-index: 2;
}
.payment-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0 16px;
  background: #fbfcfd;
}
.payment-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.payment-summary strong {
  display: block;
  margin-top: 3px;
}
input[readonly] {
  background: #e9eef2;
  color: var(--muted);
}
.placeholder-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.placeholder-token {
  display: grid;
  gap: 3px;
  text-align: left;
  background: #fbfcfc;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 7px;
  padding: 10px;
  cursor: pointer;
}
.placeholder-token code {
  font-weight: 800;
  font-size: 14px;
}
.placeholder-token span {
  color: var(--muted);
  font-size: 12px;
}
.hidden { display: none !important; }

.customer-info-public .customer-grid > div {
  grid-template-columns: minmax(180px, .32fr) minmax(0, 1fr);
  align-items: start;
}

.customer-info-public .customer-grid > div > span,
.customer-info-internal .customer-grid > div > span {
  min-width: 0;
}

.customer-info-public .customer-grid > div > strong {
  display: block;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.customer-info-public .customer-grid .mini-action {
  margin-top: 5px;
  width: fit-content;
}

.customer-info-public .customer-grid {
  grid-template-columns: 1fr;
}
.customer-info-public .customer-grid > div {
  display: grid;
  grid-template-columns: minmax(180px, .32fr) minmax(0, 1fr);
  gap: 18px;
  border: 0;
  border-bottom: 1px solid #d9e4f2;
  border-radius: 0;
  padding: 8px 0;
  background: transparent;
}
.customer-info-public .customer-grid > div:last-child {
  border-bottom: 0;
}

@media (max-width: 1300px) {
  .customer-info-internal .customer-grid > div {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .customer-info-internal .customer-grid > div > strong {
    display: block;
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
.lock {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #f4f8f6;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.lock::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/premium-fliegengitter-logo.png") center 42% / min(520px, 62vw) auto no-repeat;
  opacity: .09;
  pointer-events: none;
}
.lock-panel {
  position: relative;
  z-index: 1;
  width: min(360px, calc(100vw - 32px));
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
}
.lock-panel img {
  width: 190px;
  justify-self: center;
}
.lock-panel h1 { margin: 6px 0 0; font-size: 20px; }
.lock-panel p { margin: 0; color: var(--muted); }
#activateError { color: var(--danger); font-size: 12px; min-height: 16px; }

@media (max-width: 980px) {
  .export-trash-panel {
    padding: 8px;
  }
  .export-trash-panel th,
  .export-trash-panel td {
    padding: 5px 6px;
    font-size: 13px;
  }
  .export-trash-panel th:nth-child(1),
  .export-trash-panel td:nth-child(1) { width: 15%; }
  .export-trash-panel th:nth-child(2),
  .export-trash-panel td:nth-child(2) { width: 9%; }
  .export-trash-panel th:nth-child(3),
  .export-trash-panel td:nth-child(3) { width: 16%; }
  .export-trash-panel th:nth-child(4),
  .export-trash-panel td:nth-child(4) { width: 30%; }
  .export-trash-panel th:nth-child(5),
  .export-trash-panel td:nth-child(5) { width: 16%; }
  .export-trash-panel th:nth-child(6),
  .export-trash-panel td:nth-child(6) {
    width: 88px;
    min-width: 88px;
    overflow: visible;
  }
  .trash-actions .icon-action-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
  }
  .cancellation-table th:nth-child(1),
  .cancellation-table td:nth-child(1) { width: 20%; }
  .cancellation-table th:nth-child(2),
  .cancellation-table td:nth-child(2) { width: 24%; }
  .cancellation-table th:nth-child(3),
  .cancellation-table td:nth-child(3) { width: 14%; }
  .cancellation-table th:nth-child(4),
  .cancellation-table td:nth-child(4) { width: 18%; }
  .cancellation-table th:nth-child(5),
  .cancellation-table td:nth-child(5) {
    width: 24%;
    min-width: 0;
  }
  .cancellation-table .trash-action-buttons {
    gap: 4px;
  }
  .month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calendar-filters {
    grid-template-columns: 1fr;
  }
  .stats-filter {
    grid-template-columns: 1fr;
  }
  .estimate-note-warning-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .month-grid {
    grid-template-columns: 1fr;
  }
  .stat-kpis {
    grid-template-columns: 1fr;
  }
  .calendar-day {
    grid-template-columns: 42px 1fr;
  }
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }
  nav { grid-template-columns: repeat(3, 1fr); }
  .shell { margin-left: 0; padding: 14px; width: 100%; }
  .topbar, .grid.two, .detail-grid { grid-template-columns: 1fr; display: grid; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .kpis, .stat-kpis { grid-template-columns: repeat(2, 1fr); }
  .export-grid, .case-compact-status { grid-template-columns: 1fr; }
  .form-grid, .form-grid.compact { grid-template-columns: repeat(2, 1fr); }
  .document-review-grid { grid-template-columns: 1fr; }
  .quick-grid, .quick-main-fields, .footer-settings { grid-template-columns: 1fr; }
  .item-main, .item-detail { grid-template-columns: 1fr 1fr; }
  .template-row { grid-template-columns: 1fr 1fr; }
  .case-filter-row.fields,
  .case-filter-row.search-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .case-filter-row.date-row,
  .case-filter-row.status-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-inline-detail {
    padding: 10px;
  }

  .customer-bubble,
  .gallery-bubble {
    padding: 10px;
  }

  .section-title-actions {
    gap: 8px;
  }

  .section-title-actions button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 14px;
  }

  .customer-info-sections {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .customer-info-section {
    padding: 8px;
  }

  .customer-info-section h4 {
    margin-bottom: 2px;
  }

  .customer-section-hint {
    margin-bottom: 5px;
  }

  .customer-grid {
    gap: 0;
  }

  .customer-grid div,
  .customer-info-public .customer-grid > div,
  .customer-info-internal .customer-grid div:not(.customer-internal-alert) {
    grid-template-columns: minmax(96px, .45fr) minmax(0, 1fr);
    gap: 8px;
    padding: 5px 0;
  }

  .customer-grid span {
    font-size: 11px;
  }

  .customer-grid strong {
    font-size: 13px;
  }

  .customer-info-internal .customer-section-hint {
    display: none;
  }

  .file-upload input {
    width: 100%;
  }
}

@media (min-width: 981px) and (max-width: 1500px) {
  .sidebar {
    width: 210px;
  }
  .shell {
    margin-left: 210px;
    width: auto;
  }
  .brand img {
    width: 34px;
    height: 34px;
  }
  .nav {
    padding: 7px 9px;
  }
  .item-row {
    padding: 9px;
  }
  .item-main {
    grid-template-columns:
      minmax(115px, 1fr)
      minmax(95px, .85fr)
      minmax(210px, 1.7fr)
      minmax(160px, 1.25fr)
      minmax(64px, .45fr)
      minmax(78px, .55fr)
      minmax(96px, .65fr)
      40px;
    gap: 7px;
  }
  .item-detail {
    grid-template-columns:
      minmax(112px, .75fr)
      minmax(112px, .75fr)
      minmax(150px, 1fr)
      minmax(210px, 1.4fr)
      minmax(260px, 1.7fr)
      86px;
    gap: 7px;
  }
  .item-main input,
  .item-main select,
  .item-detail input,
  .item-detail textarea {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
  }
  button {
    padding: 7px 10px;
  }
}

@media (min-width: 981px) and (max-width: 1240px) {
  .pdf-preview {
    min-height: 74vh;
    height: 74vh;
  }
  .preview-actions {
    position: sticky;
    top: 0;
    z-index: 2;
    justify-content: flex-start;
    padding: 8px 0;
    background: #fff;
  }
  .item-main {
    grid-template-columns:
      minmax(110px, 1fr)
      minmax(88px, .8fr)
      minmax(190px, 1.6fr)
      minmax(145px, 1.2fr)
      minmax(60px, .45fr)
      minmax(72px, .55fr)
      minmax(88px, .65fr)
      40px;
  }
  .item-detail {
    grid-template-columns:
      minmax(100px, .75fr)
      minmax(100px, .75fr)
      minmax(135px, 1fr)
      minmax(180px, 1.35fr)
      minmax(220px, 1.6fr)
      86px;
  }
  .item-detail [name="color"],
  .item-detail [name="mounting_note"],
.item-detail [name="description"] {
  grid-column: span 1;
}
.offer-items {
  display: grid;
  gap: 12px;
}
.offer-item-row {
  border: 1px solid var(--line);
  border-left: 4px solid #176b87;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.offer-item-main,
.offer-item-detail {
  display: grid;
  gap: 8px;
  align-items: start;
}
.offer-item-main {
  grid-template-columns: minmax(150px, 1.2fr) minmax(180px, 1.6fr) 80px 95px 110px 44px;
}
.offer-item-detail {
  margin-top: 8px;
  grid-template-columns: minmax(160px, 1fr) 110px 110px minmax(150px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr);
}
.offer-item-main input,
.offer-item-detail input,
.offer-item-detail textarea {
  min-width: 0;
}
  .estimate-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {
  .pdf-preview {
    min-height: 78vh;
    height: 78vh;
  }
  .preview-actions {
    position: sticky;
    top: 0;
    z-index: 2;
    justify-content: flex-start;
    padding: 8px 0;
    background: #fff;
  }
  .preview-actions button {
    flex: 1 1 180px;
  }
  .tablet-pdf-message {
    font-size: 15px;
  }
}

@media (max-width: 560px) {
  nav { grid-template-columns: 1fr 1fr; }
  .kpis, .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .item-main, .item-detail { grid-template-columns: 1fr; }
  .credit-line { grid-template-columns: 1fr; }
  .template-row { grid-template-columns: 1fr; }
  .case-filter-row.fields,
  .case-filter-row.search-row,
  .case-filter-row.date-row {
    grid-template-columns: 1fr;
  }
  .case-filter-row.status-row {
    grid-template-columns: 1fr;
  }
  .case-filter-row.date-row label:not(.check-label) {
    grid-template-columns: 32px 1fr;
  }
  .topbar { align-items: stretch; }
  .actions { width: 100%; }
  .top-search { width: 100%; min-width: 0; }
  .actions button { flex: 1; }
}

/* Modal overrides: keep dialogs inside the visible browser width. */
.modal {
  padding: clamp(8px, 2vw, 20px);
}
.modal-card {
  box-sizing: border-box;
  max-width: calc(100vw - clamp(16px, 4vw, 40px));
  overflow-x: hidden;
  overflow-y: auto;
}
.wide-modal {
  width: min(1160px, calc(100vw - clamp(16px, 4vw, 40px)));
}
.wide-modal * {
  box-sizing: border-box;
}
.wide-modal .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.wide-modal .form-grid .wide {
  grid-column: 1 / -1;
}
.offer-item-row {
  max-width: 100%;
  overflow: hidden;
}
.offer-item-main,
.offer-item-detail {
  width: 100%;
  grid-template-columns: repeat(16, minmax(0, 1fr));
}
.offer-item-main [name="element_type"] { grid-column: span 2; }
.offer-item-main [name="wing_type"] { grid-column: span 2; }
.offer-item-main [name="product"] { grid-column: span 4; }
.offer-item-main [name="room"] { grid-column: span 2; }
.offer-item-main [name="quantity"] { grid-column: span 1; }
.offer-item-main [name="unit"] { grid-column: span 1; }
.offer-item-main [name="unit_price"] { grid-column: span 3; }
.offer-item-main .remove-offer-item { grid-column: span 1; }
.offer-item-detail [name="width"] { grid-column: span 2; }
.offer-item-detail [name="height"] { grid-column: span 2; }
.offer-item-detail [name="color"] { grid-column: span 2; }
.offer-item-detail [name="mounting_note"] { grid-column: span 5; }
.offer-item-detail [name="description"] { grid-column: span 5; }
.offer-item-main .remove-offer-item {
  align-self: stretch;
  min-height: 42px;
}
.offer-item-main input,
.offer-item-detail input,
.offer-item-detail select,
.offer-item-detail textarea {
  width: 100%;
}
.offer-item-row.service-item .offer-item-main {
  grid-template-columns: minmax(0, 1fr) 88px 110px minmax(100px, 140px) 42px;
}
.offer-item-row.service-item .offer-item-main [name="element_type"],
.offer-item-row.service-item .offer-item-main [name="wing_type"],
.offer-item-row.service-item .offer-item-main [name="room"] {
  display: none;
}
.offer-item-row.service-item .offer-item-main [name="product"],
.offer-item-row.service-item .offer-item-main [name="quantity"],
.offer-item-row.service-item .offer-item-main [name="unit"],
.offer-item-row.service-item .offer-item-main [name="unit_price"],
.offer-item-row.service-item .offer-item-main .remove-offer-item {
  grid-column: auto;
}
.offer-item-row.service-item .offer-item-detail {
  grid-template-columns: minmax(220px, 1fr) max-content;
  align-items: center;
}
.offer-item-row.service-item .offer-item-detail [name="room"],
.offer-item-row.service-item .offer-item-detail [name="width"],
.offer-item-row.service-item .offer-item-detail [name="height"],
.offer-item-row.service-item .offer-item-detail [name="color"],
.offer-item-row.service-item .offer-item-detail [name="mounting_note"] {
  display: none;
}
.offer-item-row.service-item .offer-item-detail [name="description"] {
  grid-column: auto;
}

.internal-order-modal-card {
  width: min(560px, calc(100vw - clamp(16px, 4vw, 40px)));
}

.internal-order-modal-card textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
}

.offer-payment-box {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #e0c574;
  border-left: 6px solid #d6a100;
  border-radius: 8px;
  background: #fff9df;
}

.offer-payment-title {
  grid-column: 1 / -1;
  font-weight: 800;
  color: #6e5200;
}

.offer-payment-box label {
  color: #5e4c17;
}

.offer-payment-box input[readonly] {
  background: #f0ead3;
  color: #2d2a20;
  font-weight: 800;
}

@media (max-width: 980px) {
  .wide-modal .form-grid {
    grid-template-columns: 1fr;
  }
  .offer-payment-box {
    grid-template-columns: 1fr;
  }
  .offer-item-main {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .offer-item-main [name="element_type"] { grid-column: span 3; }
  .offer-item-main [name="wing_type"] { grid-column: span 3; }
  .offer-item-main [name="product"] { grid-column: span 3; }
  .offer-item-main [name="quantity"],
  .offer-item-main [name="unit"],
  .offer-item-main [name="unit_price"] { grid-column: span 2; }
  .offer-item-main .remove-offer-item { grid-column: span 6; }
  .offer-item-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .offer-item-detail [name="room"],
  .offer-item-detail [name="color"],
  .offer-item-detail [name="mounting_note"],
  .offer-item-detail [name="description"] {
    grid-column: 1 / -1;
  }
  .offer-item-row.service-item .offer-item-main {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .offer-item-row.service-item .offer-item-main [name="product"] { grid-column: 1 / -1; }
  .offer-item-row.service-item .offer-item-main [name="quantity"],
  .offer-item-row.service-item .offer-item-main [name="unit"],
  .offer-item-row.service-item .offer-item-main [name="unit_price"] { grid-column: span 1; }
  .offer-item-row.service-item .offer-item-main .remove-offer-item { grid-column: span 1; }
}

@media (max-width: 620px) {
  .modal-card,
  .wide-modal {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    padding: 12px;
  }
  .offer-item-main,
  .offer-item-detail,
  .offer-item-row.service-item .offer-item-main {
    grid-template-columns: 1fr;
  }
  .offer-item-main > *,
  .offer-item-detail > *,
  .offer-item-row.service-item .offer-item-main > * {
    grid-column: 1 / -1 !important;
  }
}

@media (min-width: 1500px) {
  .quick-main-fields {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .quick-main-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .quick-col {
    padding: 8px;
  }
  .quick-item {
    min-height: 50px;
    padding: 8px;
  }
  .quick-item strong {
    font-size: 12px;
  }
  .quick-item span {
    font-size: 11px;
  }
}

@media (max-width: 700px) {
  .quick-main-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .quick-main-fields {
    grid-template-columns: 1fr;
  }
  .quick-wizard-head,
  .quick-fabric-panel {
    grid-template-columns: 1fr;
  }
}

.status-check.mini {
  display: inline-flex;
  min-height: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.permission-table th,
.permission-table td {
  vertical-align: top;
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1;
}

.permission-table {
  min-width: 760px;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  line-height: 1;
}

.permission-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f1;
  color: #26343b;
  font-size: 12px;
  text-align: center;
  padding: 6px 8px;
  line-height: 1;
}

.permission-table th:first-child,
.permission-table th:nth-child(2) {
  text-align: left;
}

.permission-table th:first-child {
  width: 185px;
}

.permission-table th:nth-child(2) {
  width: 122px;
}

.permission-role-head {
  width: 92px;
}

.permission-role-placeholder {
  color: #879197;
  font-weight: 700;
}

.permission-area-start > td {
  border-top: 1px solid #d6dfdc;
}

.permission-area-cell {
  background: #fbfcfc;
  border-right: 1px solid #dde5e2;
  padding: 7px 8px !important;
}

.permission-area-cell strong {
  display: block;
  color: #26343b;
  font-size: 12px;
  line-height: 1;
}

.permission-area-cell small {
  display: block;
  margin-top: 2px;
  color: #748087;
  font-size: 10px;
  line-height: 1;
}

.permission-action-cell {
  color: #46555d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  padding: 4px 8px !important;
  line-height: 1;
}

.permission-check-cell {
  text-align: center !important;
  vertical-align: middle !important;
  padding: 2px 8px !important;
  line-height: 1 !important;
}

.permission-check-cell label {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0 auto;
  line-height: 1;
}

.permission-check-cell input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.permission-check-cell input:disabled {
  opacity: 0.38;
}

.permission-empty-cell span {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px dashed #c9d3d0;
  border-radius: 4px;
  background: #f7faf9;
}

.permission-matrix {
  margin: 8px 0;
}

.role-admin-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.role-admin-rows {
  display: grid;
  gap: 6px;
}

.role-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, auto) auto auto;
  gap: 8px;
  align-items: center;
}

.role-admin-row input {
  min-width: 0;
}

.role-admin-row code {
  color: var(--muted);
  font-size: 12px;
}

.role-admin-create {
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px) auto;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .role-admin-row,
  .role-admin-create {
    grid-template-columns: 1fr;
  }
}

#settingsForm > h3.settings-major-title,
#settingsForm > h3.settings-group-title,
#settingsForm > .settings-major-title,
#settingsForm > .settings-group-title,
#settings .settings-major-title,
#settings .settings-group-title {
  display: block !important;
  margin: 3px 0 2px !important;
  padding: 4px 2px 4px !important;
  border: 0 !important;
  border-left: 0 !important;
  border-bottom: 2px solid #cfd8d4 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #c81e1e !important;
  box-shadow: none !important;
}

#settings .settings-title-row h3 {
  color: #c81e1e !important;
}

#settings.view.active {
  gap: 4px !important;
}

#settings .settings-collapsible,
#settings .settings-group-bubble,
#settings .settings-outer-section,
#settings .settings-section {
  margin-top: 2px !important;
  margin-bottom: 2px !important;
}

#settings .settings-activity-summary::after {
  content: "" !important;
  width: 8px !important;
  height: 8px !important;
  border-right: 3px solid #59636b !important;
  border-bottom: 3px solid #59636b !important;
  transform: rotate(45deg) !important;
}

#settings .settings-activity-panel[open] > .settings-activity-summary::after {
  transform: rotate(-135deg) !important;
}

/* Mobile-only polish for iPhone portrait and narrow Android screens.
   Desktop/tablet layouts stay on the existing rules above. */
@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
    font-size: 16px;
  }

  body {
    line-height: 1.45;
  }

  main,
  .view,
  .panel,
  .form-panel,
  .case-detail,
  .timeline-group-block,
  .export-card,
  .finance-top,
  .finance-controls {
    max-width: 100%;
    min-width: 0;
  }

  .view.active {
    gap: 14px;
  }

  .topbar {
    gap: 8px;
    padding-inline: 10px;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .actions button,
  .actions .button-link {
    width: 100%;
    min-height: 44px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  input,
  select,
  textarea,
  button,
  .button-link {
    min-height: 44px;
    font-size: 16px;
  }

  input,
  select,
  textarea {
    padding: 11px 12px;
  }

  button,
  .button-link {
    padding: 10px 12px;
    line-height: 1.2;
  }

  .case-card {
    padding: 14px 12px 14px 48px;
  }

  .case-card-main {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .case-card h3 {
    font-size: 19px;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .case-card-place,
  .case-card-created,
  .case-card-summary,
  .customer-grid,
  .customer-grid div,
  .row small,
  .case-card small {
    font-size: 15px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .case-card-summary {
    margin-top: 4px;
    padding-right: 0;
  }

  .case-card-docs {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .case-card-docs .pill,
  .case-card-docs .case-meta {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .case-card-docs .pill {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 15px;
    line-height: 1.15;
  }

  .case-progress {
    grid-template-columns: repeat(9, minmax(76px, 1fr));
    gap: 0;
    margin: 12px -4px 16px;
    padding: 10px 4px 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .case-progress::before {
    left: 42px;
    right: 42px;
    top: 27px;
    height: 5px;
  }

  .case-progress-step {
    min-width: 76px;
    scroll-snap-align: center;
  }

  .case-progress-step span {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .case-progress-step strong {
    max-width: 76px;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .timeline-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
    padding: 14px 12px;
  }

  .timeline-row > div:first-child,
  .timeline-subrow-main {
    min-width: 0;
  }

  .timeline-row strong,
  .timeline-subrow strong {
    font-size: 18px;
    line-height: 1.22;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .timeline-row small,
  .timeline-subrow small {
    font-size: 15px;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .doc-action-stack,
  .timeline-row .doc-action-stack,
  .timeline-subrow-actions {
    justify-items: stretch;
    justify-self: stretch;
    width: 100%;
  }

  .doc-action-stack .toolbar,
  .timeline-row .toolbar,
  .timeline-subrow-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    gap: 9px;
    width: 100%;
  }

  .timeline-group-offer .timeline-row .toolbar,
  .timeline-group-invoice .timeline-row .toolbar,
  .timeline-group-estimate .timeline-row .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-row .toolbar button,
  .doc-action-stack button,
  .timeline-subrow-actions button,
  .quick-actions button {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .timeline-row .next-status-btn,
  .timeline-subrow-actions .next-status-btn,
  .quick-actions .next-status-btn {
    grid-column: 1 / -1;
    min-height: 50px;
    text-align: left;
  }

  .timeline-subrows {
    margin: 0 8px 12px 14px;
  }

  .timeline-subrow {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 12px 0;
  }

  .timeline-subrow.child-mail {
    margin-left: 10px;
    padding: 12px 10px;
  }

  #estimateForm .estimate-customer-grid,
  #estimateForm .delivery-address-panel .estimate-customer-grid,
  .estimate-note-warning-row,
  .estimate-note-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #estimateForm .estimate-customer-grid {
    box-shadow: none;
    padding: 10px;
    border-radius: 8px;
  }

  #estimateForm .estimate-customer-grid label {
    font-size: 13px;
    gap: 5px;
  }

  #estimateForm .estimate-customer-grid label > input,
  #estimateForm .estimate-customer-grid label > select,
  #estimateForm .estimate-customer-grid label > textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .delivery-address-panel {
    padding: 12px;
  }

  .delivery-address-panel summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 17px;
  }

  .public-note-field textarea,
  .customer-private-warning textarea,
  .estimate-note-warning-row textarea {
    min-height: 88px;
    font-size: 16px;
  }

  .quick-price-preview,
  .quick-required-price,
  .quick-manual-result,
  .quick-price-main,
  .quick-rule-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .quick-price-preview {
    font-size: 16px;
    padding: 12px;
  }

  .quick-price-main label,
  .quick-price-main > span,
  .quick-price-main > strong,
  .quick-price-main > em,
  .quick-manual-result,
  .quick-manual-result span,
  .quick-manual-result strong {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .quick-grid,
  .quick-wizard,
  .quick-wizard-step,
  .quick-wizard-panel,
  .quick-choice-list,
  .quick-main-fields {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    overflow-x: hidden;
  }

  .quick-item {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    min-height: 58px;
    padding: 12px;
  }

  .quick-grid > *,
  .quick-wizard > *,
  .quick-wizard-step > *,
  .quick-wizard-panel > *,
  .quick-choice-list > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .quick-item strong {
    font-size: 16px;
    line-height: 1.2;
  }

  .quick-item span {
    font-size: 14px;
    line-height: 1.25;
  }

  .labor-grid {
    grid-template-columns: 1fr;
  }

  .labor-row {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
  }

  .labor-row strong,
  .labor-row span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .estimate-note-options label {
    gap: 10px;
    padding: 12px;
    font-size: 16px;
    line-height: 1.35;
  }

  .estimate-note-options input {
    width: 28px;
    height: 28px;
    margin-top: 0;
  }

  .estimate-note-grid textarea {
    min-height: 100px;
    font-size: 16px;
  }

  .item-locks {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .item-locks label {
    display: flex;
    align-items: center;
    min-height: 40px;
    font-size: 15px;
  }

  .estimate-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .estimate-actions button {
    width: 100%;
    min-height: 52px;
    font-size: 17px;
    white-space: normal;
  }

  .case-filters,
  .finance-filters,
  .trip-filters,
  .finance-import {
    box-shadow: none;
    padding: 10px;
    overflow: hidden;
  }

  .case-filter-row,
  .finance-filter-search-row,
  .finance-filter-basic-row,
  .finance-filter-date-row,
  .trip-filter-row,
  .trip-filter-row-wide {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .date-picker-line {
    grid-template-columns: minmax(0, 1fr) 46px;
  }

  .finance-summary,
  .trip-summary,
  .status-check,
  .finance-total-card {
    font-size: 16px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .finance-head,
  .panel-head.finance-head,
  .finance-import,
  .finance-import-log,
  .finance-import-log summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .finance-head button,
  .finance-head > *,
  .finance-import button,
  .finance-import input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .finance-table-wrap,
  .trip-table-wrap,
  .export-trash-panel .table-wrap,
  .cancellation-table-wrap,
  .table-wrap {
    width: 100%;
    overflow-x: visible;
  }

  .finance-table,
  .finance-table thead,
  .finance-table tbody,
  .finance-table tr,
  .finance-table th,
  .finance-table td,
  .payment-reconcile-table,
  .payment-reconcile-table thead,
  .payment-reconcile-table tbody,
  .payment-reconcile-table tr,
  .payment-reconcile-table th,
  .payment-reconcile-table td,
  .trip-table,
  .trip-table thead,
  .trip-table tbody,
  .trip-table tr,
  .trip-table th,
  .trip-table td,
  .export-trash-panel table,
  .export-trash-panel thead,
  .export-trash-panel tbody,
  .export-trash-panel tr,
  .export-trash-panel th,
  .export-trash-panel td,
  .cancellation-table,
  .cancellation-table thead,
  .cancellation-table tbody,
  .cancellation-table tr,
  .cancellation-table th,
  .cancellation-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  .finance-table thead,
  .payment-reconcile-table thead,
  .trip-table thead,
  .export-trash-panel thead,
  .cancellation-table thead {
    display: none;
  }

  .finance-table tr,
  .payment-reconcile-table tr,
  .trip-table tr,
  .export-trash-panel tr,
  .cancellation-table tr {
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    background: #fff;
  }

  .finance-table td,
  .payment-reconcile-table td,
  .trip-table td,
  .export-trash-panel td,
  .cancellation-table td {
    display: grid;
    grid-template-columns: minmax(108px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px 0 !important;
    border: 0 !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .finance-table td::before,
  .payment-reconcile-table td::before,
  .trip-table td::before,
  .export-trash-panel td::before,
  .cancellation-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    font-size: 14px;
    line-height: 1.25;
  }

  .export-trash-panel td:nth-child(1)::before { content: "Bereich"; }
  .export-trash-panel td:nth-child(2)::before { content: "Datum"; }
  .export-trash-panel td:nth-child(3)::before { content: "Titel"; }
  .export-trash-panel td:nth-child(4)::before { content: "Details"; }
  .export-trash-panel td:nth-child(5)::before { content: "Gelöscht am"; }
  .export-trash-panel td:nth-child(6)::before { content: "Aktion"; }
  .payment-reconcile-table td:nth-child(1)::before { content: "Vorgang"; }
  .payment-reconcile-table td:nth-child(2)::before { content: "Kunde"; }
  .payment-reconcile-table td:nth-child(3)::before { content: "Offen"; }
  .payment-reconcile-table td:nth-child(4)::before { content: "Treffer"; }
  .payment-reconcile-table td:nth-child(5)::before { content: "Status"; }
  .payment-reconcile-table td:nth-child(6)::before { content: "Aktion"; }
  .cancellation-table td:nth-child(1)::before { content: "Vorgang"; }
  .cancellation-table td:nth-child(2)::before { content: "Kunde"; }
  .cancellation-table td:nth-child(3)::before { content: "Status"; }
  .cancellation-table td:nth-child(4)::before { content: "Aktualisiert"; }
  .cancellation-table td:nth-child(5)::before { content: "Aktion"; }

  .finance-table input,
  .finance-table select,
  .payment-reconcile-table input,
  .payment-reconcile-table select,
  .trip-table input,
  .trip-table select {
    min-width: 0;
    width: 100%;
  }

  .finance-cell-text,
  .trip-cell-text,
  .trash-date,
  .trash-title,
  .trash-deleted,
  .trash-details {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  .finance-category-cell {
    display: grid !important;
    grid-template-columns: minmax(108px, 38%) minmax(0, 1fr) !important;
  }

  .finance-category-cell .finance-category-swatch {
    display: none !important;
  }

  .finance-bookings-wrap .finance-table td.finance-category-cell,
  .finance-table td.finance-category-cell {
    grid-template-columns: minmax(108px, 38%) minmax(0, 1fr) !important;
    white-space: normal;
  }

  .finance-bookings-wrap .finance-table .finance-category-cell select,
  .finance-bookings-wrap .finance-table .finance-category-cell .finance-cell-text,
  .finance-table .finance-category-cell select,
  .finance-table .finance-category-cell .finance-cell-text {
    width: 100%;
    min-width: 0;
  }

  .trash-action-buttons,
  .cancellation-table .trash-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .trash-actions .icon-action-btn,
  .cancellation-table .trash-action-buttons button {
    width: 100%;
    min-height: 44px;
  }
}
/* PW-Manager */
.pw-manager-panel {
  container: pw-manager / inline-size;
  min-width: 0;
  display: grid;
  gap: 14px;
  overflow: visible;
}

.pw-table-wrap {
  overflow: visible;
}

.pw-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
}

.pw-toolbar input {
  flex: 1 1 420px;
  min-width: 0;
}

.pw-toolbar button {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 44px;
  padding-inline: 18px;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  color: #4b5563;
}

.button-icon svg,
.icon-button svg {
  width: 18px;
  height: 18px;
}

.pw-locked {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.pw-locked-text {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.pw-locked-text strong {
  margin-right: 2px;
}

.pw-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.pw-table th,
.pw-table td {
  box-sizing: border-box;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

.pw-table th {
  color: #374151;
  font-weight: 800;
  background: #f7faf9;
}

.pw-table th:nth-child(1), .pw-table td:nth-child(1) { width: 21%; }
.pw-table th:nth-child(2), .pw-table td:nth-child(2) { width: 9%; }
.pw-table th:nth-child(3), .pw-table td:nth-child(3) { width: 14%; }
.pw-table th:nth-child(4), .pw-table td:nth-child(4) { width: 17%; }
.pw-table th:nth-child(5), .pw-table td:nth-child(5) { width: 21%; }
.pw-table th:nth-child(6), .pw-table td:nth-child(6) { width: 12%; }
.pw-table th:nth-child(7), .pw-table td:nth-child(7) { width: 6%; text-align: right; }

.pw-cell-with-action {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.pw-cell-with-action > button { flex-shrink: 0; }
.pw-title-cell { min-width: 0; }
.pw-title-cell strong { overflow-wrap: anywhere; line-height: 1.45; }
.pw-link { font-weight: 700; white-space: nowrap; }
.pw-truncate { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-description { display: block; overflow-wrap: anywhere; line-height: 1.5; }
.pw-secret {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
.pw-secret-error { color: #b42318; font-family: inherit; font-weight: 700; }

.pw-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
}

.pw-action-menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
  min-width: 58px;
}

.pw-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: #4b5563;
}

.pw-icon-btn svg,
.pw-more-btn svg {
  width: 18px;
  height: 18px;
}

.pw-more-btn {
  width: 46px;
  min-width: 46px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  color: #1f2937;
}

.pw-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  bottom: auto;
  z-index: 100;
  display: grid;
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
}

.pw-menu-panel.drop-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.pw-menu-panel button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.95rem;
}

.pw-menu-panel button:hover {
  background: var(--soft);
}

.pw-menu-panel button.danger {
  color: #b42318;
}

.pw-history-list {
  display: grid;
  gap: 10px;
}

.pw-history-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.password-field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.pw-master-settings {
  margin: 12px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.pw-master-settings h3 {
  margin-bottom: 6px;
}

.pw-master-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.pw-master-grid {
  display: grid;
  grid-template-columns: minmax(170px, 210px) minmax(190px, 220px) minmax(190px, 230px);
  gap: 10px;
  align-items: end;
}

.pw-master-grid label {
  display: grid;
  gap: 6px;
  align-content: end;
  min-height: 66px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
}

.pw-master-grid input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 8px 10px;
}

.pw-master-grid button {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  align-self: end;
  line-height: 1.15;
}

.pw-master-grid .settings-info-button {
  display: none;
}

.mini {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .pw-locked {
    align-items: flex-start;
    flex-direction: column;
  }

  .pw-master-grid {
    grid-template-columns: 1fr;
  }

  .pw-master-grid label {
    min-height: auto;
  }

}

/* Adapt to the available panel width, including space occupied by the sidebar. */
@container pw-manager (max-width: 1100px) {
  .pw-table, .pw-table tbody { display: block; width: 100%; }
  .pw-table thead { display: none; }
  .pw-table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .pw-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: start;
    min-width: 0;
    padding: 6px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
  }
  .pw-table td:nth-child(n) {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: auto;
    padding: 12px 0;
    text-align: left;
  }
  .pw-table td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; font-weight: 700; }
  .pw-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    display: block;
    padding: 14px 12px 14px 0;
    border: 0;
    align-self: center;
  }
  .pw-table td:nth-child(7) {
    grid-column: 2;
    grid-row: 1;
    display: block;
    border: 0;
    align-self: center;
  }
  .pw-table td:nth-child(1)::before, .pw-table td:nth-child(7)::before { display: none; }
  .pw-table td:nth-child(6) { border-bottom: 0; }
  .pw-table td[colspan] { grid-column: 1 / -1; display: block; border: 0; }
  .pw-table td[colspan]::before { display: none; }
  .pw-table .pw-truncate { white-space: normal; overflow-wrap: anywhere; overflow: visible; }
  .pw-table .pw-icon-btn { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  .pw-table .pw-more-btn { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  .pw-table .pw-action-menu { min-width: 40px; }
}

@container pw-manager (max-width: 700px) {
  .pw-table tbody { grid-template-columns: minmax(0, 1fr); }
  .pw-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pw-toolbar input { grid-column: 1 / -1; width: 100%; }
  .pw-toolbar button { min-width: 0; padding: 10px 8px; white-space: normal; line-height: 1.35; }
}

@container pw-manager (max-width: 360px) {
  .pw-table tr { padding-inline: 12px; }
  .pw-table td:nth-child(n) { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pw-table td:nth-child(1), .pw-table td:nth-child(7) { display: block; }
}

/* Keep document actions together without duplicating buttons or handlers. */
.document-more-actions,
.document-more-content { display: contents; }
.document-more-toggle { display: none; }
.mobile-nav-toggle { display: none; }

@media (max-width: 1200px) {
  .case-card {
    grid-template-columns: 22px 38px minmax(0, 1fr) auto;
    min-width: 0;
    max-width: 100%;
  }
  .case-card-docs { grid-column: 3 / -1; min-width: 0; }
  .case-card-actions { grid-column: 3 / -1; justify-self: stretch; min-width: 0; }
  .calendar-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-filters > *, .trip-filter-row > * { min-width: 0; max-width: 100%; }
  .trip-filter-row, .trip-filter-row-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .customer-field-table, .customer-field-table tbody { display: block; }
  .customer-field-table tr { display: grid; grid-template-columns: minmax(0, 1fr); padding: 10px 12px; border-top: 1px solid var(--line); }
  .customer-field-table th, .customer-field-table td { display: block; width: auto; min-width: 0; padding: 2px 0; border: 0; }
  .customer-field-table td { overflow-wrap: anywhere; word-break: normal; }
  .customer-more-menu > div { left: 0; right: auto; width: min(240px, calc(100vw - 90px)); }
  .money-combo-row { grid-template-columns: 18px minmax(0, 1fr) minmax(60px, auto); padding: 10px 0; border-bottom: 1px solid var(--line); }
  .money-combo-row > strong { grid-column: 1 / -1; }
  .money-combo-row > * { min-width: 0; }
  .money-combo-row small { overflow-wrap: anywhere; }
  .stat-bar-row { grid-template-columns: minmax(0, 1fr) minmax(40px, 1.5fr) minmax(55px, auto); }
  .stat-bar-row > * { min-width: 0; overflow-wrap: anywhere; }
  .payment-reconcile-controls { width: 100%; min-width: 0; justify-content: flex-start; }
  .payment-reconcile-controls .check-label { white-space: normal; min-width: 0; }
  .payment-reconcile-controls > button { max-width: 100%; }
  .document-more-actions { display: block; grid-column: 1 / -1; min-width: 0; width: 100%; }
  .document-more-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; }
  .document-more-content { display: none; }
  .document-more-actions.is-open > .document-more-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 8px; }
  .document-more-content > *, .document-edit-actions { min-width: 0; }
  .document-more-content > button { width: 100%; }
  .document-edit-actions { display: flex; }
  .document-edit-actions > [data-doc-action="edit"] { flex: 1; padding-inline: 8px; }
  .document-edit-actions > .document-edit-toggle { flex: 0 0 38px; width: 38px; padding-inline: 4px; }
  .doc-action-stack .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .doc-action-stack .toolbar > [data-doc-action="open-tab"] { grid-column: 1 / -1; }
  .doc-action-stack .toolbar button, .doc-action-stack .toolbar .button-link { min-width: 0; min-height: 44px; white-space: normal; overflow-wrap: break-word; }
  .document-more-content .next-status-btn { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 14px; }
  .sidebar .brand { margin: 0; min-width: 0; }
  .mobile-nav-toggle { display: block; min-height: 44px; padding: 8px 12px; color: #fff; background: #26332e; border-color: #526159; }
  .sidebar #mainNavigation, .sidebar .sidebar-foot { display: none; grid-column: 1 / -1; }
  .sidebar.mobile-nav-open #mainNavigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .sidebar.mobile-nav-open .sidebar-foot { display: block; }
  .sidebar #mainNavigation .nav { white-space: normal; min-height: 44px; padding: 10px 8px; }
  .case-card { grid-template-columns: 20px 36px minmax(0, 1fr); }
  .case-card-actions { grid-column: 3 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .case-toggle-btn { min-width: 0; flex: 1 1 100px; padding-inline: 8px; }
  .case-menu { flex: 0 0 40px; }
  .calendar-filters, .trip-filter-row, .trip-filter-row-wide { grid-template-columns: minmax(0, 1fr); }
  .payment-reconcile-controls { display: grid; grid-template-columns: minmax(0, 1fr); }
  .document-more-actions.is-open > .document-more-content { grid-template-columns: minmax(0, 1fr); }
}
