:root {
  color-scheme: light;
  --brand: #d86d3f;
  --brand-strong: #b95528;
  --brand-soft: #fff1e9;
  --brand-ink: #8f3f19;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-muted: #f0f4f3;
  --surface-subtle: #fbfbfa;
  --ink: #202426;
  --muted: #66706f;
  --line: #d9dfdd;
  --sidebar-bg: #1f2423;
  --sidebar-ink: #f6f5f2;
  --sidebar-muted: rgba(246, 245, 242, 0.7);
  --button-ink: #ffffff;
  --green: #23745f;
  --green-soft: #e1f0ea;
  --red: #b84444;
  --red-soft: #f7e2df;
  --amber: #b87822;
  --amber-soft: #f5ead7;
  --blue: #346da8;
  --blue-soft: #deebf7;
  --shadow: 0 14px 34px rgba(27, 34, 33, 0.08);
}

body.auth-loading,
body.auth-required {
  overflow: hidden;
}

body.auth-loading .app-shell,
body.auth-required .app-shell {
  visibility: hidden;
  pointer-events: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 10, 0.58);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.auth-loading .auth-gate,
body.auth-required .auth-gate {
  display: grid;
}

.auth-card {
  width: min(100%, 480px);
  padding: 24px;
  border: 1px solid color-mix(in srgb, var(--brand) 42%, rgba(255, 255, 255, 0.18));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.auth-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
}

.auth-brand span {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-brand h1 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1.55rem;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form label > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.auth-form .auth-remember-option {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 34px;
  cursor: pointer;
}

.auth-form .auth-remember-option input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.auth-form .auth-remember-option span {
  color: var(--ink);
  font-size: 0.82rem;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  color: var(--ink);
  font: inherit;
}

.auth-form input:focus {
  border-color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand) 28%, transparent);
  outline-offset: 1px;
}

.auth-form .primary-action,
.auth-form .ghost-action {
  min-height: 44px;
  justify-content: center;
}

.auth-form p,
.auth-form small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-status {
  min-height: 20px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.auth-status[data-type="error"] {
  color: var(--red);
}

.auth-status[data-type="success"] {
  color: var(--green);
}

@media (max-width: 560px) {
  .auth-gate {
    padding: 12px;
  }

  .auth-card {
    padding: 18px;
  }
}

/* Systemabrechnung: getrennte, revisionsartige Lizenzabrechnung. */
#system-billing-view {
  display: none;
  gap: 14px;
}

#system-billing-view.active {
  display: block;
}

#system-billing-root {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

#system-billing-root > * {
  width: 100%;
  min-width: 0;
}

#system-billing-view .liquid-panel,
.system-billing-kpi-grid > article,
.system-billing-area-card {
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--glass-border, var(--line)));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, color-mix(in srgb, var(--surface) 88%, transparent)), var(--glass-bg-soft, color-mix(in srgb, var(--surface-muted) 70%, transparent)));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.system-billing-landing-head,
.system-billing-page-head {
  min-height: 94px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.system-billing-page-head {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.system-billing-landing-head h2,
.system-billing-page-head h2 {
  margin: 2px 0 3px;
  font-size: clamp(24px, 2vw, 34px);
}

.system-billing-landing-head p,
.system-billing-page-head p {
  margin: 0;
  color: var(--muted);
}

.system-billing-lock-note {
  padding: 8px 11px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 6px;
  color: var(--muted);
  background: var(--glass-bg-soft, var(--surface-muted));
  font-size: 13px;
  font-weight: 700;
}

.system-billing-area-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.system-billing-area-card {
  min-height: 126px;
  padding: 16px;
  color: var(--ink);
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.system-billing-area-card:hover,
.system-billing-area-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--brand);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 64%, var(--glass-bg-strong, var(--surface))), var(--glass-bg-soft, var(--surface-subtle)));
}

.system-billing-area-icon {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 900;
}

.system-billing-area-card > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.system-billing-area-card small,
.system-billing-area-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.system-billing-area-card strong {
  font-size: 20px;
}

.system-billing-area-count {
  display: grid;
  justify-items: end;
  font-size: 24px;
  font-weight: 850;
}

.system-billing-period-toolbar {
  min-height: 68px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.system-billing-period-toolbar > div,
.system-billing-period-toolbar label {
  display: grid;
  gap: 3px;
}

.system-billing-period-toolbar span,
.system-billing-period-toolbar label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.system-billing-period-toolbar select {
  min-width: 190px;
  min-height: 40px;
  padding: 7px 36px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--glass-bg-soft, var(--surface));
}

.system-billing-warning {
  padding: 12px 14px;
  border: 1px solid var(--amber);
  border-radius: 7px;
  color: var(--ink);
  background: color-mix(in srgb, var(--amber-soft) 78%, transparent);
  font-weight: 700;
}

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

.system-billing-kpi-grid > article {
  min-height: 104px;
  padding: 14px 16px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.system-billing-kpi-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.system-billing-metric-value {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.system-billing-metric-value em {
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.system-billing-metric-value em.positive {
  color: var(--green);
}

.system-billing-metric-value em.negative {
  color: var(--red);
}

.system-billing-metric-value em.neutral {
  color: var(--muted);
}

.system-billing-kpi-grid span,
.system-billing-kpi-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.system-billing-kpi-grid strong {
  font-size: clamp(22px, 2.2vw, 32px);
}

.system-billing-kpi-grid .positive strong {
  color: var(--green);
}

.system-billing-kpi-grid .negative strong {
  color: var(--red);
}

.system-billing-section {
  overflow: clip;
}

.system-billing-section > summary,
.system-billing-snapshot > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 16px;
  font-weight: 800;
}

.system-billing-section > summary::-webkit-details-marker,
.system-billing-snapshot > summary::-webkit-details-marker {
  display: none;
}

.system-billing-section[open] > summary .section-arrow,
.system-billing-snapshot[open] > summary .section-arrow {
  transform: rotate(90deg);
}

.system-billing-section-body {
  padding: 0 16px 16px;
}

.system-billing-snapshot {
  border: 0 !important;
  border-top: 1px solid var(--glass-border, var(--line)) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.system-billing-snapshot:first-child {
  border-top: 0 !important;
}

.system-billing-snapshot > summary > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.system-billing-snapshot summary small {
  color: var(--muted);
  font-weight: 650;
}

.system-billing-summary-number {
  font-size: 18px;
  white-space: nowrap;
}

.system-billing-status {
  min-width: 112px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  text-align: center;
  font-size: 12px;
}

.system-billing-status.status-bezahlt {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.system-billing-status.status-rechnung-erstellt {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-soft);
}

.system-billing-snapshot-body {
  padding: 0 16px 16px 42px;
  display: grid;
  gap: 12px;
}

.system-billing-snapshot-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.system-billing-snapshot-kpis > div,
.system-billing-year-card {
  padding: 11px 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 6px;
  background: var(--glass-bg-soft, var(--surface-muted));
  display: grid;
  gap: 3px;
}

.system-billing-snapshot-kpis span,
.system-billing-year-card span,
.system-billing-year-card small {
  color: var(--muted);
  font-size: 12px;
}

.system-billing-snapshot-kpis strong {
  font-size: 18px;
}

.system-billing-audit-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 11px;
}

.system-billing-table-shell {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 7px;
}

.system-billing-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.system-billing-table th,
.system-billing-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border, var(--line));
  text-align: left;
  vertical-align: middle;
}

.system-billing-table th {
  color: var(--muted);
  background: var(--glass-bg-soft, var(--surface-muted));
  font-size: 11px;
  text-transform: uppercase;
}

.system-billing-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.system-billing-table tr:last-child td {
  border-bottom: 0;
}

.system-billing-table tr.is-admin-excluded td {
  opacity: 0.52;
  background: color-mix(in srgb, var(--red-soft) 34%, transparent);
  text-decoration: line-through;
}

.system-billing-row-actions,
.system-billing-payment-file > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-billing-row-actions .ghost-action,
.system-billing-payment-file .ghost-action {
  min-height: 34px;
  padding: 6px 8px;
  white-space: nowrap;
}

.system-billing-trial-label {
  color: var(--amber) !important;
}

.system-billing-exclusions {
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  border-radius: 6px;
  overflow: hidden;
}

.system-billing-exclusions > summary {
  cursor: pointer;
  padding: 9px 11px;
  color: var(--red);
  background: color-mix(in srgb, var(--red-soft) 55%, transparent);
  font-size: 12px;
  font-weight: 800;
}

.system-billing-exclusion-list {
  display: grid;
}

.system-billing-exclusion-list > div {
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(90px, 0.45fr) minmax(160px, 1.4fr) minmax(160px, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.system-billing-exclusion-list span:last-child {
  color: var(--red);
}

.system-billing-audit-log {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 6px;
  overflow: hidden;
}

.system-billing-audit-log > summary {
  cursor: pointer;
  padding: 9px 11px;
  color: var(--muted);
  background: var(--glass-bg-soft, var(--surface-muted));
  font-size: 12px;
  font-weight: 800;
}

.system-billing-audit-log > div {
  display: grid;
}

.system-billing-audit-log article {
  padding: 9px 11px;
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
}

.system-billing-audit-log article span,
.system-billing-audit-log article small {
  color: var(--muted);
  font-size: 11px;
}

.system-billing-snapshot-actions,
.system-billing-cost-toolbar,
.system-billing-contract-upload,
.system-billing-contract-card,
.system-billing-config {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.system-billing-snapshot-actions label,
.system-billing-cost-toolbar label,
.system-billing-contract-upload label,
.system-billing-config label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.system-billing-snapshot-actions select,
.system-billing-cost-toolbar input,
.system-billing-contract-upload select,
.system-billing-config input,
.system-billing-cost-table input,
.system-billing-cost-table select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  padding: 7px 9px;
}

.system-billing-payment-table input,
.system-billing-payment-table select {
  width: 100%;
  min-width: 135px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--glass-bg-soft, var(--surface));
}

.system-billing-payment-table {
  min-width: 1240px;
}

.system-billing-payment-file {
  min-width: 180px;
  display: grid;
  gap: 6px;
}

.system-billing-payment-file > strong {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

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

.system-billing-year-card strong {
  font-size: 24px;
}

.system-billing-config {
  padding: 14px 16px;
}

.system-billing-config > div {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.system-billing-config > div span,
.system-billing-config > div small {
  color: var(--muted);
  font-size: 12px;
}

.system-billing-config > div strong {
  font-size: 18px;
}

.system-billing-chart {
  height: 240px;
  padding: 18px 12px 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(30px, 1fr));
  align-items: end;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.system-billing-chart-column {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 22px;
  gap: 5px;
}

.system-billing-chart-bars {
  min-height: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
}

.system-billing-chart-bars i {
  width: min(12px, 42%);
  border-radius: 3px 3px 0 0;
}

.system-billing-chart-bars .income {
  background: var(--green);
}

.system-billing-chart-bars .expense {
  background: var(--red);
}

.system-billing-chart-column > span {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.system-billing-chart-legend {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.system-billing-chart-legend span::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 6px;
  display: inline-block;
  border-radius: 2px;
}

.system-billing-chart-legend .income::before {
  background: var(--green);
}

.system-billing-chart-legend .expense::before {
  background: var(--red);
}

.system-billing-cost-table input,
.system-billing-cost-table select {
  width: 100%;
  min-width: 120px;
}

.system-billing-contract-upload {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.system-billing-file-action {
  position: relative;
  display: inline-grid !important;
  place-items: center;
  overflow: hidden;
}

.system-billing-file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.system-billing-contract-list {
  display: grid;
  gap: 8px;
}

.system-billing-contract-card {
  padding: 11px 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 6px;
  background: var(--glass-bg-soft, var(--surface-muted));
}

.system-billing-contract-card > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.system-billing-contract-card span,
.system-billing-contract-card small {
  color: var(--muted);
  font-size: 11px;
}

.system-billing-contract-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-billing-contract-actions {
  display: flex;
  gap: 7px;
}

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

  .system-billing-page-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .system-billing-page-head > .primary-action {
    grid-column: 1 / 3;
    width: 100%;
  }
}

@media (max-width: 780px) {
  .system-billing-landing-head,
  .system-billing-page-head,
  .system-billing-config,
  .system-billing-period-toolbar {
    min-height: 0;
    padding: 14px;
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .system-billing-lock-note {
    align-self: flex-start;
  }

  .system-billing-area-grid,
  .system-billing-kpi-grid,
  .system-billing-kpi-grid-three,
  .system-billing-snapshot-kpis,
  .system-billing-year-grid {
    grid-template-columns: 1fr;
  }

  .system-billing-area-card {
    min-height: 96px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .system-billing-area-icon {
    width: 44px;
    height: 44px;
  }

  .system-billing-kpi-grid {
    gap: 8px;
  }

  .system-billing-kpi-grid > article {
    min-height: 82px;
  }

  .system-billing-snapshot > summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .system-billing-summary-number {
    margin-left: 30px;
  }

  .system-billing-status {
    margin-left: auto;
  }

  .system-billing-snapshot-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .system-billing-snapshot-actions,
  .system-billing-cost-toolbar,
  .system-billing-contract-upload,
  .system-billing-contract-card {
    align-items: stretch;
    flex-direction: column;
  }

  .system-billing-snapshot-actions label,
  .system-billing-contract-upload label,
  .system-billing-contract-actions,
  .system-billing-cost-toolbar label,
  .system-billing-cost-toolbar .primary-action {
    width: 100%;
  }

  .system-billing-contract-actions .ghost-action {
    flex: 1;
  }

  .system-billing-period-toolbar label,
  .system-billing-period-toolbar select {
    width: 100%;
  }

  .system-billing-metric-value {
    justify-content: space-between;
  }

  .system-billing-chart {
    overflow-x: auto;
    grid-template-columns: repeat(12, 42px);
  }

  .system-billing-exclusion-list > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151716;
  --surface: #202422;
  --surface-muted: #2a302d;
  --surface-subtle: #252a27;
  --ink: #f5f1ec;
  --muted: #abb5b1;
  --line: #39413e;
  --sidebar-bg: #101211;
  --sidebar-ink: #f7f2eb;
  --sidebar-muted: rgba(247, 242, 235, 0.68);
  --brand: #e8753f;
  --brand-strong: #ff8a50;
  --brand-soft: rgba(232, 117, 63, 0.16);
  --brand-ink: #ffd6c4;
  --button-ink: #1b1410;
  --green-soft: rgba(35, 116, 95, 0.22);
  --red-soft: rgba(184, 68, 68, 0.2);
  --amber-soft: rgba(184, 120, 34, 0.22);
  --blue-soft: rgba(52, 109, 168, 0.22);
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

input,
textarea,
select {
  color: var(--ink);
}

option {
  background: var(--surface);
  color: var(--ink);
}

::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 300;
}

.mobile-nav-controls {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-toggle {
  display: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
}

.brand-mark img {
  width: 33px;
  height: 33px;
  object-fit: contain;
  display: block;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-footer span {
  color: var(--sidebar-muted);
  font-size: 0.82rem;
}

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

.nav-list-bottom {
  margin-top: auto;
}

.nav-item {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  text-align: left;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(246, 245, 242, 0.12);
  color: #fff;
}

.nav-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  position: relative;
  flex: 0 0 34px;
  border: 1px solid var(--glow-brand);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.24rem;
  line-height: 1;
  filter: saturate(1.1);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--button-ink);
}

/* Gemeinsamer Standard für alle Dropdowns in der Hauptnavigation. */
.nav-dropdown {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-dropdown-trigger {
  justify-content: flex-start;
}

.nav-dropdown-trigger > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.nav-dropdown.active .nav-dropdown-trigger,
.nav-dropdown.open .nav-dropdown-trigger,
.nav-dropdown:hover .nav-dropdown-trigger {
  background: rgba(246, 245, 242, 0.12);
  color: #fff;
}

.nav-dropdown.active .nav-dropdown-trigger .nav-icon,
.nav-dropdown.open .nav-dropdown-trigger .nav-icon,
.nav-dropdown:hover .nav-dropdown-trigger .nav-icon {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--button-ink);
}

.nav-dropdown-trigger .nav-caret {
  position: relative;
  width: 18px;
  height: 18px;
  margin-left: auto;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  color: currentColor;
}

.nav-dropdown-trigger .nav-caret::before,
.nav-dropdown-trigger .nav-caret::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.26s var(--ease-glass, ease);
}

.nav-dropdown-trigger .nav-caret::before {
  left: 2px;
  transform: rotate(45deg);
}

.nav-dropdown-trigger .nav-caret::after {
  right: 2px;
  transform: rotate(-45deg);
}

.nav-dropdown.open .nav-dropdown-trigger .nav-caret::before {
  transform: rotate(-45deg);
}

.nav-dropdown.open .nav-dropdown-trigger .nav-caret::after {
  transform: rotate(45deg);
}

.nav-dropdown-menu {
  display: grid;
  gap: 2px;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    max-height 0.28s var(--ease-glass, ease),
    margin-top 0.28s var(--ease-glass, ease),
    opacity 0.2s ease,
    transform 0.28s var(--ease-glass, ease),
    visibility 0s linear 0.28s;
}

.nav-dropdown.open .nav-dropdown-menu {
  max-height: 420px;
  margin-top: 2px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.nav-dropdown-item {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  padding: 0 12px 0 56px;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.nav-dropdown-item:hover,
.nav-dropdown-item.active {
  background: color-mix(in srgb, var(--brand) 20%, transparent);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-dropdown-item.hidden {
  display: none;
}

.nav-message-label {
  min-width: 0;
}

.nav-message-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--brand) 72%, #fff);
  border-radius: 999px;
  background: var(--brand);
  color: var(--button-ink, #fff);
  box-shadow: 0 5px 14px var(--glow-brand);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  margin-top: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(246, 245, 242, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.account-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: var(--button-ink);
  font-weight: 900;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.account-avatar::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #42c47a;
  border: 2px solid var(--sidebar-bg);
}

.account-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-copy span {
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.account-copy strong {
  overflow: hidden;
  color: var(--sidebar-ink);
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-action {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(246, 245, 242, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-muted);
  display: grid;
  place-items: center;
  padding: 0;
  font-weight: 900;
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 2.8vw, 2.55rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.28rem;
}

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

.header-report-button {
  width: 48px;
  height: 52px;
  flex: 0 0 48px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--brand) 70%, var(--glass-border));
  border-radius: 8px;
  background: var(--glass-bg-strong, var(--surface));
  color: var(--brand);
  box-shadow: var(--shadow-glass, var(--shadow));
  font-size: 1.25rem;
  font-weight: 950;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.header-report-button:hover,
.header-report-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 8px 22px var(--glow-brand);
  outline: 0;
}

.report-dialog-form {
  display: grid;
  gap: 14px;
}

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

.report-dialog-form textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.45;
}

.report-attachment-field {
  padding: 12px;
  border: 1px dashed var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-muted));
}

.report-attachment-hint,
.admin-report-no-file {
  color: var(--muted);
  font-size: 0.74rem;
}

.report-attachment-preview {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
}

.report-attachment-preview img {
  width: 88px;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
}

.report-file-loading,
.report-attachment-preview span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 82, 82, 0.55);
  border-radius: 8px;
  background: rgba(192, 69, 63, 0.16);
  color: #ff9c92;
  font-weight: 800;
}

.report-image-view {
  display: grid;
  place-items: center;
  min-height: 260px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.report-image-view img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.admin-report-dropdown {
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
}

.admin-report-dropdown > summary {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  list-style: none;
  cursor: pointer;
}

.admin-report-dropdown > summary::-webkit-details-marker {
  display: none;
}

.admin-report-dropdown[open] > summary .section-arrow {
  transform: rotate(90deg);
}

.admin-report-summary {
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.admin-report-list {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.admin-report-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
}

.admin-report-card.is-done {
  opacity: 0.68;
}

.admin-report-card > header,
.admin-report-card > footer,
.admin-report-meta,
.admin-report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-report-card > header,
.admin-report-card > footer {
  justify-content: space-between;
}

.admin-report-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-report-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-report-category,
.admin-report-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.7rem;
  font-weight: 900;
}

.admin-report-card.is-done .admin-report-status {
  background: rgba(35, 116, 95, 0.2);
  color: #66d7a9;
}

.admin-report-card > p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

.admin-report-meta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.74rem;
}

.admin-report-meta span + span::before {
  content: "·";
  margin-right: 8px;
}

.report-delete-action {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.admin-report-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.market-switch {
  min-height: 52px;
  border: 2px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 8px;
  padding: 6px 10px;
  display: grid;
  gap: 2px;
  box-shadow: 0 8px 18px rgba(31, 36, 35, 0.12);
}

.market-switch span,
.access-switch span,
.background-switch span {
  color: var(--brand-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.market-switch select,
.access-switch select,
.background-switch select {
  height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.market-switch select {
  min-width: 250px;
}

.access-switch {
  min-height: 52px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 10px;
  display: grid;
  gap: 2px;
}

.access-switch select {
  min-width: 190px;
  color: var(--ink);
}

.background-switch {
  min-height: 52px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 10px;
  display: grid;
  gap: 2px;
}

.background-switch select {
  min-width: 92px;
  color: var(--ink);
}

.search {
  height: 52px;
  min-width: 340px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
}

.search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
}

select,
.primary-action,
.ghost-action {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.primary-action {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--button-ink);
  font-weight: 700;
}

.topbar .primary-action {
  height: 52px;
}

.ghost-action {
  background: var(--surface-muted);
}

body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select,
body[data-theme="dark"] option {
  background-color: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

body[data-theme="dark"] .market-switch select,
body[data-theme="dark"] .access-switch select,
body[data-theme="dark"] .background-switch select {
  background-color: transparent;
  color: var(--ink);
}

body[data-theme="dark"] .search input,
body[data-theme="dark"] .combo-search {
  background: transparent;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.inventory-card,
.product-row,
.product-detail,
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 128px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 2rem;
}

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.metric-value-row strong {
  min-width: 0;
}

.metric-trend {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 1000;
  line-height: 1;
}

.metric-trend.positive {
  color: #58d783;
}

.metric-trend.negative {
  color: #ff6a5a;
}

.metric-trend.neutral {
  color: var(--muted);
}

.statistic-metric-card.is-blurred {
  position: relative;
  overflow: hidden;
}

.statistic-metric-card.is-blurred::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(246, 245, 242, 0.05), rgba(232, 117, 63, 0.08));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.statistic-metric-card.is-blurred > * {
  position: relative;
  z-index: 1;
}

.statistic-metric-card.is-blurred .metric-value-row strong {
  letter-spacing: 0.08em;
}

.search-results {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-results h2 {
  margin-bottom: 10px;
}

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

.result-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px;
  display: grid;
  gap: 5px;
}

.result-item button,
.market-item {
  cursor: pointer;
}

.status-overview-panel {
  margin-bottom: 18px;
}

.status-overview {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.status-step {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-subtle);
  display: grid;
  align-content: space-between;
  color: inherit;
  font: inherit;
  text-align: left;
}

.status-step-link {
  cursor: pointer;
}

.status-step-link:hover {
  border-color: rgba(255, 124, 59, 0.75);
}

.status-step-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status-step strong {
  font-size: 1.35rem;
}

.status-step span {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric-card.warning {
  border-color: #e4c38c;
  background: var(--amber-soft);
}

.split-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}

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

.panel-heading,
.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.activity-panel-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
}

.activity-panel-heading h2 {
  font-size: 1.32rem;
}

.log-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.log-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.log-date-field {
  cursor: pointer;
}

.log-date-shell {
  position: relative;
  display: inline-grid;
}

.activity-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -4px 0 12px;
}

.filter-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 11px;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.filter-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 800;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  font-size: 0.74rem;
  font-weight: 900;
}

.ghost-action.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.log-date-trigger {
  height: 40px;
  width: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.log-date-shell.has-value .log-date-trigger {
  color: var(--ink);
}

.load-more {
  width: 100%;
  margin-top: 12px;
}

.activity-feed,
.market-list,
.inventory-grid,
.product-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.market-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.activity-item.escalated {
  border-color: rgba(213, 64, 42, 0.8);
  background: rgba(213, 64, 42, 0.08);
  box-shadow: 0 0 0 1px rgba(213, 64, 42, 0.12);
}

.activity-item.archived {
  opacity: 0.78;
}

.market-item {
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}

.market-item:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.market-owner {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-stats {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.history-stats strong {
  font-size: 1.35rem;
}

.history-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}

#history-view > .history-header-bar {
  min-height: 62px;
  margin: 0 0 14px;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--glass-border, var(--line)));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), color-mix(in srgb, var(--brand-soft) 42%, var(--glass-bg-soft, var(--surface-subtle))));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#history-view > .history-header-bar .eyebrow {
  margin-bottom: 2px;
}

