:root {
  --bg: #f5f7fa;
  --panel: #fff;
  --ink: #172033;
  --muted: #64748b;
  --line: #d8e0ea;
  --blue: #1f4e79;
  --dark: #10263d;
  --yellow: #f6c445;
  --green: #1f7a4d;
  --red: #b42318;
  --soft-blue: #e8f2fb;
  --soft-amber: #fff5d6;
  --soft-green: #e7f5ec;
  --sabosol-navy: #0f253a;
  --sabosol-blue: #1f4e79;
  --sabosol-gold: #f6c445;
  --surface: #ffffff;
  --surface-muted: #f3f7fb;
  --border: #d8e0ea;
  --text-main: #102033;
  --text-muted: #63738a;
  --radius-lg: 12px;
  --radius-md: 8px;
  --shadow-soft: 0 14px 34px rgba(16, 38, 61, .09);
  --shadow-row: 0 10px 24px rgba(16, 38, 61, .07);
  --crm-card: #ffffff;
  --crm-card-muted: #f8fbfe;
  --crm-line: #dce5ef;
  --crm-line-soft: #edf2f7;
  --crm-blue-50: #eef6fc;
  --crm-blue-100: #d7e9f7;
  --crm-blue-700: #164f7b;
  --crm-green-50: #edf8f1;
  --crm-green-100: #cfead8;
  --crm-green-700: #17663f;
  --crm-gold-50: #fff8df;
  --crm-gold-100: #f6dea0;
  --crm-gold-700: #765312;
  --crm-orange-50: #fff3eb;
  --crm-orange-100: #f7cdb8;
  --crm-orange-700: #9b3f18;
  --crm-gray-50: #f6f8fb;
  --crm-gray-100: #e5ebf2;
  --crm-gray-700: #46596f;
  --crm-radius-xl: 16px;
  --crm-radius-lg: 12px;
  --crm-shadow-card: 0 14px 34px rgba(15, 37, 58, .08);
  --crm-shadow-hover: 0 18px 42px rgba(15, 37, 58, .13);
  --crm-focus: 0 0 0 4px rgba(246, 196, 69, .22);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Global SaaS-CRM polish for all application pages */
:root {
  --app-bg: #f3f6fa;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fbfe;
  --app-border: #dce5ef;
  --app-border-soft: #edf2f7;
  --app-ink: #102033;
  --app-muted: #63738a;
  --app-navy: #0f253a;
  --app-blue: #1f5a89;
  --app-blue-dark: #174a73;
  --app-gold: #f6c445;
  --app-green: #239363;
  --app-red: #b42318;
  --app-radius-xl: 16px;
  --app-radius-lg: 12px;
  --app-radius-md: 10px;
  --app-shadow: 0 14px 34px rgba(15, 37, 58, .08);
  --app-shadow-soft: 0 8px 22px rgba(15, 37, 58, .06);
  --app-focus: 0 0 0 4px rgba(246, 196, 69, .22);
}

body {
  background:
    radial-gradient(circle at 82% 6%, rgba(31, 90, 137, .07), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, var(--app-bg) 100%);
  color: var(--app-ink);
}

.shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #102942 0%, #0b1d30 100%);
  padding: 22px 18px;
  gap: 22px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08), 12px 0 32px rgba(15,37,58,.08);
}

.brand {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-logo {
  width: 200px;
}

.brand span,
.side-card span {
  color: rgba(232,241,250,.78);
}

nav {
  gap: 7px;
}

nav a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  padding: 7px 11px 7px 7px;
  border-radius: 12px;
  color: rgba(238,246,255,.9);
  font-weight: 700;
  letter-spacing: 0;
  transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  transform: translateX(2px);
}

nav a.active {
  background: rgba(255,255,255,.13);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--app-gold), 0 12px 26px rgba(0,0,0,.16);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  color: var(--app-gold);
}

.nav-icon::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

nav a.active .nav-icon {
  background: var(--app-gold);
  color: #10263d;
}

.side-card {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255,255,255,.045);
  box-shadow: 0 14px 28px rgba(0,0,0,.13);
}

.side-card strong {
  color: #fff;
  font-size: 16px;
}

.side-card a {
  color: rgba(255,255,255,.9);
}

main {
  padding: 28px 22px;
}

.topbar {
  margin-bottom: 20px;
  padding-bottom: 2px;
}

h1 {
  color: var(--app-ink);
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p {
  color: var(--app-muted);
}

.panel,
.dashboard-hero,
.research-panel,
.portal-invite-box,
.inline-details,
.partner-card,
.list-item,
.tool-card,
.user-card,
fieldset {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-xl);
  background: rgba(255,255,255,.94);
  box-shadow: var(--app-shadow-soft);
}

.panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-head,
.detail-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--app-border-soft);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.panel-head h2,
.detail-head h2 {
  color: var(--app-ink);
}

.form {
  padding: 18px;
}

fieldset {
  padding: 16px;
  margin-bottom: 16px;
}

legend {
  color: var(--app-blue-dark);
  font-weight: 850;
}

label {
  color: var(--app-muted);
  font-weight: 650;
}

input,
select,
textarea {
  min-height: 42px;
  border-radius: var(--app-radius-md);
  border-color: var(--app-border);
  background: #fff;
  color: var(--app-ink);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--app-gold);
  box-shadow: var(--app-focus);
  background: #fff;
}

.button,
button {
  min-height: 40px;
  border-radius: var(--app-radius-md);
  border-color: var(--app-border);
  background: #fff;
  color: var(--app-blue-dark);
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15,37,58,.08);
}

.button.primary,
button.primary {
  background: linear-gradient(180deg, var(--app-blue), var(--app-blue-dark));
  border-color: var(--app-blue-dark);
  color: #fff;
  box-shadow: 0 12px 22px rgba(23,74,115,.2);
}

.button.ghost {
  background: #f4f8fc;
  border-color: #d7e6f2;
}

.upload-button {
  border-color: var(--app-gold);
  background: linear-gradient(180deg, #ffd761, var(--app-gold));
  border-radius: var(--app-radius-md);
}

.flash {
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-soft);
}

.kpis {
  gap: 14px;
}

.kpis div {
  min-height: 104px;
  border-radius: var(--app-radius-xl);
  border-color: var(--app-border);
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: var(--app-shadow);
}

.kpis .warning {
  background: linear-gradient(180deg, #fff, #fffaf0);
}

.kpis .money {
  background: linear-gradient(180deg, #fff, #f0faf4);
}

.kpis span {
  color: var(--app-muted);
  font-weight: 700;
}

.kpis strong {
  color: var(--app-ink);
  font-weight: 900;
}

.filters {
  padding: 14px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-xl);
  background: rgba(255,255,255,.94);
  box-shadow: var(--app-shadow-soft);
}

.filters input,
.filters select {
  max-width: none;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: #f6f9fc;
  color: #60748b;
  border-bottom: 1px solid var(--app-border);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

td {
  background: #fff;
  border-bottom: 1px solid var(--app-border-soft);
}

tbody tr:nth-child(even) td {
  background: #f8fbfe;
}

tbody tr:hover td {
  background: #f3f8fd;
}

.badge,
.mini-badge,
.customer-type-badge {
  border-radius: 999px;
  min-height: 24px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  border: 1px solid transparent;
}

.list,
.partner-grid,
.portal-message-list {
  gap: 12px;
}

.list-item,
.partner-card,
.tool-card,
.user-card {
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.list-item:hover,
.partner-card:hover,
.tool-card:hover,
.user-card:hover {
  transform: translateY(-1px);
  border-color: #c9d9e8;
  box-shadow: var(--app-shadow);
}

.dashboard-hero {
  border-left: 5px solid var(--app-gold);
  border-radius: var(--app-radius-xl);
}

.dashboard-hero h2 {
  color: var(--app-ink);
  font-weight: 900;
}

.dashboard-hero span,
.status-row div:first-child span,
.mini-badge {
  background: #eef6fc;
  color: var(--app-blue-dark);
  border: 1px solid #d7e9f7;
}

.status-row {
  border-radius: var(--app-radius-lg);
}

.bar {
  background: #eaf2f8;
}

.bar span {
  background: linear-gradient(90deg, var(--app-blue-dark), var(--app-blue));
}

@media (max-width: 980px) {
  .sidebar {
    box-shadow: none;
  }

  nav a:hover {
    transform: none;
  }
}

/* Angebotsgenerator */
.offer-builder-intro .panel-head { align-items: flex-start; }
.offer-builder-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.offer-builder-steps span {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft-blue);
  color: var(--blue);
  font-weight: 800;
}
.offer-builder-steps b {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #102033;
}
.offer-builder .panel { margin-bottom: 16px; }
.offer-builder .cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.offer-builder .cols.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.offer-builder .cols.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.offer-builder-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin-bottom: 12px;
}
.offer-photo-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.offer-photo-option {
  position: relative;
  display: grid;
  grid-template-rows: 150px auto;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.offer-photo-option:has(input:checked) {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(246, 196, 69, .18);
}
.offer-photo-option input { position: absolute; top: 13px; left: 13px; z-index: 1; }
.offer-photo-option img { width: 100%; height: 150px; object-fit: cover; border-radius: 7px; background: var(--soft-blue); }
.offer-photo-option span { color: var(--text); font-weight: 750; overflow-wrap: anywhere; }
.offer-builder-actions {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 30px rgba(8,42,74,.16);
}
@media (max-width: 1180px) {
  .offer-builder .cols.five,
  .offer-builder .cols.four,
  .offer-photo-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offer-builder-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .offer-builder-steps,
  .offer-builder .cols.three,
  .offer-builder .cols.four,
  .offer-builder .cols.five,
  .offer-builder-checks,
  .offer-photo-picker { grid-template-columns: 1fr; }
  .offer-builder-actions { flex-direction: column; }
  .offer-builder-actions .button { width: 100%; }
}

@media (max-width: 640px) {
  main {
    padding: 10px;
  }

  .panel,
  .dashboard-hero,
  .filters,
  fieldset {
    border-radius: 14px;
  }

  .filters {
    display: grid;
    gap: 10px;
  }
}

/* Final tablet and phone overrides */
@media (max-width: 1180px) and (min-width: 781px) {
  main {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
  }

  .customer-list-stats,
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two,
  .dashboard-grid,
  .users-layout,
  .portal-profile-grid {
    grid-template-columns: 1fr;
  }

  .upload-wait-card {
    width: min(460px, calc(100vw - 56px));
  }
}

@media (max-width: 780px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 0;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 14px 30px rgba(6, 23, 39, .16);
  }

  .brand {
    padding-bottom: 10px;
    margin-bottom: 6px;
  }

  .brand-logo {
    width: 154px;
    max-width: 72vw;
  }

  .brand span {
    font-size: 12px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 12px;
    grid-template-columns: 22px auto;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
  }

  .nav-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
  }

  main {
    padding: 14px 12px 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 26px;
    line-height: 1.12;
  }

  .topbar p,
  .muted {
    font-size: 14px;
  }

  .topbar .button.primary,
  .topbar .btn.primary {
    width: 100%;
    min-height: 46px;
  }

  .panel,
  .dashboard-hero,
  .filters,
  .customer-filter-card,
  .detail-head,
  fieldset {
    border-radius: 14px;
  }

  .panel,
  .dashboard-hero,
  fieldset {
    box-shadow: 0 10px 28px rgba(15, 37, 58, .06);
  }

  .form,
  .panel > form.form {
    padding: 14px;
  }

  .form-grid,
  .form-grid.three,
  .form-grid.four,
  .grid.two,
  .kpis,
  .customer-list-stats,
  .portal-card-grid,
  .portal-summary-grid,
  .portal-profile-grid,
  .hardware-suggestions,
  .hardware-catalog-grid,
  .file-grid,
  .component-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .button,
  .btn,
  button,
  input[type="submit"] {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  textarea {
    line-height: 1.45;
  }

  .side-card {
    display: none;
  }

  .upload-wait-overlay {
    align-items: flex-end;
    padding:
      max(18px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .upload-wait-card {
    width: 100%;
    max-width: none;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .upload-wait-spinner {
    width: 44px;
    height: 44px;
  }

  .portal-shell {
    width: min(100%, 1120px);
    padding: 12px;
  }

  .portal-header {
    border-radius: 14px;
    padding: 14px;
    gap: 12px;
  }

  .portal-header img {
    max-width: 220px;
  }

  .portal-header nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding: 0;
  }

  .portal-header nav a {
    display: flex;
    justify-content: center;
    min-height: 44px;
    text-align: center;
  }
}

@media (max-width: 430px) {
  main {
    padding: 12px 10px 22px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .customer-list-stats .stat-card,
  .kpis div {
    min-height: 88px;
  }

  .panel-head,
  .detail-head {
    padding: 13px;
  }

  .upload-wait-card strong {
    font-size: 18px;
  }

  .upload-wait-card span:last-child {
    font-size: 13px;
  }
}

/* Final override: form controls and colorful UI accents. */
body {
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.12), rgba(246, 196, 69, 0) 28%),
    linear-gradient(215deg, rgba(47, 155, 114, 0.08), rgba(47, 155, 114, 0) 30%),
    linear-gradient(180deg, #f8fbff 0%, #edf4fa 100%);
}

.panel,
.dashboard-hero,
.detail-hero,
.portal-card,
.tool-card,
.research-card,
.user-card,
.partner-card,
.hardware-card,
.hardware-item,
.crm-table-wrap,
.filter-card,
.customer-list-stats .stat-card,
.kpis div {
  border-color: rgba(31, 90, 137, 0.16);
  box-shadow: 0 14px 34px rgba(15, 46, 74, 0.08);
}

.panel-head,
.detail-head,
.portal-card > .panel-head,
.crm-table-head {
  background:
    linear-gradient(90deg, rgba(31, 90, 137, 0.08), rgba(255, 255, 255, 0.96) 42%, rgba(246, 196, 69, 0.12));
}

.panel-head h2,
.detail-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.panel-head h2::before,
.detail-head h2::before {
  content: "";
  width: 7px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--app-gold), var(--app-blue));
  box-shadow: 0 5px 12px rgba(246, 196, 69, 0.28);
}

.customer-list-stats .stat-card,
.kpis div {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 254, 0.92)),
    #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.customer-list-stats .stat-card::after,
.kpis div::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--app-blue), #2f8fcb);
}

.customer-list-stats .stat-card:nth-child(3)::after,
.kpis div:nth-child(3)::after {
  background: linear-gradient(90deg, #2f9b72, #79c78f);
}

.customer-list-stats .stat-card:nth-child(4)::after,
.kpis div:nth-child(4)::after {
  background: linear-gradient(90deg, var(--app-gold), #e69d25);
}

.customer-list-stats .stat-card:hover,
.kpis div:hover,
.status-card:hover,
.customer-row:hover,
.partner-card:hover,
.hardware-card:hover,
.hardware-item:hover,
.user-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(15, 46, 74, 0.12);
}

.badge,
.mini-badge,
.status-badge,
.priority-badge,
.customer-type-badge,
.pill,
.role-pill {
  border-radius: 999px;
  border: 1px solid rgba(31, 90, 137, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.button.primary,
.btn.primary,
button.primary,
input[type="submit"] {
  background: linear-gradient(135deg, var(--app-blue), #164e7d);
  box-shadow: 0 12px 24px rgba(31, 90, 137, 0.20);
}

.button.primary:hover,
.btn.primary:hover,
button.primary:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(31, 90, 137, 0.26);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(246, 196, 69, 0.95);
  box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.18);
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  margin: 0;
  flex: 0 0 18px;
  display: inline-block;
  vertical-align: middle;
  accent-color: var(--app-blue);
  box-shadow: none;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.20);
}

.checkline,
.checkbox-line,
.suggestion-check,
.checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 90, 137, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.12), rgba(255, 255, 255, 0.96) 32%),
    #fff;
  color: var(--app-ink);
  box-sizing: border-box;
}

.checkline:hover,
.checkbox-line:hover,
.suggestion-check:hover,
.checks label:hover {
  border-color: rgba(31, 90, 137, 0.28);
  background:
    linear-gradient(90deg, rgba(47, 143, 203, 0.10), rgba(255, 255, 255, 0.96) 36%),
    #fff;
}

.checkline input[type="checkbox"],
.checkbox-line input[type="checkbox"],
.suggestion-check input[type="checkbox"],
.checks label input[type="checkbox"] {
  flex: 0 0 18px;
}

@media (max-width: 900px) {
  .panel,
  .dashboard-hero,
  .detail-hero,
  .portal-card,
  .filter-card {
    box-shadow: 0 10px 24px rgba(15, 46, 74, 0.08);
  }

  .checkline,
  .checkbox-line,
  .suggestion-check,
  .checks label {
      min-height: 48px;
    }
}