#admin-view > .admin-header-bar {
  min-height: 62px;
  margin: 0 0 14px;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--glass-border, var(--line)));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), color-mix(in srgb, var(--brand-soft) 42%, var(--glass-bg-soft, var(--surface-subtle))));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#admin-view > .admin-header-bar .eyebrow {
  margin-bottom: 2px;
}

.table-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(160px, 0.32fr) minmax(240px, 0.5fr);
  gap: 10px;
  margin-bottom: 14px;
}

.table-filters input,
.table-filters select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(520px, 1.2fr);
  gap: 18px;
  align-items: start;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.admin-form input,
.admin-form select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.admin-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-users {
  display: grid;
  gap: 12px;
}

.admin-user {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 14px;
  display: grid;
  gap: 12px;
}

#admin-view .admin-user {
  border-color: color-mix(in srgb, var(--brand) 24%, var(--glass-border, var(--line)));
  background: linear-gradient(135deg, var(--glass-bg-strong, rgba(24, 30, 28, 0.78)), color-mix(in srgb, var(--brand-soft) 22%, var(--glass-bg-soft, rgba(24, 30, 28, 0.52))));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12)), var(--shadow-glass, var(--shadow));
}

.admin-user header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.admin-user strong,
.admin-user span {
  display: block;
}

.admin-user span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 3px;
}

.admin-user .status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-weight: 800;
}

.admin-user .status-chip.success {
  border-color: color-mix(in srgb, var(--green) 62%, var(--line));
  color: var(--green);
}

.admin-user .status-chip.danger {
  border-color: color-mix(in srgb, var(--red) 62%, var(--line));
  color: var(--red);
}

.empty-state.danger-state {
  border-color: color-mix(in srgb, var(--red) 70%, var(--line));
  color: var(--red);
}

.empty-state.danger-state span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 600;
}

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

.permission-grid label,
.edit-toggle {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
  color: var(--ink);
  font-size: 0.9rem;
}

.edit-toggle {
  min-width: 240px;
}

.activity-item strong,
.market-item strong {
  font-size: 0.95rem;
}

.activity-meta,
.market-meta {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  flex-wrap: wrap;
}

.activity-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.icon-action {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.icon-action:hover {
  border-color: var(--brand);
  color: var(--brand-ink);
}

.section-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-muted);
}

.segmented-control button {
  height: 38px;
  border: 0;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
}

.segmented-control button.active {
  background: var(--brand);
  color: var(--button-ink);
}

.production-view-tabs {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.production-view-tabs:empty {
  display: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 6px;
}

.board-column {
  min-height: 540px;
  background: rgba(216, 109, 63, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

body[data-theme="dark"] .board-column {
  background: rgba(232, 117, 63, 0.11);
  border-color: rgba(232, 117, 63, 0.22);
}

.board-column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.order-card {
  position: relative;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: none;
}

.order-card h3 {
  padding-right: 28px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.delete-order-button {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(184, 68, 68, 0.35);
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0;
  font-weight: 900;
  line-height: 1;
}

.delete-order-button::before {
  content: "×";
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
}

.delete-order-button:hover {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.order-facts {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.special-board-note {
  border: 1px solid rgba(216, 109, 63, 0.24);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--ink);
  padding: 7px 8px;
}

.special-board-note summary {
  cursor: pointer;
  color: var(--brand-ink);
  font-weight: 900;
}

.special-size-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.special-size-grid span,
.special-size-note {
  border: 1px solid rgba(216, 109, 63, 0.22);
  border-radius: 7px;
  background: var(--surface);
  padding: 5px 6px;
}

.special-size-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.special-size-grid strong {
  display: block;
  color: var(--ink);
  font-size: 0.84rem;
}

.special-size-note {
  color: var(--ink);
  margin-top: 8px;
  font-weight: 800;
}

.special-board-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.badge {
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.green {
  background: var(--green-soft);
  color: var(--green);
}

.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.badge.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.due-days {
  background: var(--brand-soft);
  color: var(--brand-ink);
  border: 1px solid rgba(216, 109, 63, 0.25);
  font-weight: 900;
}

.data-table {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.history-table {
  min-width: 1600px;
}

.history-table th,
.history-table td {
  vertical-align: top;
}

.history-details {
  min-width: 360px;
  max-width: 520px;
  white-space: normal;
  line-height: 1.45;
}

.document-order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.freight-preset-dropdown {
  display: grid;
  gap: 0;
  margin-bottom: 16px;
}

.freight-preset-dropdown summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.freight-preset-dropdown summary::-webkit-details-marker {
  display: none;
}

.freight-preset-dropdown summary > span:last-child {
  display: grid;
  gap: 3px;
}

.freight-preset-dropdown summary strong {
  color: var(--ink);
}

.freight-preset-dropdown summary small {
  color: var(--muted);
  font-weight: 800;
}

.freight-preset-dropdown summary small b {
  color: var(--accent);
}

.freight-preset-dropdown[open] > summary > .section-arrow {
  transform: rotate(90deg);
}

.freight-active-dropdown > .document-order-grid,
.freight-archive-dropdown > .section-content {
  margin-top: 12px;
}

.freight-preset-form {
  margin-top: 12px;
}

.freight-preset-form textarea,
.freight-preset-form input,
.freight-preset-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  line-height: 1.35;
  padding: 10px;
}

.freight-preset-form textarea {
  min-height: 78px;
  resize: vertical;
  white-space: pre-wrap;
}

.invoice-database-dropdown {
  margin-top: 16px;
}

.inline-document-search {
  grid-template-columns: minmax(220px, 1fr);
  margin: 0 0 12px;
}

.document-dialog textarea {
  font: inherit;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
}

.document-order-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-order-media {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 900;
}

.document-order-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.document-order-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.document-order-body h3 {
  margin: 0;
  font-size: 1.02rem;
}

.document-order-meta,
.document-mini-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.document-order-meta span,
.document-mini-meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.document-order-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.document-card-actions {
  display: grid;
  justify-items: stretch;
  gap: 8px;
  min-width: 0;
}

.document-order-actions .primary-action {
  min-height: 38px;
  width: 100%;
}

.document-card-actions .badge {
  justify-self: start;
}

.document-card-actions .document-table-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.document-card-actions .document-table-actions .ghost-action {
  min-width: 0;
  width: 100%;
  padding: 0 8px;
  white-space: normal;
}

.document-invoice-root,
.document-module-root {
  display: grid;
  gap: 16px;
}

.document-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

#internal-documents-view > .section-bar {
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#credit-documents-view > .section-bar {
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#invoice-documents-view > .section-bar {
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#employees-view > .section-bar {
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.employees-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.employees-summary span {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.employees-root {
  display: grid;
  gap: 16px;
}

.employees-panel {
  padding: 16px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.employee-section-dropdown {
  padding: 0;
  overflow: visible;
}

.employee-section-dropdown > summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
}

.employee-section-dropdown > summary::-webkit-details-marker {
  display: none;
}

.employee-section-dropdown > summary h2 {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  margin: 0;
}

.employee-section-dropdown > summary .panel-note {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  text-align: right;
}

.employee-section-dropdown > summary .section-arrow {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  margin: 0;
}

.employee-section-dropdown[open] > summary .section-arrow {
  transform: rotate(90deg);
}

.employee-section-dropdown > .employee-card-grid,
.employee-section-dropdown > .employee-weekdays,
.employee-section-dropdown > .employee-calendar-grid,
.employee-section-dropdown > .employee-meeting-grid,
.employee-section-dropdown > .employee-score-list,
.employee-section-dropdown > .employee-score-period,
.employee-section-dropdown > .employee-panel-actions {
  margin: 0 16px 16px;
}

.employee-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.employee-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.employee-card {
  display: grid;
  gap: 0;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  padding: 0;
  min-height: 0;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.employee-card:hover {
  border-color: rgba(255, 122, 71, 0.72);
  transform: translateY(-1px);
}

.employee-card.employee-company-wf,
.employee-dialog-summary.employee-company-wf {
  background: linear-gradient(135deg, rgba(216, 109, 63, 0.18), var(--glass-bg-soft, var(--surface)));
}

.employee-card.employee-company-epmc,
.employee-dialog-summary.employee-company-epmc {
  background: linear-gradient(135deg, rgba(95, 198, 122, 0.14), var(--glass-bg-soft, var(--surface)));
}

.employee-card.employee-company-extern,
.employee-dialog-summary.employee-company-extern {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.16), var(--glass-bg-soft, var(--surface)));
}

.employee-card-photo {
  aspect-ratio: 16 / 9;
  width: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 122, 71, 0.16), rgba(255, 255, 255, 0.035));
  border-bottom: 1px solid var(--glass-border, var(--line));
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  font-weight: 1000;
  letter-spacing: 0;
  overflow: hidden;
}

.employee-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-card-content {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.employee-card-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.employee-card-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  gap: 12px;
  align-items: center;
}

.employee-worktime-line {
  min-width: 0;
  font-size: 0.86rem;
  line-height: 1.25;
}

.employee-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #16110d;
  font-weight: 1000;
  font-size: 1rem;
  overflow: hidden;
}

.employee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-card strong,
.employee-card span,
.employee-card small {
  display: block;
  min-width: 0;
}

.employee-card span,
.employee-card small {
  color: var(--muted);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-card-main {
  min-width: 0;
}

.employee-card-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.16;
}

.employee-card-main small {
  margin-top: 3px;
}

.employee-presence {
  justify-self: end;
  display: grid;
  gap: 2px;
  text-align: right;
  min-width: 112px;
}

.employee-presence strong {
  color: var(--ink);
  font-size: 0.74rem;
}

.employee-presence-dot {
  justify-self: end;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.employee-presence.is-online .employee-presence-dot {
  background: #5fc67a;
}

.employee-presence.is-offline .employee-presence-dot {
  background: #d86d3f;
}

.employee-schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  gap: 10px;
}

.employee-schedule-day {
  display: grid;
  gap: 7px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.employee-schedule-active {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 900;
}

.employee-schedule-day input[type="time"] {
  width: 100%;
  min-width: 104px;
  min-height: 34px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  padding: 0 7px;
  font-weight: 900;
}

.employee-weekdays,
.employee-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.employee-weekdays {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.employee-calendar-day,
.employee-calendar-empty {
  min-height: 360px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 5px;
}

.employee-calendar-empty {
  opacity: 0.35;
}

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

.employee-calendar-day.has-absence {
  border-color: color-mix(in srgb, var(--brand) 70%, var(--glass-border, var(--line)));
}

.employee-calendar-day.has-birthday {
  border-color: rgba(95, 198, 122, 0.7);
}

.employee-calendar-day.is-today {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 62%, transparent), 0 0 18px var(--glow-brand);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 82%, transparent), rgba(255, 255, 255, 0.035));
}

.employee-calendar-date {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--glass-border, var(--line));
}

.employee-calendar-date span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.employee-calendar-chip {
  border-radius: 6px;
  padding: 4px 6px;
  color: var(--ink);
  background: var(--brand-soft);
  font-size: 0.68rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.employee-calendar-chip.absence-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  padding: 4px;
}

.employee-calendar-chip.absence-chip > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-calendar-chip-actions {
  display: inline-flex;
  gap: 3px;
}

.employee-chip-action {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: rgba(20, 24, 21, 0.74);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 1000;
  line-height: 1;
  cursor: pointer;
}

.employee-chip-action.wide {
  width: auto;
  min-width: 30px;
  padding: 0 5px;
  font-size: 0.58rem;
}

.employee-chip-action:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.employee-calendar-chip.birthday {
  background: rgba(95, 198, 122, 0.2);
}

.employee-calendar-chip.today {
  background: var(--brand);
  color: var(--button-ink);
}

.employee-calendar-day.has-meeting {
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--brand) 74%, transparent);
}

.employee-calendar-chip.meeting-chip {
  display: grid;
  gap: 3px;
  border: 1px solid color-mix(in srgb, var(--brand) 52%, var(--glass-border, var(--line)));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 90%, transparent), var(--glass-bg-soft, var(--surface)));
}

.employee-calendar-chip.meeting-chip strong {
  color: var(--ink);
  font-size: 0.7rem;
}

.employee-calendar-chip.meeting-chip span {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.3;
}

.employee-calendar-day.has-delivery {
  border-bottom-color: color-mix(in srgb, var(--brand) 72%, var(--glass-border, var(--line)));
}

.employee-calendar-chip.delivery-chip {
  display: grid;
  gap: 3px;
  border: 1px solid color-mix(in srgb, var(--brand) 58%, var(--glass-border, var(--line)));
  background: color-mix(in srgb, var(--brand-soft) 76%, var(--glass-bg-soft, var(--surface)));
}

.employee-calendar-chip.delivery-chip strong {
  color: var(--brand);
  font-size: 0.7rem;
}

.employee-calendar-chip.delivery-chip span {
  color: var(--ink);
  font-size: 0.64rem;
  line-height: 1.25;
}

.employee-meeting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.employee-meeting-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--glass-border, var(--line)));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.employee-meeting-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-meeting-card header span {
  display: block;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.employee-meeting-card h3 {
  margin: 3px 0 0;
  font-size: 1.05rem;
}

.employee-meeting-settings {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

.employee-meeting-settings:hover,
.employee-meeting-settings:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
  outline: 0;
}

.employee-meeting-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.employee-meeting-facts span {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  background: var(--glass-bg-soft, var(--surface));
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.employee-meeting-card > small {
  color: var(--muted);
  font-weight: 800;
}

.employee-meeting-participants-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.employee-meeting-participants-row > strong {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.employee-meeting-person,
.employee-meeting-participant-avatar {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--glass-bg-strong, var(--surface));
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 0.64rem;
  font-weight: 1000;
}

.employee-meeting-person + .employee-meeting-person {
  margin-left: -8px;
}

.employee-meeting-person img,
.employee-meeting-participant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#inventory-modal.employee-meeting-modal {
  width: min(980px, calc(100vw - 32px));
  max-width: 980px;
}

.employee-meeting-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.employee-meeting-topic {
  grid-column: 1 / -1;
}

.employee-meeting-once-field.hidden,
.employee-meeting-recurring-field.hidden {
  display: none;
}

.employee-meeting-participants {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
}

.employee-meeting-participants legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.employee-meeting-participant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.employee-meeting-participant-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  cursor: pointer;
}

.employee-meeting-participant-option > span:last-child {
  min-width: 0;
}

.employee-meeting-participant-option strong,
.employee-meeting-participant-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-meeting-participant-option small {
  color: var(--muted);
}

.employee-worktime-dialog {
  display: grid;
  gap: 16px;
  max-width: 100%;
}

#inventory-modal.employee-modal-wide {
  max-width: 1080px;
  width: min(1080px, calc(100vw - 32px));
}

.employee-dialog-summary {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  padding: 12px;
}

.employee-dialog-summary span,
.employee-dialog-summary small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.employee-profile-editor {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.employee-profile-image-preview {
  aspect-ratio: 16 / 9;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 122, 71, 0.18), rgba(255, 255, 255, 0.035));
  color: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 3.4rem;
  font-weight: 1000;
  letter-spacing: 0;
}

.employee-profile-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-profile-fields {
  display: grid;
  gap: 12px;
  align-content: start;
}

.employee-profile-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.employee-profile-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(255, 122, 71, 0.8);
  border-radius: 8px;
  background: var(--brand);
  color: #160f0b;
  padding: 0 14px;
  font-weight: 1000;
  cursor: pointer;
}

.employee-profile-upload-button input {
  display: none;
}

.employee-score-period {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.employee-score-period select {
  min-height: 34px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
}

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

.employee-score-list article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  padding: 10px 12px;
}

.employee-score-list span {
  color: var(--accent);
  font-weight: 1000;
}

.employee-score-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}

.employee-score-info {
  position: relative;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border: 1px solid var(--brand);
  border-radius: 50%;
  color: var(--brand);
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 1000;
  line-height: 1;
  vertical-align: 2px;
  cursor: help;
}

.employee-section-dropdown:not([open]) .employee-score-info {
  display: none;
}

.employee-score-tooltip {
  position: absolute;
  z-index: 80;
  top: calc(100% + 9px);
  left: 0;
  width: min(340px, calc(100vw - 48px));
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--glass-bg-strong, var(--surface));
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.employee-score-info:hover .employee-score-tooltip,
.employee-score-info:focus .employee-score-tooltip,
.employee-score-info:focus-visible .employee-score-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.employee-section-dropdown:not([open]) .employee-score-tooltip {
  top: auto;
  bottom: calc(100% + 9px);
}

@media (max-width: 980px) {
  .employee-card-bottom {
    grid-template-columns: 1fr;
  }

  .employee-presence,
  .employee-presence-dot {
    justify-self: start;
    text-align: left;
  }

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

  .employee-profile-editor {
    grid-template-columns: 1fr;
  }
}

.internal-documents-bar > div:first-child {
  flex: 0 0 176px;
  min-width: 0;
}

.credit-documents-bar > div:first-child {
  flex: 0 0 176px;
  min-width: 0;
}

.invoice-documents-bar > div:first-child {
  flex: 0 0 176px;
  min-width: 0;
}

.internal-documents-summary {
  flex: 1 1 auto;
  min-width: 0;
}

.credit-documents-summary {
  flex: 1 1 auto;
  min-width: 0;
}

.invoice-documents-summary {
  flex: 1 1 auto;
  min-width: 0;
}

.internal-kpi-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.internal-kpi-metrics {
  display: grid;
  grid-template-columns: max-content max-content max-content max-content max-content;
  align-items: center;
  justify-content: start;
  min-width: 0;
}

.internal-kpi-item {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 0 10px;
  border-left: 1px solid var(--glass-border, var(--line));
}

.internal-kpi-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.internal-kpi-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.internal-kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.internal-kpi-value {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.internal-kpi-trend {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.internal-kpi-trend-positive {
  color: #5fc67a;
}

.internal-kpi-trend-negative {
  color: #ff705f;
}

.internal-kpi-trend-neutral {
  color: var(--muted);
}

.credit-kpi-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.credit-kpi-metrics {
  display: grid;
  grid-template-columns: max-content max-content max-content;
  align-items: center;
  justify-content: start;
  min-width: 0;
}

.credit-kpi-item {
  display: grid;
  gap: 2px;
  padding: 0 14px;
  border-left: 1px solid var(--glass-border, var(--line));
}

.credit-kpi-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.credit-kpi-item span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
}

.credit-kpi-item strong {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
  white-space: normal;
}

.credit-kpi-item small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.credit-kpi-item small b {
  color: var(--ink);
}

.credit-currency-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.credit-currency-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  padding: 3px 7px;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1;
  white-space: nowrap;
}

.credit-kpi-strip .primary-action {
  min-height: 34px;
  height: 34px;
  white-space: nowrap;
}

.invoice-kpi-metrics {
  grid-template-columns: max-content max-content;
}

.invoice-kpi-strip .primary-action {
  min-height: 34px;
  height: 34px;
  white-space: nowrap;
}

.internal-documents-summary .internal-period-control {
  gap: 5px;
  margin-left: 0;
}

.internal-documents-summary .internal-period-control span {
  font-size: 0.62rem;
}

.internal-documents-summary .internal-period-control select {
  width: 142px;
  height: 28px;
  min-height: 28px;
  padding: 0 7px;
  font-size: 0.7rem;
}

.document-kpi-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.internal-period-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.internal-period-control span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.internal-period-control select {
  width: 112px;
  min-height: 28px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  padding: 0 7px;
  font-size: 0.76rem;
  font-weight: 900;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
}

.document-kpi-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.document-kpi-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.document-kpi-card .internal-period-control span {
  font-size: 0.68rem;
  font-weight: 900;
}

.document-kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
}

.document-kpi-trend {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 900;
}

.document-kpi-trend-positive {
  color: #5fc67a;
}

.document-kpi-trend-negative {
  color: #ff705f;
}

.document-kpi-trend-neutral {
  color: var(--muted);
}

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

.invoice-document-section {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.invoice-document-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 16px;
}

.invoice-document-section > summary::-webkit-details-marker {
  display: none;
}

.invoice-document-section[open] > summary .section-arrow {
  transform: rotate(90deg);
}

.invoice-automation-note {
  margin: 0 0 12px;
}

.invoice-document-table {
  min-width: 1120px;
  table-layout: fixed;
}

.invoice-document-table th:nth-child(1) { width: 11%; }
.invoice-document-table th:nth-child(2) { width: 15%; }
.invoice-document-table th:nth-child(3) { width: 12%; }
.invoice-document-table th:nth-child(4) { width: 16%; }
.invoice-document-table th:nth-child(5),
.invoice-document-table th:nth-child(6) { width: 8%; }
.invoice-document-table th:nth-child(7) { width: 12%; }
.invoice-document-table th:nth-child(8) { width: 12%; }
.invoice-document-table th:nth-child(9) { width: 10%; }

.invoice-status-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  font-weight: 800;
}

.invoice-customer-summary {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
  display: grid;
  gap: 3px;
}

.invoice-customer-summary span,
.invoice-customer-summary small {
  color: var(--muted);
  font-weight: 800;
}

.invoice-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-checkbox-row input {
  width: auto;
}

.invoice-alt-delivery-fields.hidden {
  display: none;
}

.document-table {
  min-width: 1120px;
}

#internal-documents-root .data-table {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.18));
  overflow-x: hidden;
}

#credit-documents-root .data-table {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.18));
  overflow-x: hidden;
}

#internal-documents-root .document-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

#internal-documents-root .document-table th,
#internal-documents-root .document-table td {
  overflow-wrap: anywhere;
  white-space: normal;
}

#credit-documents-root .document-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

#credit-documents-root .document-table th,
#credit-documents-root .document-table td {
  overflow-wrap: anywhere;
  white-space: normal;
}

.credit-document-table th:nth-child(1) {
  width: 13%;
}

.credit-document-table th:nth-child(2) {
  width: 11%;
}

.credit-document-table th:nth-child(3),
.credit-document-table th:nth-child(6),
.credit-document-table th:nth-child(9) {
  width: 8%;
}

.credit-document-table th:nth-child(4),
.credit-document-table th:nth-child(5),
.credit-document-table th:nth-child(7) {
  width: 12%;
}

.credit-document-table th:nth-child(8) {
  width: 16%;
}

.document-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-table-actions .ghost-action {
  min-height: 34px;
  padding: 0 10px;
}

.internal-payment-table {
  min-width: 0;
}

#internal-documents-root .internal-payment-table th:nth-child(1) {
  width: 12%;
}

#internal-documents-root .internal-payment-table th:nth-child(2) {
  width: 20%;
}

#internal-documents-root .internal-payment-table th:nth-child(3) {
  width: 14%;
}

#internal-documents-root .internal-payment-table th:nth-child(4) {
  width: 17%;
}

#internal-documents-root .internal-payment-table th:nth-child(5),
#internal-documents-root .internal-payment-table th:nth-child(6) {
  width: 18.5%;
}

.internal-payment-status {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
}

.internal-shipping-cost-input {
  width: 100%;
  margin-bottom: 0;
}

.internal-cost-editor {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.internal-cost-editor > span:first-child {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
}

.internal-cost-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  padding: 0 9px;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.14));
}

.internal-cost-input-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
}

.internal-cost-input-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}

.internal-archive-search {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  padding: 8px 10px;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.14));
}

.internal-archive-search span,
.internal-archive-search strong {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.internal-archive-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  color: var(--ink);
  padding: 0 10px;
  font-weight: 800;
  outline: 0;
}

.internal-invoice-file {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.internal-invoice-generated {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.internal-invoice-upload-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.internal-invoice-upload-label input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
}

.internal-invoice-file-name {
  max-width: 260px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

.internal-payment-actions {
  align-items: center;
}

#internal-documents-root .internal-payment-actions {
  gap: 5px;
}

#internal-documents-root .internal-payment-actions .ghost-action,
#internal-documents-root .internal-payment-actions .primary-action {
  flex: 1 1 64px;
  min-width: 0;
  min-height: 30px;
  height: auto;
  padding: 5px 6px;
  font-size: 0.78rem;
  line-height: 1.12;
  white-space: normal;
}

#internal-documents-root .internal-invoice-file .internal-payment-actions,
#internal-documents-root .internal-invoice-generated .internal-payment-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#internal-documents-root .internal-invoice-generated .internal-payment-actions button:first-child {
  grid-column: 1 / -1;
}

.internal-status-actions {
  margin-top: 8px;
}

.internal-payment-actions .ghost-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.internal-payment-archive {
  margin-top: 2px;
}

.internal-payment-section,
.internal-payment-archive,
.credit-document-section {
  border-color: var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
  overflow: hidden;
}

#internal-documents-root > details.order-section {
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#credit-documents-root > details.order-section {
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

#internal-documents-root > details.order-section summary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.14));
}

#credit-documents-root > details.order-section summary {
  min-height: 44px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.14));
}

.internal-payment-section summary,
.internal-payment-archive summary {
  min-height: 44px;
  padding: 8px 12px;
}

.internal-section-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.internal-section-summary .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1;
}

.internal-section-summary strong {
  font-size: 1rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.internal-section-note {
  margin: 0 0 10px;
}

#internal-documents-root .section-arrow {
  border-color: var(--glass-border, var(--line));
  background: var(--glass-bg-soft, var(--surface));
}

#internal-documents-root .section-content {
  border-top-color: var(--glass-border, var(--line));
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
}

#credit-documents-root .section-arrow {
  border-color: var(--glass-border, var(--line));
  background: var(--glass-bg-soft, var(--surface));
}

#credit-documents-root .section-content {
  border-top-color: var(--glass-border, var(--line));
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
}

#internal-documents-root .internal-invoice-file,
#internal-documents-root .internal-invoice-generated {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  padding: 8px;
}

#credit-documents-root .internal-invoice-generated {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  padding: 8px;
}

#credit-documents-root .internal-invoice-generated .internal-payment-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

#credit-documents-root .internal-invoice-generated .internal-payment-actions button:first-child {
  grid-column: auto;
}

.credit-table-actions .ghost-action,
.credit-table-actions .primary-action {
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.credit-refund-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.credit-refund-cell strong {
  line-height: 1.1;
}

.compact-action {
  min-height: 28px;
  padding: 5px 7px;
  font-size: 0.72rem;
  line-height: 1.05;
  white-space: normal;
}

.credit-market-cell {
  display: block;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

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

.credit-payment-details div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  padding: 10px;
}

.credit-payment-details span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.credit-payment-details strong {
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.credit-payment-details-wide {
  grid-column: 1 / -1;
}

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

.credit-form-wide {
  grid-column: 1 / -1;
}

.credit-bank-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.credit-bank-fields.hidden,
.credit-form-grid .hidden {
  display: none;
}

.credit-order-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.credit-order-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.credit-order-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 122, 62, 0.28);
}

.credit-order-option span,
.credit-order-option small {
  display: grid;
  min-width: 0;
}

.credit-order-option strong,
.credit-order-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-order-option small,
.credit-order-option em,
.credit-order-empty {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 800;
}

.credit-order-empty {
  border: 1px dashed var(--glass-border, var(--line));
  border-radius: 8px;
  padding: 10px;
}

.credit-timer,
.credit-paid-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  padding: 7px 8px;
}

.credit-timer strong,
.credit-paid-meta strong {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 950;
  line-height: 1.1;
}

.credit-timer span,
.credit-paid-meta span,
.credit-paid-meta small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.1;
}

.credit-timer-ok {
  border-color: rgba(95, 198, 122, 0.48);
}

.credit-timer-warning {
  border-color: rgba(255, 178, 92, 0.62);
}

.credit-timer-danger {
  border-color: rgba(255, 112, 95, 0.7);
}

.credit-timer-ok strong {
  color: #5fc67a;
}

.credit-timer-warning strong {
  color: #ffb25c;
}

.credit-timer-danger strong {
  color: #ff705f;
}

.internal-invoice-preview {
  display: grid;
  gap: 18px;
  width: min(960px, 82vw);
  color: var(--ink);
}

.internal-invoice-preview header,
.internal-invoice-preview footer,
.internal-invoice-parties,
.internal-invoice-reference {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.internal-invoice-preview header {
  grid-template-columns: minmax(0, 1fr) auto;
}

.internal-invoice-preview h2,
.internal-invoice-preview h3,
.internal-invoice-preview p {
  margin: 0;
}

.internal-invoice-preview table {
  width: 100%;
  border-collapse: collapse;
}

.internal-invoice-preview th,
.internal-invoice-preview td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.internal-invoice-meta,
.internal-invoice-reference div,
.internal-invoice-preview footer div {
  display: grid;
  gap: 4px;
}

.internal-invoice-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-subtle);
}

.company-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.company-data-card {
  display: grid;
  gap: 14px;
}

.company-data-fields {
  display: grid;
  gap: 10px;
}

.company-data-fields div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.company-data-field {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.company-data-fields div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.company-data-fields span,
.company-data-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.company-data-fields strong {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.35;
}

.company-data-field input,
.company-data-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  line-height: 1.35;
  padding: 10px;
}

.company-data-field textarea {
  min-height: 76px;
  resize: vertical;
}

.company-data-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.invoice-preview-document,
.freight-preview-document {
  display: grid;
  gap: 18px;
  color: var(--ink);
}

.invoice-preview-document header,
.invoice-preview-document footer,
.freight-preview-document header,
.freight-preview-document footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
}

.invoice-preview-document h2,
.invoice-preview-document h3,
.invoice-preview-document p,
.freight-preview-document h2,
.freight-preview-document h3,
.freight-preview-document p {
  margin: 0;
}

.invoice-preview-document header p,
.invoice-preview-document footer span,
.invoice-preview-document small,
.freight-preview-document header p,
.freight-preview-document small,
.freight-preview-grid span {
  color: var(--muted);
}

.invoice-preview-document table {
  min-width: 0;
}

.invoice-preview-document footer div {
  display: grid;
  gap: 4px;
}

.freight-preview-media img {
  width: min(240px, 100%);
  max-height: 180px;
  object-fit: contain;
}

.freight-preview-header-meta {
  display: grid;
  gap: 4px;
  text-align: right;
}

.freight-preview-header-meta span,
.freight-preview-section h3,
.freight-signatures span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.freight-preview-section {
  display: grid;
  gap: 10px;
}

.freight-preview-section h3 {
  text-transform: uppercase;
}

.freight-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 16px;
}

.freight-preview-grid div {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.freight-preview-grid span,
.freight-preview-grid strong {
  display: block;
}

.freight-signatures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.freight-signatures div {
  min-height: 74px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
}

.document-dialog {
  max-width: 840px;
}

.freight-dialog-summary {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.freight-dialog-media {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.freight-dialog-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.freight-dialog-summary h3 {
  margin: 0 0 8px;
}

.freight-dialog-summary p {
  margin: 0 0 8px;
  color: var(--muted);
}

.repair-history-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

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

.repair-history-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-subtle);
}

.repair-history-card div {
  display: grid;
  gap: 4px;
}

.repair-history-card span,
.repair-history-card small {
  color: var(--muted);
}

.repair-source {
  display: inline-flex;
  margin-left: 6px;
  background: var(--amber-soft);
  color: var(--amber);
}

.hidden {
  display: none;
}

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

.inventory-card {
  padding: 16px;
  box-shadow: none;
}

.inventory-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.stock-meter {
  height: 9px;
  border-radius: 999px;
  background: #e7ecea;
  overflow: hidden;
  margin: 12px 0;
}

.stock-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.stock-fill.low {
  background: var(--red);
}

.stock-fill.medium {
  background: var(--amber);
}

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

.stock-data span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stock-data strong {
  display: block;
  margin-top: 3px;
}

.products-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 16px;
  align-items: start;
}

[hidden],
.products-layout.hidden {
  display: none !important;
}

.product-duplicate-warning {
  margin: 0 0 14px;
  border: 1px solid rgba(214, 70, 60, 0.8);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(129, 38, 32, 0.9), rgba(73, 25, 23, 0.86));
  color: #fff2ef;
  padding: 14px 16px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.product-duplicate-warning strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.product-duplicate-warning ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: rgba(255, 242, 239, 0.88);
}

.product-duplicate-warning li + li {
  margin-top: 5px;
}

.product-sidebar {
  display: grid;
  gap: 12px;
}

.product-filter-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-search-field {
  grid-column: 1 / -1;
}

.product-filter-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.product-filter-panel select,
.product-filter-panel input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  padding: 0 9px;
}

.product-filter-count {
  grid-column: 1 / -1;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0;
}

.product-filter-count strong {
  color: var(--ink);
}

.product-database-switch {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.product-database-main span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.product-database-switch h3 {
  margin: 3px 0 0;
  font-size: 1.2rem;
}

.product-database-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.product-database-mode {
  min-height: 42px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  color: var(--ink);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
}

.product-database-mode.active {
  border-color: rgba(255, 126, 62, 0.95);
  background: linear-gradient(135deg, var(--brand), #ff894d);
  color: var(--button-ink);
  box-shadow: 0 10px 26px rgba(255, 107, 53, 0.2);
}

.product-database-mode .nav-caret {
  transition: transform 0.16s ease;
}

.product-database-mode[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.third-party-picker-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  padding: 14px;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.16));
}

.third-party-picker-panel.hidden {
  display: none;
}

.third-party-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.third-party-picker-head div {
  display: grid;
  gap: 3px;
}

.third-party-picker-head strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
}

.third-party-picker-head span,
.third-party-picker-label {
  color: var(--muted);
  font-weight: 900;
}

.third-party-current-pill {
  flex: 0 0 auto;
  max-width: 100%;
  border: 1px solid rgba(255, 126, 62, 0.55);
  border-radius: 999px;
  background: rgba(255, 126, 62, 0.12);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.third-party-picker-section {
  display: grid;
  gap: 8px;
}

.third-party-picker-label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.third-party-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.third-party-choice {
  min-height: 58px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  color: var(--ink);
  padding: 9px 10px;
  display: grid;
  justify-items: start;
  gap: 3px;
  text-align: left;
  font-weight: 900;
  cursor: pointer;
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
}

.third-party-choice span {
  overflow-wrap: anywhere;
}

.third-party-choice small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.third-party-choice.active {
  border-color: rgba(255, 126, 62, 0.95);
  background: rgba(255, 126, 62, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 20px rgba(255, 107, 53, 0.14);
}

.third-party-choice.empty {
  opacity: 0.62;
}

body.product-database-view #market-multi {
  display: none;
}

@media (max-width: 900px) {
  .product-database-switch {
    grid-template-columns: 1fr;
  }

  .product-database-actions,
  .third-party-picker-head {
    align-items: stretch;
    flex-direction: column;
  }

  .product-database-mode,
  .third-party-current-pill {
    width: 100%;
  }
}

.third-party-media-strip .product-drawing-preview .product-hero {
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  min-height: 220px;
}

.third-party-media-strip .product-hero span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.product-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
  cursor: pointer;
}