/* iPad / tablet guard: keep the app readable in Safari split and landscape views. */
@media (min-width: 768px) and (max-width: 1366px) {
  html,
  body {
    overflow-x: hidden;
  }

  .shell {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }

  .sidebar {
    width: auto !important;
    padding: 22px 12px !important;
  }

  .brand-logo {
    width: 168px !important;
    max-width: 100% !important;
  }

  nav {
    gap: 7px !important;
  }

  nav a {
    min-height: 40px !important;
    padding: 8px 9px !important;
    font-size: 14px !important;
    grid-template-columns: 24px minmax(0, 1fr) !important;
  }

  .nav-icon {
    width: 24px !important;
    height: 24px !important;
    border-radius: 8px !important;
  }

  main {
    width: 100% !important;
    min-width: 0 !important;
    max-width: calc(100vw - 210px) !important;
    padding: 28px 16px 36px !important;
    overflow-x: hidden !important;
  }

  .page-title {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 14px !important;
  }

  .page-title h1 {
    font-size: 32px !important;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .kpis div {
    min-width: 0 !important;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .filters .button,
  .filters button {
    width: 100% !important;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .dashboard-grid > * {
    min-width: 0 !important;
  }

  .dashboard-grid > :last-child {
    grid-column: 1 / -1 !important;
  }

  .panel,
  .dashboard-hero,
  .detail-hero,
  .portal-card {
    max-width: 100% !important;
    overflow: hidden;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .shell {
    grid-template-columns: 184px minmax(0, 1fr) !important;
  }

  main {
    max-width: calc(100vw - 184px) !important;
    padding: 24px 12px 32px !important;
  }

  .brand-logo {
    width: 146px !important;
  }

  .brand span {
    font-size: 12px !important;
  }

  nav a {
    font-size: 13px !important;
    min-height: 38px !important;
  }

  .page-title {
    grid-template-columns: 1fr !important;
  }

  .page-title .button {
    justify-self: start !important;
  }

  .kpis,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Final tablet guard: iPad Safari must not get the full desktop width. */
@media (hover: none) and (pointer: coarse) and (min-width: 768px) and (max-width: 1180px),
       (min-width: 981px) and (max-width: 1180px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell {
    grid-template-columns: 200px minmax(0, 1fr) !important;
  }

  .sidebar {
    min-width: 0 !important;
    padding: 22px 12px !important;
    gap: 18px !important;
  }

  .brand-logo {
    width: 168px !important;
    max-width: 100% !important;
  }

  nav {
    gap: 8px !important;
  }

  nav a {
    min-height: 42px !important;
    padding: 10px 8px !important;
    gap: 10px !important;
    font-size: 15px !important;
  }

  nav a .nav-icon,
  .nav-icon {
    flex: 0 0 28px !important;
    width: 28px !important;
    height: 28px !important;
  }

  .userbox {
    padding: 14px !important;
  }

  main {
    min-width: 0 !important;
    width: 100% !important;
    max-width: calc(100vw - 200px) !important;
    padding: 30px 16px 36px !important;
    overflow-x: hidden !important;
  }

  .page-title {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 14px !important;
  }

  .page-title .button.primary {
    position: static !important;
    justify-self: end !important;
    white-space: nowrap !important;
  }

  .page-title h1 {
    font-size: 30px !important;
    line-height: 1.08 !important;
  }

  .page-title p {
    font-size: 15px !important;
  }

  .dashboard-hero,
  .detail-hero,
  .panel,
  .filter-card,
  .table-wrap,
  .crm-table-wrap,
  .portal-card {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .dashboard-hero,
  .detail-hero {
    padding: 24px !important;
  }

  .dashboard-hero .actions,
  .hero-actions,
  .page-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }

  .customer-list-stats,
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .customer-list-stats .customer-stat-card,
  .customer-list-stats .stat-card,
  .kpis div {
    min-height: 104px !important;
  }

  .filter-card,
  .customer-filter-card {
    max-width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .filter-card button,
  .customer-filter-card button {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .dashboard-grid > * {
    min-width: 0 !important;
  }

  .dashboard-grid > .panel:last-child,
  .dashboard-grid .activity-panel,
  .dashboard-portal-messages {
    grid-column: 1 / -1 !important;
  }

  .activity-list,
  .panel-body {
    min-width: 0 !important;
  }
}

@media (hover: none) and (pointer: coarse) and (max-width: 767px),
       (max-width: 767px) {
  .shell {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    position: relative !important;
    min-height: auto !important;
  }

  main {
    max-width: 100% !important;
    padding: 18px 12px 28px !important;
  }

  .page-title {
    grid-template-columns: 1fr !important;
  }

  .page-title .button.primary {
    justify-self: start !important;
  }

  .customer-list-stats,
  .kpis,
  .dashboard-grid,
  .filter-card,
  .customer-filter-card {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet/iPad refinement: desktop density without horizontal clipping. */
@media (hover: none) and (pointer: coarse) and (min-width: 901px) and (max-width: 1600px),
       (min-width: 981px) and (max-width: 1280px) {
  .shell {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }

  .sidebar {
    min-width: 0 !important;
    padding: 22px 14px !important;
    gap: 18px !important;
  }

  .brand-logo {
    width: 178px !important;
  }

  nav {
    gap: 8px !important;
  }

  nav a {
    min-height: 42px !important;
    padding: 10px !important;
    gap: 10px !important;
    font-size: 15px !important;
  }

  nav a .nav-icon,
  .nav-icon {
    flex: 0 0 28px !important;
    width: 28px !important;
    height: 28px !important;
  }

  .userbox {
    padding: 14px !important;
  }

  main {
    min-width: 0 !important;
    overflow-x: hidden !important;
    padding: 30px 18px 36px !important;
  }

  .page-title {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 14px !important;
  }

  .page-title .button.primary {
    position: static !important;
    justify-self: end !important;
    white-space: nowrap !important;
  }

  .dashboard-hero,
  .detail-hero,
  .panel,
  .filter-card,
  .crm-table-wrap,
  .table-wrap {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .dashboard-hero,
  .detail-hero {
    padding: 24px !important;
  }

  .dashboard-hero .actions,
  .hero-actions,
  .page-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }

  .customer-list-stats,
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .customer-list-stats .customer-stat-card,
  .customer-list-stats .stat-card,
  .kpis div {
    min-height: 104px !important;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .dashboard-grid > * {
    min-width: 0 !important;
  }

  .dashboard-grid > .panel:last-child,
  .dashboard-grid .activity-panel,
  .dashboard-portal-messages {
    grid-column: 1 / -1 !important;
  }

  .activity-list,
  .panel-body {
    min-width: 0 !important;
  }
}

/* Tablet/iPad tuning: avoid clipped desktop tables and cramped dashboard columns. */
@media (min-width: 981px) and (max-width: 1400px) {
  .shell {
    grid-template-columns: 220px minmax(0, 1fr) !important;
  }

  .sidebar {
    padding: 18px 14px !important;
    gap: 14px !important;
  }

  .brand {
    padding-bottom: 14px !important;
  }

  .brand-logo {
    width: 176px !important;
    max-width: 100% !important;
  }

  nav {
    gap: 5px !important;
  }

  nav a {
    min-height: 40px !important;
    grid-template-columns: 25px minmax(0, 1fr) !important;
    padding: 6px 9px 6px 6px !important;
    font-size: 14px !important;
  }

  nav a::before {
    width: 25px !important;
    height: 25px !important;
  }

  .side-card {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  main {
    padding: 26px 16px 34px !important;
  }

  .page-title {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 16px !important;
    align-items: start !important;
  }

  .page-title h1 {
    font-size: 30px !important;
    line-height: 1.08 !important;
  }

  .page-title .button {
    min-width: 120px !important;
    white-space: nowrap !important;
  }

  .dashboard-hero,
  .detail-hero {
    padding: 24px !important;
  }

  .dashboard-hero {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
  }

  .dashboard-hero .hero-actions,
  .detail-hero .hero-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    max-width: 340px !important;
  }

  .kpis,
  .customer-list-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .kpis div,
  .customer-list-stats .stat-card,
  .customer-stat-card {
    min-height: 112px !important;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .dashboard-grid > .panel:last-child,
  .dashboard-grid .activity-panel {
    grid-column: 1 / -1 !important;
  }

  .panel,
  .dashboard-hero,
  .detail-hero,
  .filter-card,
  .customer-filter-card {
    overflow: hidden !important;
  }

  .activity-list,
  .panel-body {
    min-width: 0 !important;
  }
}

@media (min-width: 641px) and (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    position: relative !important;
    min-height: auto !important;
    padding: 16px !important;
  }

  .brand-logo {
    width: 168px !important;
  }

  .sidebar nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .side-card {
    max-width: none !important;
  }

  main {
    padding: 20px 14px 30px !important;
  }

  .page-title,
  .dashboard-hero,
  .detail-hero {
    grid-template-columns: 1fr !important;
  }

  .dashboard-hero .hero-actions,
  .detail-hero .hero-actions {
    justify-content: flex-start !important;
    max-width: none !important;
  }

  .kpis,
  .customer-list-stats,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Final visual polish: richer accents and sane checkbox sizing. */
:root {
  --accent-sky: #2f8fcb;
  --accent-mint: #2f9b72;
  --accent-berry: #bd5b72;
  --accent-amber: #f6c445;
  --accent-ink-soft: #48627e;
}

body {
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.12), rgba(246, 196, 69, 0) 28%),
    linear-gradient(215deg, rgba(47, 155, 114, 0.08), rgba(47, 155, 114, 0) 30%),
    linear-gradient(180deg, #f8fbff 0%, #edf4fa 100%);
}

.panel,
.dashboard-hero,
.detail-hero,
.portal-card,
.tool-card,
.research-card,
.user-card,
.partner-card,
.hardware-card,
.hardware-item,
.crm-table-wrap,
.filter-card,
.customer-list-stats .stat-card,
.kpis div {
  border-color: rgba(31, 90, 137, 0.16);
  box-shadow: 0 14px 34px rgba(15, 46, 74, 0.08);
}

.panel-head,
.detail-head,
.portal-card > .panel-head,
.crm-table-head {
  background:
    linear-gradient(90deg, rgba(31, 90, 137, 0.08), rgba(255, 255, 255, 0.96) 42%, rgba(246, 196, 69, 0.12));
}

.panel-head h2,
.detail-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.panel-head h2::before,
.detail-head h2::before {
  content: "";
  width: 7px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--app-gold), var(--accent-sky));
  box-shadow: 0 5px 12px rgba(246, 196, 69, 0.28);
}

.dashboard-hero,
.detail-hero,
.portal-card.hero,
.hero-card {
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.10), rgba(255, 255, 255, 0.92) 22%),
    linear-gradient(135deg, rgba(47, 143, 203, 0.07), rgba(255, 255, 255, 0));
}

.customer-list-stats .stat-card,
.kpis div {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 254, 0.92)),
    #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.customer-list-stats .stat-card::after,
.kpis div::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--accent-sky), var(--app-blue));
}

.customer-list-stats .stat-card:nth-child(3)::after,
.kpis div:nth-child(3)::after {
  background: linear-gradient(90deg, var(--accent-mint), #79c78f);
}

.customer-list-stats .stat-card:nth-child(4)::after,
.kpis div:nth-child(4)::after {
  background: linear-gradient(90deg, var(--accent-amber), #e69d25);
}

.customer-list-stats .stat-card:hover,
.kpis div:hover,
.status-card:hover,
.customer-row:hover,
.partner-card:hover,
.hardware-card:hover,
.hardware-item:hover,
.user-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(15, 46, 74, 0.12);
}

.badge,
.mini-badge,
.status-badge,
.priority-badge,
.customer-type-badge,
.pill,
.role-pill {
  border-radius: 999px;
  border: 1px solid rgba(31, 90, 137, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.badge-success,
.status-won,
.status-gewonnen,
.priority-low {
  background: #e9f8ef;
  color: #116742;
  border-color: #bfe8cf;
}

.badge-warning,
.status-open,
.priority-high {
  background: #fff4d8;
  color: #835300;
  border-color: #f3cf7a;
}

.badge-danger,
.status-lost,
.status-verloren {
  background: #fff0ec;
  color: #a14421;
  border-color: #f2c1ae;
}

.button.primary,
.btn.primary,
button.primary,
input[type="submit"] {
  background: linear-gradient(135deg, var(--app-blue), #164e7d);
  box-shadow: 0 12px 24px rgba(31, 90, 137, 0.20);
}

.button.primary:hover,
.btn.primary:hover,
button.primary:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(31, 90, 137, 0.26);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(246, 196, 69, 0.95);
  box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.18);
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  margin: 0;
  flex: 0 0 18px;
  display: inline-block;
  vertical-align: middle;
  accent-color: var(--app-blue);
  box-shadow: none;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.20);
}

.checkline,
.checkbox-line,
.suggestion-check,
.checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 90, 137, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.12), rgba(255, 255, 255, 0.96) 32%),
    #fff;
  color: var(--app-ink);
  box-sizing: border-box;
}

.checkline:hover,
.checkbox-line:hover,
.suggestion-check:hover,
.checks label:hover {
  border-color: rgba(31, 90, 137, 0.28);
  background:
    linear-gradient(90deg, rgba(47, 143, 203, 0.10), rgba(255, 255, 255, 0.96) 36%),
    #fff;
}

.checkline input[type="checkbox"],
.checkbox-line input[type="checkbox"],
.suggestion-check input[type="checkbox"],
.checks label input[type="checkbox"] {
  flex: 0 0 18px;
}

@media (max-width: 900px) {
  .panel,
  .dashboard-hero,
  .detail-hero,
  .portal-card,
  .filter-card {
    box-shadow: 0 10px 24px rgba(15, 46, 74, 0.08);
  }

  .checkline,
  .checkbox-line,
  .suggestion-check,
  .checks label {
    min-height: 48px;
    align-items: center;
  }
}

/* Tablet and phone refinements */
@media (max-width: 1180px) and (min-width: 781px) {
  main {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
  }

  .customer-list-stats,
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two,
  .dashboard-grid,
  .users-layout,
  .portal-profile-grid {
    grid-template-columns: 1fr;
  }

  .filters,
  .customer-filter-card {
    gap: 10px;
  }

  .panel,
  .dashboard-hero,
  .customer-list-panel,
  fieldset {
    border-radius: 16px;
  }

  .upload-wait-card {
    width: min(460px, calc(100vw - 56px));
  }
}