.product-row.active {
  outline: 2px solid var(--green);
  border-color: transparent;
}

.product-row h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.product-row-thumb {
  width: 58px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.product-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-row-copy {
  min-width: 0;
}

.missing-pill {
  color: var(--red);
  font-weight: 900;
}

.product-detail {
  padding: 18px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  box-shadow: none;
  scrollbar-gutter: stable;
}

.product-media-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.product-issue-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0 16px;
  padding: 12px;
  border: 1px solid rgba(184, 68, 68, 0.45);
  border-radius: 12px;
  background: var(--red-soft);
}

.product-issue-panel.is-ok {
  border-color: rgba(45, 137, 92, 0.38);
  background: var(--green-soft);
}

.product-issue-panel strong {
  color: var(--ink);
}

.product-issue-panel span {
  color: var(--muted);
  font-size: 0.86rem;
}

.product-issue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-issue-list span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--red);
  font-weight: 900;
}

.product-image-preview,
.product-drawing-preview {
  display: grid;
  grid-template-rows: auto 42px;
  gap: 10px;
}

.product-image-square,
.product-hero {
  aspect-ratio: 1 / 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  overflow: hidden;
}

.product-image-square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-hero {
  border: 1px dashed #b8c3bf;
  background:
    linear-gradient(90deg, rgba(31, 36, 35, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 36, 35, 0.08) 1px, transparent 1px), #f7faf8;
  background-size: 24px 24px;
  padding: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

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

.detail-field {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 42px 10px 10px;
  background: var(--surface-subtle);
}

.detail-field.missing-field {
  border-color: rgba(184, 68, 68, 0.45);
  background: var(--red-soft);
}

.detail-field span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.field-edit-button {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0.82rem;
}

.product-drawing-preview {
  min-width: 0;
}

.product-media-actions .ghost-action,
.product-drawing-preview .ghost-action {
  width: 100%;
  height: 42px;
  padding: 0 8px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.product-edit-dialog textarea {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  padding: 10px;
  resize: vertical;
}

.product-edit-dialog select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
}

.product-edit-dialog .draft-submit-row {
  margin-top: 18px;
}

.product-edit-dialog .field.hidden {
  display: none;
}

.media-preview-frame {
  width: min(900px, 82vw);
  height: min(680px, 72vh);
  border: 0;
  background: var(--surface);
}

@media (max-width: 860px) {
  .product-media-strip {
    grid-template-columns: 1fr;
  }
}

.order-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: min(86vh, 920px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.order-dialog::backdrop {
  background: rgba(31, 36, 35, 0.35);
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.field textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.field input:disabled {
  background: var(--surface-muted);
  color: var(--muted);
}

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

.check-field {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.customer-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: end;
}

.mini-action {
  height: 40px;
  white-space: nowrap;
  font-size: 0.88rem;
}

.company-toggle {
  align-self: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface-subtle);
}

.order-number-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: end;
}

.repair-toggle,
.custom-product-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface-subtle);
  white-space: nowrap;
}

.product-source-section > summary {
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr);
}

.product-source-summary {
  min-width: 0;
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-source-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.product-source-option {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  color: var(--ink);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
}

.product-source-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.product-source-option input {
  flex: 0 0 auto;
  margin-top: 3px;
  accent-color: var(--brand);
}

.product-source-option > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.product-source-option strong,
.product-source-option small {
  display: block;
  line-height: 1.25;
}

.product-source-option small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.product-source-panel {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.product-source-panel.hidden {
  display: none;
}

.third-party-product-picker {
  margin: 0;
}

.repair-fields,
.custom-product-fields {
  grid-column: 1 / -1;
}

.repair-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-subtle);
  display: grid;
  gap: 10px;
}

.repair-fields.hidden,
.custom-product-fields.hidden,
#order-id-field.hidden {
  display: none !important;
}

.repair-product-fields {
  display: grid;
  gap: 14px;
}

.repair-product-fields.hidden,
.repair-glass-fields.hidden,
.new-order-stat-field.hidden,
.repair-inheritance-note.hidden,
#draft-market-field.hidden,
#draft-customer-entry.hidden,
#draft-company-toggle.hidden,
#draft-product-source-options.hidden,
#repair-drawing-fields.hidden,
#repair-burner-fields.hidden,
#repair-accessories-block.hidden,
#normal-glass-block.hidden,
.special-toggle.hidden {
  display: none !important;
}

.repair-damaged-parts {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-subtle);
}

.repair-damaged-parts legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 800;
}

.repair-damaged-parts-grid,
.repair-custom-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.repair-damaged-parts-grid label,
.repair-custom-parts label {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.repair-damaged-parts-grid label:has(input:checked),
.repair-custom-parts label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.repair-damaged-parts input {
  accent-color: var(--brand);
}

.repair-custom-part-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.repair-custom-part-remove {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.repair-inheritance-note {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.repair-fields-head,
.repair-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.42fr);
  gap: 10px;
  align-items: center;
}

.repair-fields-head span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.repair-filter-row input,
.repair-filter-row select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.repair-result-list {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.repair-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  gap: 4px;
  text-align: left;
}

.repair-result:hover,
.repair-result.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.repair-result span,
.repair-result small {
  color: var(--muted);
}

.disabled-combo {
  opacity: 0.62;
}

.company-fields {
  grid-column: 1 / -1;
  grid-template-columns: minmax(160px, 0.7fr) minmax(360px, 1.3fr);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.company-fields.hidden {
  display: none;
}

.vat-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) max-content;
  gap: 12px;
  align-items: end;
}

.vat-toggle {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
  white-space: nowrap;
}

.file-toggle,
.special-toggle,
.glass-toggle,
.accessories-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 0 10px;
}

.accessories-toggle {
  margin-top: 24px;
}

.accessories-field {
  margin-top: 8px;
  margin-bottom: 18px;
}

.accessory-multi-select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.accessory-multi-select > label {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--ink);
  background: var(--surface-subtle);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.accessory-multi-select > label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.accessory-multi-select input {
  accent-color: var(--brand);
}

.glass-toggle {
  margin-top: 18px;
}

.glass-fields {
  margin-top: 10px;
}

.production-comments-field {
  margin-bottom: 14px;
}

.repair-glass-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.repair-glass-pane-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.repair-glass-pane-option {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.repair-glass-pane-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.repair-glass-pane-option.invalid {
  border-color: rgba(191, 68, 68, 0.7);
}

.repair-glass-pane-option input {
  margin-top: 3px;
  accent-color: var(--brand);
}

.repair-glass-pane-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.repair-glass-pane-option small {
  color: var(--muted);
  line-height: 1.3;
}

.repair-glass-fields .repair-inheritance-note {
  grid-column: 1 / -1;
  margin: 0;
}

.own-drawing-field.hidden,
.special-fields.hidden,
.glass-fields.hidden,
.accessories-field.hidden {
  display: none;
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.price-field {
  align-content: start;
}

.price-field:not(:has(.field-hint))::after {
  content: "";
  min-height: 1.014rem;
}

.combo {
  position: relative;
}

.combo-trigger {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  text-align: left;
}

.combo-chevron {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.16s ease;
}

.combo:has(.combo-menu:not(.hidden)) .combo-chevron,
.date-picker:has(.date-popover:not(.hidden)) .combo-chevron {
  transform: translateY(2px) rotate(225deg);
}

.combo-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-menu {
  position: absolute;
  z-index: 20;
  inset: calc(100% + 6px) 0 auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 8px;
}

.combo-search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  margin-bottom: 8px;
}

.combo-options {
  max-height: 270px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.combo-option {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-subtle);
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  text-align: left;
}

.combo-option.has-image {
  min-height: 58px;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.combo-option-image {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  display: grid;
  place-items: center;
}

.combo-option-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.combo-option-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: var(--ink);
}

.combo-option-copy strong,
.combo-option-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-option-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.combo-option:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.combo-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.combo-empty {
  padding: 10px;
}

.date-picker {
  position: relative;
}

.date-trigger {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.date-popover {
  position: absolute;
  z-index: 25;
  top: calc(100% + 6px);
  left: 0;
  width: 318px;
  max-width: calc(100vw - 32px);
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--brand-ink);
}

.date-head .ghost-action {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 34px);
  justify-content: center;
  gap: 7px;
}

.date-weekdays {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
}

.date-day,
.date-empty {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  display: grid;
  place-items: center;
  position: relative;
  padding: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1;
}

.date-day:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.date-day.active {
  background: var(--brand);
  color: var(--button-ink);
  font-weight: 800;
}

.date-day.today-marker {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(216, 109, 63, 0.24);
  font-weight: 800;
}

.date-day.today-marker::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--brand);
}

.date-day.today-marker.active::after {
  background: var(--button-ink);
}

.drawing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.icon-action {
  height: 40px;
  padding: 0 10px;
  white-space: nowrap;
}

.icon-action.danger {
  color: #b84444;
  font-size: 1.1rem;
  font-weight: 900;
}

.order-accordion {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
}

.order-accordion.repair-mode #draft-shipping-section { order: 1; }
.order-accordion.repair-mode #draft-product-section { order: 2; }
.order-accordion.repair-mode #draft-production-section { order: 3; }
.order-accordion.repair-mode #draft-statistics-section { order: 4; }

.order-accordion.repair-mode #repair-accessories-block .accessories-toggle {
  display: none;
}

.order-section {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  overflow: visible;
}

.order-section summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.order-section summary::-webkit-details-marker {
  display: none;
}

.section-arrow {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex: 0 0 24px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  position: relative;
  padding: 0;
  font-size: 0 !important;
  line-height: 0;
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12));
  transition: transform 0.22s var(--ease-glass, ease), border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.section-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(-62%, -50%) rotate(-45deg);
  transform-origin: 50% 50%;
}

.order-section[open] > summary > .section-arrow,
details[open] > summary > .section-arrow {
  transform: rotate(90deg);
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong, var(--brand));
}

.section-content {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.order-dialog .field,
.order-dialog .combo,
.order-dialog .dialog-grid,
.order-dialog .product-source-panel {
  min-width: 0;
}

.shipping-fields {
  margin-top: 16px;
}

.muted-section {
  color: var(--muted);
}

.address-check {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.customer-dialog,
.preview-dialog {
  width: min(860px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.customer-dialog::backdrop,
.preview-dialog::backdrop {
  background: rgba(31, 36, 35, 0.35);
}

.customer-picker-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.5fr) minmax(160px, 0.4fr);
  gap: 10px;
  margin-bottom: 12px;
}

.customer-picker-filters input,
.customer-picker-filters select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
}

.customer-picker-list {
  max-height: min(540px, 60vh);
  overflow: auto;
  display: grid;
  gap: 8px;
}

.customer-pick {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px;
  display: grid;
  gap: 3px;
  text-align: left;
}

.customer-pick:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.customer-pick span,
.customer-pick small {
  color: var(--muted);
}

.drawing-preview {
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.drawing-preview img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.drawing-preview-placeholder {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.confirm-dialog p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
}

.production-stats {
  display: grid;
  gap: 18px;
}

.production-stats.hidden {
  display: none;
}

.statistics-period-bar {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr) max-content;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.statistics-period-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 1000;
  white-space: nowrap;
}

.statistics-period-title,
.statistics-period-bar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-weight: 900;
}

.statistics-period-title {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: 42%;
  transform: translate(-50%, -50%);
  justify-items: center;
  text-align: center;
  pointer-events: none;
}

.statistics-period-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(132px, max-content));
  align-items: end;
  justify-self: end;
  gap: 10px;
}

.statistics-period-title span,
.statistics-period-bar label {
  font-size: 0.82rem;
}

.statistics-period-title strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.statistics-period-bar select,
.statistics-period-bar input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  padding: 0 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.credit-duration-stat-card small {
  line-height: 1.35;
}

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

.webshop-score-body {
  display: grid;
  gap: 14px;
}

.webshop-score-info {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.webshop-score-info strong {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #16110d;
}

.webshop-score-info span,
.webshop-score-card small {
  color: var(--muted);
  font-weight: 800;
}

.webshop-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.webshop-score-card {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface));
  padding: 12px;
  display: grid;
  gap: 8px;
}

.webshop-score-card div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.webshop-score-card span {
  color: var(--muted);
  font-weight: 900;
}

.webshop-score-card strong {
  font-size: 2rem;
}

.chart-card {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
  padding: 16px;
}

.stats-dropdown {
  padding: 0;
  overflow: hidden;
  border-color: var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.stats-dropdown > summary {
  list-style: none;
  cursor: pointer;
  min-height: 68px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-dropdown > summary::-webkit-details-marker {
  display: none;
}

.stats-dropdown > summary strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.stats-dropdown > summary small {
  color: var(--muted);
}

.stats-dropdown[open] > summary .section-arrow {
  transform: rotate(90deg);
}

.stats-dropdown-body {
  border-top: 1px solid var(--line);
  padding: 16px;
}

.statistics-line-details {
  margin-top: 14px;
}

.statistics-line-body {
  display: grid;
  gap: 12px;
  background: rgba(15, 22, 20, 0.2);
}

.statistics-line-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, max-content)) minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.statistics-line-controls > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.statistics-line-controls input[type="date"] {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  padding: 0 10px;
}

.statistics-chart-toggles {
  justify-content: flex-end;
}

.statistics-chart-toggles label {
  min-height: 40px;
}

.statistics-line-chart-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 242, 236, 0.04);
  padding: 10px;
}

.statistics-line-chart {
  width: 100%;
  min-width: 760px;
  height: auto;
  display: block;
}

.statistics-chart-grid-line {
  stroke: rgba(202, 195, 185, 0.18);
  stroke-width: 1;
}

.statistics-chart-label,
.statistics-chart-month {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.statistics-line-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.statistics-line-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.statistics-line-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--metric-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--metric-color), transparent 72%);
}

.credit-duration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.credit-duration-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.credit-duration-metric > span,
.credit-duration-meta span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.credit-duration-metric > strong {
  color: var(--ink);
  font-size: 1.55rem;
}

.credit-duration-metric small {
  color: var(--muted);
}

.credit-duration-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.credit-duration-meta strong {
  color: var(--ink);
  text-align: right;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut-chart {
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--chart);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(31, 36, 35, 0.08);
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 36px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.chart-legend {
  display: grid;
  gap: 9px;
}

.legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.panel-note {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.billing-shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.billing-shop-card {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  padding: 14px;
  text-align: left;
  box-shadow: var(--shadow);
}

.billing-shop-card span {
  grid-row: span 2;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  font-size: 1.45rem;
}

.billing-shop-card strong {
  font-size: 1.05rem;
}

.billing-shop-card small {
  color: var(--muted);
  font-weight: 800;
}

.billing-shop-card.active,
.billing-shop-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.billing-note {
  border: 1px solid rgba(216, 109, 63, 0.28);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 800;
}

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

.billing-period-controls {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.billing-period-pill {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
}

.billing-period-pill.active,
.billing-period-pill:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.billing-custom-range {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-date-field,
.billing-date-shell {
  position: relative;
  display: inline-grid;
}

.billing-date-trigger {
  width: 136px;
  height: 40px;
  border: 1px solid rgba(216, 109, 63, 0.32);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
  text-align: left;
  font-weight: 850;
}

.billing-date-shell.has-value .billing-date-trigger,
.billing-date-trigger:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.billing-period-label {
  border: 1px solid rgba(216, 109, 63, 0.24);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 900;
}

.billing-date-popover {
  border-color: var(--brand);
}

.billing-kpi-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  align-content: space-between;
}

.billing-kpi-card span,
.billing-kpi-card small {
  color: var(--muted);
  font-weight: 800;
}

.billing-kpi-card strong {
  font-size: 1.7rem;
}

.billing-kpi-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.billing-compare {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.86rem;
  line-height: 1.2;
  font-weight: 900;
}

.billing-compare.up {
  background: var(--green-soft);
  color: var(--green);
}

.billing-compare.down {
  background: var(--red-soft);
  color: var(--red);
}

.billing-compare.neutral {
  background: var(--surface-muted);
  color: var(--muted);
}

.billing-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.billing-overview-panel {
  box-shadow: none;
}

.billing-mini-table {
  display: grid;
  gap: 8px;
}

.billing-mini-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px;
}

.billing-mini-row span {
  color: var(--muted);
  font-weight: 800;
}

.billing-analytics-stack {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.billing-analytics-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.billing-analytics-details summary {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.billing-analytics-details summary::-webkit-details-marker {
  display: none;
}

.billing-analytics-details summary::before {
  content: "›";
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 900;
  transition: transform 0.16s ease;
}

.billing-analytics-details[open] summary::before {
  transform: rotate(90deg);
}

.billing-analytics-details summary span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
  margin-right: auto;
}

.billing-analytics-details summary strong {
  font-size: 1.08rem;
}

.billing-analytics-details summary small,
.billing-details-count {
  color: var(--muted);
  font-weight: 800;
}

.billing-details-count {
  border: 1px solid rgba(216, 109, 63, 0.24);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 7px 10px;
  white-space: nowrap;
}

.billing-summary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.billing-year-filter {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 8px 0 12px;
  font-size: 0.78rem;
  font-weight: 900;
}

.billing-year-filter select {
  height: 28px;
  min-width: 86px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 0 8px;
  font: inherit;
  cursor: pointer;
}

.billing-year-filter select:focus {
  outline: 2px solid rgba(216, 109, 63, 0.22);
}

.billing-analytics-list {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: var(--surface-subtle);
}

.billing-analysis-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.billing-analysis-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.billing-analysis-card header div {
  display: grid;
  gap: 3px;
}

.billing-analysis-card header strong {
  font-size: 1.05rem;
}

.billing-analysis-card header small,
.billing-analysis-card header span,
.billing-top-order {
  color: var(--muted);
  font-weight: 800;
}

.billing-analysis-card header > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  white-space: nowrap;
}

.billing-analysis-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.billing-analysis-metrics div {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px;
  display: grid;
  align-content: space-between;
}

.billing-analysis-metrics span,
.billing-breakdowns > section > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.billing-analysis-metrics strong {
  font-size: 1.14rem;
}

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

.billing-breakdowns section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.billing-breakdowns section div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.billing-pill {
  border: 1px solid rgba(216, 109, 63, 0.24);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 850;
}

.billing-pill strong {
  margin-right: 4px;
}

.billing-pill.muted {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.billing-top-order {
  margin: 0;
}

.billing-month-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: var(--surface-subtle);
}

.billing-year-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.billing-month-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  display: grid;
}

.billing-month-card header {
  min-height: 76px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.billing-month-card header div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.billing-month-card header strong {
  text-transform: capitalize;
}

.billing-month-card header small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.billing-month-card header > span {
  border: 1px solid rgba(216, 109, 63, 0.24);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 6px 8px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.billing-year-card header {
  min-height: 68px;
}

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

.billing-month-mini div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 4px;
}

.billing-month-mini div:last-child {
  border-right: 0;
}

.billing-month-mini span,
.billing-month-calc-row span,
.billing-cost-table small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.billing-month-mini strong {
  font-size: 0.9rem;
}

.billing-month-calc {
  display: grid;
  padding: 8px 12px 12px;
}

.billing-month-calc-row {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(217, 223, 221, 0.7);
}

.billing-month-calc-row:last-child {
  border-bottom: 0;
}

.billing-month-calc-row strong {
  font-size: 0.88rem;
  white-space: nowrap;
}

.billing-month-calc-row.total,
.billing-month-calc-row.david-total {
  margin-top: 4px;
  border-bottom: 0;
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 7px 8px;
}

.billing-month-calc-row.david-total {
  background: var(--brand-soft);
}

.billing-cost-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  padding: 14px;
}

.billing-cost-table {
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.billing-cost-table th,
.billing-cost-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.billing-cost-table th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.billing-cost-table tr:last-child td {
  border-bottom: 0;
}

.billing-cost-table th:last-child,
.billing-cost-table td:last-child {
  border-right: 0;
}

.billing-cost-table td:first-child {
  min-width: 180px;
}

.billing-cost-table td:first-child strong,
.billing-cost-table td:first-child small {
  display: block;
}

.billing-cost-input {
  width: 116px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 8px;
  font: inherit;
  font-weight: 800;
}

.billing-cost-input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(216, 109, 63, 0.16);
}

.billing-trend-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  padding: 14px;
}

.billing-chart-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-chart-toggles label {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 900;
}

.billing-chart-toggles label:has(input:checked) {
  border-color: var(--metric-color);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.billing-chart-toggles input {
  accent-color: var(--metric-color);
}

.billing-chart-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.billing-line-chart {
  width: 100%;
  min-width: 720px;
  height: auto;
  display: block;
}

.billing-chart-grid-line {
  stroke: rgba(131, 119, 108, 0.22);
  stroke-width: 1;
}

.billing-chart-label,
.billing-chart-month {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.billing-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  font-weight: 800;
}

.billing-tabs button.active,
.billing-tabs button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.billing-table {
  overflow-x: auto;
}

.billing-table table {
  min-width: 1420px;
}

.billing-table small {
  color: var(--muted);
}

.billing-source {
  border: 1px solid rgba(216, 109, 63, 0.25);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.billing-entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.billing-entry-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.billing-entry-form input,
.billing-entry-form select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
}

.billing-entry-form .primary-action {
  min-height: 42px;
}

.positive {
  color: var(--green);
  font-weight: 900;
}

.negative {
  color: var(--red);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-weight: 800;
}

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

.bestseller-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px;
}

.bestseller-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bestseller-row > span:not(.bestseller-rank) {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.bestseller-rank {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: var(--button-ink);
  font-weight: 900;
}

.bestseller-bar {
  grid-column: 2 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.bestseller-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.draft-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

#draft-order-status:not(:empty) {
  flex-basis: 100%;
  color: var(--red);
  font-weight: 800;
}

.order-stamp {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 8px 12px;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.86rem;
  margin-left: auto;
  justify-self: end;
}

.order-stamp strong {
  color: var(--ink);
}

.messages-layout {
  display: grid;
  grid-template-columns: minmax(220px, 23%) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
}

#messages-view.active {
  height: calc(100dvh - var(--messages-view-top, 180px) - 20px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

body.messages-viewport-locked {
  overflow: hidden;
}

body.messages-viewport-locked .app-shell,
body.messages-viewport-locked .workspace {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.messages-viewport-locked .sidebar {
  overflow-y: auto;
}

#messages-view > .messages-header-bar {
  min-height: 62px;
  margin: 0;
  padding: 9px 14px;
  border-color: color-mix(in srgb, var(--brand) 34%, var(--glass-border, var(--line)));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), color-mix(in srgb, var(--brand-soft) 42%, var(--glass-bg-soft, var(--surface-subtle))));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.messages-header-bar .eyebrow {
  margin-bottom: 2px;
}

.messages-saved-action {
  flex: 0 0 auto;
  box-shadow: 0 8px 20px var(--glow-brand, rgba(216, 109, 63, 0.24));
}

.chat-sidebar,
.chat-pane {
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
  box-shadow: var(--shadow-glass, var(--shadow-soft));
}

.chat-sidebar,
.chat-pane {
  border-radius: 8px;
}

.chat-sidebar {
  padding: 12px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.chat-mobile-picker-toggle {
  display: none;
}

.chat-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.chat-tabs button,
.chat-card,
.chat-message-actions button,
.chat-reaction-pill {
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg-strong, rgba(20, 27, 24, 0.78)), var(--glass-bg-soft, rgba(20, 27, 24, 0.48)));
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12));
}

.chat-tabs button {
  min-height: 44px;
  padding: 6px 4px;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.chat-tabs button.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 25%, var(--glass-bg-strong, var(--surface))), var(--glass-bg-soft, var(--surface-subtle)));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12)), 0 8px 20px var(--glow-brand);
}

.chat-mode-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  background: var(--brand);
  color: var(--button-ink);
  font-size: 0.7rem;
  line-height: 1;
}

.chat-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding-right: 2px;
}

.chat-card {
  width: 100%;
  min-height: 66px;
  padding: 10px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  transition: transform 0.22s var(--ease-glass, ease), border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.chat-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand) 58%, var(--glass-border, var(--line)));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 42%, var(--glass-bg-strong, var(--surface))), var(--glass-bg-soft, var(--surface-subtle)));
}

.chat-card.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 24%, var(--glass-bg-strong, var(--surface))), color-mix(in srgb, var(--brand-soft) 52%, var(--glass-bg-soft, var(--surface-subtle))));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12)), 0 8px 22px var(--glow-brand);
}

.chat-card.has-unread:not(.active) {
  border-color: color-mix(in srgb, var(--brand) 62%, var(--glass-border, var(--line)));
}

.chat-card.escalated {
  border-color: rgba(255, 82, 82, 0.9);
  background: rgba(100, 33, 33, 0.48);
  order: -1;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 1.35rem;
  overflow: hidden;
  flex: 0 0 auto;
}

.chat-avatar.large {
  width: 52px;
  height: 52px;
}

.chat-avatar.mini {
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-card-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.chat-card-copy strong,
.chat-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-card-copy small {
  color: var(--muted);
  font-weight: 700;
}

.chat-unread,
.chat-escalated-flag {
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 1000;
}

.chat-card-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.chat-unread {
  background: var(--accent);
  color: #111;
}

.chat-escalated-flag {
  background: #ff5252;
  color: #fff;
}

.chat-pane {
  min-height: 0;
  height: 100%;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
}

.chat-pane-head {
  min-height: 72px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-title-row h2 {
  margin: 0;
}

.chat-thread-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.chat-archive-hint {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(20, 27, 24, 0.64);
}

.chat-participant-panel {
  flex: 1 0 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(12, 18, 16, 0.74);
  display: grid;
  gap: 8px;
}

.chat-participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px 5px 5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-weight: 900;
}

.chat-messages {
  min-height: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}

.chat-message {
  max-width: min(720px, 82%);
  display: flex;
  position: relative;
  margin-bottom: 0;
}

.chat-message.own {
  align-self: flex-end;
}

.chat-bubble {
  width: 100%;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 27, 24, 0.82);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.chat-message.own .chat-bubble {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.chat-message.escalated .chat-bubble {
  border-color: rgba(255, 82, 82, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 82, 82, 0.45);
}

.chat-bubble header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.chat-bubble p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message-translation {
  display: grid;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--brand) 58%, var(--glass-border, var(--line)));
  border-radius: 8px;
  padding: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 70%, var(--glass-bg-strong, rgba(20, 27, 24, 0.84))), var(--glass-bg-soft, rgba(20, 27, 24, 0.68)));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12));
}

.chat-message-translation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--brand-bright, var(--accent));
  font-size: 0.76rem;
  font-weight: 1000;
  letter-spacing: 0;
}

.chat-message-translation-head button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.chat-message-translation-head button:hover,
.chat-message-translation-head button:focus-visible {
  border-color: var(--glass-border, var(--line));
  background: var(--brand-soft);
  color: var(--ink);
}

.chat-order-ref {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 1px 3px;
  border: 1px solid color-mix(in srgb, var(--brand) 76%, var(--glass-border, var(--line)));
  border-radius: 7px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 26%, var(--glass-bg-strong, var(--surface))), var(--glass-bg-soft, var(--surface-subtle)));
  color: #fff;
  padding: 3px 9px;
  font: inherit;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.14)), 0 4px 14px var(--glow-brand);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease-glass, ease);
}

.chat-order-ref:hover,
.chat-order-ref:focus-visible {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 72%, var(--glass-bg-strong, var(--surface)));
  color: var(--button-ink);
  transform: translateY(-1px);
}

.chat-reply-ref,
.chat-forward-ref,
.chat-archive-note {
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 800;
}

.chat-attachments,
.chat-reactions,
.chat-message-actions,
.chat-attach-row,
.chat-attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chat-attachment-card {
  position: relative;
  width: min(390px, 100%);
  min-width: min(270px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--glass-border, var(--line)));
  border-radius: 8px;
  padding: 7px;
  background: linear-gradient(135deg, var(--glass-bg-strong, rgba(20, 27, 24, 0.82)), var(--glass-bg-soft, rgba(20, 27, 24, 0.58)));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.1));
}

.chat-attachment-card.voice-note {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.chat-attachment-card.unavailable {
  opacity: 0.68;
}

.chat-attachment-main {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.chat-attachment-main:disabled {
  cursor: default;
}

.chat-attachment-thumb,
.chat-attachment-file-icon {
  width: 44px;
  height: 44px;
  border-radius: 6px;
}

.chat-attachment-thumb {
  object-fit: cover;
}

.chat-attachment-file-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--brand-soft);
  font-size: 1.2rem;
}

.chat-attachment-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.chat-attachment-copy strong,
.chat-attachment-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.chat-attachment-download {
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 7px;
  padding: 0;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
}

.chat-attachment-download:hover,
.chat-attachment-download:focus-visible {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--button-ink);
}

.chat-attachment-download:disabled {
  cursor: default;
  opacity: 0.5;
}

.chat-attachment-card .chat-attachment-audio {
  grid-column: 1 / -1;
  width: 100%;
}

.chat-attachment-preview-surface {
  min-height: min(62vh, 620px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: rgba(6, 10, 9, 0.58);
}

.chat-attachment-preview-image,
.chat-attachment-preview-video,
.chat-attachment-preview-frame {
  width: 100%;
  height: min(68vh, 720px);
  border: 0;
  object-fit: contain;
}

.chat-attachment-preview-audio {
  width: min(560px, calc(100% - 32px));
}

.chat-attachment-video {
  width: min(320px, 58vw);
  border-radius: 8px;
}

.chat-attachment-audio {
  width: min(320px, 58vw);
}

.chat-voice-note {
  display: grid;
  gap: 8px;
  width: min(360px, 64vw);
  border: 1px solid color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--accent) 16%, rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-voice-note span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 1000;
}

.chat-message-actions {
  position: static;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  max-height: 0;
  flex-wrap: nowrap;
  gap: 4px;
  overflow: hidden;
  padding: 0 4px;
  border: 0 solid color-mix(in srgb, var(--brand) 48%, var(--glass-border, var(--line)));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, rgba(20, 27, 24, 0.9)), var(--glass-bg-soft, rgba(20, 27, 24, 0.72)));
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px);
  scrollbar-width: none;
  transition: max-height 0.24s var(--ease-glass, ease), padding 0.24s var(--ease-glass, ease), opacity 0.16s ease, transform 0.2s var(--ease-glass, ease), visibility 0s linear 0.24s;
}

.chat-message-actions::-webkit-scrollbar {
  display: none;
}

.chat-message:hover .chat-message-actions,
.chat-message:has(.chat-message-actions button:focus-visible) .chat-message-actions {
  max-height: 48px;
  overflow: visible;
  padding: 4px;
  border-width: 1px;
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12)), 0 8px 20px rgba(0, 0, 0, 0.24);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.chat-message-actions .chat-action-icon {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-color: transparent;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.chat-message-actions .chat-action-icon:hover,
.chat-message-actions .chat-action-icon:focus-visible,
.chat-message-actions .chat-action-icon.active {
  border-color: color-mix(in srgb, var(--brand) 48%, transparent);
  background: var(--brand-soft);
}

.chat-message-actions .chat-action-icon:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.chat-action-symbol {
  display: block;
  font-size: 1.08rem;
  line-height: 1;
  font-weight: 1000;
}

.chat-action-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  z-index: 20;
  width: max-content;
  max-width: 190px;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--brand) 48%, var(--glass-border, var(--line)));
  border-radius: 6px;
  background: rgba(10, 15, 13, 0.97);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  font-size: 0.68rem;
  line-height: 1.25;
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.chat-action-icon:hover .chat-action-tooltip,
.chat-action-icon:focus-visible .chat-action-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chat-reaction-menu-wrap {
  position: relative;
  display: inline-flex;
}

.chat-reaction-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  width: max-content;
  max-width: min(360px, calc(100vw - 48px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(14, 20, 18, 0.96);
  box-shadow: var(--shadow);
}

.chat-reaction-menu button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.08rem;
}

.chat-escalation-pin,
.chat-reply-banner,
.chat-composer {
  border-top: 1px solid var(--line);
  padding: 12px 18px;
}

.chat-escalation-pin {
  background: rgba(100, 33, 33, 0.78);
  display: grid;
  gap: 8px;
}

.chat-escalation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.16);
}

.chat-reply-banner {
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
}

.chat-reply-banner button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.chat-composer {
  display: grid;
  gap: 8px;
  background: rgba(10, 14, 12, 0.42);
}

.chat-composer textarea {
  width: 100%;
  min-height: clamp(64px, 8dvh, 92px);
  max-height: 190px;
  overflow: auto;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 27, 24, 0.84);
  color: var(--ink);
  padding: 12px;
  font: inherit;
}

.chat-composer-translation-state {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--brand) 52%, var(--glass-border, var(--line)));
  border-radius: 8px;
  padding: 6px 8px 6px 11px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 72%, var(--glass-bg-strong, var(--surface))), var(--glass-bg-soft, var(--surface-subtle)));
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.chat-composer-translation-state.hidden {
  display: none;
}

.chat-composer-translation-state .ghost-action {
  flex: 0 0 auto;
  min-height: 30px;
  height: 30px;
  padding: 0 9px;
}

.chat-order-picker,
.chat-composer-emoji-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 19, 17, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.chat-order-picker.hidden,
.chat-composer-emoji-panel.hidden {
  display: none;
}

.chat-order-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.chat-order-picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  gap: 10px;
  align-items: end;
}

.chat-order-picker-head small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.chat-order-picker-head input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 27, 24, 0.84);
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-weight: 900;
}

.chat-order-results {
  display: grid;
  gap: 8px;
}

.chat-order-results button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  padding: 9px 10px;
  display: grid;
  gap: 3px;
  text-align: left;
  cursor: pointer;
}

.chat-order-results button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chat-order-results span,
.chat-order-results small {
  color: var(--muted);
  font-weight: 800;
}

.chat-composer-emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px;
}

.chat-composer-emoji-panel button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.15rem;
  cursor: pointer;
}

.chat-composer-emoji-panel button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chat-file-action {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1;
  white-space: nowrap;
}

.chat-file-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 18px;
  font-size: 1rem;
  line-height: 1;
}

.chat-file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chat-schedule-button {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.chat-translate-button {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--line));
  color: var(--ink);
}

.chat-translation-dialog {
  display: grid;
  gap: 14px;
}

.chat-translation-dialog > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.chat-translation-language-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.chat-translation-swap {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}

.chat-translation-swap:hover,
.chat-translation-swap:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.chat-translation-source-preview {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  padding: 12px;
  background: var(--glass-bg-soft, rgba(255, 255, 255, 0.04));
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-translation-dialog .chat-translation-note {
  font-size: 0.8rem;
}

.chat-translation-error {
  border: 1px solid rgba(255, 82, 82, 0.62);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(100, 33, 33, 0.52);
  color: #ffaaa2;
  font-weight: 900;
}

.chat-translation-error.hidden {
  display: none;
}

.chat-scheduled-queue {
  border: 1px solid color-mix(in srgb, var(--brand) 58%, var(--glass-border, var(--line)));
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 7px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 72%, var(--glass-bg-strong, var(--surface))), var(--glass-bg-soft, var(--surface-subtle)));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12));
}

.chat-scheduled-queue > header,
.chat-scheduled-queue > article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-scheduled-queue > header small,
.chat-scheduled-queue > article span {
  color: var(--muted);
  font-weight: 800;
}

.chat-scheduled-queue > article {
  border-top: 1px solid var(--glass-border, var(--line));
  padding-top: 7px;
}

.chat-scheduled-queue > article span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-scheduled-queue .ghost-action {
  flex: 0 0 auto;
  height: 32px;
}

.chat-scheduled-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.chat-schedule-dialog {
  display: grid;
  gap: 14px;
}

.chat-schedule-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.chat-schedule-dialog input {
  width: 100%;
}

.chat-schedule-dialog textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
}

.chat-scheduled-attachment-note {
  color: var(--muted);
  font-weight: 800;
}

.chat-schedule-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.chat-schedule-presets .ghost-action {
  min-width: 0;
  padding: 0 8px;
}

.chat-voice-button.recording {
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.chat-voice-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
}

.chat-escalation-pin.hidden,
.chat-reply-banner.hidden,
.chat-voice-panel.hidden {
  display: none;
}

.chat-voice-recording,
.chat-voice-ready {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-voice-ready {
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.chat-voice-ready audio {
  width: min(340px, 100%);
}

.chat-voice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-voice-pulse {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  animation: chatVoicePulse 1.2s ease-out infinite;
}

@keyframes chatVoicePulse {
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.chat-attachment-preview span,
.chat-forward-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 800;
}

.chat-attachment-preview .attachment-rejected {
  border-color: rgba(255, 82, 82, 0.72);
  color: #ff8a80;
  background: rgba(100, 33, 33, 0.38);
}

.chat-order-address,
.saved-chat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 6px;
}

.chat-order-address span,
.saved-chat-card span {
  color: var(--muted);
  font-weight: 900;
}

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

.saved-chat-browser {
  display: grid;
  gap: 14px;
}

.saved-chat-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.8fr);
  gap: 10px;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12));
}

.saved-chat-search,
.saved-chat-filter {
  width: 100%;
  min-width: 0;
}

.saved-chat-search {
  display: grid;
  gap: 6px;
}

.saved-chat-control-label,
.saved-chat-filter {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 1000;
}

.saved-chat-search-control {
  min-height: 46px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(8, 13, 11, 0.34);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.saved-chat-search-control:focus-within {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand-soft) 32%, rgba(8, 13, 11, 0.52));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 24%, transparent);
}

.saved-chat-search-icon {
  color: var(--brand-bright, var(--brand));
  font-size: 1rem;
  line-height: 1;
}

.saved-chat-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.saved-chat-search input::placeholder {
  color: var(--muted);
}

.saved-chat-filter select {
  width: 100%;
  min-width: 0;
}

.saved-chat-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
}

.saved-chat-card p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.saved-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.saved-chat-actions .primary-action,
.saved-chat-actions .ghost-action {
  width: auto;
}

.saved-chat-more-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.saved-chat-more {
  width: auto;
  min-height: 38px;
  padding-inline: 16px;
}

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

.message-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.message-item.unread {
  border-color: #d43d3d;
  background: var(--red-soft);
}

.message-item span,
.message-item p {
  color: var(--muted);
  margin: 0;
}

.shipping-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shipping-overdue-list,
.shipping-upcoming-list,
.shipping-open-list,
.transport-plan-list,
.transport-candidate-list {
  display: grid;
  gap: 10px;
}

.shipping-open-details {
  display: grid;
  gap: 12px;
}

.shipping-open-details summary {
  list-style: none;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  font-weight: 900;
}

.shipping-open-details summary::marker,
.shipping-open-details summary::-webkit-details-marker {
  display: none;
  content: "";
}

.open-summary-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.shipping-open-details[open] > summary .section-arrow {
  transform: rotate(90deg);
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong, var(--brand));
}

.shipping-open-details summary small {
  color: var(--muted);
  font-weight: 800;
}

.shipping-open-details[open] summary {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.shipping-open-list {
  margin-top: 10px;
}

.shipping-overdue-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1fr) minmax(110px, 0.45fr) minmax(240px, 1.2fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 12px;
}

.shipping-overdue-card.is-overdue {
  border-color: rgba(213, 64, 42, 0.35);
  background: rgba(213, 64, 42, 0.07);
}