@media (max-width: 780px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 0;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 14px 30px rgba(6, 23, 39, .16);
  }

  .brand {
    padding-bottom: 10px;
    margin-bottom: 6px;
  }

  .brand-logo {
    width: 154px;
    max-width: 72vw;
  }

  .brand span {
    font-size: 12px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 12px;
    grid-template-columns: 22px auto;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
  }

  .nav-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
  }

  main {
    padding: 14px 12px 24px;
  }

  .topbar,
  .panel-head,
  .dashboard-hero {
    gap: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 26px;
    line-height: 1.12;
  }

  .topbar p,
  .muted {
    font-size: 14px;
  }

  .topbar .button.primary,
  .topbar .btn.primary {
    width: 100%;
    min-height: 46px;
  }

  .panel,
  .dashboard-hero,
  .filters,
  .customer-filter-card,
  .detail-head,
  fieldset {
    border-radius: 14px;
  }

  .panel,
  .dashboard-hero,
  fieldset {
    box-shadow: 0 10px 28px rgba(15, 37, 58, .06);
  }

  .form,
  .panel > form.form {
    padding: 14px;
  }

  .form-grid,
  .form-grid.three,
  .form-grid.four,
  .grid.two,
  .kpis,
  .customer-list-stats,
  .portal-card-grid,
  .portal-summary-grid,
  .portal-profile-grid,
  .hardware-suggestions,
  .hardware-catalog-grid,
  .file-grid,
  .component-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .button,
  .btn,
  button,
  input[type="submit"] {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  textarea {
    line-height: 1.45;
  }

  .side-card {
    display: none;
  }

  .upload-wait-overlay {
    align-items: flex-end;
    padding:
      max(18px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .upload-wait-card {
    width: 100%;
    max-width: none;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .upload-wait-spinner {
    width: 44px;
    height: 44px;
  }

  .portal-shell {
    width: min(100%, 1120px);
    padding: 12px;
  }

  .portal-header {
    border-radius: 14px;
    padding: 14px;
    gap: 12px;
  }

  .portal-header img {
    max-width: 220px;
  }

  .portal-header nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding: 0;
  }

  .portal-header nav a {
    display: flex;
    justify-content: center;
    min-height: 44px;
    text-align: center;
  }
}

@media (max-width: 430px) {
  main {
    padding: 12px 10px 22px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .customer-list-stats .stat-card,
  .kpis div {
    min-height: 88px;
  }

  .panel-head,
  .detail-head {
    padding: 13px;
  }

  .upload-wait-card strong {
    font-size: 18px;
  }

  .upload-wait-card span:last-child {
    font-size: 13px;
  }
}

body.is-uploading {
  cursor: wait;
}

.upload-wait-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 24, 39, .38);
  backdrop-filter: blur(4px);
}

body.is-uploading .upload-wait-overlay {
  display: flex;
}

.upload-wait-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: 0 26px 70px rgba(3, 17, 30, .24);
  text-align: center;
  color: var(--app-text, #061b33);
}

.upload-wait-card strong {
  display: block;
  margin-top: 14px;
  font-size: 20px;
  line-height: 1.25;
}

.upload-wait-card span:last-child {
  display: block;
  margin-top: 8px;
  color: var(--app-muted, #5f7187);
  font-size: 14px;
}

.upload-wait-spinner {
  display: inline-block;
  width: 48px;
  height: 48px;
  border: 5px solid #d9e9f7;
  border-top-color: var(--app-gold, #f6c445);
  border-right-color: var(--app-blue, #1f5b89);
  border-radius: 50%;
  animation: upload-wait-spin .8s linear infinite;
}

.is-submitting-upload button[type="submit"],
.is-submitting-upload input[type="submit"] {
  cursor: wait;
  opacity: .78;
}

@keyframes upload-wait-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .upload-wait-spinner {
    animation: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
html, body { max-width: 100%; overflow-x: hidden; }
a { color: var(--blue); text-decoration: none; }
input, select, textarea, button { font: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: var(--dark); color: #fff; padding: 22px 18px; display: flex; flex-direction: column; gap: 24px; min-height: 100vh; position: sticky; top: 0; align-self: start; }
.brand { display: grid; gap: 8px; }
.brand-logo { width: 190px; max-width: 100%; height: auto; display: block; }
.brand span, .side-card span { color: #b9c7d6; font-size: 13px; }
nav { display: grid; gap: 6px; }
nav a { color: #d8e5f2; padding: 11px 12px; border-radius: 6px; }
nav a.active, nav a:hover { background: var(--blue); color: #fff; }
.side-card { margin-top: auto; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 14px; display: grid; gap: 5px; }
.side-card a { color: #fff; font-size: 13px; }
main { padding: 22px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
.topbar p { margin-top: 5px; color: var(--muted); }

.button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--blue); cursor: pointer; }
.button.primary, button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.danger, button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.button.ghost { background: rgba(31,78,121,.08); border-color: rgba(31,78,121,.18); color: var(--blue); }
.button.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
button:disabled,
.button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none !important; }
.upload-button { background: var(--yellow); border-color: var(--yellow); color: var(--dark); font-weight: 800; box-shadow: 0 6px 14px rgba(246,196,69,.24); }
.upload-button:hover { filter: brightness(.96); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.inline-actions { display: flex; gap: 10px; margin-top: 0; flex-wrap: wrap; justify-content: flex-end; }
.offer-send-form textarea { min-height: 220px; line-height: 1.45; }

.flash { border-radius: 6px; padding: 11px 13px; margin-bottom: 14px; background: var(--soft-green); color: var(--green); border: 1px solid #b8dec6; }
.flash.error { background: #fee4e2; color: var(--red); border-color: #f8b4ad; }

.dashboard-hero { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 18px 20px; margin-bottom: 16px; border-radius: 6px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-left: 6px solid var(--yellow); box-shadow: 0 10px 28px rgba(16,38,61,.08); }
.dashboard-hero span { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: var(--soft-blue); color: var(--blue); font-weight: 800; font-size: 12px; }
.dashboard-hero h2 { font-size: 24px; margin: 8px 0 6px; }
.dashboard-hero p { color: var(--muted); max-width: 760px; }
.dashboard-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(260px, .95fr) minmax(320px, 1.05fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.dashboard-grid .activity-panel { grid-column: auto; }
.dashboard-portal-messages { grid-column: span 2; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tool-card { display: grid; gap: 8px; min-height: 150px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); box-shadow: 0 8px 20px rgba(16,38,61,.06); }
.tool-card:hover { border-color: rgba(31,78,121,.35); box-shadow: 0 10px 24px rgba(16,38,61,.1); }
.tool-card strong { color: var(--blue); font-size: 17px; }
.tool-card span { color: var(--muted); line-height: 1.4; }
.tool-card em { align-self: end; width: fit-content; padding: 7px 10px; border-radius: 6px; background: var(--soft-blue); color: var(--blue); font-style: normal; font-weight: 800; font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis div { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; position: relative; overflow: hidden; box-shadow: 0 8px 20px rgba(16,38,61,.06); }
.kpis-strong div::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: var(--blue); opacity: .85; }
.kpis-strong .warning::after { background: var(--yellow); }
.kpis-strong .money::after { background: var(--green); }
.kpis span { color: var(--muted); font-size: 13px; }
.kpis strong { display: block; font-size: 28px; margin-top: 6px; letter-spacing: 0; }
.kpis .warning { background: var(--soft-amber); }
.kpis .money { background: var(--soft-green); }

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 12px 6px;
}

.dashboard-metric-grid div,
.dashboard-metric-grid .metric-card {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.dashboard-metric-grid a.metric-card {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.dashboard-metric-grid a.metric-card::after {
  content: "oeffnen";
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: #6b7f94;
  font-size: 10px;
  font-weight: 850;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .15s ease, transform .15s ease;
}

.dashboard-metric-grid a.metric-card:hover,
.dashboard-metric-grid a.metric-card:focus-visible {
  border-color: rgba(31, 90, 137, .34);
  box-shadow: 0 12px 24px rgba(15, 46, 74, .10);
  transform: translateY(-1px);
}

.dashboard-metric-grid a.metric-card:hover::after,
.dashboard-metric-grid a.metric-card:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.dashboard-metric-grid div.ok {
  background: var(--soft-green);
  border-color: #b8dec6;
}

.dashboard-metric-grid div.warning {
  background: var(--soft-amber);
  border-color: #f5cf75;
}

.dashboard-metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.dashboard-metric-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.dashboard-subhead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 10px 12px 0;
  color: var(--ink);
}

.dashboard-subhead span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.compact-list {
  padding-top: 8px;
}

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

  .dashboard-subhead {
    display: grid;
    gap: 4px;
  }

  .dashboard-subhead span {
    text-align: left;
  }
}

@media (max-width: 430px) {
  .dashboard-metric-grid {
    grid-template-columns: 1fr;
  }
}

.status-bars { display: grid; gap: 10px; padding: 12px; }
.status-row { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.status-row:hover { border-color: rgba(31,78,121,.45); box-shadow: 0 8px 18px rgba(16,38,61,.08); transform: translateY(-1px); }
.status-row:focus-visible { outline: 3px solid rgba(246,196,69,.45); outline-offset: 2px; }
.status-row div:first-child { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.status-row span, .status-row small { color: var(--muted); }
.status-row div:first-child span { color: var(--blue); background: var(--soft-blue); border-radius: 999px; padding: 2px 8px; font-weight: 800; font-size: 12px; }
.bar { height: 9px; background: var(--soft-blue); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.timeline { display: grid; padding: 12px; max-height: 520px; overflow: auto; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 10px 0; color: var(--ink); border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item > span { width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); margin-top: 4px; box-shadow: 0 0 0 4px var(--soft-amber); }
.timeline-item div { display: grid; gap: 4px; }
.timeline-item small { color: var(--muted); }
.timeline-item p { color: var(--muted); font-size: 13px; line-height: 1.4; }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list { display: grid; gap: 8px; padding: 12px; }
.list-item { border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 4px; color: var(--ink); }
.list-item span, .list-item small { color: var(--muted); }
.activity-item { border-left: 4px solid var(--yellow); }
.partner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 12px; }
.partner-card { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: #fff; display: grid; gap: 10px; align-content: start; }
.partner-card span { display: inline-flex; width: fit-content; min-height: 22px; align-items: center; padding: 0 8px; border-radius: 999px; background: var(--soft-blue); color: var(--blue); font-size: 12px; font-weight: 800; }
.partner-card strong { display: block; margin-top: 7px; color: var(--ink); overflow-wrap: anywhere; }
.partner-card small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.partner-card-meta { display: grid; gap: 2px; }
.partner-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.partner-card-actions form { margin: 0; }
.partner-list-item { border-left: 4px solid var(--blue); }
.task-title { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mini-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; background: var(--soft-blue); color: var(--blue) !important; font-size: 12px; font-weight: 800; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--blue); color: #fff; }
tbody tr:nth-child(even) td { background: var(--soft-blue); }
.customer-row.is-business td:first-child { border-left: 4px solid var(--blue); }
.customer-row.is-private td:first-child { border-left: 4px solid var(--yellow); }
.customer-row.is-partner td { background: #eef8f1 !important; }
.customer-row.is-partner td:first-child { border-left: 5px solid var(--green); }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 760px; }
.table-actions { display: flex; gap: 10px; white-space: nowrap; }
.table-actions form { margin: 0; display: inline-flex; }
.table-actions .button.small { width: auto; min-height: 30px; padding: 0 10px; font-size: 13px; }
.customer-title { display: grid; gap: 5px; color: var(--ink); min-width: 190px; }
.customer-title strong { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.customer-title small { color: var(--muted); }
.customer-title .partner-line { color: var(--green); font-weight: 700; }
.customer-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.customer-type-badge { display: inline-flex; align-items: center; min-height: 21px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0; }
.customer-type-badge.business { background: var(--soft-blue); color: var(--blue); }
.customer-type-badge.private { background: var(--soft-amber); color: #7a5200; }
.customer-type-badge.partner { background: var(--soft-green); color: var(--green); border: 1px solid #b8dec6; }
.customer-type-badge.supplier { background: #fff; color: var(--green); border: 1px solid #b8dec6; }
.customer-assignment { display: flex; flex-wrap: wrap; gap: 6px; min-width: 240px; align-items: flex-start; }
.assignment-chip { display: grid; gap: 2px; min-width: 118px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.78); }
.assignment-chip em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 700; }
.assignment-chip strong { color: var(--ink); font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.assignment-chip.commission { flex-basis: 100%; }
.assignment-chip.has-commission { border-color: #b8dec6; background: var(--soft-green); }
.assignment-chip.no-commission { background: #fff; }
small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: var(--soft-blue); color: var(--blue); font-weight: 700; font-size: 12px; }
.badge.danger { background: #fee4e2; color: var(--red); }

.filters { display: flex; gap: 10px; margin-bottom: 12px; }
.filters input { max-width: 360px; }
.form { padding: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
.research-panel { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-left: 5px solid var(--yellow); border-radius: 6px; background: #fff; }
.research-panel p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.research-output { grid-column: 1 / -1; display: grid; gap: 10px; }
.research-links { display: flex; gap: 8px; flex-wrap: wrap; }
.research-results { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 10px; }
.research-card { display: flex; justify-content: space-between; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--soft-blue); }
.research-card div { display: grid; gap: 4px; }
.research-card small { display: block; color: var(--muted); overflow-wrap: anywhere; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 14px; padding: 14px; display: grid; gap: 10px; }
legend { padding: 0 6px; font-weight: 700; color: var(--blue); }
label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.form-note { border: 1px solid var(--line); border-left: 4px solid var(--yellow); border-radius: 6px; padding: 9px 10px; background: #fffaf0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.contact-person { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fff; }
.contact-person strong { color: var(--ink); font-size: 13px; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.35; }
input, select, textarea { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checks label { display: flex; align-items: center; gap: 8px; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.checks input { width: 16px; min-height: 16px; }
.compact-checks { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.role-inline-form { display: grid; gap: 8px; min-width: 280px; }
.role-inline-form label { font-size: 12px; }
.role-inline-form select { min-height: 34px; }
.role-inline-form .compact-checks { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
.role-inline-form .compact-checks label { padding: 6px; }
.role-inline-form small { color: var(--muted); }
.users-layout { display: grid; grid-template-columns: minmax(340px, .85fr) minmax(620px, 1.35fr); gap: 14px; align-items: start; }
.user-list { display: grid; gap: 10px; padding: 12px; }
.user-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: start; border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: #fff; }
.user-card-main { display: grid; gap: 9px; min-width: 0; }
.user-card-main strong { display: block; color: var(--ink); overflow-wrap: anywhere; }
.user-card-main small { display: block; margin-top: 3px; overflow-wrap: anywhere; }
.role-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.start-password-box { display: grid; gap: 3px; width: fit-content; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.start-password-box span { color: var(--muted); font-size: 12px; }
.start-password-box strong { font-family: Consolas, "Courier New", monospace; color: var(--ink); overflow-wrap: anywhere; }
.start-password-box small { margin: 0; }
.user-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 250px; }
.user-card-actions form { margin: 0; }
.user-card-actions .button.small { white-space: nowrap; }
.user-role-details { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); overflow: hidden; }
.user-role-details summary { cursor: pointer; padding: 9px 11px; color: var(--blue); font-weight: 800; }
.user-role-details[open] summary { border-bottom: 1px solid var(--line); background: var(--soft-blue); }
.user-role-details .role-inline-form { padding: 12px; min-width: 0; }
.user-role-details .role-inline-form .compact-checks { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.checkbox-line { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.checkbox-line input { width: 16px; min-height: 16px; }
.inline-form { margin-top: 6px; }
.inline-details { border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.inline-details summary { cursor: pointer; padding: 9px 10px; color: var(--blue); font-weight: 800; }
.inline-details[open] summary { border-bottom: 1px solid var(--line); background: var(--soft-blue); }
.inline-details .form { padding: 12px; }
.inline-details fieldset { margin: 10px; }
.compact { display: grid; gap: 10px; }
.narrow { max-width: 640px; }
.intro { margin-bottom: 14px; color: var(--muted); }
.portal-invite-box { border: 1px solid var(--line); border-left: 5px solid var(--yellow); border-radius: 6px; padding: 12px; background: var(--soft-amber); display: grid; gap: 8px; }
.portal-invite-box strong { color: var(--dark); }
.portal-invite-box textarea { background: #fff; line-height: 1.45; min-height: 190px; }
.portal-message-panel { border-left: 5px solid var(--yellow); }
.portal-message-list { display: grid; gap: 10px; padding: 12px; }
.portal-message-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 12px; display: grid; gap: 8px; }
.portal-message-card.from-customer { background: var(--soft-amber); border-color: #f5cf75; }
.portal-message-meta { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.portal-message-delete { margin: 0; }
.button.danger-light { color: var(--red); border-color: #f8b4ad; background: #fff; }
.button.danger-light:hover { background: #fee4e2; }
.portal-message-card strong { display: block; color: var(--ink); }
.portal-message-card small { display: block; margin-top: 3px; color: var(--muted); }
.portal-message-card p { margin: 0; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-message-reply { border-top: 1px solid var(--line); padding: 12px; background: #fff; }

.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin-bottom: 14px; }
.detail-head h2 { font-size: 24px; margin: 8px 0 4px; }
.detail-head p { color: var(--muted); }
.compact-customer-head { align-items: stretch; padding: 13px 16px; gap: 14px; }
.customer-head-main { display: grid; gap: 8px; min-width: 0; flex: 1; }
.compact-customer-head h2 { margin: 5px 0 0; font-size: 27px; line-height: 1.1; }
.customer-head-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 13px; }
.customer-head-meta span { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: #f8fbfe; }
.customer-contact-strip { display: grid; grid-template-columns: minmax(260px, 1.4fr) repeat(4, minmax(150px, 1fr)); gap: 8px; }
.contact-chip { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.contact-chip span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.contact-chip a, .contact-chip strong { display: block; color: var(--ink); font-weight: 850; line-height: 1.25; overflow-wrap: anywhere; }
.contact-chip a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.contact-chip small { display: block; margin-top: 2px; color: var(--muted); line-height: 1.25; overflow-wrap: anywhere; }
.compact-head-actions { align-content: flex-start; justify-content: flex-end; min-width: 210px; }
.compact-head-actions .button { min-height: 38px; }
.customer-overview.compact-map-overview { grid-template-columns: minmax(0, 1fr) !important; gap: 10px; }
.customer-overview.compact-map-overview .contact-card { display: none !important; }
.compact-map-overview .map-card .panel-head { padding: 10px 12px !important; }
.compact-map-overview .map-preview { height: 235px; }
.compact-map-overview .map-hint { margin: 0; padding: 8px 12px; }
@media (max-width: 1280px) {
  .customer-contact-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-chip-wide { grid-column: 1 / -1; }
  .compact-head-actions { min-width: 0; }
}
@media (max-width: 640px) {
  .compact-customer-head { padding: 12px; }
  .customer-contact-strip { grid-template-columns: 1fr; }
  .contact-chip-wide { grid-column: auto; }
  .compact-map-overview .map-preview { height: 210px; }
}
.customer-overview { display: grid; grid-template-columns: minmax(320px, .95fr) minmax(340px, 1.05fr); gap: 14px; margin-bottom: 14px; }
.overview-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.overview-list { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 10px; padding: 14px 16px; }
.overview-list div { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fff; min-width: 0; }
.overview-list span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.overview-list a, .overview-list strong { display: block; overflow-wrap: anywhere; color: var(--ink); font-weight: 800; }
.overview-list a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 16px 16px; }
.map-card .panel-head { gap: 10px; }
.map-preview { width: 100%; height: 310px; border: 0; display: block; background: var(--soft-blue); }
.detail dl { display: grid; grid-template-columns: 150px 1fr; gap: 0; padding: 12px 16px 16px; margin: 0; }
.detail dt, .detail dd { border-bottom: 1px solid var(--line); padding: 8px 0; margin: 0; }
.detail dt { color: var(--muted); }
.notes { padding: 16px; line-height: 1.5; white-space: pre-wrap; }
.empty { color: var(--muted); padding: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 12px; }
.file-card { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; display: grid; }
.file-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--soft-blue); }
.pdf-preview { height: 150px; display: grid; place-items: center; align-content: center; gap: 6px; background: var(--soft-blue); color: var(--blue); text-align: center; }
.pdf-preview span { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 6px; background: #fff; border: 1px solid var(--line); font-weight: 800; }
.file-meta { padding: 10px; display: grid; gap: 4px; }
.file-meta span, .file-meta small { color: var(--muted); overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 10px; margin-top: 4px; font-size: 13px; }
.file-actions form { margin: 0; }
.file-visibility-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; }
.visibility-note { color: var(--green); font-weight: 800; }
.file-visibility-form button.link-button { display: inline !important; width: auto !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.link-button { border: 0; background: transparent; min-height: 0; padding: 0; color: var(--blue); font-size: 13px; }
.link-button.danger { color: var(--red); }
.table-actions .link-button,
.file-actions .link-button { width: auto; background: transparent; border: 0; min-height: 0; padding: 0; box-shadow: none; }
.table-actions .link-button.danger,
.file-actions .link-button.danger { color: var(--red); background: transparent; border: 0; }
.button.danger-outline,
button.danger-outline { background: #fff; border-color: #f8b4ad; color: var(--red); font-weight: 800; box-shadow: none; }
.button.danger-outline:hover,
button.danger-outline:hover { background: #fee4e2; border-color: var(--red); }
.finance-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); background: #fff; }
.finance-summary div { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--soft-blue); }
.finance-summary span { display: block; color: var(--muted); font-size: 12px; }
.finance-summary strong { display: block; margin-top: 4px; font-size: 20px; }
.finance-summary small { display: block; margin-top: 4px; color: var(--muted); }
.purchase-items-review { display: grid; gap: 10px; margin: 10px 0 14px; padding: 12px; border: 1px solid var(--line); border-left: 5px solid var(--yellow); border-radius: 6px; background: #fffaf0; }
.purchase-items-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.purchase-items-head strong { display: block; color: var(--ink); }
.purchase-items-head small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.purchase-item-row { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.purchase-item-description { color: var(--muted); }
.purchase-table td strong { overflow-wrap: anywhere; }
.purchase-table td { vertical-align: top; }
.assignment-pill { display: inline-flex; align-items: center; max-width: 100%; margin-bottom: 4px; padding: 3px 8px; border-radius: 999px; background: var(--soft-green); color: var(--green); font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.assignment-pill.muted { background: #f8fafc; color: var(--muted); border: 1px solid var(--line); }
.purchase-assignment-details { margin-top: 8px; min-width: 260px; }
.purchase-assignment-details summary { padding: 7px 9px; }
.purchase-assignment-form { display: grid; gap: 9px; min-width: 280px; }
.purchase-assignment-form select,
.purchase-assignment-form input { min-height: 34px; }
.purchase-items-compact { border-top: 1px solid var(--line); padding: 12px; background: #fff; }
.purchase-items-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.purchase-item-card { display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--soft-amber); }
.purchase-item-card strong { color: var(--ink); overflow-wrap: anywhere; }
.purchase-item-card small { color: var(--muted); }
.purchase-item-card span { color: var(--blue); font-weight: 800; }
.panel-body { padding: 12px 16px; }
.appointment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 12px; }
.appointment-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 12px; display: grid; gap: 10px; align-content: start; }
.appointment-card strong { display: block; margin-top: 6px; overflow-wrap: anywhere; }
.appointment-card small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.35; }
.appointment-form { border-top: 1px solid var(--line); padding: 12px; background: #fff; }
.inline-status-form, .table-status-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.inline-status-form select, .table-status-form select { min-width: 150px; min-height: 34px; }
.appointment-filters { align-items: end; }
.appointment-list-meta { display: grid; gap: 3px; min-width: 220px; }
.appointment-list-meta small { color: var(--muted); line-height: 1.35; }
.appointment-master-form { display: grid; gap: 14px; }
.appointment-participants-fieldset { margin: 0; }
.appointment-participant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.appointment-participant-option {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.appointment-participant-option span { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 800; overflow-wrap: anywhere; }
.appointment-participant-option input[type="checkbox"] { min-height: 0; }
.appointment-participant-option select { min-height: 34px; }
.appointment-participant-option small { color: var(--muted); line-height: 1.3; }
.map-hint { padding: 8px 12px 12px; background: #fff; }
.danger-zone { border-color: #f8b4ad; }
.danger-zone .panel-head { background: #fee4e2; color: var(--red); }
.danger-zone .intro { color: var(--red); }
.hardware-item { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.hardware-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hardware-actions form { margin: 0; }
.hardware-analysis-panel { grid-column: 1 / -1; }
.hardware-catalog-panel { grid-column: 1 / -1; }
.hardware-catalog-panel .panel-head small { display: block; margin-top: 4px; color: var(--muted); }
.hardware-filter-bar { display: grid; grid-template-columns: minmax(260px, 1.4fr) minmax(190px, .8fr) minmax(190px, .8fr) auto; gap: 10px; align-items: end; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.hardware-filter-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.hardware-catalog { display: grid; gap: 16px; padding: 14px 16px 16px; }
.hardware-category-section { display: grid; gap: 10px; }
.hardware-category-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: var(--soft-blue); }
.hardware-category-head h3 { margin: 0; font-size: 16px; color: var(--ink); }
.hardware-catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.hardware-catalog-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 12px; display: grid; gap: 10px; align-content: start; box-shadow: 0 8px 20px rgba(16,38,61,.05); }
.hardware-card-main { display: grid; gap: 6px; min-width: 0; }
.hardware-card-main strong { color: var(--ink); overflow-wrap: anywhere; line-height: 1.25; font-size: 16px; }
.hardware-card-main small { overflow-wrap: anywhere; }
.hardware-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hardware-specs div { border: 1px solid var(--line); border-radius: 6px; padding: 9px; background: #f8fafc; min-width: 0; }
.hardware-specs span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.hardware-specs strong { display: block; color: var(--ink); overflow-wrap: anywhere; font-size: 14px; }
.hardware-note { color: var(--muted); font-size: 13px; line-height: 1.4; max-height: 58px; overflow: hidden; }
.hardware-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hardware-card-actions form { margin: 0; }
.hardware-edit-details { background: var(--bg); }
.hardware-edit-details summary { background: #fff; }
.hardware-edit-details .form { background: #fff; }
.analysis-summary { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--soft-amber); color: var(--ink); line-height: 1.45; }
.analysis-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.analysis-facts div { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fff; min-width: 0; }
.analysis-facts span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.analysis-facts strong { display: block; color: var(--ink); overflow-wrap: anywhere; }
.analysis-json { margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.analysis-json summary { cursor: pointer; padding: 10px 12px; color: var(--blue); font-weight: 800; }
.analysis-json pre { margin: 0; padding: 12px; border-top: 1px solid var(--line); background: #f8fafc; color: var(--ink); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; }
.analysis-section { margin-top: 14px; }
.analysis-section legend { padding: 0 6px; }
.analysis-warning-box { margin-top: 14px; border: 1px solid #f2c078; border-left: 4px solid var(--yellow); border-radius: 8px; padding: 12px 14px; background: #fff8df; color: var(--ink); }
.analysis-warning-box strong { display: block; margin-bottom: 6px; color: #765312; }
.analysis-warning-box ul { margin: 0; padding-left: 18px; }
.analysis-warning-box li + li { margin-top: 4px; }
.analysis-position-list { display: grid; gap: 8px; }
.analysis-position-list div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: #fff; }
.analysis-position-list strong { min-width: 0; overflow-wrap: anywhere; }
.analysis-position-list span { color: var(--muted); white-space: nowrap; }
.hardware-suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.hardware-suggestion { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: #fff; display: grid; gap: 10px; }
.suggestion-check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 800; }
.suggestion-check input { width: 16px; min-height: 16px; }
.component-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 12px; }
.component-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 12px; display: grid; gap: 10px; }
.component-card span { display: inline-flex; width: fit-content; min-height: 22px; align-items: center; padding: 0 8px; border-radius: 999px; background: var(--soft-blue); color: var(--blue); font-size: 12px; font-weight: 800; }
.component-card strong { display: block; margin-top: 6px; }
.component-card small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.component-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.component-actions form { margin: 0; }
.component-actions .button { white-space: nowrap; }
.component-form { border-top: 1px solid var(--line); }
.monitoring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 12px; }
.monitoring-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 12px; display: grid; gap: 12px; }
.monitoring-card strong { display: block; margin-top: 8px; }
.monitoring-card small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.monitoring-form { border-top: 1px solid var(--line); }
.solar-panel { border-left: 5px solid var(--yellow); }
.solar-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px; padding: 12px; }
.solar-grid div { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: var(--soft-amber); }
.solar-grid span { display: block; color: var(--muted); font-size: 12px; }
.solar-grid strong { display: block; margin-top: 4px; font-size: 22px; }
.solar-grid small { display: block; margin-top: 4px; color: var(--muted); }
.solar-note { padding: 0 12px 12px; color: var(--muted); line-height: 1.45; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #f5f7fa 0%, #e8f2fb 100%); padding: 18px; }
.login-card { width: min(460px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0; display: grid; gap: 14px; overflow: hidden; box-shadow: 0 18px 42px rgba(16,38,61,.14); }
.login-brand { display: grid; justify-items: start; background: var(--dark); padding: 26px 26px 22px; border-bottom: 5px solid var(--yellow); }
.login-logo { width: 260px; max-width: 100%; height: auto; display: block; }
.login-intro { display: grid; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.login-intro h1 { font-size: 24px; }
.login-intro p { color: var(--muted); line-height: 1.45; }
.login-card .login-intro, .login-card .flash, .login-card label, .login-card button { margin-left: 26px; margin-right: 26px; }
.login-card button { margin-bottom: 26px; }

.portal-page { min-height: 100vh; background: #f3f6fa; }
.portal-shell { max-width: 1180px; margin: 0 auto; padding: 18px; }
.portal-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--dark); color: #fff; border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; border-bottom: 5px solid var(--yellow); }
.portal-header img { width: 220px; max-width: 70%; height: auto; display: block; }
.portal-header nav { display: flex; gap: 10px; align-items: center; }
.portal-header nav a { color: #fff; border: 1px solid rgba(255,255,255,.24); border-radius: 6px; padding: 8px 10px; text-decoration: none; }
.portal-hero { display: grid; gap: 8px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--yellow); border-radius: 6px; padding: 18px; margin-bottom: 14px; }
.portal-hero h1 { font-size: 28px; }
.portal-hero p { color: var(--muted); line-height: 1.45; }
.portal-card-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.portal-stat { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.portal-stat span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.portal-stat strong { display: block; font-size: 20px; overflow-wrap: anywhere; }
.portal-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.portal-summary-grid div { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px; box-shadow: 0 8px 20px rgba(16,38,61,.05); }
.portal-summary-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.portal-summary-grid strong { display: block; color: var(--ink); overflow-wrap: anywhere; line-height: 1.3; }
.portal-profile-grid { display: grid; grid-template-columns: minmax(420px, 1.35fr) minmax(320px, .85fr); gap: 14px; align-items: start; }

/* Sabosol CRM refresh: navigation and customer overview */
.shell { grid-template-columns: 260px minmax(0, 1fr); background: linear-gradient(180deg, #f6f8fb 0%, #eef3f8 100%); }
.sidebar {
  background: radial-gradient(circle at 20% 0%, rgba(246,196,69,.14), transparent 28%), linear-gradient(180deg, #10263d 0%, #0b1d30 100%);
  padding: 24px 18px;
  gap: 22px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08);
}
.brand { gap: 10px; padding: 0 0 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo { width: 198px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.18)); }
.brand span { color: rgba(226,236,247,.82); font-size: 13px; letter-spacing: 0; }
nav { gap: 4px; }
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: rgba(238,246,255,.88);
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
nav a:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #fff; transform: translateX(2px); }
nav a.active { background: linear-gradient(135deg, rgba(31,78,121,.95), rgba(39,94,141,.92)); border-color: rgba(246,196,69,.34); color: #fff; box-shadow: 0 10px 22px rgba(0,0,0,.18); }
.nav-dot { width: 8px; height: 8px; border-radius: 999px; background: rgba(246,196,69,.36); box-shadow: 0 0 0 4px rgba(246,196,69,.08); flex: 0 0 auto; }
nav a.active .nav-dot { background: var(--sabosol-gold); box-shadow: 0 0 0 4px rgba(246,196,69,.18); }
.side-card {
  border-radius: 12px;
  padding: 16px;
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  box-shadow: 0 14px 28px rgba(0,0,0,.12);
}
.side-card span { color: rgba(226,236,247,.72); }
.side-card strong { color: #fff; font-size: 15px; }
.side-card a { color: #fff; width: fit-content; border-bottom: 1px solid rgba(246,196,69,.45); }
main { padding: 26px 22px 34px; }
.topbar {
  min-height: 82px;
  padding: 4px 0 18px;
  border-bottom: 1px solid rgba(216,224,234,.8);
  margin-bottom: 18px;
}
.topbar h1 { font-size: 28px; line-height: 1.15; color: var(--text-main); }
.topbar p { color: var(--text-muted); font-size: 15px; }
.topbar .button.primary { min-height: 40px; border-radius: 9px; padding: 0 18px; box-shadow: 0 10px 20px rgba(31,78,121,.18); }
.topbar .button.primary:hover { transform: translateY(-1px); box-shadow: 0 13px 24px rgba(31,78,121,.22); }
.button, button { transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(246,196,69,.28); border-color: rgba(31,78,121,.55); box-shadow: 0 0 0 1px rgba(31,78,121,.08); }
.customer-list-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.customer-list-stats div {
  border: 1px solid rgba(216,224,234,.9);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow-row);
}
.customer-list-stats span { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 5px; }
.customer-list-stats strong { display: block; color: var(--text-main); font-size: 24px; line-height: 1.1; }
.customer-filter-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(190px, .7fr) minmax(160px, .55fr) minmax(150px, .5fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(216,224,234,.9);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}
.customer-filter-card input,
.customer-filter-card select {
  max-width: none;
  min-height: 44px;
  border-radius: 9px;
  border-color: #cfd9e6;
  background: #fbfdff;
}
.customer-filter-card button { min-height: 44px; border-radius: 9px; padding: 0 18px; font-weight: 800; }
.customer-list-panel {
  border: 0;
  background: transparent;
  overflow: visible;
  box-shadow: none;
}
.customer-list-panel.table-wrap { overflow-x: visible; }
.customer-crm-table {
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0 10px;
}
.customer-crm-table thead th {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 0 12px 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.customer-crm-table tbody tr {
  position: relative;
  isolation: isolate;
  transition: transform .15s ease, box-shadow .15s ease;
}
.customer-crm-table tbody tr::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 5px;
  border-radius: 999px;
  background: var(--sabosol-blue);
  z-index: 2;
}
.customer-crm-table tbody tr.is-private::before { background: var(--sabosol-gold); }
.customer-crm-table tbody tr.is-partner::before { background: #22a06b; }
.customer-crm-table tbody tr.is-won::before { background: #2f9461; }
.customer-crm-table tbody tr.is-lost::before { background: #d26b3d; }
.customer-crm-table tbody tr:hover { transform: translateY(-1px); }
.customer-crm-table tbody tr:hover td { box-shadow: 0 16px 34px rgba(16,38,61,.11); }
.customer-crm-table td {
  padding: 14px 12px;
  border-top: 1px solid rgba(216,224,234,.92);
  border-bottom: 1px solid rgba(216,224,234,.92);
  background: rgba(255,255,255,.94) !important;
  vertical-align: middle;
}
.customer-crm-table td:first-child {
  border-left: 1px solid rgba(216,224,234,.92);
  border-radius: 12px 0 0 12px;
  padding-left: 18px;
}
.customer-crm-table td:last-child {
  border-right: 1px solid rgba(216,224,234,.92);
  border-radius: 0 12px 12px 0;
}
.customer-crm-table tr.is-partner td { background: #f2faf5 !important; }
.customer-crm-table tr.is-private td { background: #fffdf7 !important; }
.customer-crm-table tr.is-lost td { background: #fff8f5 !important; }
.customer-title { min-width: 240px; gap: 7px; }
.customer-title strong {
  color: #0d4873;
  font-size: 16px;
  line-height: 1.22;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.customer-title:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.customer-title small { color: var(--text-muted); line-height: 1.35; }
.customer-title .partner-line { color: #0f7a4c; font-weight: 800; }
.customer-badges { gap: 6px; }
.customer-type-badge,
.badge,
.next-call-chip {
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  border: 1px solid transparent;
}
.customer-type-badge.private { background: #fff2c7; color: #704900; border-color: #f4d782; }
.customer-type-badge.business { background: #e9f3fb; color: #164f7b; border-color: #c8ddec; }
.customer-type-badge.partner { background: #e8f7ee; color: #17663f; border-color: #b9dec8; }
.customer-type-badge.supplier { background: #fff; color: #17663f; border-color: #b9dec8; }
.status-badge { background: #e9f3fb; color: #164f7b; border-color: #c8ddec; }
.status-gewonnen { background: #e8f7ee; color: #17663f; border-color: #b9dec8; }
.status-verloren { background: #fff0e8; color: #a33d14; border-color: #f4c0a4; }
.status-neu { background: #fff2c7; color: #704900; border-color: #f4d782; }
.priority-badge { background: #eef3f7; color: #31506c; border-color: #d9e2ec; }
.priority-hoch { background: #fff0e8; color: #9a3412; border-color: #f4c0a4; }
.priority-mittel { background: #e9f3fb; color: #164f7b; border-color: #c8ddec; }
.priority-niedrig { background: #edf7ed; color: #276749; border-color: #c2e0c6; }
.next-call-chip { display: inline-flex; align-items: center; background: #f8fafc; color: #40556c; border-color: #dbe4ef; }
.location-text { color: var(--text-main); font-weight: 650; overflow-wrap: anywhere; }
.customer-assignment {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 7px;
  min-width: 320px;
}
.assignment-chip {
  min-width: 0;
  border-radius: 9px;
  padding: 9px 10px;
  background: rgba(255,255,255,.86);
  border-color: #d8e3ee;
}
.assignment-chip em {
  color: #6d7c8f;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.assignment-chip strong { font-size: 13px; line-height: 1.25; color: #102033; }
.assignment-chip.commission { grid-column: 1 / -1; flex-basis: auto; }
.assignment-chip.has-commission { background: #eaf7ef; border-color: #bddfca; }
.assignment-chip.no-commission { background: #fbfdff; }
.customer-value { text-align: right; white-space: nowrap; }
.customer-value strong { display: inline-block; color: var(--text-main); font-size: 17px; line-height: 1; }
.customer-value span { margin-left: 4px; color: var(--text-muted); font-size: 12px; font-weight: 800; }
.customer-value.is-zero strong,
.customer-value.is-zero span { color: #7a8796; }
.customer-action { text-align: right; }
.customer-action .button.small {
  border-radius: 9px;
  min-height: 34px;
  padding: 0 13px;
  background: #fff;
  border-color: #cfd9e6;
  color: #164f7b;
  font-weight: 800;
}
.customer-action .button.small:hover { background: #164f7b; color: #fff; border-color: #164f7b; transform: translateY(-1px); box-shadow: 0 10px 18px rgba(31,78,121,.18); }

/* CRM premium pass: customer overview */
.sidebar {
  width: 260px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 36%),
    radial-gradient(circle at 36px 28px, rgba(246,196,69,.18), transparent 86px),
    linear-gradient(180deg, #102942 0%, #0b1d30 100%);
  padding: 22px 18px;
}
.brand {
  gap: 12px;
  padding: 2px 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-logo {
  width: 198px;
  padding: 2px 0;
}
.brand span {
  color: rgba(232,241,250,.76);
  font-size: 12px;
  letter-spacing: .01em;
}
nav { gap: 6px; }
nav a {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  padding: 6px 10px 6px 7px;
  border-radius: 12px;
  color: rgba(238,246,255,.88);
  font-weight: 650;
}
nav a:hover {
  background: rgba(255,255,255,.075);
  border-color: rgba(255,255,255,.12);
  transform: translateX(2px);
}
nav a.active {
  background: rgba(255,255,255,.11);
  border-color: rgba(246,196,69,.32);
  box-shadow: inset 3px 0 0 var(--sabosol-gold), 0 12px 26px rgba(0,0,0,.16);
}
.nav-dot { display: none; }
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  color: rgba(246,196,69,.9);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}
.nav-icon::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
nav a.active .nav-icon {
  background: var(--sabosol-gold);
  color: #10263d;
}
.side-card {
  border-radius: 14px;
  padding: 15px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  border: 1px solid rgba(255,255,255,.14);
}
.side-card span {
  color: rgba(232,241,250,.68);
  font-size: 12px;
}
.side-card strong { font-size: 16px; letter-spacing: 0; }
.side-card a {
  width: fit-content;
  color: rgba(255,255,255,.92);
  border: 0;
}
main { padding: 26px 28px 36px; }
.topbar {
  border-bottom: 0;
  margin-bottom: 16px;
}
.topbar h1 {
  font-size: 30px;
  letter-spacing: 0;
}
.topbar p {
  color: #61738a;
  font-size: 15px;
}
.customer-list-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin: 0 0 16px;
}
.customer-list-stats .customer-stat-card {
  position: relative;
  overflow: hidden;
  min-height: 106px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-xl);
  padding: 19px 20px 17px;
  background: linear-gradient(180deg, #fff, #fbfdff);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--crm-shadow-card);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.customer-list-stats .customer-stat-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 3px;
  background: linear-gradient(90deg, var(--crm-blue-700), rgba(22,79,123,.22));
  opacity: 1;
}
.customer-list-stats .customer-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31,90,137,.28);
  box-shadow: 0 18px 38px rgba(15,37,58,.12);
}
.customer-list-stats .customer-stat-card.money::after { background: linear-gradient(90deg, #20885a, rgba(32,136,90,.18)); }
.customer-list-stats .customer-stat-card.warning::after { background: linear-gradient(90deg, #d49a18, rgba(212,154,24,.18)); }
.customer-list-stats .customer-stat-card.money,
.customer-list-stats .customer-stat-card.warning {
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.customer-stat-icon {
  display: none !important;
}
.customer-stat-card.money .customer-stat-icon {
  background: var(--crm-green-50);
  color: var(--crm-green-700) !important;
  border-color: var(--crm-green-100);
}
.customer-stat-card.warning .customer-stat-icon {
  background: var(--crm-gold-50);
  color: var(--crm-gold-700) !important;
  border-color: var(--crm-gold-100);
}
.customer-list-stats .customer-stat-card > span:not(.customer-stat-icon) {
  display: block;
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}
.customer-list-stats .customer-stat-card strong {
  align-self: start;
  color: var(--text-main);
  font-size: 29px;
  line-height: 1;
}
.customer-filter-card {
  position: relative;
  grid-template-columns: minmax(260px, 1.35fr) minmax(190px, .75fr) minmax(150px, .52fr) minmax(150px, .52fr) auto;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-xl);
  background: rgba(255,255,255,.9);
  box-shadow: var(--crm-shadow-card);
}
.customer-filter-card::before {
  content: "Filter";
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f7fb;
  color: #68798e;
  font-size: 11px;
  font-weight: 850;
}
.customer-filter-card input,
.customer-filter-card select {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--crm-line);
  background: #fbfdff;
  color: var(--text-main);
}
.customer-filter-card input:focus,
.customer-filter-card select:focus {
  border-color: rgba(31,78,121,.55);
  box-shadow: var(--crm-focus);
}
.customer-filter-card button {
  min-height: 48px;
  border-radius: 12px;
  padding: 0 20px;
  background: linear-gradient(180deg, #235b8b, #174a73);
  border-color: #174a73;
  box-shadow: 0 12px 22px rgba(23,74,115,.2);
}
.customer-filter-card button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(23,74,115,.24);
}
.cockpit-filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 16px;
}
.cockpit-filter-note strong {
  color: var(--color-primary-dark);
}
.cockpit-filter-note span {
  flex: 1;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}
.customer-list-panel {
  margin-top: 4px;
}
.customer-crm-table {
  min-width: 1120px;
  border-spacing: 0 12px;
}
.customer-crm-table thead th {
  background: rgba(255,255,255,.48);
  color: #6a7d92;
  border-top: 1px solid rgba(220,229,239,.78);
  border-bottom: 1px solid rgba(220,229,239,.78);
  padding: 10px 12px;
  font-size: 11px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.customer-crm-table thead th:first-child {
  border-left: 1px solid rgba(220,229,239,.78);
  border-radius: 12px 0 0 12px;
}
.customer-crm-table thead th:last-child {
  border-right: 1px solid rgba(220,229,239,.78);
  border-radius: 0 12px 12px 0;
}
.customer-crm-table tbody tr {
  filter: drop-shadow(0 10px 20px rgba(15,37,58,.055));
}
.customer-crm-table tbody tr:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 16px 30px rgba(15,37,58,.12));
}
.customer-crm-table tbody tr:hover td { box-shadow: none; }
.customer-crm-table tbody tr::before {
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  opacity: .95;
}
.customer-crm-table td {
  padding: 15px 12px;
  border-top: 1px solid var(--crm-line);
  border-bottom: 1px solid var(--crm-line);
  background: var(--crm-card) !important;
}
.customer-crm-table td:first-child {
  border-left: 1px solid var(--crm-line);
  border-radius: 15px 0 0 15px;
  padding-left: 20px;
}
.customer-crm-table td:last-child {
  border-right: 1px solid var(--crm-line);
  border-radius: 0 15px 15px 0;
}
.customer-crm-table tr.is-private td { background: linear-gradient(90deg, #fffdf7, #fff) !important; }
.customer-crm-table tr.is-partner td { background: linear-gradient(90deg, #f1fbf5, #fff) !important; }
.customer-crm-table tr.is-lost td { background: linear-gradient(90deg, #fff8f5, #fff) !important; }
.customer-title {
  min-width: 250px;
  gap: 7px;
}
.customer-title strong {
  color: #0f4770;
  font-size: 17px;
  line-height: 1.18;
  font-weight: 850;
}
.customer-title small {
  color: #65768c;
  font-size: 13px;
}
.customer-title .partner-line {
  color: var(--crm-green-700);
  font-weight: 850;
}
.customer-badges {
  gap: 6px;
  margin-bottom: 1px;
}
.customer-type-badge,
.badge,
.next-call-chip {
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}
.customer-type-badge.private { background: var(--crm-gold-50); color: var(--crm-gold-700); border-color: var(--crm-gold-100); }
.customer-type-badge.business { background: var(--crm-blue-50); color: var(--crm-blue-700); border-color: var(--crm-blue-100); }
.customer-type-badge.partner { background: var(--crm-green-50); color: var(--crm-green-700); border-color: var(--crm-green-100); }
.customer-type-badge.supplier { background: #fff; color: var(--crm-green-700); border-color: var(--crm-green-100); }
.status-badge { background: var(--crm-blue-50); color: var(--crm-blue-700); border-color: var(--crm-blue-100); }
.status-gewonnen { background: var(--crm-green-50); color: var(--crm-green-700); border-color: var(--crm-green-100); }
.status-verloren { background: var(--crm-orange-50); color: var(--crm-orange-700); border-color: var(--crm-orange-100); }
.status-neu { background: var(--crm-gold-50); color: var(--crm-gold-700); border-color: var(--crm-gold-100); }
.status-offen { background: var(--crm-gray-50); color: var(--crm-gray-700); border-color: var(--crm-gray-100); }
.priority-badge { background: var(--crm-gray-50); color: var(--crm-gray-700); border-color: var(--crm-gray-100); }
.priority-hoch { background: var(--crm-orange-50); color: var(--crm-orange-700); border-color: var(--crm-orange-100); }
.priority-mittel { background: var(--crm-blue-50); color: var(--crm-blue-700); border-color: var(--crm-blue-100); }
.priority-niedrig { background: var(--crm-green-50); color: var(--crm-green-700); border-color: var(--crm-green-100); }
.next-call-chip {
  background: #fff;
  color: #425872;
  border-color: var(--crm-line);
}
.location-text {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: #21364d;
  font-weight: 750;
}
.customer-assignment {
  min-width: 300px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.assignment-chip {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px;
  align-items: baseline;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.assignment-chip em {
  color: #718198;
  font-size: 11px;
  font-weight: 850;
}
.assignment-chip strong {
  color: #15283d;
  font-size: 13px;
  font-weight: 850;
}
.assignment-chip.assignment-meta {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f7fafc;
  border: 1px solid var(--crm-line-soft);
}
.assignment-chip.commission {
  flex-basis: 100%;
  width: fit-content;
  max-width: 100%;
  margin-top: 1px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--crm-line);
  background: var(--crm-gray-50);
}
.assignment-chip.commission-pending {
  background: var(--crm-blue-50);
  border-color: var(--crm-blue-100);
}
.assignment-chip.commission-pending strong { color: var(--crm-blue-700); }
.assignment-chip.commission-none,
.assignment-chip.commission-empty {
  background: var(--crm-gray-50);
  border-color: var(--crm-gray-100);
}
.assignment-chip.commission-none strong,
.assignment-chip.commission-empty strong { color: var(--crm-gray-700); }
.assignment-chip.commission-active {
  background: linear-gradient(90deg, var(--crm-green-50), var(--crm-gold-50));
  border-color: #cfe3bb;
}
.assignment-chip.commission-active strong { color: var(--crm-green-700); }
.customer-value {
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.customer-value strong {
  color: #0f253a;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}
.customer-value span {
  margin-left: 5px;
  color: #718198;
  font-size: 11px;
  font-weight: 900;
}
.customer-value.is-zero strong,
.customer-value.is-zero span {
  color: #8793a3;
  font-weight: 800;
}
.customer-action .button.small {
  min-height: 36px;
  border-radius: 10px;
  padding: 0 14px;
  background: #fff;
  color: var(--crm-blue-700);
  border-color: var(--crm-line);
}
.customer-action .button.small:hover {
  background: var(--crm-blue-700);
  border-color: var(--crm-blue-700);
}

@media (max-width: 1280px) {
  .customer-list-panel.table-wrap { overflow-x: auto; }
}

@media (max-width: 980px) {
  .shell, .grid.two, .users-layout, .form-grid, .research-panel, .research-results, .finance-summary, .solar-grid, .kpis, .cols, .checks, .dashboard-grid, .customer-overview, .overview-list, .portal-card-grid, .portal-summary-grid, .portal-profile-grid, .hardware-filter-bar, .appointment-grid, .customer-list-stats, .customer-filter-card { grid-template-columns: 1fr; }
  .sidebar { width: auto; position: static; padding: 14px; gap: 14px; max-height: none; overflow: visible; }
  .brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .brand-logo { width: 170px; }
  nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  nav a { white-space: nowrap; padding: 7px 10px; grid-template-columns: 28px auto; min-width: fit-content; }
  .nav-group { flex: 0 0 190px; }
  .nav-group-items { max-height: none; padding-left: 0; }
  .nav-group-items a { white-space: nowrap; }
  .side-card { margin-top: 0; }
  main { padding: 14px; }
  .topbar, .filters, .dashboard-hero { flex-direction: column; align-items: stretch; }
  .customer-filter-card { display: grid; }
  .customer-list-panel.table-wrap { overflow-x: auto; }
  .dashboard-actions { justify-content: stretch; }
  .dashboard-actions .button { flex: 1; }
  .panel-head, .detail-head, .hardware-item, .research-card { flex-direction: column; align-items: stretch; }
  .inline-actions, .hardware-actions, .hardware-filter-actions, .quick-actions { justify-content: flex-start; }
  .detail dl { grid-template-columns: 1fr; }
  .detail dt { border-bottom: 0; padding-bottom: 2px; }
  .detail dd { padding-top: 0; }
  .form-grid, fieldset, label, .panel, .research-panel { min-width: 0; }
  .user-card { grid-template-columns: 1fr; }
  .user-card-actions { justify-content: flex-start; max-width: none; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  input, select, textarea, button { font-size: 16px; }
  main { padding: 8px; }
  h1 { font-size: 23px; }
  .topbar { gap: 12px; margin-bottom: 12px; }
  .topbar .button, .dashboard-actions .button, .actions .button, .actions button { width: 100%; }
  .brand-logo { width: 150px; }
  .sidebar { padding: 12px 10px; }
  nav a { padding: 9px 10px; border: 1px solid rgba(255,255,255,.12); }
  .panel { margin-bottom: 10px; }
  .form.panel { border: 0; background: transparent; padding: 0; overflow: visible; }
  .panel-head, .detail-head, .notes { padding: 12px; }
  fieldset { padding: 12px 10px; margin-bottom: 12px; background: #fff; }
  legend { font-size: 18px; }
  label { font-size: 14px; }
  .research-panel { padding: 12px; margin-bottom: 12px; }
  .actions, .file-actions, .component-actions, .table-actions { flex-wrap: wrap; }
  .button, button { width: 100%; min-height: 42px; }
  .user-card-actions { display: grid; grid-template-columns: 1fr; }
  .table-actions .button, .table-actions button { width: auto; min-height: 34px; }
  .link-button { width: auto; }
  .file-grid, .component-grid, .monitoring-grid, .hardware-suggestions, .hardware-catalog-grid, .hardware-specs, .appointment-grid { grid-template-columns: 1fr; }
  .inline-status-form, .table-status-form { align-items: stretch; flex-direction: column; }
  .file-card img, .pdf-preview { height: 180px; }
  .kpis strong { font-size: 24px; }
  .dashboard-hero h2, .detail-head h2 { font-size: 22px; }
  .research-links { display: grid; grid-template-columns: 1fr; }
  input, select, textarea { min-height: 46px; padding: 10px 12px; }
  textarea { min-height: 110px; }
  th, td { padding: 9px; }
  .table-wrap table { min-width: 680px; }
  .customer-title { min-height: 42px; justify-content: center; }
  .customer-list-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .customer-list-stats .customer-stat-card {
    min-height: 96px;
    grid-template-columns: 36px 1fr;
    padding: 12px;
    border-radius: 14px;
  }
  .customer-stat-icon { width: 36px; height: 36px; border-radius: 11px; }
  .customer-list-stats .customer-stat-card strong { font-size: 22px; }
  .customer-filter-card {
    padding: 14px 10px 10px;
    gap: 8px;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15,37,58,.07);
  }
  .customer-list-panel.table-wrap { overflow: visible; }
  .customer-list-panel .customer-crm-table { min-width: 0; border-spacing: 0; display: block; }
  .customer-crm-table thead { display: none; }
  .customer-crm-table tbody { display: grid; gap: 12px; }
  .customer-crm-table tbody tr {
    display: grid;
    gap: 9px;
    padding: 16px 14px 14px 20px;
    border: 1px solid rgba(216,224,234,.95);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(15,37,58,.08);
    filter: none;
  }
  .customer-crm-table tbody tr::before { top: 16px; bottom: 16px; left: 8px; }
  .customer-crm-table tbody tr:hover { transform: none; }
  .customer-crm-table tbody tr:hover td { box-shadow: none; }
  .customer-crm-table td {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 0;
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
  }
  .customer-crm-table td:first-child,
  .customer-crm-table td:last-child {
    border: 0;
    border-radius: 0;
    padding-left: 0;
  }
  .customer-crm-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 850;
  }
  .customer-crm-table td:first-child {
    grid-template-columns: 1fr;
  }
  .customer-crm-table td:first-child::before,
  .customer-crm-table .customer-action::before { display: none; }
  .customer-title { min-width: 0; min-height: 0; justify-content: start; }
  .customer-title strong { font-size: 19px; }
  .customer-badges { margin-bottom: 2px; }
  .customer-assignment {
    min-width: 0;
    display: flex;
    gap: 7px;
  }
  .assignment-chip.commission {
    width: 100%;
    flex-basis: 100%;
    border-radius: 12px;
  }
  .customer-value {
    text-align: left;
    display: flex !important;
    align-items: baseline;
  }
  .customer-value strong { font-size: 20px; }
  .customer-action { text-align: left; }
  .customer-action .button.small { width: 100%; min-height: 44px; border-radius: 12px; }
  .overview-list { padding: 12px; }
  .quick-actions { padding: 0 12px 12px; }
  .map-preview { height: 240px; }
  .portal-shell { padding: 10px; }
  .portal-header { align-items: stretch; flex-direction: column; }
  .portal-header nav { display: grid; grid-template-columns: 1fr; }
  .portal-header nav a { text-align: center; }
  .portal-hero h1 { font-size: 24px; }
}

/* Final shared app theme: keep this block last so every page uses the same shell styling. */
body {
  background:
    radial-gradient(circle at 82% 6%, rgba(31, 90, 137, .07), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, var(--app-bg, #f3f6fa) 100%);
  color: var(--app-ink, #102033);
}

.sidebar {
  background: linear-gradient(180deg, #102942 0%, #0b1d30 100%);
  padding: 22px 18px;
  gap: 22px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08), 12px 0 32px rgba(15,37,58,.08);
}

.brand {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-logo {
  width: 200px;
}

nav {
  gap: 7px;
}

nav a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  padding: 7px 11px 7px 7px;
  border-radius: 12px;
  color: rgba(238,246,255,.9);
  font-weight: 700;
  transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  transform: translateX(2px);
}

nav a.active {
  background: rgba(255,255,255,.13);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--app-gold, #f6c445), 0 12px 26px rgba(0,0,0,.16);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  color: var(--app-gold, #f6c445);
}

.nav-icon::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

nav a.active .nav-icon {
  background: var(--app-gold, #f6c445);
  color: #10263d;
}

.side-card {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255,255,255,.045);
  box-shadow: 0 14px 28px rgba(0,0,0,.13);
}

main {
  padding: 28px 22px;
}

.panel,
.dashboard-hero,
.research-panel,
.portal-invite-box,
.inline-details,
.partner-card,
.list-item,
.tool-card,
.user-card,
fieldset {
  border: 1px solid var(--app-border, #dce5ef);
  border-radius: var(--app-radius-xl, 16px);
  background: rgba(255,255,255,.94);
  box-shadow: var(--app-shadow-soft, 0 8px 22px rgba(15,37,58,.06));
}

.panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-head,
.detail-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--app-border-soft, #edf2f7);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.form,
.panel > form.form {
  padding: 18px;
}

fieldset {
  padding: 16px;
  margin-bottom: 16px;
}

legend {
  color: var(--app-blue-dark, #174a73);
  font-weight: 850;
}

label {
  color: var(--app-muted, #63738a);
  font-weight: 650;
}

input,
select,
textarea {
  min-height: 42px;
  border-radius: var(--app-radius-md, 10px);
  border-color: var(--app-border, #dce5ef);
  background: #fff;
  color: var(--app-ink, #102033);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--app-gold, #f6c445);
  box-shadow: var(--app-focus, 0 0 0 4px rgba(246,196,69,.22));
}

.button,
button {
  min-height: 40px;
  border-radius: var(--app-radius-md, 10px);
  border-color: var(--app-border, #dce5ef);
  background: #fff;
  color: var(--app-blue-dark, #174a73);
  font-weight: 750;
}

.button.primary,
button.primary {
  background: linear-gradient(180deg, var(--app-blue, #1f5a89), var(--app-blue-dark, #174a73));
  border-color: var(--app-blue-dark, #174a73);
  color: #fff;
  box-shadow: 0 12px 22px rgba(23,74,115,.2);
}

.button.ghost {
  background: #f4f8fc;
  border-color: #d7e6f2;
}

.upload-button {
  border-color: var(--app-gold, #f6c445);
  background: linear-gradient(180deg, #ffd761, var(--app-gold, #f6c445));
  border-radius: var(--app-radius-md, 10px);
}

.kpis {
  gap: 14px;
}

.kpis div {
  min-height: 104px;
  border-radius: var(--app-radius-xl, 16px);
  border-color: var(--app-border, #dce5ef);
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: var(--app-shadow, 0 14px 34px rgba(15,37,58,.08));
}

.kpis .warning {
  background: linear-gradient(180deg, #fff, #fffaf0);
}

.kpis .money {
  background: linear-gradient(180deg, #fff, #f0faf4);
}

.filters {
  padding: 14px;
  border: 1px solid var(--app-border, #dce5ef);
  border-radius: var(--app-radius-xl, 16px);
  background: rgba(255,255,255,.94);
  box-shadow: var(--app-shadow-soft, 0 8px 22px rgba(15,37,58,.06));
}

.filters input,
.filters select {
  max-width: none;
}

th {
  background: #f6f9fc;
  color: #60748b;
  border-bottom: 1px solid var(--app-border, #dce5ef);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

td {
  background: #fff;
  border-bottom: 1px solid var(--app-border-soft, #edf2f7);
}

tbody tr:nth-child(even) td {
  background: #f8fbfe;
}

tbody tr:hover td {
  background: #f3f8fd;
}

.badge,
.mini-badge,
.customer-type-badge {
  border-radius: 999px;
  min-height: 24px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  border: 1px solid transparent;
}

.dashboard-hero {
  border-left: 5px solid var(--app-gold, #f6c445);
  border-radius: var(--app-radius-xl, 16px);
}

.list-item,
.partner-card,
.tool-card,
.user-card {
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.list-item:hover,
.partner-card:hover,
.tool-card:hover,
.user-card:hover {
  transform: translateY(-1px);
  border-color: #c9d9e8;
  box-shadow: var(--app-shadow, 0 14px 34px rgba(15,37,58,.08));
}

@media (max-width: 980px) {
  nav a:hover {
    transform: none;
  }

  .sidebar {
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  main {
    padding: 10px;
  }

  .panel,
  .dashboard-hero,
  .filters,
  fieldset {
    border-radius: 14px;
  }

  .filters {
    display: grid;
    gap: 10px;
  }
}

/* Final tablet and phone overrides */
@media (max-width: 1180px) and (min-width: 781px) {
  main {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
  }

  .customer-list-stats,
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two,
  .dashboard-grid,
  .users-layout,
  .portal-profile-grid {
    grid-template-columns: 1fr;
  }

  .upload-wait-card {
    width: min(460px, calc(100vw - 56px));
  }
}

@media (max-width: 780px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 0;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 14px 30px rgba(6, 23, 39, .16);
  }

  .brand {
    padding-bottom: 10px;
    margin-bottom: 6px;
  }

  .brand-logo {
    width: 154px;
    max-width: 72vw;
  }

  .brand span {
    font-size: 12px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 12px;
    grid-template-columns: 22px auto;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
  }

  .nav-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
  }

  main {
    padding: 14px 12px 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 26px;
    line-height: 1.12;
  }

  .topbar p,
  .muted {
    font-size: 14px;
  }

  .topbar .button.primary,
  .topbar .btn.primary {
    width: 100%;
    min-height: 46px;
  }

  .panel,
  .dashboard-hero,
  .filters,
  .customer-filter-card,
  .detail-head,
  fieldset {
    border-radius: 14px;
  }

  .panel,
  .dashboard-hero,
  fieldset {
    box-shadow: 0 10px 28px rgba(15, 37, 58, .06);
  }

  .form,
  .panel > form.form {
    padding: 14px;
  }

  .form-grid,
  .form-grid.three,
  .form-grid.four,
  .grid.two,
  .kpis,
  .customer-list-stats,
  .portal-card-grid,
  .portal-summary-grid,
  .portal-profile-grid,
  .hardware-suggestions,
  .hardware-catalog-grid,
  .file-grid,
  .component-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .button,
  .btn,
  button,
  input[type="submit"] {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  textarea {
    line-height: 1.45;
  }

  .side-card {
    display: none;
  }

  .upload-wait-overlay {
    align-items: flex-end;
    padding:
      max(18px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .upload-wait-card {
    width: 100%;
    max-width: none;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .upload-wait-spinner {
    width: 44px;
    height: 44px;
  }

  .portal-shell {
    width: min(100%, 1120px);
    padding: 12px;
  }

  .portal-header {
    border-radius: 14px;
    padding: 14px;
    gap: 12px;
  }

  .portal-header img {
    max-width: 220px;
  }

  .portal-header nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding: 0;
  }

  .portal-header nav a {
    display: flex;
    justify-content: center;
    min-height: 44px;
    text-align: center;
  }
}

@media (max-width: 430px) {
  main {
    padding: 12px 10px 22px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .customer-list-stats .stat-card,
  .kpis div {
    min-height: 88px;
  }

  .panel-head,
  .detail-head {
    padding: 13px;
  }

  .upload-wait-card strong {
    font-size: 18px;
  }

  .upload-wait-card span:last-child {
    font-size: 13px;
  }
}

/* Final live override: form controls and colorful UI accents. */
body {
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.12), rgba(246, 196, 69, 0) 28%),
    linear-gradient(215deg, rgba(47, 155, 114, 0.08), rgba(47, 155, 114, 0) 30%),
    linear-gradient(180deg, #f8fbff 0%, #edf4fa 100%);
}

.panel,
.dashboard-hero,
.detail-hero,
.portal-card,
.tool-card,
.research-card,
.user-card,
.partner-card,
.hardware-card,
.hardware-item,
.crm-table-wrap,
.filter-card,
.customer-list-stats .stat-card,
.kpis div {
  border-color: rgba(31, 90, 137, 0.16);
  box-shadow: 0 14px 34px rgba(15, 46, 74, 0.08);
}

.panel-head,
.detail-head,
.portal-card > .panel-head,
.crm-table-head {
  background:
    linear-gradient(90deg, rgba(31, 90, 137, 0.08), rgba(255, 255, 255, 0.96) 42%, rgba(246, 196, 69, 0.12));
}

.panel-head h2,
.detail-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.panel-head h2::before,
.detail-head h2::before {
  content: "";
  width: 7px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--app-gold), var(--app-blue));
  box-shadow: 0 5px 12px rgba(246, 196, 69, 0.28);
}

.customer-list-stats .stat-card,
.kpis div {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 254, 0.92)),
    #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.customer-list-stats .stat-card::after,
.kpis div::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--app-blue), #2f8fcb);
}

.customer-list-stats .stat-card:nth-child(3)::after,
.kpis div:nth-child(3)::after {
  background: linear-gradient(90deg, #2f9b72, #79c78f);
}

.customer-list-stats .stat-card:nth-child(4)::after,
.kpis div:nth-child(4)::after {
  background: linear-gradient(90deg, var(--app-gold), #e69d25);
}

.customer-list-stats .stat-card:hover,
.kpis div:hover,
.status-card:hover,
.customer-row:hover,
.partner-card:hover,
.hardware-card:hover,
.hardware-item:hover,
.user-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(15, 46, 74, 0.12);
}

.badge,
.mini-badge,
.status-badge,
.priority-badge,
.customer-type-badge,
.pill,
.role-pill {
  border-radius: 999px;
  border: 1px solid rgba(31, 90, 137, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.button.primary,
.btn.primary,
button.primary,
input[type="submit"] {
  background: linear-gradient(135deg, var(--app-blue), #164e7d);
  box-shadow: 0 12px 24px rgba(31, 90, 137, 0.20);
}

.button.primary:hover,
.btn.primary:hover,
button.primary:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(31, 90, 137, 0.26);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(246, 196, 69, 0.95);
  box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.18);
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  margin: 0;
  flex: 0 0 18px;
  display: inline-block;
  vertical-align: middle;
  accent-color: var(--app-blue);
  box-shadow: none;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.20);
}

.checkline,
.checkbox-line,
.suggestion-check,
.checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 90, 137, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.12), rgba(255, 255, 255, 0.96) 32%),
    #fff;
  color: var(--app-ink);
  box-sizing: border-box;
}

.checkline:hover,
.checkbox-line:hover,
.suggestion-check:hover,
.checks label:hover {
  border-color: rgba(31, 90, 137, 0.28);
  background:
    linear-gradient(90deg, rgba(47, 143, 203, 0.10), rgba(255, 255, 255, 0.96) 36%),
    #fff;
}

.checkline input[type="checkbox"],
.checkbox-line input[type="checkbox"],
.suggestion-check input[type="checkbox"],
.checks label input[type="checkbox"] {
  flex: 0 0 18px;
}

@media (max-width: 900px) {
  .panel,
  .dashboard-hero,
  .detail-hero,
  .portal-card,
  .filter-card {
    box-shadow: 0 10px 24px rgba(15, 46, 74, 0.08);
  }

  .checkline,
  .checkbox-line,
  .suggestion-check,
  .checks label {
    min-height: 48px;
  }
}

/* Final tablet/iPad guard: prevent desktop sidebar and wide grids from clipping content. */
@media (min-width: 641px) and (max-width: 1366px) {
  html,
  body {
    overflow-x: hidden;
  }

  .shell {
    display: block !important;
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
  }

  .sidebar {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 14px 16px 12px !important;
    box-sizing: border-box !important;
    border-radius: 0 0 22px 22px;
  }

  .brand {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 0 0 10px !important;
    margin: 0 0 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.13) !important;
  }

  .brand img {
    width: min(210px, 36vw) !important;
    max-width: 210px !important;
    height: auto !important;
  }

  .brand small {
    white-space: nowrap !important;
  }

  .sidebar nav,
  .sidebar .nav {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    overflow-x: auto !important;
    padding: 0 0 7px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar nav::-webkit-scrollbar,
  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar nav a,
  .sidebar .nav a {
    flex: 0 0 auto !important;
    min-height: 42px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
  }

  .sidebar .userbox,
  .userbox {
    margin-top: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    max-width: none !important;
  }

  main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 22px 18px 34px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .page-title-row {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
  }

  .kpis,
  .customer-list-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .dashboard-grid,
  .grid-2,
  .split,
  .form-grid.two,
  .two-column {
    grid-template-columns: 1fr !important;
  }

  .dashboard-hero,
  .detail-hero,
  .panel,
  .portal-card {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .dashboard-actions,
  .hero-actions {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }
}

@media (max-width: 640px) {
  .shell {
    display: block !important;
  }

  .sidebar {
    position: relative !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 12px !important;
    border-radius: 0 0 18px 18px;
  }

  .sidebar nav,
  .sidebar .nav {
    display: flex !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding-bottom: 6px !important;
  }

  .sidebar nav a,
  .sidebar .nav a {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  main {
    padding: 18px 12px 30px !important;
    overflow-x: hidden !important;
  }

  .kpis,
  .customer-list-stats {
    grid-template-columns: 1fr !important;
  }
}

/* iPad landscape polish: compact top navigation and denser content without clipping. */
@media (min-width: 981px) and (max-width: 1366px) and (orientation: landscape) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    z-index: 30;
    display: grid !important;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(150px, auto);
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 10px 16px !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  .brand {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .brand-logo,
  .brand img {
    width: min(176px, 18vw) !important;
    max-width: 176px !important;
  }

  .brand span {
    display: none !important;
  }

  .sidebar nav,
  .sidebar .nav {
    min-width: 0 !important;
    padding: 0 2px 4px !important;
  }

  .sidebar nav a,
  .sidebar .nav a {
    min-height: 40px !important;
    padding: 7px 10px !important;
    font-size: 13px !important;
  }

  .sidebar .side-card,
  .sidebar .userbox,
  .side-card,
  .userbox {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
    box-shadow: none !important;
  }

  .sidebar .side-card {
    display: grid !important;
    gap: 2px !important;
  }

  .sidebar .side-card span,
  .sidebar .side-card strong,
  .sidebar .side-card a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 18px 18px 32px !important;
    overflow-x: hidden !important;
  }

  .topbar {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 14px !important;
  }

  .topbar h1 {
    font-size: 26px !important;
  }

  .topbar .button {
    flex: 0 0 auto;
  }

  .kpis,
  .customer-list-stats,
  .portal-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  .dashboard-grid > .activity-panel,
  .dashboard-grid > .dashboard-portal-messages {
    grid-column: 1 / -1 !important;
  }

  .customer-overview,
  .portal-profile-grid,
  .users-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  .form-grid,
  .form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .form-grid.three,
  .form-grid.four,
  .hardware-filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .panel,
  .dashboard-hero,
  .detail-hero,
  .portal-card {
    max-width: 100% !important;
  }

  .table-wrap,
  .crm-table-wrap {
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 981px) and (max-width: 1100px) and (orientation: landscape) {
  .sidebar {
    grid-template-columns: minmax(140px, 160px) minmax(0, 1fr);
  }

  .sidebar .side-card {
    display: none !important;
  }

  .brand-logo,
  .brand img {
    width: 148px !important;
  }
}

.back-to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 46px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(16, 38, 61, .18);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f5f8fc);
  color: var(--app-blue-dark, #174a73);
  box-shadow: 0 14px 34px rgba(15, 37, 58, .18);
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--app-gold, #f6c445);
  color: #10263d;
  font-size: 16px;
  font-weight: 900;
}

.back-to-top:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 90, 137, .3);
  box-shadow: 0 18px 40px rgba(15, 37, 58, .22);
}

.back-to-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(246, 196, 69, .26), 0 14px 34px rgba(15, 37, 58, .18);
}

body.is-uploading .back-to-top {
  display: none;
}

.portal-consent-shell {
  max-width: 920px;
}

.portal-consent-panel .panel-head p {
  margin: 4px 0 0;
  color: var(--app-muted, #63738a);
  font-size: 13px;
}

.portal-consent-panel .form {
  display: grid;
  gap: 16px;
}

.consent-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--app-ink, #102033);
}

.consent-list li {
  line-height: 1.45;
}

.consent-check {
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgba(246, 196, 69, .42);
  border-radius: 12px;
  background: #fffaf0;
  color: var(--app-ink, #102033);
}

.portal-header {
  flex-wrap: nowrap;
  min-width: 0;
  overflow: visible;
}

.portal-header img {
  flex: 0 1 auto;
}

.portal-header nav,
.portal-header .portal-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: max-content;
  max-width: none;
  overflow: visible;
}

.portal-header nav a,
.portal-header .portal-nav a,
.portal-header .portal-logout-link {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto !important;
  min-width: 0;
  min-height: 46px;
  max-width: none;
  padding: 0 16px !important;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 10px !important;
  background: rgba(255, 255, 255, .08);
  color: #fff !important;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.1;
  overflow: visible;
  text-align: center;
  text-decoration: none;
  text-overflow: clip;
  white-space: nowrap;
  box-shadow: none;
}

.portal-header nav a:hover,
.portal-header .portal-nav a:hover,
.portal-header .portal-logout-link:hover {
  background: rgba(255, 255, 255, .16) !important;
  border-color: rgba(255, 255, 255, .44) !important;
  color: #fff !important;
  transform: none !important;
}

.portal-logout-secondary {
  min-width: 134px;
}

@media (max-width: 640px) {
  .portal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-header nav,
  .portal-header .portal-nav {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
  }

  .portal-header nav a,
  .portal-header .portal-nav a,
  .portal-header .portal-logout-link {
    width: 100% !important;
  }
}

.portal-legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 20px auto 4px;
  color: var(--app-muted, #63738a);
  font-size: 13px;
}

.portal-legal-footer a {
  color: var(--app-blue-dark, #174a73);
  font-weight: 750;
  text-decoration: none;
}

.portal-legal-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 26px auto 0;
  padding: 16px 8px 2px;
  color: var(--app-muted, #63738a);
  font-size: 13px;
}

.app-legal-footer a {
  color: var(--app-blue-dark, #174a73);
  font-weight: 750;
  text-decoration: none;
}

.app-legal-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page {
  max-width: 960px;
}

.legal-content {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.legal-content h2 {
  margin: 8px 0 0;
  font-size: 18px;
  color: var(--app-ink, #102033);
}

.legal-content p {
  margin: 0;
  color: var(--app-muted, #63738a);
  line-height: 1.55;
}

@media (max-width: 640px) {
  .back-to-top {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    min-width: 48px;
    min-height: 48px;
    padding: 0;
  }

  .back-to-top > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

/* Cockpit command-center refresh. Presentation only: existing data, links and permissions stay unchanged. */
:root {
  --color-primary: var(--app-blue, #1f5a89);
  --color-primary-dark: var(--app-blue-dark, #174a73);
  --color-accent: var(--app-gold, #f6c445);
  --color-warning: #b7791f;
  --color-danger: var(--app-red, #b42318);
  --color-success: var(--app-green, #239363);
  --color-info: #2f8fcb;
  --color-surface: var(--app-surface, #ffffff);
  --color-surface-muted: var(--app-surface-soft, #f8fbfe);
  --color-border: var(--app-border, #dce5ef);
  --shadow-card: 0 16px 36px rgba(15, 46, 74, .09);
  --radius-card: 12px;
  --spacing-xs: 6px;
  --spacing-sm: 10px;
  --spacing-md: 14px;
  --spacing-lg: 20px;
}

.button.secondary,
button.secondary {
  background: #fff;
  border-color: rgba(31, 90, 137, .20);
  color: var(--color-primary-dark);
  box-shadow: 0 8px 18px rgba(15, 46, 74, .06);
}

.button.ghost,
button.ghost {
  background: rgba(31, 90, 137, .07);
  border-color: rgba(31, 90, 137, .12);
}

.button:focus-visible,
button:focus-visible,
.status-row:focus-visible,
.action-item:focus-visible {
  outline: 3px solid rgba(246, 196, 69, .46);
  outline-offset: 2px;
}

.sidebar nav a {
  min-height: 42px;
  padding: 7px 10px 7px 7px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.sidebar nav a:hover {
  border-color: rgba(255, 255, 255, .10);
  transform: translateX(1px);
}

.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(31, 90, 137, .82), rgba(16, 38, 61, .96));
  border-color: rgba(246, 196, 69, .34);
  box-shadow: inset 3px 0 0 var(--color-accent), 0 10px 22px rgba(0, 0, 0, .16);
}

.sidebar .nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
}

.sidebar .nav-icon::before {
  width: 6px;
  height: 6px;
  opacity: .76;
}

.sidebar nav a.active .nav-icon {
  background: var(--color-accent);
  color: #10263d;
}

.sidebar .side-card {
  padding: 12px;
  gap: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  box-shadow: none;
}

.command-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
  min-height: 132px;
  padding: 22px 24px;
  border: 1px solid rgba(31, 90, 137, .16);
  border-left: 6px solid var(--color-accent);
  border-radius: var(--radius-card);
  background:
    linear-gradient(110deg, rgba(16, 38, 61, .99), rgba(31, 90, 137, .96) 58%, rgba(18, 48, 75, .94) 100%),
    var(--color-primary-dark);
  box-shadow: var(--shadow-card);
  color: #fff;
}

.command-hero__copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.command-hero .command-hero__eyebrow {
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid rgba(246, 196, 69, .36);
  border-radius: 999px;
  background: rgba(246, 196, 69, .16);
  color: #ffe7a2;
  font-size: 12px;
  font-weight: 850;
}

.command-hero h2 {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: 30px;
  line-height: 1.08;
}

.command-hero p {
  max-width: 780px;
  color: rgba(239, 246, 255, .82);
  line-height: 1.45;
}

.command-hero__actions {
  align-content: center;
  min-width: 280px;
}

.command-hero__actions .button {
  min-height: 40px;
  border-color: rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.command-hero__actions .button:hover {
  background: rgba(255, 255, 255, .20);
  box-shadow: none;
}

.dashboard-kpis {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--spacing-md);
}

.dashboard-kpis .kpi-card {
  display: grid;
  align-content: space-between;
  position: relative;
  overflow: hidden;
  min-height: 122px;
  padding: 16px 17px 14px;
  border: 1px solid rgba(31, 90, 137, .14);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #fff, #f9fcff);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.dashboard-kpis .kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 90, 137, .28);
  box-shadow: 0 18px 38px rgba(15, 37, 58, .12);
}

.dashboard-kpis .kpi-card span {
  color: #596d83;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-kpis .kpi-card strong {
  margin-top: 8px;
  color: #102033;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1;
}

.dashboard-kpis .kpi-card small {
  margin-top: 9px;
  color: #66788c;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-kpis .kpi-card::after {
  content: "";
  position: absolute;
  inset: auto 16px 0 16px;
  height: 4px;
  background: var(--color-primary);
}

.dashboard-kpis .kpi-card--warning {
  border-color: rgba(183, 121, 31, .28);
  background: linear-gradient(180deg, #fff, #fff8e7);
}

.dashboard-kpis .kpi-card--warning::after {
  background: linear-gradient(90deg, var(--color-warning), var(--color-accent));
}

.dashboard-kpis .kpi-card--success {
  border-color: rgba(35, 147, 99, .22);
  background: linear-gradient(180deg, #fff, #f0faf4);
}

.dashboard-kpis .kpi-card--success::after {
  background: linear-gradient(90deg, #1f7a4d, var(--color-success));
}

.dashboard-kpis .kpi-card--pipeline {
  border-color: rgba(31, 90, 137, .24);
  background: linear-gradient(135deg, #fff, #f0f7fc);
}

.dashboard-kpis .kpi-card--pipeline strong {
  color: var(--color-primary-dark);
  font-size: clamp(24px, 2.4vw, 34px);
}

.dashboard-kpis .kpi-card--pipeline::after {
  background: linear-gradient(90deg, var(--color-primary-dark), var(--color-info));
}

.dashboard-grid.command-grid {
  grid-template-columns: minmax(270px, .9fr) minmax(310px, 1fr) minmax(370px, 1.18fr);
  gap: var(--spacing-md);
}

.command-grid > .panel {
  min-width: 0;
  border-radius: var(--radius-card);
  box-shadow: 0 12px 30px rgba(15, 46, 74, .07);
}

.sales-command-panel {
  border-color: rgba(246, 196, 69, .34);
}

.status-pipeline {
  gap: 8px;
  padding: 12px;
}

.status-pipeline .status-row {
  --status-color: var(--color-primary);
  --status-bg: rgba(31, 90, 137, .08);
  gap: 8px;
  padding: 11px 12px;
  border-color: rgba(31, 90, 137, .12);
  border-left: 4px solid var(--status-color);
  border-radius: 10px;
  background: linear-gradient(90deg, var(--status-bg), #fff 34%);
}

.status-row--info { --status-color: var(--color-info); --status-bg: rgba(47, 143, 203, .10); }
.status-row--warning { --status-color: var(--color-warning); --status-bg: rgba(246, 196, 69, .14); }
.status-row--accent { --status-color: var(--color-primary); --status-bg: rgba(31, 90, 137, .10); }
.status-row--success { --status-color: var(--color-success); --status-bg: rgba(35, 147, 99, .12); }
.status-row--danger { --status-color: var(--color-danger); --status-bg: rgba(180, 35, 24, .08); }

.status-pipeline .status-row__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.status-pipeline .status-row__label {
  color: #102033;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.status-pipeline .status-row__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid rgba(31, 90, 137, .16);
  border-radius: 999px;
  background: #fff;
  color: var(--status-color);
  font-size: 12px;
  font-weight: 900;
}

.status-pipeline .status-row__bar {
  height: 8px;
  background: rgba(16, 38, 61, .08);
}

.status-pipeline .status-row__bar-fill {
  background: var(--status-color);
}

.status-pipeline .status-row__amount {
  color: #5d7085;
  font-size: 12px;
  font-weight: 750;
}

.sales-focus-grid .metric-card {
  min-height: 76px;
  border-radius: 10px;
  background: #fff;
}

.metric-card {
  --metric-color: var(--color-primary);
  --metric-bg: #fff;
  border-color: rgba(31, 90, 137, .16) !important;
  background: linear-gradient(180deg, #fff, var(--metric-bg)) !important;
}

.metric-card span {
  color: #5f7084;
  font-weight: 850;
}

.metric-card strong {
  color: var(--metric-color);
  font-weight: 950;
}

.metric-card--info { --metric-color: var(--color-info); --metric-bg: #eef8fd; }
.metric-card--warning { --metric-color: var(--color-warning); --metric-bg: #fff8e7; }
.metric-card--danger { --metric-color: var(--color-danger); --metric-bg: #fff1ef; }
.metric-card--success { --metric-color: var(--color-success); --metric-bg: #edf8f1; }
.metric-card--muted { --metric-color: #6b7787; --metric-bg: #f5f7fa; }

.dashboard-appointment-panel {
  border-color: rgba(47, 143, 203, .24);
}

.dashboard-appointment-panel .appointment-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.appointment-cockpit-list {
  gap: 8px;
}

.appointment-cockpit-item .task-title {
  align-items: center;
}

.appointment-cockpit-item small {
  overflow-wrap: anywhere;
}

.appointment-view-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--app-border-soft);
}

.action-center__head {
  padding-top: 14px;
}

.action-center__head strong {
  font-size: 15px;
}

.action-center {
  gap: 8px;
  padding-top: 9px;
}

.action-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border-left: 0;
  border-radius: 10px;
}

.action-item--top {
  border-color: rgba(246, 196, 69, .42);
  background:
    linear-gradient(90deg, rgba(246, 196, 69, .13), rgba(255, 255, 255, .98) 38%),
    #fff;
}

.action-item__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #10263d;
  color: #fff !important;
  font-size: 13px;
  font-weight: 900;
}

.action-item__body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.action-item__title {
  align-items: center;
}

.action-item__title strong {
  color: #102033;
  overflow-wrap: anywhere;
}

.action-item__meta {
  color: #4d6075 !important;
  font-size: 12px;
  line-height: 1.35;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge--info {
  border-color: rgba(47, 143, 203, .26);
  background: #eef8fd;
  color: #17668e;
}

.status-badge--warning {
  border-color: rgba(183, 121, 31, .28);
  background: #fff6dd;
  color: #815011;
}

.status-badge--danger {
  border-color: rgba(180, 35, 24, .26);
  background: #fff1ef;
  color: var(--color-danger);
}

.status-badge--success {
  border-color: rgba(35, 147, 99, .24);
  background: #edf8f1;
  color: #17663f;
}

.command-grid .panel-head a {
  color: var(--color-primary-dark);
  font-weight: 850;
  text-decoration: none;
}

.command-grid .panel-head a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 981px) and (max-width: 1366px) and (orientation: landscape) {
  .dashboard-grid.command-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  .sales-command-panel,
  .dashboard-health-panel,
  .dashboard-offer-panel,
  .activity-panel,
  .dashboard-portal-messages {
    grid-column: auto;
  }

  .sales-command-panel,
  .activity-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .command-hero {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
  }

  .command-hero__actions {
    min-width: 0;
    justify-content: flex-start;
  }

  .dashboard-grid.command-grid {
    grid-template-columns: 1fr !important;
  }

  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .command-hero {
    padding: 17px;
  }

  .command-hero h2 {
    font-size: 24px;
  }

  .command-hero__actions,
  .command-hero__actions .button {
    width: 100%;
  }

  .dashboard-kpis {
    grid-template-columns: 1fr !important;
  }

  .dashboard-kpis .kpi-card {
    min-height: 104px;
  }

  .dashboard-metric-grid.sales-focus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-appointment-panel .appointment-metric-grid {
    grid-template-columns: 1fr;
  }

  .action-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .action-item__rank {
    width: 28px;
    height: 28px;
  }
}

/* Cockpit polish pass: denser secondary panels without changing data or permissions. */
.followup-panel .list,
.dashboard-appointment-panel .compact-list,
.dashboard-health-panel .compact-list,
.dashboard-offer-panel .compact-list,
.dashboard-portal-messages .portal-message-list {
  gap: 8px;
}

.followup-panel .list-item,
.dashboard-appointment-panel .list-item,
.dashboard-health-panel .list-item,
.dashboard-offer-panel .list-item,
.dashboard-portal-messages .portal-message-card {
  border-radius: 10px !important;
  border-color: rgba(31, 90, 137, .13) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 251, 254, .94)) !important;
  box-shadow: 0 8px 20px rgba(15, 46, 74, .05) !important;
}

.followup-panel .list-item:hover,
.dashboard-appointment-panel .list-item:hover,
.dashboard-health-panel .list-item:hover,
.dashboard-offer-panel .list-item:hover,
.dashboard-portal-messages .portal-message-card:hover {
  border-color: rgba(31, 90, 137, .26) !important;
  box-shadow: 0 14px 28px rgba(15, 46, 74, .10) !important;
}

.followup-panel .task-title strong,
.dashboard-appointment-panel .task-title strong,
.dashboard-offer-panel .task-title strong,
.dashboard-health-panel .task-title strong {
  color: #102033;
  font-size: 15px;
  line-height: 1.25;
}

.followup-panel .list-item small,
.dashboard-appointment-panel .list-item small,
.dashboard-offer-panel .list-item small,
.dashboard-health-panel .list-item small {
  color: #50647a !important;
  line-height: 1.35;
}

.dashboard-health-panel .dashboard-metric-grid .metric-card,
.dashboard-offer-panel .dashboard-metric-grid .metric-card {
  min-height: 72px;
  border-radius: 10px;
  border-color: rgba(31, 90, 137, .14);
  background: linear-gradient(180deg, #fff, #f8fbfe);
}

.dashboard-health-panel .dashboard-metric-grid .metric-card--success,
.dashboard-offer-panel .dashboard-metric-grid .metric-card--success {
  border-color: rgba(35, 147, 99, .22);
  background: linear-gradient(180deg, #fff, #edf8f1);
}

.dashboard-health-panel .dashboard-metric-grid .metric-card--warning,
.dashboard-offer-panel .dashboard-metric-grid .metric-card--warning {
  border-color: rgba(183, 121, 31, .28);
  background: linear-gradient(180deg, #fff, #fff8e7);
}

.dashboard-health-panel .dashboard-metric-grid span,
.dashboard-offer-panel .dashboard-metric-grid span {
  color: #5f7084;
  font-weight: 850;
}

.dashboard-health-panel .dashboard-metric-grid strong,
.dashboard-offer-panel .dashboard-metric-grid strong {
  color: #102033;
  font-weight: 950;
}

.dashboard-subhead:not(.action-center__head) {
  padding-top: 12px;
}

.dashboard-subhead:not(.action-center__head) strong {
  font-size: 14px;
}

.dashboard-subhead:not(.action-center__head) span {
  color: #5f7084;
  font-weight: 650;
}

.activity-panel .timeline {
  max-height: 500px;
  padding: 10px 14px 14px;
}

.activity-panel .timeline-item {
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 9px;
  padding: 11px 0;
  border-bottom-color: rgba(31, 90, 137, .12);
}

.activity-panel .timeline-item > span {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  background: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(246, 196, 69, .16);
}

.activity-panel .timeline-item strong {
  color: #102033;
  font-size: 14px;
}

.activity-panel .timeline-item small,
.activity-panel .timeline-item p {
  color: #5f7084;
}

.dashboard-portal-messages .portal-message-card {
  padding: 11px 12px;
}

.dashboard-portal-messages .portal-message-card p {
  color: #3f5369;
  line-height: 1.38;
}

@media (max-width: 980px) {
  .dashboard-health-panel .dashboard-metric-grid,
  .dashboard-offer-panel .dashboard-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Per-customer object photo in the customer portal */
.portal-page--custom-background {
  position: relative;
  isolation: isolate;
  background: #e8eef4;
}

.portal-page--custom-background .portal-object-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 1;
}

.portal-page--custom-background::after {
  position: fixed;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background: transparent;
}

.portal-page--custom-background .portal-shell,
.portal-page--custom-background .back-to-top {
  position: relative;
  z-index: 1;
}

.portal-page--custom-background .portal-hero,
.portal-page--custom-background .panel,
.portal-page--custom-background .kpis > div,
.portal-page--custom-background .portal-stat,
.portal-page--custom-background .portal-summary-grid > div {
  background-color: rgba(255, 255, 255, .90);
  backdrop-filter: blur(4px);
}

.portal-background-form {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(31, 90, 137, .12);
}

.portal-background-status {
  color: var(--color-success, #237a50);
  font-size: 12px;
  font-weight: 850;
}

.portal-background-picker {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(300px, 1.3fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(31, 90, 137, .18);
  border-left: 4px solid var(--color-accent, #f6c445);
  border-radius: 12px;
  background: #f8fbfe;
}

.portal-background-picker__preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(135deg, #dce6ef, #eef3f8);
  color: var(--app-muted, #63738a);
  text-align: center;
}

.portal-background-picker__preview img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}

.portal-background-picker__content {
  display: grid;
  align-content: start;
  gap: 8px;
}

.portal-background-picker__content > strong {
  color: var(--app-ink, #102033);
  font-size: 18px;
}

@media (max-width: 720px) {
  .portal-background-picker {
    grid-template-columns: 1fr;
  }
}

.portal-preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid rgba(183, 121, 31, .36);
  border-left: 5px solid var(--color-accent, #f6c445);
  border-radius: 12px;
  background: rgba(255, 248, 231, .97);
  box-shadow: 0 8px 24px rgba(16, 32, 51, .08);
}

.portal-preview-banner > div {
  display: grid;
  gap: 3px;
}

.portal-preview-banner strong {
  color: var(--app-ink, #102033);
  font-size: 15px;
}

.portal-preview-banner span {
  color: var(--app-muted, #63738a);
  font-size: 13px;
}

@media (max-width: 640px) {
  .portal-preview-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-preview-banner .button {
    width: 100%;
  }
}

/* Geschuetzter Bildbetrachter fuer Kundenakte und Kundenportal. */
.photo-gallery-page {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: #07111b;
  color: #fff;
}

.photo-gallery-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 50% 35%, rgba(42, 82, 112, .3), transparent 45%),
    #07111b;
}

.photo-gallery-topbar {
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 22px;
  border-bottom: 3px solid #f6c445;
  background: rgba(10, 28, 45, .96);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
}

.photo-gallery-brand,
.photo-gallery-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.photo-gallery-brand img {
  width: 170px;
  height: auto;
}

.photo-gallery-brand > div {
  display: grid;
  gap: 2px;
}

.photo-gallery-brand span {
  color: #b9c9d8;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.photo-gallery-brand strong {
  max-width: min(48vw, 560px);
  overflow: hidden;
  color: #fff;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-gallery-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.photo-gallery-action:hover,
.photo-gallery-action:focus-visible {
  border-color: #f6c445;
  background: rgba(246, 196, 69, .14);
  outline: none;
}

.photo-gallery-close {
  font-size: 22px;
}

.photo-gallery-close span {
  font-size: 14px;
}

.photo-gallery-main {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px 88px 8px;
}

.photo-gallery-figure {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0;
}

.photo-gallery-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: pan-y;
}

.photo-gallery-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .45);
}

.photo-gallery-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #fff;
}

.photo-gallery-figure figcaption > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.photo-gallery-figure figcaption strong,
.photo-gallery-figure figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-gallery-figure figcaption span {
  color: #aec0d0;
  font-size: 13px;
}

.photo-gallery-counter {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .11);
  color: #fff !important;
  font-weight: 700;
}

.photo-gallery-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 54px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: rgba(4, 13, 22, .66);
  color: #fff;
  font-size: 48px;
  line-height: 1;
  text-decoration: none;
  transform: translateY(-50%);
}

.photo-gallery-nav:hover,
.photo-gallery-nav:focus-visible {
  border-color: #f6c445;
  background: rgba(10, 28, 45, .96);
  outline: none;
}

.photo-gallery-nav--previous { left: 18px; }
.photo-gallery-nav--next { right: 18px; }

.photo-gallery-help {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 6px 16px 10px;
  color: #9eb2c4;
  font-size: 12px;
}

.photo-gallery-help kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 4px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font: inherit;
}

@media (max-width: 720px) {
  .photo-gallery-page { overflow: auto; }
  .photo-gallery-topbar { padding: 9px 11px; }
  .photo-gallery-brand img { width: 125px; }
  .photo-gallery-brand > div { display: none; }
  .photo-gallery-action { min-height: 38px; padding: 6px 10px; }
  .photo-gallery-close span { display: none; }
  .photo-gallery-main { padding: 10px 48px 4px; }
  .photo-gallery-stage img { max-height: calc(100vh - 155px); }
  .photo-gallery-nav { width: 40px; height: 58px; font-size: 38px; }
  .photo-gallery-nav--previous { left: 4px; }
  .photo-gallery-nav--next { right: 4px; }
  .photo-gallery-help { display: none; }
}

/* Professionelles Kundenportal mit Titelbild-Slideshow. */
.portal-page--project {
  min-height: 100vh;
  background: #eef3f7;
  color: var(--ink, #102033);
}

.portal-page--project .portal-shell {
  width: min(100%, 1280px);
  max-width: 1280px;
  padding: 20px;
}

.portal-page--project .portal-header {
  margin-bottom: 12px;
  padding: 13px 18px;
  border-radius: 12px;
  border-bottom-width: 4px;
  box-shadow: 0 12px 32px rgba(15, 39, 62, .14);
}

.portal-page--project .portal-header img {
  width: 190px;
}

.portal-page--project .portal-preview-banner {
  margin-bottom: 12px;
  padding: 9px 12px;
}

.portal-project-hero {
  position: relative;
  min-height: 390px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  margin-bottom: 16px;
  border-radius: 18px;
  background: #163754;
  color: #fff;
  box-shadow: 0 22px 55px rgba(15, 39, 62, .2);
  isolation: isolate;
}

.portal-project-hero__slides,
.portal-project-hero__slide,
.portal-project-hero__shade {
  position: absolute;
  inset: 0;
}

.portal-project-hero__slide {
  z-index: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  transform: scale(1.025);
  transition: opacity 1.1s ease, transform 8s ease;
}

.portal-project-hero__slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.portal-project-hero--empty {
  background:
    radial-gradient(circle at 82% 20%, rgba(246, 196, 69, .24), transparent 30%),
    linear-gradient(125deg, #0e2a43 0%, #1f5a89 100%);
}

.portal-project-hero__shade {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(5, 18, 30, .88) 0%, rgba(5, 18, 30, .56) 43%, rgba(5, 18, 30, .08) 78%),
    linear-gradient(0deg, rgba(5, 18, 30, .62) 0%, transparent 52%);
}

.portal-project-hero__content {
  position: relative;
  z-index: 2;
  width: min(720px, 76%);
  display: grid;
  gap: 8px;
  padding: 38px 42px;
}

.portal-project-hero__eyebrow,
.portal-media-panel__header > div > span,
.portal-communication-panel__intro > span {
  color: #f6c445;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.portal-project-hero__content h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .3);
}

.portal-project-hero__content > p {
  margin: 0;
  color: rgba(255, 255, 255, .86);
  font-size: 16px;
}

.portal-project-hero__meta {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(7, 24, 39, .48);
  backdrop-filter: blur(8px);
}

.portal-project-hero__meta span {
  color: rgba(255, 255, 255, .7);
  font-size: 12px;
}

.portal-project-hero__meta strong {
  color: #fff;
  font-size: 13px;
}

.portal-project-hero__controls {
  position: absolute;
  z-index: 3;
  right: 26px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-project-hero__controls > button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(7, 24, 39, .58);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  backdrop-filter: blur(7px);
}

.portal-project-hero__controls > button:hover,
.portal-project-hero__controls > button:focus-visible {
  border-color: #f6c445;
  background: rgba(7, 24, 39, .9);
  outline: none;
}

.portal-project-hero__dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-project-hero__dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .48);
  cursor: pointer;
  transition: width .2s ease, border-radius .2s ease, background .2s ease;
}

.portal-project-hero__dots button.is-active {
  width: 24px;
  border-radius: 999px;
  background: #f6c445;
}

.portal-project-progress {
  display: grid;
  grid-template-columns: minmax(240px, .72fr) minmax(560px, 1.7fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 16px;
  padding: 22px 24px;
  border: 1px solid rgba(31, 90, 137, .15);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 39, 62, .08);
}

.portal-project-progress__summary {
  display: grid;
  gap: 5px;
}

.portal-project-progress__summary > span {
  color: #1f5a89;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.portal-project-progress__summary > strong {
  color: #102033;
  font-size: 18px;
  line-height: 1.28;
}

.portal-project-progress__summary > small {
  color: #66798c;
}

.portal-project-progress__steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal-project-progress__steps li {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: #8292a2;
  text-align: center;
}

.portal-project-progress__steps li::before {
  position: absolute;
  z-index: 0;
  top: 17px;
  right: 50%;
  width: 100%;
  height: 3px;
  content: "";
  background: #dce5ed;
}

.portal-project-progress__steps li:first-child::before {
  display: none;
}

.portal-project-progress__steps li > span {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 3px solid #dce5ed;
  border-radius: 50%;
  background: #fff;
  color: #738598;
  font-weight: 850;
}

.portal-project-progress__steps li > strong {
  max-width: 120px;
  font-size: 12px;
  line-height: 1.25;
}

.portal-project-progress__steps li.is-complete::before,
.portal-project-progress__steps li.is-current::before {
  background: #3a9a6a;
}

.portal-project-progress__steps li.is-complete > span {
  border-color: #3a9a6a;
  background: #3a9a6a;
  color: #fff;
}

.portal-project-progress__steps li.is-complete {
  color: #317a58;
}

.portal-project-progress__steps li.is-current > span {
  border-color: #f6c445;
  background: #fff8e4;
  color: #8a6100;
  box-shadow: 0 0 0 5px rgba(246, 196, 69, .18);
}

.portal-project-progress__steps li.is-current {
  color: #102033;
}

.portal-media-panel,
.portal-communication-panel {
  margin-bottom: 16px;
  border: 1px solid rgba(31, 90, 137, .15);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 39, 62, .08);
}

.portal-media-panel {
  overflow: hidden;
}

.portal-media-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
}

.portal-media-panel__header > div {
  display: grid;
  gap: 3px;
}

.portal-media-panel__header h2,
.portal-communication-panel__intro h2 {
  margin: 0;
  color: #102033;
  font-size: 25px;
  letter-spacing: -.02em;
}

.portal-media-tabs {
  display: flex;
  gap: 8px;
  padding: 0 24px;
  border-bottom: 1px solid #dbe5ed;
}

.portal-media-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #64778a;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.portal-media-tabs button span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e9f0f6;
  color: #526a80;
  font-size: 11px;
}

.portal-media-tabs button.is-active {
  border-bottom-color: #f6c445;
  color: #102033;
}

.portal-media-tabs button.is-active span {
  background: #fff0bf;
  color: #785400;
}

.portal-media-tabs button:focus-visible {
  outline: 2px solid #1f5a89;
  outline-offset: 2px;
}

.portal-media-tab {
  padding: 22px 24px 26px;
}

.portal-media-tab[hidden] {
  display: none !important;
}

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

.portal-photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d9e3eb;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 39, 62, .07);
  transition: transform .2s ease, box-shadow .2s ease;
}

.portal-photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(15, 39, 62, .13);
}

.portal-photo-card__image {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #dce5ed;
}

.portal-photo-card__image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease;
}

.portal-photo-card:hover .portal-photo-card__image img {
  transform: scale(1.025);
}

.portal-photo-card__image > span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(7, 24, 39, .76);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
}

.portal-photo-card:hover .portal-photo-card__image > span,
.portal-photo-card__image:focus-visible > span {
  opacity: 1;
  transform: translateY(0);
}

.portal-photo-card__meta {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 13px 14px 14px;
}

.portal-photo-card__meta strong,
.portal-photo-card__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-photo-card__meta strong {
  color: #102033;
  font-size: 14px;
}

.portal-photo-card__meta span,
.portal-photo-card__meta small {
  color: #718397;
  font-size: 12px;
}

.portal-photo-card__meta > a {
  width: fit-content;
  margin-top: 4px;
  color: #1f5a89;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

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

.portal-document-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid #dce5ed;
  border-radius: 11px;
  background: #fbfdff;
}

.portal-document-row__icon {
  width: 52px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e5eef6;
  color: #1f5a89;
  font-size: 11px;
  font-weight: 900;
}

.portal-document-row__meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.portal-document-row__meta strong,
.portal-document-row__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-document-row__meta strong {
  color: #102033;
}

.portal-document-row__meta span,
.portal-document-row__meta small {
  color: #718397;
  font-size: 12px;
}

.portal-document-row__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-document-row__actions > a:not(.button) {
  color: #1f5a89;
  font-weight: 800;
  text-decoration: none;
}

.portal-empty-state {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 32px 20px;
  border: 1px dashed #c6d4df;
  border-radius: 12px;
  background: #f7fafc;
  color: #728497;
  text-align: center;
}

.portal-empty-state strong {
  color: #30475d;
}

.portal-communication-panel {
  display: grid;
  grid-template-columns: minmax(250px, .7fr) minmax(480px, 1.3fr);
  gap: 28px;
  padding: 24px;
}

.portal-communication-panel__intro {
  display: grid;
  align-content: start;
  gap: 6px;
}

.portal-communication-panel__intro p {
  margin: 6px 0 0;
  color: #64778a;
  line-height: 1.55;
}

.portal-communication-panel__content {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.portal-conversation {
  max-height: 380px;
  display: grid;
  gap: 9px;
  overflow-y: auto;
  padding: 2px;
}

.portal-conversation__item {
  max-width: 88%;
  display: grid;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid #d9e4ec;
  border-radius: 12px;
  background: #f6f9fb;
}

.portal-conversation__item--customer {
  justify-self: end;
  border-color: #d8e5c9;
  background: #f2f8ec;
}

.portal-conversation__item strong {
  color: #102033;
  font-size: 12px;
}

.portal-conversation__item strong span {
  margin-left: 5px;
  color: #8090a0;
  font-weight: 500;
}

.portal-conversation__item p {
  margin: 0;
  color: #43586c;
  font-size: 13px;
  line-height: 1.45;
}

.portal-slideshow-form {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(31, 90, 137, .12);
}

.portal-slideshow-status {
  color: var(--color-success, #237a50);
  font-size: 12px;
  font-weight: 850;
}

@media (prefers-reduced-motion: reduce) {
  .portal-project-hero__slide,
  .portal-photo-card,
  .portal-photo-card__image img,
  .portal-photo-card__image > span {
    transition: none;
  }
}

@media (max-width: 960px) {
  .portal-project-progress {
    grid-template-columns: 1fr;
  }

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

  .portal-communication-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .portal-page--project .portal-shell {
    padding: 10px;
  }

  .portal-page--project .portal-header {
    align-items: center;
    flex-direction: row;
    padding: 10px 12px;
  }

  .portal-page--project .portal-header img {
    width: 145px;
  }

  .portal-page--project .portal-header nav,
  .portal-page--project .portal-header .portal-nav {
    width: auto;
    display: grid;
    grid-template-columns: repeat(3, auto);
  }

  .portal-page--project .portal-header nav a,
  .portal-page--project .portal-header .portal-nav a {
    padding: 7px 8px;
    font-size: 11px;
  }

  .portal-project-hero {
    min-height: 330px;
    border-radius: 14px;
  }

  .portal-project-hero__content {
    width: 100%;
    padding: 30px 22px 74px;
  }

  .portal-project-hero__content h1 {
    font-size: 36px;
  }

  .portal-project-hero__controls {
    right: 18px;
    bottom: 18px;
  }

  .portal-project-progress {
    padding: 18px 14px;
  }

  .portal-project-progress__steps li > strong {
    font-size: 10px;
  }

  .portal-media-panel__header,
  .portal-media-tab,
  .portal-communication-panel {
    padding: 18px 14px;
  }

  .portal-media-tabs {
    padding: 0 14px;
  }

  .portal-document-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .portal-document-row__icon {
    width: 44px;
    height: 50px;
  }

  .portal-document-row__actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .portal-page--project .portal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-page--project .portal-header nav,
  .portal-page--project .portal-header .portal-nav {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .portal-page--project .portal-header .portal-nav--single {
    grid-template-columns: 1fr;
  }

  .portal-project-hero__shade {
    background: linear-gradient(0deg, rgba(5, 18, 30, .9) 0%, rgba(5, 18, 30, .28) 100%);
  }

  .portal-project-hero__content h1 {
    font-size: 31px;
  }

  .portal-project-hero__meta {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 12px;
  }

  .portal-project-progress__steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .portal-project-progress__steps li {
    grid-template-columns: 36px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    text-align: left;
  }

  .portal-project-progress__steps li::before {
    top: auto;
    right: auto;
    bottom: 50%;
    left: 17px;
    width: 3px;
    height: calc(100% + 10px);
  }

  .portal-project-progress__steps li > strong {
    max-width: none;
    font-size: 12px;
  }

  .portal-media-panel__header {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-media-tabs button {
    flex: 1;
    justify-content: center;
    padding-inline: 6px;
    font-size: 12px;
  }

  .portal-photo-grid {
    grid-template-columns: 1fr;
  }

  .portal-photo-card__image > span {
    opacity: 1;
    transform: none;
  }

  .portal-conversation__item {
    max-width: 100%;
  }
}

/* Kompakte Fotovorschau im Kopf der internen Kundenakte. */
.compact-customer-head--with-slideshow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: stretch;
}

.compact-customer-head--with-slideshow .customer-head-main {
  grid-column: 1;
  grid-row: 1;
}

.compact-customer-head--with-slideshow .compact-head-actions {
  grid-column: 1;
  grid-row: 2;
}

.customer-photo-preview {
  position: relative;
  min-width: 0;
  min-height: 238px;
  grid-column: 2;
  grid-row: 1 / 3;
  overflow: hidden;
  border: 1px solid rgba(31, 90, 137, .2);
  border-radius: 12px;
  background: #173650;
  box-shadow: 0 12px 28px rgba(15, 39, 62, .15);
}

.customer-photo-preview__stage,
.customer-photo-preview__slides,
.customer-photo-preview__slide,
.customer-photo-preview__shade {
  position: absolute;
  inset: 0;
}

.customer-photo-preview__stage {
  display: block;
  color: #fff;
  text-decoration: none;
  touch-action: pan-y;
}

.customer-photo-preview__slide {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.025);
  transition: opacity .7s ease, transform 6.5s ease;
}

.customer-photo-preview__slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.customer-photo-preview__shade {
  background: linear-gradient(0deg, rgba(5, 18, 30, .82) 0%, rgba(5, 18, 30, .08) 68%);
}

.customer-photo-preview__meta {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 2px;
  padding: 38px 66px 13px 14px;
}

.customer-photo-preview__meta > span {
  color: #f6c445;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.customer-photo-preview__meta > strong {
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-photo-preview__meta > small {
  color: rgba(255, 255, 255, .75);
  font-size: 10px;
}

.customer-photo-preview__controls {
  position: absolute;
  z-index: 3;
  right: 10px;
  bottom: 12px;
  display: flex;
  gap: 5px;
}

.customer-photo-preview__controls button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(5, 18, 30, .65);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.customer-photo-preview__controls button:hover,
.customer-photo-preview__controls button:focus-visible,
.customer-photo-preview__stage:focus-visible {
  border-color: #f6c445;
  outline: 2px solid #f6c445;
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .customer-photo-preview__slide {
    transition: none;
  }
}

@media (max-width: 1180px) {
  .compact-customer-head--with-slideshow {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .compact-customer-head--with-slideshow .customer-head-main,
  .compact-customer-head--with-slideshow .compact-head-actions,
  .customer-photo-preview {
    grid-column: 1;
    grid-row: auto;
  }

  .customer-photo-preview {
    min-height: 290px;
  }
}

@media (max-width: 640px) {
  .customer-photo-preview {
    min-height: 220px;
  }

  .customer-photo-preview__meta {
    padding-left: 12px;
  }
}