.shipping-overdue-card span,
.shipping-overdue-card small {
  display: block;
  color: var(--muted);
}

.shipping-address-lines {
  display: grid;
  gap: 2px;
}

.shipping-address-lines span {
  color: var(--ink);
}

.shipping-card-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.shipping-card-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.shipping-card-controls select,
.shipping-card-controls input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
  font: inherit;
}

.shipping-archive-button {
  height: 36px;
  padding: 0 12px;
}

.kera-note {
  align-self: center;
  color: var(--brand-ink);
  font-weight: 900;
}

.transport-waitlist {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.transport-waitlist-head,
.transport-waitlist-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 10px 12px;
}

.transport-waitlist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.transport-waitlist-head span,
.transport-waitlist-item span,
.transport-waitlist-item small {
  color: var(--muted);
}

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

.transport-waitlist-item {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.transport-candidate {
  display: grid;
  grid-template-columns: auto minmax(170px, 0.9fr) minmax(240px, 1.3fr) minmax(90px, 0.35fr) minmax(110px, 0.4fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 11px;
}

.transport-candidate input {
  width: 18px;
  height: 18px;
}

.transport-candidate small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.transport-table {
  overflow-x: auto;
  padding-bottom: 8px;
}

.transport-table input,
.transport-table select {
  height: 36px;
  min-width: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 8px;
}

.transport-table .transport-stop-input {
  min-width: 72px;
  width: 72px;
}

.panel-heading-actions,
.transport-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.danger-action {
  color: #b7351f;
  border-color: rgba(226, 112, 58, 0.45);
}

.transport-search {
  width: min(340px, 48vw);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.transport-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.transport-dialog .draft-submit-row {
  margin-top: 18px;
}

.transport-date-shell {
  position: relative;
  display: inline-flex;
}

.transport-date-trigger {
  height: 36px;
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 800;
  text-align: left;
}

.transport-date-popover {
  left: auto;
  right: 0;
}

@media (max-width: 1120px) {
  .dashboard-grid,
  .inventory-grid,
  .stats-grid,
  .shipping-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-period-bar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .statistics-period-title {
    position: static;
    max-width: none;
    transform: none;
    justify-items: start;
    text-align: left;
    pointer-events: auto;
  }

  .statistics-period-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .split-layout,
  .products-layout,
  .product-filter-panel,
  .messages-layout,
  .admin-layout,
  .billing-shop-grid,
  .billing-split-grid,
  .shipping-overdue-card,
  .shipping-card-controls,
  .transport-candidate,
  .transport-waitlist-item {
    grid-template-columns: 1fr;
  }

  .billing-entry-form,
  .billing-kpi-grid,
  .billing-analysis-metrics,
  .billing-breakdowns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-detail {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 14px;
    gap: 12px;
  }

  .sidebar.mobile-open {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1200;
  }

  body.messages-viewport-locked .sidebar.mobile-open {
    height: 100dvh;
    min-height: 0;
    overflow-y: auto;
  }

  .brand {
    justify-content: space-between;
  }

  .brand > div:nth-child(2) {
    flex: 1;
    min-width: 0;
  }

  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(246, 245, 242, 0.18);
    border-radius: 8px;
    background: rgba(246, 245, 242, 0.08);
    color: var(--sidebar-ink);
    display: grid;
    place-items: center;
    padding: 9px;
  }

  .mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    display: block;
  }

  .sidebar:not(.mobile-open) .nav-list,
  .sidebar:not(.mobile-open) .mobile-nav-controls,
  .sidebar:not(.mobile-open) .sidebar-footer {
    display: none;
  }

  .sidebar.mobile-open .mobile-nav-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-nav-controls .access-switch,
  .mobile-nav-controls .background-switch {
    width: 100%;
    min-width: 0;
    border-color: var(--glass-border, rgba(255, 255, 255, 0.14));
    background: linear-gradient(135deg, var(--glass-bg-strong, rgba(28, 33, 31, 0.74)), var(--glass-bg-soft, rgba(40, 47, 44, 0.4)));
    -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
    backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 150%));
    box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.12));
  }

  .mobile-nav-controls .access-switch select,
  .mobile-nav-controls .background-switch select {
    width: 100%;
    min-width: 0;
  }

  .nav-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .nav-list-bottom {
    margin-top: 0;
    grid-template-columns: 1fr;
  }

  .nav-item {
    justify-content: flex-start;
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .sidebar-footer {
    display: grid;
  }

  .nav-icon {
    display: grid;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .section-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .statistics-period-bar {
    min-height: 0;
    padding: 16px;
  }

  .statistics-period-label {
    white-space: normal;
  }

  .statistics-period-title {
    position: static;
    max-width: none;
    transform: none;
    justify-items: start;
    text-align: left;
  }

  .statistics-line-controls {
    grid-template-columns: 1fr;
  }

  .statistics-chart-toggles {
    justify-content: flex-start;
  }

  .search,
  .market-switch,
  .access-switch,
  .market-switch select,
  .access-switch select,
  select,
  .primary-action {
    width: 100%;
    min-width: 0;
  }

  .market-switch select,
  .access-switch select,
  .search input {
    min-height: 40px;
  }

  .dashboard-grid,
  .inventory-grid,
  .stats-grid,
  .stats-chart-grid,
  .statistics-period-bar,
  .statistics-period-fields,
  .stock-data,
  .detail-grid,
  .permission-grid,
  .vat-row,
  .customer-entry,
  .order-number-block,
  .repair-fields-head,
  .repair-filter-row,
  .customer-picker-filters,
  .table-filters,
  .drawing-row,
  .billing-entry-form,
  .billing-kpi-grid,
  .billing-mini-row,
  .billing-analysis-metrics,
  .billing-breakdowns,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .billing-analytics-details summary,
  .billing-analysis-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-summary-actions {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .billing-details-count,
  .billing-analysis-card header > span {
    width: fit-content;
    white-space: normal;
  }

  .repair-history-card {
    align-items: stretch;
    flex-direction: column;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .board {
    grid-template-columns: repeat(6, 220px);
    overflow-x: auto;
  }
}

/* ============================================================
   VORRAT / LAGER — Branddesign
   ============================================================ */
.inv-pin {
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

/* --- Hub: Firmen + Kacheln --- */
.inv-company {
  margin-bottom: 26px;
}
.inv-company-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.inv-company-title h3 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.inv-company-address {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.inv-tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.inv-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.inv-tile:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: 0 18px 40px rgba(216, 109, 63, 0.18);
}
.inv-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
}
.inv-tile-icon svg {
  width: 26px;
  height: 26px;
}
.inv-tile-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--ink);
}
.inv-tile-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.inv-tile-meta em {
  color: var(--red);
  font-style: normal;
  font-weight: 600;
}
.inv-tile-locked {
  cursor: not-allowed;
  opacity: 0.55;
  background: var(--surface-muted);
  box-shadow: none;
}
.inv-tile-lock {
  font-size: 0.85rem;
}
.inv-tile-meta-locked {
  color: var(--muted);
  font-style: italic;
}

/* --- Unterseite --- */
.inv-subpage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.inv-subpage-address {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.inv-subpage-count {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
#inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* --- Bestandskarte --- */
.inventory-card {
  position: relative;
  display: flex;
  flex-direction: column;
}
.inv-card-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-muted);
  margin-bottom: 14px;
}
.inv-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.inv-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  opacity: 0.7;
}
.inv-thumb-placeholder svg {
  width: 38px;
  height: 38px;
}
.inv-thumb-placeholder small {
  font-size: 0.7rem;
  color: var(--muted);
}
.inventory-card header {
  align-items: flex-start;
  margin-bottom: 12px;
}
.inventory-card h3 {
  margin: 0;
  font-size: 1rem;
}
.inv-card-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.inv-card-extra {
  margin: 10px 0 0;
}
.inv-card-special {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber) inset;
}
.inv-special-badge {
  white-space: nowrap;
}
.inv-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.inv-card-delete:hover {
  color: var(--red);
  border-color: var(--red);
}

/* --- Mengen-Steuerung +/- --- */
.inv-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: auto;
  padding-top: 12px;
}
.inv-qty-value {
  min-width: 36px;
  text-align: center;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}
.inv-qty-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--brand-strong);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.inv-qty-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.inv-qty-readonly {
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- Glas: passt-zu-Kamin --- */
.inv-fits {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
}
.inv-fits-label {
  font-size: 0.78rem;
  color: var(--muted);
}
.inv-fits-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 0.78rem;
}
.inv-fits-chip img,
.inv-fits-noimg {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.inv-fits-noimg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.inv-fits-noimg svg {
  width: 14px;
  height: 14px;
}
.inv-fits-empty {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* --- Leerzustand --- */
.inv-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface-subtle);
}
.inv-empty-icon {
  display: inline-flex;
  color: var(--brand);
  opacity: 0.6;
  margin-bottom: 12px;
}
.inv-empty-icon svg {
  width: 48px;
  height: 48px;
}
.inv-empty h3 {
  margin: 0 0 8px;
}
.inv-empty p {
  margin: 0 auto;
  max-width: 460px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- Modal / Dialoge --- */
.inventory-modal {
  max-width: 540px;
  width: calc(100vw - 40px);
}
.inv-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 6px 0 4px;
}
.inv-warning {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 0.85rem;
  font-weight: 600;
}
.inv-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.inv-field-row .field {
  flex: 1 1 140px;
}
.inv-confirm-copy {
  margin: 0;
  font-size: 0.95rem;
}
.inv-confirm-sure {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.inv-hint {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* --- Picker mit Suche --- */
.inv-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}
.inv-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.inv-pick-row:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.inv-pick-thumb img,
.inv-pick-noimg {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}
.inv-pick-noimg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.inv-pick-noimg svg {
  width: 20px;
  height: 20px;
}
.inv-pick-text {
  display: flex;
  flex-direction: column;
}
.inv-pick-text small {
  color: var(--muted);
  font-size: 0.78rem;
}
.inv-pick-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* --- Glas-Editor --- */
.glass-pane-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.glass-pane-row[hidden] {
  display: none;
}
.glass-pane-label {
  flex: 0 0 100%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-strong);
}
.glass-pane-row .field {
  flex: 1 1 120px;
}
.detail-field-glass strong {
  font-size: 0.9rem;
}

/* --- Admin: Rechte-Gruppen pro Firma --- */
.permission-inventory-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.permission-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface-subtle);
}
.permission-group-master {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.permission-group-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}
.permission-grid-tiles {
  margin-top: 8px;
  padding-left: 24px;
}

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

/* ============================================================
   VORRAT v2 — Liquid Glass, 5 Spalten, Glas-Farbtags, Filter
   (nutzt die --glass-* Variablen aus assets/liquid-glass.css)
   ============================================================ */

/* Liquid-Glass-Optik für Hub-Kacheln */
.inv-tile {
  background: linear-gradient(135deg, var(--glass-bg-strong, rgba(255,255,255,0.6)), var(--glass-bg-soft, rgba(255,255,255,0.35)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.7));
  border-radius: var(--radius-lg, 20px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18), inset 0 1px 0 var(--glass-edge, rgba(255,255,255,0.5));
}
.inv-tile:hover:not(:disabled) {
  border-color: var(--glow-brand, var(--brand));
  box-shadow: 0 16px 40px rgba(0,0,0,0.26), inset 0 1px 0 var(--glass-edge, rgba(255,255,255,0.6));
}
.inv-tile-icon {
  background: var(--glass-bg-soft, var(--brand-soft));
  border: 1px solid var(--glass-border, transparent);
}

/* Liquid-Glass-Optik für Bestandskarten */
.inventory-card {
  background: linear-gradient(135deg, var(--glass-bg, rgba(255,255,255,0.55)), var(--glass-bg-soft, rgba(255,255,255,0.35)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  border: 1px solid var(--glass-border, var(--line));
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.16), inset 0 1px 0 var(--glass-edge, rgba(255,255,255,0.4));
}

/* Glas-Box „Lagerbestände nach Standort" als Liquid-Glass-Pille */
#inventory-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--glass-bg-soft, var(--surface-muted));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  border: 1px solid var(--glass-border, var(--line));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255,255,255,0.4));
}

/* 5 Kacheln pro Zeile auf den Unterseiten */
#inventory-root .inventory-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

/* Kamin: quadratisches Produktbild sauber, Karte schmaler & etwas höher */
.inv-card-media-square {
  aspect-ratio: 1 / 1;
  height: auto;
}
.inv-card-media-square img {
  object-fit: cover;
}

/* Glas-Farbtag (gut sichtbar) */
.inv-card-glass .inv-card-media { height: 86px; }
.inv-glass-tag {
  align-self: flex-start;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.inv-glass-tag-graphite {
  background: linear-gradient(135deg, #4a4f55, #23272c);
  color: #eef1f4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.inv-glass-tag-white {
  background: linear-gradient(135deg, #ffffff, #e7ecf2);
  color: #2a2f36;
  border: 1px solid rgba(0,0,0,0.12);
}
.inv-glass-tag-unknown { background: var(--amber-soft); color: var(--amber); }

/* Brenner-Filterleiste */
.inv-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.inv-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--glass-bg-soft, var(--surface));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
}
.inv-filter-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--button-ink, #fff);
}
.inv-filter-count {
  font-size: 0.72rem;
  opacity: 0.75;
}

/* Material: Tag-Gruppen mit leichter Grenze */
.inv-tag-group { margin-bottom: 18px; }
.inv-tag-group + .inv-tag-group {
  border-top: 1px solid var(--glass-border, var(--line));
  padding-top: 16px;
}
.inv-tag-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.inv-tag-name {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-strong);
}
.inv-tag-count {
  font-size: 0.74rem;
  color: var(--muted);
  background: var(--glass-bg-soft, var(--surface-muted));
  border-radius: 999px;
  padding: 1px 9px;
}

.inv-material-dropdown {
  margin: 0 0 12px;
  padding: 0;
  overflow: clip;
}

.inv-material-dropdown + .inv-material-dropdown {
  border-top: 1px solid var(--glass-border, var(--line));
  padding-top: 0;
}

.inv-material-dropdown > summary {
  min-height: 58px;
  margin: 0;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.inv-material-dropdown > summary::-webkit-details-marker {
  display: none;
}

.inv-material-dropdown-body {
  padding: 0 16px 16px;
}

#inventory-root .inv-material-dropdown .inventory-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inv-card-paint .inv-card-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  width: 100%;
}

.inv-paint-stock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
}

.inv-paint-stock > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-muted));
}

.inv-paint-stock span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.inv-paint-stock strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.inv-paint-stock .paint-critical strong {
  color: var(--red);
}

.inv-paint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  grid-column: 1 / -1;
}

.inv-paint-actions .primary-action,
.inv-paint-actions .ghost-action {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.78rem;
}

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

.paint-ledger-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 8px;
  background: var(--glass-bg-soft, var(--surface-muted));
}

.paint-ledger-list article > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.paint-ledger-list span {
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  #inventory-root .inv-material-dropdown .inventory-grid {
    grid-template-columns: 1fr;
  }

  .inv-paint-stock {
    grid-template-columns: 1fr;
  }

  .paint-ledger-list article {
    grid-template-columns: 1fr auto;
  }

  .paint-ledger-list article .ghost-action {
    grid-column: 1 / -1;
  }
}

/* Glas-Picker: breites Popup, zwei Spalten, Farb-Segment */
.inventory-modal-wide {
  max-width: 820px;
  width: calc(100vw - 40px);
}
.inv-glass-color-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}
.inv-glass-color-label { font-size: 0.82rem; color: var(--muted); }
.inv-seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--glass-bg-soft, var(--surface-muted));
  border: 1px solid var(--glass-border, var(--line));
  align-self: flex-start;
}
.inv-seg-btn {
  padding: 7px 16px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.inv-seg-btn.active {
  background: var(--brand);
  color: var(--button-ink, #fff);
}
.inv-glass-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.inv-glass-col { display: flex; flex-direction: column; gap: 8px; }
.inv-pick-row-size {
  justify-content: flex-start;
  gap: 12px;
  align-items: baseline;
}
.inv-pick-size {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.inv-pick-row-size small { color: var(--muted); }

@media (max-width: 1200px) {
  #inventory-root .inventory-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  #inventory-root .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-glass-cols { grid-template-columns: 1fr; }
}

/* ============================================================
   VORRAT v3 — Kachelbilder + Accessoires + 5er-Hub
   ============================================================ */
/* Hub jetzt 5 Kacheln pro Zeile (5 Bereiche je Firma) */
.inv-tile-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* Bild-/Icon-Bereich oben auf der Kachel */
.inv-tile-media {
  position: relative;
  width: 100%;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  background: var(--glass-bg-soft, var(--surface-muted));
  border: 1px solid var(--glass-border, transparent);
}
.inv-tile-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}
/* Icon ist Fallback: ausblenden sobald ein Bild geladen ist */
.inv-tile-media.has-image .inv-tile-icon { display: none; }
.inv-tile-media .inv-tile-icon {
  width: auto;
  height: auto;
  background: transparent;
  border: none;
  color: var(--brand);
}
.inv-tile-media .inv-tile-icon svg { width: 34px; height: 34px; }

@media (max-width: 1200px) {
  .inv-tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .order-dialog {
    width: calc(100vw - 14px);
    max-height: calc(100dvh - 14px);
    padding: 12px;
  }

  .product-source-options {
    grid-template-columns: 1fr;
  }

  .product-source-option {
    min-height: 58px;
  }

  .third-party-product-picker {
    grid-template-columns: 1fr;
  }

  .repair-glass-fields,
  .repair-glass-pane-list {
    grid-template-columns: 1fr;
  }

  .repair-custom-part-row {
    grid-template-columns: 1fr;
  }

  .product-source-summary {
    text-align: right;
  }

  .draft-submit-row .primary-action {
    flex: 1 1 180px;
  }

  .order-stamp {
    margin-left: auto;
  }
  .inv-tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   VORRAT v4 — Hub fix 5/Reihe, gesperrte Nav, Warnschwelle
   ============================================================ */
/* Hub: immer genau 5 Kacheln in einer Reihe (überschreibt alle Media-Breakpoints) */
.inv-tile-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 10px;
}

/* Gesperrte Hub-Kachel: leicht geblurrt + ausgegraut + Schloss */
.inv-tile-locked {
  opacity: 0.6;
}
.inv-tile-locked .inv-tile-media {
  filter: blur(2px) grayscale(0.5);
}

/* Gesperrte Navigation: ausgeblurrt + Schloss, nicht klickbar */
.nav-item.nav-locked {
  filter: blur(0.8px) grayscale(0.5);
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}
.nav-item .nav-lock {
  margin-left: auto;
  font-size: 0.78rem;
  filter: none;
  opacity: 1;
}

/* Warnschwelle-Chip auf der Bestandskarte */
.inv-card-foot {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.inv-threshold {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--glass-bg-soft, var(--surface-muted));
  color: var(--muted);
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease;
}
.inv-threshold:hover {
  border-color: var(--brand);
  color: var(--ink);
}
.inv-threshold-readonly { cursor: default; }

/* ============================================================
   VORRAT v5 — Lösch-Button (Mülltonne) + Liquid-Glass-Kopfbox
   ============================================================ */
/* Mülltonne in der Ecke jeder Bestandskarte */
.inv-card-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
}
.inv-card-delete svg { display: block; }
.inv-card-delete:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }

/* Kopfbox „Lagerbestände nach Standort … / Vorrat" als Liquid-Glass-Panel */
#inventory-view .section-bar {
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 18px;
  border-radius: var(--radius-lg, 20px);
  background: linear-gradient(135deg, var(--glass-bg-strong, rgba(255,255,255,0.6)), var(--glass-bg-soft, rgba(255,255,255,0.35)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  border: 1px solid var(--glass-border, var(--line));
  box-shadow: 0 12px 34px rgba(0,0,0,0.20), inset 0 1px 0 var(--glass-edge, rgba(255,255,255,0.5));
}
/* Eyebrow innerhalb der Glasbox als dezentes Label (Pille zurücksetzen) */
#inventory-view #inventory-eyebrow {
  display: block;
  padding: 0;
  margin: 0 0 4px;
  background: none;
  border: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-strong);
}
#inventory-view #inventory-heading {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
}

/* ============================================================
   VORRAT v6b — Hub-Kachelbild quadratisch & groß (Originalformat)
   ============================================================ */
.inv-tile-media {
  height: auto;
  aspect-ratio: 1 / 1;   /* quadratische Bildkachel -> nutzt Seitenhöhe besser */
}
.inv-tile-img {
  object-fit: contain;   /* Bild im Originalseitenverhältnis, nicht beschnitten */
  padding: 8px;
}
/* Icon-Fallback in der größeren Kachel etwas größer */
.inv-tile-media .inv-tile-icon svg { width: 48px; height: 48px; }

/* ============================================================
   VORRAT v8b — weißer Bildhintergrund (Glas/SmartFire) + Brenner-Filter mit Bild
   ============================================================ */
/* Glas & SmartFire haben transparente Produktbilder -> weiße Bildfläche wie die übrigen */
.inv-tile-media[data-tile-type="glass"],
.inv-tile-media[data-tile-type="smartfire"] {
  background: #ffffff;
}

/* Brenner-Typ-Filter als Bildkarten statt schlichter Chips */
.inv-bfilter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.inv-bfilter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 16px;
  border: 1px solid var(--glass-border, var(--line));
  background: linear-gradient(135deg, var(--glass-bg, rgba(255,255,255,0.5)), var(--glass-bg-soft, rgba(255,255,255,0.3)));
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.inv-bfilter:hover { transform: translateY(-2px); border-color: var(--glow-brand, var(--brand)); }
.inv-bfilter.active {
  border-color: var(--brand);
  box-shadow: 0 8px 22px var(--glow-brand, rgba(216,109,63,0.24)), inset 0 0 0 1px var(--brand);
}
.inv-bfilter-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;     /* Brennerbilder auf Weiß */
  flex: 0 0 auto;
  color: var(--brand);
}
.inv-bfilter-media img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.inv-bfilter-media svg { width: 26px; height: 26px; display: none; }           /* Icon nur als Fallback */
.inv-bfilter-media-all,
.inv-bfilter-media-fallback { background: var(--glass-bg-soft, var(--surface-muted)); }
.inv-bfilter-media-all svg,
.inv-bfilter-media-fallback svg { display: block; }
.inv-bfilter-text { display: flex; flex-direction: column; line-height: 1.2; }
.inv-bfilter-text strong { font-size: 0.98rem; }
.inv-bfilter-count { font-size: 0.76rem; color: var(--muted); }
.inv-bfilter.active .inv-bfilter-count { color: var(--brand-strong); }

/* Brenner-Produktfotos je Größe: vollständig zeigen (nicht beschneiden), auf Weiß */
.inv-card-media-product {
  background: #ffffff;
  height: 130px;
}
.inv-card-media-product img {
  object-fit: contain;
  padding: 6px;
}

/* Bild + Platzhalter-Geschwister: Platzhalter ausblenden, solange das Bild geladen ist */
.inv-card-media img ~ .inv-thumb-placeholder { display: none; }

/* ============================================================
   VORRAT v13 — Kamin-Popup, klickbarer Chip, Material-Tag-Pills
   ============================================================ */
/* Fits-Chip als klickbarer Button (Reset + Hover) */
.inv-fits-chip {
  border: none;
  cursor: pointer;
  font: inherit;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}
.inv-fits-chip:hover {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

/* Produktkarte-Popup (großer Kamin) */
.inv-productcard {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.inv-productcard-media {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--glass-border, var(--line));
}
.inv-productcard-media img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.inv-productcard-media .inv-pick-noimg { width: 64px; height: 64px; }
.inv-productcard-info { display: flex; flex-direction: column; gap: 8px; }
.inv-productcard-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border, var(--line));
}
.inv-productcard-row span { color: var(--muted); font-size: 0.85rem; }
.inv-productcard-row strong { text-align: right; }
@media (max-width: 640px) {
  .inv-productcard { grid-template-columns: 1fr; }
}

/* Material-Tag-Pills in der Datenbanktabelle */
.inv-tag-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.inv-tag-pill-roh { background: var(--brand-soft); color: var(--brand-strong); }
.inv-tag-pill-versand { background: var(--blue-soft, #deebf7); color: var(--blue, #346da8); }
.inv-mat-del { padding: 4px 8px; }
.inv-mat-del svg { display: block; }

/* ============================================================
   VORRAT v14 — Dashboard-Box, Brenner-Zoom, Glas-Filter, Admin-Erweiterung
   ============================================================ */
/* Vorratswarnung-Box im Dashboard-Banner (zwei Zahlen WF | EPMC) */
.wf-stockwarn-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}
.wf-stockwarn-split > div { display: flex; flex-direction: column; gap: 2px; }
.wf-stockwarn-split strong { font-size: 1.7rem; line-height: 1; }
.wf-stockwarn-split small { font-size: 0.72rem; color: var(--muted, #66706f); opacity: 0.9; }
.wf-hero-stockwarn { min-width: clamp(160px, 15vw, 210px); }

/* Brenner-Produktfotos etwas mehr reinzoomen */
.inv-card-media-product { overflow: hidden; }
.inv-card-media-product img { padding: 0; transform: scale(1.35); }

/* Glas-Filterleiste: Suche + Farbchips */
.inv-glass-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.inv-glass-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
  min-width: 220px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--glass-bg-soft, var(--surface));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--muted);
}
.inv-glass-search input { flex: 1 1 auto; border: none; background: transparent; color: var(--ink); font: inherit; outline: none; }
.inv-glass-colorchips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Glas-Karte ohne Bild: etwas kompakter, Farbtag oben */
.inv-card-noimg { padding-top: 14px; }
.inv-card-noimg .inv-glass-tag { margin-top: 0; }

/* Admin: Rolle, Toggles, Chat-Bereiche-Dropdown */
.admin-user-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--glass-bg-soft, var(--surface-subtle));
  border: 1px solid var(--glass-border, var(--line));
}
.admin-role-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.admin-role-field input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--surface, #fff);
  color: var(--ink);
  font: inherit;
}
.admin-user-toggles { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.admin-activity-dropdown {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 10px;
  background: var(--surface, #fff);
}
.admin-activity-dropdown summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.admin-activity-dropdown summary::-webkit-details-marker { display: none; }
.admin-activity-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 14px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--glass-border, var(--line));
}
.admin-activity-list label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; }

/* ============================================================
   VORRAT v15 — Dashboard-Spacing, Warnung-Toggle, Material-DB, weiße Tiles
   ============================================================ */
/* Vorratswarnung-Box: zwei Zeilen (WF/EPMC), Zahl + Label mit Abstand */
.wf-stockwarn-split {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wf-stockwarn-split > div {
  display: flex;
  align-items: baseline;
  gap: 12px;              /* mehr Abstand zwischen Zahl und Firmenname */
}
.wf-stockwarn-split strong { font-size: 1.8rem; line-height: 1; }
.wf-stockwarn-split small { font-size: 0.8rem; color: var(--muted, #66706f); }

/* Weißer Bildhintergrund für alle Produktfoto-Tiles (transparente PNGs) */
.inv-tile-media[data-tile-type="glass"],
.inv-tile-media[data-tile-type="smartfire"],
.inv-tile-media[data-tile-type="material"],
.inv-tile-media[data-tile-type="versand"],
.inv-tile-media[data-tile-type="bioethanol"],
.inv-tile-media[data-tile-type="bauteile"] {
  background: #ffffff;
}

/* Warnung an/aus Toggle (grün = Warnung an, rot = keine Warnung) */
.inv-warntoggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.14s ease;
}
.inv-warntoggle::before { content: "●"; font-size: 0.7em; }
.inv-warntoggle.on { background: var(--green-soft, #e1f0ea); color: var(--green, #23745f); border-color: var(--green, #23745f); }
.inv-warntoggle.off { background: var(--red-soft, #f7e2df); color: var(--red, #b84444); border-color: var(--red, #b84444); }
.inv-warntoggle:hover { filter: brightness(1.05); }
.inv-warntoggle-readonly { cursor: default; }
.inv-threshold-disabled { opacity: 0.45; }
.inv-card-foot { flex-wrap: wrap; gap: 8px; }

/* Badge „Warnung aus" */
.badge.inv-badge-muted { background: var(--surface-muted, #f0f4f3); color: var(--muted, #66706f); }

/* Materialdatenbank: Firmen-Sektionen + Art-Pill */
.material-company { margin-bottom: 22px; }
.material-company-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--brand-strong);
}
.inv-art-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--glass-bg-soft, var(--surface-muted));
  border: 1px solid var(--glass-border, var(--line));
}
.inv-mat-empty { color: var(--muted); font-style: italic; text-align: center; padding: 14px; }

/* ============================================================
   VORRAT v16 — Kartenlayout, Warntoggle grün/rot, Multi-Kamin, Palette, Material-Bild
   ============================================================ */
/* Kompakte Steuerzeile (Menge + Warnschwelle + Toggle in einer Reihe, wrappt bei Bedarf) */
.inv-card-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;               /* deutlich mehr Abstand zwischen den Elementen */
  margin-top: auto;
  padding-top: 12px;
}
.inv-card-controls .inv-qty { margin: 0; padding: 0; }

/* Warnung-Toggle klar grün (an) / rot (aus) */
.inv-warntoggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  color: #fff;
}
.inv-warntoggle::before { content: "●"; font-size: 0.7em; opacity: 0.9; }
.inv-warntoggle.on { background: #2f8f6f; }     /* grün */
.inv-warntoggle.off { background: #c0453f; }    /* rot */
.inv-warntoggle:hover { filter: brightness(1.08); }
.inv-warntoggle-readonly { cursor: default; }
.inv-threshold-disabled { opacity: 0.45; }

/* Glas: „Passt zu" – größere, zweizeilige Chips, mehrere Kamine sauber gestapelt */
.inv-fits-list { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.inv-fits-list .inv-fits-label { font-size: 0.78rem; color: var(--muted); }
.inv-fits-chips { display: flex; flex-direction: column; gap: 6px; }
.inv-fits-chips .inv-fits-chip {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  min-height: 44px;
  text-align: left;
}
.inv-fits-chips .inv-fits-chip img,
.inv-fits-chips .inv-fits-noimg { width: 32px; height: 32px; flex: 0 0 auto; }
.inv-fits-name { white-space: normal; line-height: 1.2; font-weight: 600; }

/* Farbtag (unter „Passt zu") mit etwas Abstand */
.inv-card-glass .inv-glass-tag { align-self: flex-start; margin: 8px 0 2px; }

/* Bioethanol: Neue Palette + Zahnrad */
.inv-pallet-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.inv-pallet-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.inv-pallet-btn:hover { background: var(--brand); color: #fff; }
.inv-gear-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--glass-bg-soft, var(--surface));
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.inv-gear-btn:hover { border-color: var(--brand); }

/* Materialdatenbank: Bild-Thumbnail + Großansicht */
.inv-mat-thumb {
  width: 52px; height: 52px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border, var(--line));
  background: #fff;
  cursor: pointer;
}
.inv-mat-thumb img { width: 100%; height: 100%; object-fit: contain; }
.inv-mat-thumb-empty {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; background: var(--surface-muted, #f0f4f3);
  color: var(--muted); font-size: 0.68rem; text-align: center;
}
.inv-mat-thumb-none { color: var(--muted); }
.inv-mat-imgview {
  display: flex; align-items: center; justify-content: center;
  min-height: 240px; background: #fff; border-radius: 12px;
  border: 1px solid var(--glass-border, var(--line)); overflow: hidden; margin-bottom: 10px;
}
.inv-mat-imgview img { max-width: 100%; max-height: 360px; object-fit: contain; }
.inv-mat-imgview-empty { color: var(--muted); font-style: italic; }
.inv-pane-option { justify-content: flex-start; }

/* ============================================================
   VORRAT v17 — Überfällig-Highlight, Vorratswarnung-Link
   ============================================================ */
/* Überfällig-Box anders (kräftiger rot) hervorheben als die übrigen Metriken */
.wf-hero-metrics .metric-card.warning {
  background: linear-gradient(135deg, rgba(192,69,63,0.30), rgba(192,69,63,0.12));
  border: 1px solid rgba(192,69,63,0.85);
  box-shadow: 0 10px 26px rgba(192,69,63,0.28), inset 0 1px 0 rgba(255,255,255,0.12);
}
.wf-hero-metrics .metric-card.warning strong { color: #ff6a5a; }
.wf-hero-metrics .metric-card.warning span { color: #ffb4ab; }

.wf-hero-messages.chat-ok {
  border-color: rgba(63, 214, 126, 0.55);
  background: linear-gradient(135deg, rgba(35, 116, 95, 0.28), rgba(35, 116, 95, 0.1));
}

.wf-hero-messages.chat-warn {
  border-color: rgba(255, 194, 87, 0.82);
  background: linear-gradient(135deg, rgba(118, 84, 20, 0.34), rgba(118, 84, 20, 0.12));
}

.wf-hero-messages.chat-danger {
  border-color: rgba(255, 82, 82, 0.9);
  background: linear-gradient(135deg, rgba(192, 69, 63, 0.32), rgba(192, 69, 63, 0.12));
}

.wf-hero-messages.chat-ok strong { color: #54d98a; }
.wf-hero-messages.chat-warn strong { color: #ffc257; }
.wf-hero-messages.chat-danger strong { color: #ff6a5a; }

.wf-hero-messages {
  gap: 4px !important;
}

.wf-hero-messages > span {
  font-size: 0.68rem;
  line-height: 1.1;
}

.wf-hero-messages[role="button"] {
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.wf-hero-messages[role="button"]:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 66%, var(--line));
  box-shadow: var(--shadow-glass-lift, var(--shadow));
}

.wf-hero-messages[role="button"]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.wf-hero-events {
  align-content: start;
  gap: 6px !important;
}

.wf-hero-events > span {
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
}

.wf-hero-event-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 5px;
}

.wf-hero-event-line {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  padding: 4px 6px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 7px;
  background: var(--glass-bg-soft, var(--surface));
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.wf-hero-event-line:last-child {
  place-items: center;
  align-content: center;
  text-align: center;
}

.wf-hero-event-line:last-child strong {
  font-size: 1.4rem !important;
  line-height: 1;
}

.wf-hero-event-line:last-child em {
  display: none;
}

.wf-hero-event-line:hover,
.wf-hero-event-line:focus-visible {
  border-color: var(--brand);
  outline: 0;
}

.wf-hero-event-line small,
.wf-hero-event-line em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.6rem;
  font-style: normal;
}

.wf-hero-event-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem !important;
  line-height: 1.25;
}

.dashboard-mini-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
  margin: 14px 0 18px;
}

.dashboard-stockwarn-small {
  min-height: 86px;
  padding: 12px 14px;
  align-content: center;
  gap: 8px;
}

.dashboard-stockwarn-small span {
  font-size: 0.82rem;
  font-weight: 900;
}

.dashboard-stockwarn-small .wf-stockwarn-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dashboard-stockwarn-small .wf-stockwarn-split strong {
  font-size: 1.25rem;
}

.dashboard-stockwarn-small::after {
  display: none;
}

.dashboard-stockwarn-status {
  align-content: space-between;
}

.dashboard-stockwarn-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dashboard-stockwarn-values strong {
  display: grid;
  gap: 1px;
}

.dashboard-stockwarn-values small {
  color: inherit;
  font-size: 0.58rem;
  font-weight: 900;
}

.dashboard-stockwarn-status.has-warning {
  border-color: var(--glass-border, var(--line));
  background: var(--glass-bg, var(--surface));
  box-shadow: var(--shadow-glass, var(--shadow));
}

.dashboard-stockwarn-status.has-warning strong {
  color: #ff8b7f;
}

.dashboard-stockwarn-status.has-warning > span,
.dashboard-stockwarn-status.has-warning strong small {
  color: var(--muted);
}

.dashboard-stockwarn-status.is-clear {
  border-color: rgba(63, 214, 126, 0.55);
  background: linear-gradient(135deg, rgba(35, 116, 95, 0.24), rgba(35, 116, 95, 0.08));
}

/* Vorratswarnung-Box ist klickbar (Link zum Vorrat) */
.wf-hero-stockwarn { transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease; }
.wf-hero-stockwarn:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 12px 28px var(--glow-brand, rgba(216,109,63,0.24));
}
.wf-hero-stockwarn::after {
  content: "Zum Vorrat →";
  display: block;
  margin-top: 6px;
  font-size: 0.68rem;
  color: var(--brand-strong, #b95528);
  opacity: 0.85;
}

/* ============================================================
   VORRAT v18 — kompakte Warn-Spalte, lesbarer Toggle, Nachbestell-Link, Material-Überschrift
   ============================================================ */
/* Menge links, Warnschwelle + Toggle rechts gestapelt (spart Höhe) */
.inv-card-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  margin-top: auto;
  padding-top: 12px;
}
.inv-card-warncol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.inv-card-warncol .inv-threshold,
.inv-card-warncol .inv-warntoggle { justify-content: center; text-align: center; }

/* Warnung-Toggle: kräftig grün/rot, WEISSE gut lesbare Schrift */
.inv-warntoggle { color: #ffffff !important; font-weight: 700; }
.inv-warntoggle.on { background: #1f7a5c; }   /* dunkleres Grün → weiß lesbar */
.inv-warntoggle.off { background: #b23b34; }  /* kräftiges Rot */
.inv-warntoggle::before { color: #ffffff; }

/* Nachbestell-Link je Eintrag */
.inv-reorder-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--brand);
  color: var(--button-ink, #fff);
  border: 1px solid var(--brand);
  cursor: pointer;
}
.inv-reorder-link:hover { filter: brightness(1.06); }
.inv-reorder-empty {
  background: transparent;
  color: var(--brand-strong);
  border: 1px dashed var(--brand);
}

/* Materialdatenbank: Firmen-Überschrift nicht in der Ecke kleben */
.material-company { padding: 0 4px; }
.material-company-title { padding-left: 4px; margin-top: 4px; }
#material-table { padding: 4px 2px; }

/* Glas „Passt zu"-Chip einheitlich (immer gleiche Struktur, Name links, umbricht sauber) */
.inv-fits-chips .inv-fits-chip { justify-content: flex-start; align-items: center; }
.inv-fits-name { text-align: left; }

/* ============================================================
   VORRAT v19 — Vorratswarnung-Box wieder kompakt (nicht mehr riesig)
   ============================================================ */
/* WF & EPMC nebeneinander (2 Spalten), kleinere Zahlen -> Box so hoch wie die anderen */
.wf-stockwarn-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 14px;
  align-items: baseline;
}
.wf-stockwarn-split > div { display: flex; flex-direction: column; gap: 0; }
.wf-stockwarn-split strong { font-size: 1.5rem; line-height: 1.05; }
.wf-stockwarn-split small { font-size: 0.72rem; color: var(--muted, #66706f); }
/* „Zum Vorrat"-Link kompakt, ohne die Box aufzublähen */
.wf-hero-stockwarn::after {
  margin-top: 4px;
  font-size: 0.66rem;
}

.metric-card.dashboard-stockwarn-small.wf-hero-stockwarn::after {
  display: none;
}

/* ============================================================
   PRODUKTION v1 — Status-Board Drag&Drop, Zeichnungsvorschau, Design/Fertigung/Glas
   ============================================================ */
.order-card {
  cursor: pointer;
}
.order-card.dragging {
  opacity: 0.4;
}
.board-column.drop-target {
  outline: 2px dashed var(--brand, #e8753f);
  outline-offset: -2px;
}
.order-status-field {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
}
.order-status-field select {
  width: 100%;
  margin-top: 2px;
}
.drawing-file-preview {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.drawing-file-pdf {
  width: 100%;
  height: 360px;
}
.design-claim-timer {
  font-weight: 700;
}
.design-claim-timer.timer-warning {
  color: #c0453f;
}
.production-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.production-info-card {
  background: rgba(216, 109, 63, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
body[data-theme="dark"] .production-info-card {
  background: rgba(232, 117, 63, 0.11);
  border-color: rgba(232, 117, 63, 0.22);
}
.production-info-card h3 {
  margin: 0 0 6px;
}
.production-info-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
}
.production-info-row:last-child {
  border-bottom: none;
}
.design-archive-row,
.design-review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

/* ============================================================
   ADMIN v2 — schlanke Rechte-Dropdowns, Firmen-Gliederung, Nutzer-Aktionen
   ============================================================ */
.permission-group-dropdown {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
}
.permission-group-dropdown summary {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 10px;
  gap: 10px;
}
.permission-group-dropdown summary:hover {
  background: rgba(255, 255, 255, 0.05);
}
.permission-group-dropdown[open] {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}
.permission-group-dropdown .section-arrow {
  margin-right: 2px;
}
.permission-group-dropdown .section-content {
  border-top: none;
  padding: 4px 12px 12px;
}
.permission-group-dropdown .permission-group-count {
  margin-left: auto;
  font-weight: 500;
}
.permission-hint {
  margin: 0 0 8px;
  font-size: 0.76rem;
  color: var(--muted);
}
.admin-company-heading {
  margin: 22px 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-company-heading:first-child {
  margin-top: 0;
}
.admin-user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
/* Firmen-Ebene als zuklappbares Dropdown (Wild Flame / EPMC / Extern) */
.admin-company-section {
  border: none;
  background: transparent;
}
.admin-company-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-company-section > summary::-webkit-details-marker {
  display: none;
}
.admin-company-section > summary .section-arrow {
  margin-right: 2px;
}
.admin-company-section[open] > summary .section-arrow {
  transform: rotate(90deg);
}
.admin-company-section > summary .permission-group-count {
  margin-left: auto;
  font-size: 0.74rem;
  text-transform: none;
  letter-spacing: 0;
}
.admin-company-members {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}
/* Rechte-&-Zugriff-Block pro Mitarbeiter etwas absetzen */
.admin-rights-dropdown {
  margin-top: 10px;
}
.admin-rights-dropdown > .section-content > .admin-user-toggles {
  margin-bottom: 10px;
}
.admin-rights-dropdown > .section-content > .admin-role-field {
  margin-bottom: 12px;
  max-width: 320px;
}
/* Glas-View: Hinweis wenn Glasmaße in der Produktdatenbank fehlen */
.glas-spec-missing {
  color: #c0453f;
}

.glass-workflow-dropdown {
  grid-column: 1 / -1;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 14px;
  background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), var(--glass-bg-soft, var(--surface-subtle)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  box-shadow: var(--shadow-glass, var(--shadow));
  overflow: hidden;
}
.glass-workflow-dropdown > summary {
  min-height: 74px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  cursor: pointer;
}
.glass-workflow-dropdown > summary::-webkit-details-marker {
  display: none;
}
.glass-workflow-dropdown > summary strong {
  display: block;
  font-size: 1.04rem;
}
.glass-workflow-dropdown > summary small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.glass-workflow-dropdown[open] > summary {
  border-bottom: 1px solid var(--glass-border, var(--line));
}
.glass-dropdown-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}
.glass-work-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 12px;
  padding: 14px;
  background: var(--glass-bg-soft, var(--surface));
  box-shadow: inset 0 1px 0 var(--glass-edge, rgba(255,255,255,0.14));
}
.glass-work-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.glass-work-card h3 {
  margin: 2px 0 0;
}
.glass-work-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.glass-work-meta div {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 10px;
  padding: 10px;
  background: var(--glass-bg-soft, var(--surface-subtle));
}
.glass-work-meta span,
.glass-order-table small,
.glass-status-card small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}
.glass-pane-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.glass-pane-list.compact {
  margin-top: 6px;
}
.glass-pane-pill {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--glass-bg-soft, var(--surface-muted));
  font-size: 0.82rem;
  font-weight: 800;
}
.glass-pane-pill.warning {
  color: var(--red);
}
.glass-order-main-action {
  width: 100%;
  min-height: 54px;
}
.glass-view-switch {
  display: flex;
  gap: 8px;
  padding: 12px 14px 0;
}
.glass-view-switch .active {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--button-ink, #fff);
}
.glass-order-table table {
  min-width: 980px;
}
.glass-order-table td {
  vertical-align: top;
}
.glass-deadline-input,
.glass-order-status-select {
  width: 100%;
}
.glass-status-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.glass-status-column {
  min-height: 260px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 12px;
  background: var(--glass-bg-soft, var(--surface));
  padding: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-status-column.drag-over {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--glow-brand, rgba(216,109,63,0.2));
}
.glass-status-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.glass-status-column header span {
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 900;
}
.glass-status-items {
  display: grid;
  gap: 8px;
}
.glass-status-card {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 10px;
  background: var(--glass-bg-strong, var(--surface));
  padding: 10px;
  cursor: grab;
}
.glass-status-card:active {
  cursor: grabbing;
}
.manual-glass-zone {
  display: grid;
  gap: 10px;
}
.manual-glass-zone.hidden {
  display: none;
}
.manual-glass-pane-row {
  grid-template-columns: auto minmax(120px, 1fr) minmax(120px, 1fr);
  align-items: end;
}
.glass-manual-preview {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 12px;
  padding: 12px;
  background: var(--glass-bg-soft, var(--surface-subtle));
}
.inv-pick-row.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand), 0 8px 20px var(--glow-brand, rgba(216,109,63,0.18));
}
@media (max-width: 980px) {
  .glass-status-board,
  .glass-work-meta {
    grid-template-columns: 1fr;
  }
  .glass-work-card header {
    flex-direction: column;
  }
  .manual-glass-pane-row {
    grid-template-columns: 1fr;
  }
}

/* Mitarbeiter-Karten im Liquid-Glass-Look (gleiche Optik wie die Vorrat-Karten) */
.admin-user {
  background: linear-gradient(135deg, var(--glass-bg, rgba(255, 255, 255, 0.55)), var(--glass-bg-soft, rgba(255, 255, 255, 0.35)));
  -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  backdrop-filter: blur(var(--glass-blur, 22px)) saturate(var(--glass-saturate, 165%));
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), inset 0 1px 0 var(--glass-edge, rgba(255, 255, 255, 0.4));
}

/* ============================================================
   MOBILE AUDIT 2026-07-06 — shared phone layout hardening
   ============================================================ */
@media (max-width: 780px) {
  body,
  .workspace {
    overflow-x: hidden;
  }

  .wf-hero {
    overflow: hidden;
  }

  .wf-hero-metrics {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .wf-hero-metrics .metric-card,
  .wf-hero-market {
    width: 100%;
    min-width: 0;
  }

  .status-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
    gap: 8px;
  }

  .status-step {
    min-width: 0;
  }

  .status-step span {
    overflow-wrap: anywhere;
  }

  .statistics-line-chart,
  .billing-line-chart {
    min-width: 560px;
  }

  .statistics-chart-toggles label,
  .billing-chart-toggles label {
    min-height: 44px;
  }

  .statistics-chart-toggles input,
  .billing-chart-toggles input {
    width: 18px;
    height: 18px;
  }

  .delete-order-button {
    width: 34px;
    height: 34px;
    top: 8px;
    right: 8px;
  }

  .delete-order-button::before {
    font-size: 22px;
  }

  .order-card h3 {
    padding-right: 40px;
  }

  input[type="file"] {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .field-edit-button {
    width: 34px;
    height: 34px;
    right: 8px;
  }

  .detail-field {
    padding-right: 50px;
  }

  .internal-documents-bar,
  .credit-documents-bar,
  .invoice-documents-bar {
    gap: 12px;
  }

  .internal-documents-bar > div:first-child,
  .credit-documents-bar > div:first-child,
  .invoice-documents-bar > div:first-child {
    flex: 1 1 auto;
    width: 100%;
  }

  .internal-kpi-strip,
  .credit-kpi-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .internal-kpi-metrics,
  .credit-kpi-metrics,
  .invoice-kpi-metrics {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .internal-kpi-item,
  .credit-kpi-item {
    border-left: 0;
    border-top: 1px solid var(--glass-border, var(--line));
    padding: 8px 0 0;
  }

  .internal-kpi-item:first-child,
  .credit-kpi-item:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .internal-kpi-label,
  .credit-kpi-item span,
  .credit-kpi-item small {
    white-space: normal;
  }

  .internal-kpi-value-row {
    justify-content: space-between;
  }

  #internal-documents-root .data-table,
  #credit-documents-root .data-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #internal-documents-root .document-table {
    min-width: 780px;
  }

  #credit-documents-root .document-table {
    min-width: 880px;
  }

  #internal-documents-root .internal-payment-actions .ghost-action,
  #internal-documents-root .internal-payment-actions .primary-action,
  #credit-documents-root .internal-payment-actions .ghost-action,
  #credit-documents-root .internal-payment-actions .primary-action {
    min-width: 92px;
    min-height: 40px;
    height: auto;
    white-space: normal;
  }

  #internal-documents-root select,
  #internal-documents-root input,
  #internal-documents-root .internal-payment-status,
  #credit-documents-root select,
  #credit-documents-root input {
    min-height: 38px;
  }

  #internal-documents-root .internal-cost-input-row {
    min-height: 42px;
    padding-block: 4px;
  }

  #internal-documents-root .internal-cost-input-row input {
    min-height: 34px;
    font-size: 0.92rem;
  }

  #internal-documents-root .internal-invoice-upload-label input {
    height: auto;
    padding: 8px 0;
    font-size: 0.82rem;
  }

  .internal-documents-summary .internal-period-control select {
    height: 40px;
    min-height: 40px;
    font-size: 0.82rem;
  }

  .inv-tile-grid {
    grid-template-columns: 1fr;
  }

  .inv-tile {
    min-width: 0;
  }

  .inv-mat-del {
    min-width: 40px;
    padding: 0 10px;
  }

  .inv-tile-label,
  .inv-tile-meta {
    overflow-wrap: anywhere;
  }

  .billing-month-card-grid,
  .billing-year-card-grid {
    grid-template-columns: 1fr;
  }

  .billing-cost-table-wrap {
    padding: 10px;
  }

  .employee-weekdays,
  .employee-calendar-grid {
    grid-template-columns: repeat(7, minmax(72px, 1fr));
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .employee-calendar-day,
  .employee-calendar-empty {
    min-height: 260px;
    padding: 5px;
  }

  .employee-meeting-grid,
  .employee-meeting-form,
  .employee-meeting-participant-grid {
    grid-template-columns: 1fr;
  }

  .employee-meeting-participants {
    grid-column: 1;
  }

  .employee-calendar-chip.absence-chip {
    grid-template-columns: 1fr;
  }

  .employee-calendar-chip-actions {
    flex-wrap: wrap;
  }

  .employee-panel-actions .ghost-action {
    min-width: 38px;
  }

  .employee-chip-action {
    width: 34px;
    height: 34px;
  }

  .employee-chip-action.wide {
    min-width: 48px;
    height: 34px;
  }
}

@media (min-width: 781px) and (max-width: 1120px) {
  .messages-layout {
    grid-template-columns: minmax(180px, 28%) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .chat-sidebar {
    min-height: 0;
    height: 100%;
    padding: 8px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .chat-list {
    display: grid;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .chat-card {
    min-height: 64px;
  }

  .chat-pane {
    min-height: 0;
  }
}

@media (hover: none), (pointer: coarse) {
  .chat-message-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    max-height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px;
    border-width: 1px;
  }
}

@media (max-width: 780px) {
  body.messages-viewport-locked .app-shell {
    grid-template-rows: 68px minmax(0, 1fr);
  }

  body.messages-viewport-locked .sidebar {
    height: 68px;
    min-height: 68px;
    overflow: hidden;
  }

  body.messages-viewport-locked .workspace {
    height: auto;
  }

  body.messages-viewport-locked .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-bottom: 10px;
  }

  body.messages-viewport-locked .topbar > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  body.messages-viewport-locked .topbar > div:first-child .eyebrow {
    margin: 0;
    font-size: 0.65rem;
  }

  body.messages-viewport-locked .topbar h1 {
    font-size: 1.35rem;
  }

  body.messages-viewport-locked .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, 0.58fr);
    gap: 7px;
  }

  body.messages-viewport-locked .topbar .market-switch,
  body.messages-viewport-locked .topbar .search,
  body.messages-viewport-locked .topbar #new-order-button {
    display: none;
  }

  body.messages-viewport-locked .topbar .access-switch,
  body.messages-viewport-locked .topbar .background-switch {
    min-height: 48px;
    width: auto;
    padding: 4px 8px;
  }

  body.messages-viewport-locked .topbar .access-switch select,
  body.messages-viewport-locked .topbar .background-switch select {
    min-height: 28px;
  }

  #messages-view.active {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  #messages-view .messages-header-bar {
    min-height: 60px;
    gap: 8px;
    flex-flow: row nowrap;
    align-items: center;
  }

  #messages-view .messages-header-bar > div:first-child {
    min-width: 0;
  }

  #messages-view .messages-header-bar .eyebrow {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #open-saved-messages {
    width: 158px;
    max-width: 158px;
    flex: 0 1 158px;
    margin-left: auto;
    height: 40px;
    padding: 0 7px;
    font-size: 0.72rem;
    line-height: 1.05;
    white-space: normal;
  }

  .messages-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .chat-sidebar {
    min-height: 0;
    height: auto;
    margin-bottom: 0;
    padding: 8px;
    grid-template-rows: auto;
  }

  .chat-mobile-picker-toggle {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    border: 1px solid color-mix(in srgb, var(--brand) 42%, var(--glass-border, var(--line)));
    border-radius: 8px;
    padding: 6px 9px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--glass-bg-strong, var(--surface)), color-mix(in srgb, var(--brand-soft) 46%, var(--glass-bg-soft, var(--surface-subtle))));
    color: var(--ink);
    text-align: left;
  }

  .chat-mobile-picker-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
    flex: 1 1 auto;
  }

  .chat-mobile-picker-copy small,
  .chat-mobile-picker-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-mobile-picker-copy small {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .chat-mobile-picker-caret {
    flex: 0 0 auto;
    color: var(--muted);
    font-weight: 1000;
    transition: transform 0.2s ease;
  }

  .chat-sidebar.mobile-picker-open {
    grid-template-rows: auto auto auto;
  }

  .chat-sidebar.mobile-picker-open .chat-mobile-picker-caret {
    transform: rotate(180deg);
  }

  .chat-tabs {
    margin-bottom: 10px;
  }

  .chat-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
  }

  .chat-sidebar:not(.mobile-picker-open) .chat-tabs,
  .chat-sidebar:not(.mobile-picker-open) .chat-list {
    display: none;
  }

  .chat-sidebar.mobile-picker-open .chat-tabs {
    display: grid;
    margin-top: 8px;
  }

  .chat-sidebar.mobile-picker-open .chat-list {
    display: flex;
  }

  .chat-card {
    flex: 0 0 min(280px, 82vw);
    min-width: 0;
    min-height: 70px;
    scroll-snap-align: start;
  }

  .chat-pane {
    min-height: 0;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  }

  .chat-pane-head {
    min-height: 0;
    padding: 8px 10px;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .chat-title-row .chat-avatar.large {
    width: 44px;
    height: 44px;
  }

  .chat-title-row,
  .chat-thread-actions {
    width: 100%;
  }

  .chat-thread-actions {
    justify-content: flex-start;
  }

  .chat-archive-hint {
    display: none;
  }

  .chat-thread-actions:has(> .chat-archive-hint:only-child) {
    display: none;
  }

  .chat-archive-hint {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .chat-participant-panel {
    flex-basis: 100%;
  }

  .chat-messages {
    min-height: 0;
    padding: 10px;
    gap: 10px;
  }

  .chat-message {
    max-width: 94%;
    margin-bottom: 0;
  }

  .chat-bubble {
    padding: 10px;
  }

  .chat-message-actions {
    position: static;
    width: auto;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    max-height: 48px;
    padding: 4px;
    border-width: 1px;
    scrollbar-width: none;
  }

  .chat-message-actions::-webkit-scrollbar {
    display: none;
  }

  .chat-message-actions button {
    flex: 0 0 auto;
  }

  .chat-message:not(.own) .chat-reaction-menu {
    left: 0;
    transform: none;
  }

  .chat-message.own .chat-reaction-menu {
    right: 0;
    left: auto;
    transform: none;
  }

  .chat-escalation-pin,
  .chat-reply-banner,
  .chat-composer {
    padding: 10px;
  }

  .chat-composer textarea {
    min-height: 64px;
  }

  .chat-order-picker-head {
    grid-template-columns: 1fr;
  }

  .chat-order-picker-head input {
    min-width: 0;
    width: 100%;
  }

  .chat-attach-row {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 48px 48px;
    gap: 8px;
  }

  .chat-attach-row .chat-file-action {
    width: 100%;
    min-width: 0;
    gap: 5px;
    padding: 0 5px;
    grid-column: 1;
    grid-row: 1;
  }

  .chat-attach-row .chat-voice-button {
    width: 100%;
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
    white-space: nowrap;
  }

  .chat-attach-row #chat-composer-emoji-button {
    width: 48px;
    min-width: 0;
    padding: 0;
    grid-column: 3;
    grid-row: 1;
  }

  .chat-attach-row .chat-schedule-button {
    width: 48px;
    grid-column: 4;
    grid-row: 1;
  }

  .chat-attach-row .chat-translate-button {
    width: 100%;
    min-width: 0;
    grid-column: 1 / 3;
    grid-row: 2;
  }

  .chat-attach-row .primary-action {
    width: 100%;
    min-width: 0;
    grid-column: 3 / 5;
    grid-row: 2;
  }

  .chat-composer-translation-state {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-composer-translation-state .ghost-action {
    width: 100%;
  }

  .chat-translation-language-grid {
    grid-template-columns: 1fr 42px;
  }

  .chat-translation-language-grid .field:last-child {
    grid-column: 1 / 3;
  }

  .chat-scheduled-queue > article {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-scheduled-actions {
    width: 100%;
  }

  .chat-scheduled-actions .ghost-action {
    flex: 1 1 0;
  }

  .chat-schedule-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-voice-panel,
  .chat-reply-banner,
  .chat-escalation-item {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-voice-ready audio,
  .chat-attachment-video,
  .chat-attachment-audio,
  .chat-voice-note {
    width: 100%;
    max-width: 100%;
  }

  .saved-chat-actions .primary-action,
  .saved-chat-actions .ghost-action {
    flex: 1 1 100%;
    width: 100%;
  }

  .saved-chat-toolbar {
    position: static;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .topbar {
    position: relative;
  }

  .topbar > div:first-child {
    padding-right: 54px;
  }

  .header-report-button {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 6;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    margin: 0;
  }

  .report-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-report-card > header,
  .admin-report-card > footer,
  .admin-report-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-report-card > footer,
  .admin-report-actions {
    width: 100%;
  }

  .admin-report-actions {
    justify-content: flex-end;
  }
}
/* Supabase write failures must stay visible above dialogs and navigation. */
.core-data-warning {
  position: fixed;
  z-index: 100000;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 93, 84, 0.8);
  border-radius: 8px;
  background: rgba(77, 19, 18, 0.96);
  color: #fff;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.4);
  font: 700 14px/1.4 system-ui, sans-serif;
}

.core-data-warning[hidden] {
  display: none;
}
