:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --text: #17212b;
  --muted: #5d6c7b;
  --line: #d7dee6;
  --blue: #1d5f99;
  --teal: #00796b;
  --amber: #a56100;
  --red: #b42318;
  --green: #16794a;
  --shadow: 0 14px 34px rgba(23, 33, 43, 0.08);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    linear-gradient(180deg, rgba(16, 42, 67, 0.08), rgba(16, 42, 67, 0) 36%),
    var(--bg);
}

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

.login-logo {
  display: block;
  width: 156px;
  height: auto;
  margin: 0 auto 22px;
}

.login-eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  text-align: center;
}

.login-subtitle {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.login-version {
  margin: -10px 0 18px;
  color: #587089;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

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

.login-field {
  display: grid;
  gap: 6px;
  color: #41546a;
  font-size: 14px;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #ffffff;
}

.login-field input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(29, 95, 153, 0.14);
}

.login-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.login-divider {
  margin: 20px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.login-sso-button {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.login-sso-button:hover,
.login-sso-button:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(29, 95, 153, 0.14);
}

.login-sso-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid #fdecc8;
  border-radius: 6px;
  background: #fff8e8;
  color: #845100;
  font-size: 13px;
  line-height: 1.4;
}

.login-status {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.login-status.error {
  background: #fff1f0;
  color: #9b1c1c;
}

.login-status.ok {
  background: #e8f6ef;
  color: var(--green);
}

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

.readonly-textarea {
  background: #f4f6f8;
  color: #435466;
  cursor: default;
}

.topbar {
  min-height: 76px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #102a43;
  color: #ffffff;
  border-bottom: 4px solid #00a693;
}

.brand-lockup {
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 156px;
  height: 48px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.brand-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: #a9d6cf;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.status-strip {
  min-width: 210px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: #dce8f2;
  font-size: 14px;
}

.app-version-badge {
  min-height: 28px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(169, 214, 207, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #d7f2ec;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.security-alert-badge {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 221, 166, 0.8);
  border-radius: 999px;
  background: rgba(255, 244, 224, 0.18);
  color: #ffe6b8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.security-alert-badge:hover {
  border-color: #fff0d0;
  background: #fff4e0;
  color: #7a3f00;
}

.sharepoint-sync-alert {
  min-height: 30px;
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #ffb4b4;
  border-radius: 7px;
  background: #b42318;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 0 0 2px rgba(255, 180, 180, 0.16);
}

.sharepoint-sync-alert.is-working {
  border-color: #b9d8ff;
  background: #155ca2;
}

.sharepoint-sync-alert.is-success {
  border-color: #a7e0c4;
  background: #147a4f;
}

.sharepoint-sync-button {
  min-height: 24px;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 5px;
  background: #ffffff;
  color: #7f1d16;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.sharepoint-sync-button:hover:not(:disabled) {
  background: #fff1f0;
}

.sharepoint-sync-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.logout-button {
  min-height: 30px;
  padding: 5px 9px;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.52);
  background: #ffffff;
  color: #102a43;
}

.module-menu {
  position: relative;
  flex: 1;
  min-width: 230px;
  display: flex;
  justify-content: center;
}

.module-menu-toggle {
  position: relative;
  width: min(360px, 100%);
  min-height: 44px;
  padding: 7px 14px;
  display: grid;
  gap: 2px;
  text-align: left;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.module-menu-toggle:hover,
.module-menu-toggle[aria-expanded="true"] {
  border-color: rgba(169, 214, 207, 0.75);
  background: rgba(255, 255, 255, 0.14);
}

.module-menu-toggle::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #a9d6cf;
  border-bottom: 2px solid #a9d6cf;
  transform: translateY(-68%) rotate(45deg);
}

.module-menu-toggle[aria-expanded="true"]::after {
  transform: translateY(-28%) rotate(225deg);
}

.module-menu-eyebrow {
  color: #a9d6cf;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.module-menu-current {
  padding-right: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.app-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.module-menu-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  left: 50%;
  width: min(760px, calc(100vw - 48px));
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  align-items: stretch;
  gap: 8px;
  border: 1px solid rgba(16, 42, 67, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(16, 42, 67, 0.22);
  transform: translateX(-50%);
}

.module-menu-panel[hidden] {
  display: none;
}

.menu-button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: #dce8f2;
}

.module-menu-panel .menu-button {
  min-height: 42px;
  justify-content: flex-start;
  border-color: var(--line);
  background: #f8fbfd;
  color: #102a43;
  text-align: left;
  white-space: normal;
}

.menu-button.active,
.menu-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: #ffffff;
  color: #102a43;
}

.module-menu-panel .menu-button.active,
.module-menu-panel .menu-button:hover {
  border-color: rgba(0, 166, 147, 0.45);
  background: #eaf8f5;
  color: #063d35;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-wait {
  background: var(--amber);
}

.status-ok {
  background: #33c481;
}

.status-error {
  background: #ff6b63;
}

.layout {
  min-height: max(680px, calc(100vh - 80px));
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.single-workspace {
  max-width: 1760px;
  margin: 0 auto;
  width: 100%;
}

.panel {
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading {
  min-height: 52px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.marketing-metric-control {
  display: grid;
  gap: 3px;
  min-width: 150px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.marketing-metric-control select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 34px 6px 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.source-panel-content,
.knowledge-list {
  height: calc(100% - 52px);
  overflow: auto;
  padding: 12px;
}

.portal-card,
.knowledge-item,
.erp-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.portal-card + .portal-card,
.knowledge-item + .knowledge-item {
  margin-top: 10px;
}

.portal-list {
  padding: 0;
}

.source-group-title {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.erp-card,
.erp-search {
  margin-top: 14px;
}

.erp-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

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

.portal-title strong {
  font-size: 15px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #ffffff;
  white-space: nowrap;
}

.pill-ok {
  background: var(--green);
}

.pill-missing {
  background: var(--amber);
}

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

.portal-actions {
  margin-top: 10px;
}

a.portal-link,
button {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 34px;
  padding: 7px 10px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
a.portal-link:hover {
  border-color: var(--blue);
}

.new-repair-modal .icon-button {
  width: 34px;
  padding: 0;
  font-weight: 700;
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.secondary-button {
  background: #ffffff;
}

.danger-button {
  background: #fff1f0;
  border-color: #f2b8b5;
  color: #a03a32;
  font-weight: 700;
}

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

.assistant-panel {
  display: flex;
  flex-direction: column;
}

.app-view[hidden] {
  display: none;
}

.assistant-panel > .quick-row,
.assistant-panel > .live-context-grid,
.assistant-panel > .chat-log,
.assistant-panel > .chat-composer {
  margin-left: 16px;
  margin-right: 16px;
}

.quick-row {
  padding-top: 14px;
}

.quick-chip {
  background: #eef8f6;
  border-color: #badbd5;
  color: #164e45;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cases-panel {
  display: flex;
  flex-direction: column;
}

.call-panel {
  display: flex;
  flex-direction: column;
}

.communication-panel {
  display: flex;
  flex-direction: column;
}

.embedded-module-shell {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  overflow: hidden;
  min-height: 920px;
}

.embedded-module-frame {
  display: block;
  width: 100%;
  min-height: 920px;
  border: 0;
  background: #fff;
}

.lead-panel {
  display: flex;
  flex-direction: column;
}

.users-panel {
  display: flex;
  flex-direction: column;
}

.lead-workspace {
  min-height: 760px;
  display: grid;
  grid-template-columns: minmax(520px, 0.58fr) minmax(360px, 0.42fr);
  flex: 1;
}

.lead-workspace.representative-mode {
  grid-template-columns: minmax(420px, 920px);
}

.lead-preference-panel,
.lead-manager-panel,
.lead-plan-panel {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.lead-plan-panel {
  display: none;
}

body.lead-plan-modal-open .lead-plan-panel {
  position: fixed;
  inset: 42px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  max-width: none;
  min-height: 0;
  padding: 20px;
  border: 1px solid #c8d6e2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 37, 58, 0.28);
}

.lead-plan-backdrop {
  z-index: 65;
}

.lead-preference-panel,
.lead-manager-panel {
  border-right: 1px solid var(--line);
}

.lead-manager-panel {
  background: #fbfcfd;
}

.lead-week-panel {
  padding: 14px 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
}

.lead-marketing-panel {
  padding: 14px 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f3faf5;
}

.lead-marketing-header {
  min-height: 34px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.lead-marketing-header h3 {
  margin: 2px 0 4px;
}

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

.lead-marketing-table-wrap {
  max-height: 380px;
  overflow: auto;
  border: 1px solid #cfe3d6;
  border-radius: 8px;
  background: #ffffff;
}

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

.lead-marketing-extra {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d7e5dc;
  border-radius: 8px;
  background: #ffffff;
}

.lead-marketing-extra summary {
  cursor: pointer;
  font-weight: 700;
}

.lead-marketing-extra ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.case-summary.compact-summary {
  padding: 10px 0 12px;
  border-bottom: 0;
}

.lead-week-chart {
  display: grid;
  gap: 10px;
}

.lead-target-history {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lead-target-schedule {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid #168a78;
  background: #f0faf7;
  color: #234c47;
  font-size: 13px;
}

.lead-target-schedule span {
  color: var(--muted);
}

.lead-history-header {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.lead-history-title {
  display: grid;
  gap: 2px;
}

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

.lead-history-filter {
  display: grid;
  gap: 3px;
  min-width: 230px;
}

.lead-history-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lead-history-filter select {
  width: 100%;
}

.lead-history-header span:not(.case-badge) {
  color: var(--muted);
  font-size: 13px;
}

.lead-history-table-wrap {
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.lead-history-table th,
.lead-history-table td {
  white-space: nowrap;
}

.lead-week-chart-header {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #12324a;
}

.lead-week-chart-header span {
  color: var(--muted);
  font-size: 13px;
}

.lead-week-chart-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.lead-week-filter {
  display: grid;
  gap: 3px;
  min-width: 220px;
}

.lead-week-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lead-week-filter select,
.lead-week-filter input {
  width: 100%;
}

.lead-week-filter-compact {
  min-width: 150px;
}

.lead-week-current-button {
  align-self: end;
  white-space: nowrap;
}

.lead-week-bars {
  display: grid;
  gap: 8px;
}

.lead-week-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(260px, 1fr) minmax(90px, 0.16fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #d7e2ed;
  border-left-width: 5px;
  border-radius: 8px;
  background: #ffffff;
}

.lead-week-person,
.lead-week-progress,
.lead-week-numbers {
  display: grid;
  gap: 3px;
}

.lead-week-person span,
.lead-week-progress span,
.lead-week-numbers span {
  color: var(--muted);
  font-size: 12px;
}

.lead-week-numbers {
  text-align: right;
}

.lead-week-numbers strong {
  color: #102a43;
  font-size: 18px;
}

.lead-week-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef5;
}

.lead-week-fill,
.lead-week-overflow {
  position: absolute;
  inset-block: 0;
  left: 0;
  border-radius: 999px;
}

.lead-week-fill {
  background: #1d6fb8;
}

.lead-week-overflow {
  left: auto;
  right: 0;
  background: repeating-linear-gradient(135deg, #0f8c64 0 8px, #42b883 8px 16px);
}

.lead-week-complete {
  border-left-color: #0f8c64;
}

.lead-week-complete .lead-week-fill,
.lead-week-above .lead-week-fill {
  background: #0f8c64;
}

.lead-week-nearly {
  border-left-color: #d69e2e;
}

.lead-week-nearly .lead-week-fill {
  background: #d69e2e;
}

.lead-week-behind {
  border-left-color: #1d6fb8;
}

.lead-week-inactive,
.lead-week-unknown {
  border-left-color: #9aa9b7;
}

.lead-week-inactive .lead-week-fill,
.lead-week-unknown .lead-week-fill {
  background: #9aa9b7;
}

.lead-form {
  display: grid;
  gap: 12px;
}

.lead-form label,
.lead-manager-toolbar label {
  display: grid;
  gap: 5px;
}

.lead-form label span,
.lead-manager-toolbar span,
.lead-products-fieldset legend,
.user-modules-fieldset legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lead-form input,
.lead-form select,
.lead-form textarea,
.lead-manager-toolbar select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
}

.lead-imported-fields {
  padding: 10px 12px;
  border: 1px solid #cce4d5;
  border-radius: 7px;
  background: #f2fbf5;
}

.lead-imported-fields strong {
  display: block;
  margin-bottom: 8px;
  color: #0b5f2a;
}

.lead-imported-fields dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.lead-imported-fields div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
}

.lead-imported-fields dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lead-imported-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.lead-postcode-fieldset,
.lead-products-fieldset,
.user-modules-fieldset {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.lead-postcode-map {
  display: grid;
  gap: 12px;
  border: 1px solid #cdd9e6;
  border-radius: 8px;
  padding: 12px;
  background: #f7fbfa;
}

.postcode-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #c8e4d7;
  border-radius: 7px;
  background: #eefaf4;
}

.postcode-selector-header div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.postcode-selector-header strong {
  color: #075d42;
  font-size: 24px;
}

.compact-button {
  min-height: 32px;
  padding: 5px 10px;
}

.postcode-selected-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  align-items: center;
  padding: 4px 0;
}

.postcode-selected-chip {
  min-width: 42px;
  min-height: 30px;
  border: 1px solid #0f8c64;
  border-radius: 999px;
  background: #0f8c64;
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.postcode-selected-chip:hover,
.postcode-selected-chip:focus-visible {
  background: #086548;
  outline: 2px solid rgba(15, 140, 100, 0.2);
}

.postcode-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.postcode-group {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d6e1eb;
  border-radius: 8px;
  background: #ffffff;
}

.postcode-group.has-selection {
  border-color: #a6d9bf;
  background: #f3fbf7;
}

.postcode-group header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.postcode-group header div {
  display: grid;
  gap: 2px;
}

.postcode-group header span {
  color: var(--muted);
  font-size: 12px;
}

.postcode-group-toggle {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #b8c7d6;
  border-radius: 6px;
  background: #f8fbfd;
  color: #12324a;
  cursor: pointer;
}

.postcode-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
}

.postcode-region {
  min-height: 44px;
  display: grid;
  align-content: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid #c8d4df;
  border-radius: 7px;
  background: #ffffff;
  color: #172636;
  text-align: center;
  cursor: pointer;
}

.postcode-region strong {
  font-size: 15px;
}

.postcode-region span {
  min-height: 14px;
  color: #526375;
  font-size: 11px;
  line-height: 1.15;
}

.postcode-region:hover,
.postcode-region:focus-visible {
  border-color: #0f6b4d;
  outline: 2px solid rgba(27, 145, 104, 0.22);
  outline-offset: 1px;
}

.postcode-region.selected.main,
.postcode-region.selected:not(.extra) {
  border-color: #086548;
  background: #0f8c64;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 140, 100, 0.2);
}

.postcode-region.selected.extra {
  border-color: #c76a00;
  background: #f59e0b;
  color: #2f1b00;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.22);
}

.postcode-region.selected span {
  color: rgba(255, 255, 255, 0.82);
}

.postcode-region.selected.extra span {
  color: rgba(47, 27, 0, 0.78);
}

.postcode-mode-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.postcode-mode-legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.postcode-mode-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.postcode-mode-dot.main {
  background: #0f8c64;
}

.postcode-mode-dot.extra {
  background: #f59e0b;
}

.postcode-selected-chip.main {
  border-color: #086548;
  background: #e7f6ef;
  color: #075a40;
}

.postcode-selected-chip.extra {
  border-color: #c76a00;
  background: #fff3d6;
  color: #7a3e00;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.lead-vacation-editor {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

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

.lead-vacation-item {
  min-height: 36px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.lead-manager-fields {
  display: grid;
  gap: 10px;
}

.lead-happerp-fields {
  margin: 0;
  padding: 10px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  background: #f7fbfa;
  display: grid;
  gap: 10px;
}

.lead-happerp-fields legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lead-happerp-id-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lead-manager-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

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

.lead-suggestions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.lead-create-panel {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.lead-create-panel h3 {
  margin-bottom: 4px;
}

.inline-input-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.lead-suggestions ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.lead-plan-table-wrap {
  max-height: 620px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

body.lead-plan-modal-open .lead-plan-table-wrap {
  max-height: none;
  min-height: 0;
  flex: 1;
}

.lead-plan-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.lead-plan-actions p {
  flex: 1 1 260px;
  margin: 0;
}

.lead-plan-table td {
  vertical-align: top;
}

.lead-manual-select {
  display: block;
  width: min(260px, 100%);
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.users-workspace {
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(520px, 0.62fr) minmax(360px, 0.38fr);
  flex: 1;
}

.users-list-panel,
.user-detail-panel {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.users-list-panel {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

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

.users-table tbody tr {
  cursor: pointer;
}

.users-table tbody tr:hover {
  background: #eef8f6;
}

.user-form {
  display: grid;
  gap: 12px;
}

.user-form label {
  display: grid;
  gap: 5px;
}

.user-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.user-form input,
.user-form select {
  min-height: 38px;
  padding: 8px 10px;
}

.communication-toolbar {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1fr) minmax(220px, 0.8fr);
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.communication-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.communication-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.communication-toolbar select {
  width: 100%;
}

.internal-escalation-form {
  grid-template-columns: minmax(180px, 0.8fr) minmax(140px, 0.5fr) minmax(180px, 0.6fr) minmax(320px, 1.4fr) auto;
}

.internal-escalation-form .wide-field textarea {
  min-height: 78px;
  resize: vertical;
}

.inline-fields {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-fields input {
  min-width: 180px;
}

.success-pill,
.warning-pill,
.danger-pill,
.info-pill,
.neutral-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.success-pill {
  background: #dff5eb;
  color: #0b6f43;
}

.warning-pill {
  background: #fff2d6;
  color: #8a5a00;
}

.danger-pill {
  background: #fde2e2;
  color: #9f1d1d;
}

.info-pill {
  background: #deeff8;
  color: #145a7a;
}

.neutral-pill {
  background: #e9edf1;
  color: #4b5965;
}

.internal-escalation-follow-up p {
  margin: 8px 0;
  white-space: normal;
}

.communication-workspace {
  min-height: 760px;
  display: grid;
  grid-template-columns: minmax(300px, 0.34fr) minmax(620px, 1fr);
  flex: 1;
}

.communication-sellers,
.communication-detail {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.communication-sellers {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

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

.case-detail-block {
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

.communication-seller-item {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  background: #ffffff;
}

.communication-seller-item span {
  color: var(--muted);
  font-size: 13px;
}

.case-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.case-detail-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.case-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.case-detail-grid strong {
  display: block;
  margin-top: 4px;
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: 18px;
}

.communication-records {
  display: grid;
  gap: 10px;
}

.communication-state-summary,
.communication-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.communication-state-summary {
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.communication-legend {
  margin-bottom: 4px;
}

.communication-state-pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.state-icon {
  width: 20px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--state-accent, var(--text));
  color: #ffffff;
}

.state-icon-svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.communication-state-solved {
  --state-accent: var(--green);
  border-color: #72c992;
  background: #eaf8ef;
  color: var(--green);
}

.communication-state-ongoing {
  --state-accent: var(--blue);
  border-color: #9bc0df;
  background: #f2f8fd;
  color: var(--blue);
}

.communication-state-customer {
  --state-accent: var(--amber);
  border-color: #e7b86e;
  background: #fff7e8;
  color: var(--amber);
}

.communication-state-supplier {
  --state-accent: var(--teal);
  border-color: #8fc8c1;
  background: #edf9f7;
  color: var(--teal);
}

.communication-state-seller {
  --state-accent: #9b3446;
  border-color: #e3a2ad;
  background: #fff3f5;
  color: #9b3446;
}

.communication-repair {
  padding: 11px;
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 8px;
  background: #fbfcfd;
}

.communication-repair-solved {
  border-color: #72c992;
  border-left-color: var(--green);
  background: #f0fbf4;
  box-shadow: 0 8px 18px rgba(22, 121, 74, 0.12);
}

.communication-repair-ongoing {
  border-left-color: var(--blue);
}

.communication-repair-customer {
  border-left-color: var(--amber);
  background: #fffbf3;
}

.communication-repair-supplier {
  border-left-color: var(--teal);
  background: #f3fbfa;
}

.communication-repair-seller {
  border-left-color: #9b3446;
  background: #fff8fa;
}

.manufacturer-email-panel {
  padding: 12px;
  border: 1px solid #cfe3e0;
  border-radius: 8px;
  background: #f4fbfa;
}

.manufacturer-email-panel h4 {
  margin-top: 0;
}

.communication-repair-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.communication-repair-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.communication-repair h4 {
  margin: 8px 0 4px;
}

.communication-state-reason {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.communication-repair ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.communication-draft {
  margin-top: 18px;
}

.disabled-link {
  opacity: 0.55;
  pointer-events: none;
}

.call-searchbar {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.call-searchbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.call-searchbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.call-searchbar input {
  min-height: 38px;
  padding: 8px 10px;
}

.call-status {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.call-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(520px, 1fr);
  flex: 1;
}

.call-side-panel,
.call-timeline-panel {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.call-side-panel {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.call-customer-block + .call-customer-block {
  margin-top: 18px;
}

.call-customer-block h3 {
  margin: 3px 0 6px;
}

.call-customer-block h4 {
  margin: 0 0 8px;
}

.call-meta {
  grid-template-columns: 1fr;
}

.source-dl {
  margin: 0 0 10px;
}

.source-dl div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.source-dl dt {
  color: var(--muted);
  font-weight: 700;
}

.source-dl dd {
  margin: 0;
}

.product-group {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.product-group strong {
  display: block;
  margin-bottom: 6px;
}

.product-group ul,
.timeline-list {
  margin: 0;
  padding: 0;
}

.product-group li {
  margin-left: 18px;
  margin-bottom: 5px;
  line-height: 1.35;
}

.call-story {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.call-inline-loading {
  display: inline-grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.call-inline-loading .progress-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  font-weight: 700;
}

.inline-loader-content,
.marketing-loading-content {
  display: grid;
  gap: 5px;
  min-width: min(260px, 100%);
}

.inline-progress-bar {
  display: block;
  width: min(240px, 100%);
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4edf5;
}

.inline-progress-bar span {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  animation: progressEstimate 28s cubic-bezier(0.18, 0.82, 0.24, 1) forwards;
}

.inline-loader .progress-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-width: 2px;
}

td .inline-loader,
p .inline-loader {
  vertical-align: middle;
}

button .inline-loader {
  justify-content: center;
  color: inherit;
}

button .inline-loader-content {
  display: inline;
  min-width: 0;
}

button .inline-progress-bar {
  display: none;
}

button .inline-loader .progress-spinner {
  border-color: rgba(0, 43, 78, 0.18);
  border-top-color: currentColor;
}

button.primary-button .inline-loader .progress-spinner {
  border-color: rgba(255, 255, 255, 0.5);
  border-top-color: currentColor;
}

button.secondary-button .inline-loader .progress-spinner {
  border-color: #c8d8e8;
  border-top-color: currentColor;
}

.lookup-diagnostics {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff8ec;
}

.lookup-diagnostics strong {
  display: block;
  margin-bottom: 5px;
  color: var(--amber);
}

.lookup-diagnostics p {
  margin-bottom: 5px;
}

.trengo-summary-card {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #f7fbff;
}

.trengo-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.trengo-summary-head h4 {
  margin: 0;
  font-size: 15px;
}

.summary-loader {
  display: inline-grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.summary-loader .progress-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.summary-skeleton {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.summary-skeleton span {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dfeaf3 0%, #f8fbff 45%, #dfeaf3 90%);
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.summary-skeleton span:nth-child(2) {
  width: 82%;
}

.summary-skeleton span:nth-child(3) {
  width: 64%;
}

.trengo-chronology {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.trengo-chronology li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  line-height: 1.35;
}

.trengo-chronology time {
  color: #35546d;
  font-size: 12px;
  font-weight: 700;
}

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-date {
  color: #243b53;
  font-size: 13px;
  font-weight: 700;
}

.timeline-body {
  min-width: 0;
}

.timeline-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.timeline-head span:last-child {
  color: var(--muted);
}

.timeline-body h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.timeline-body p {
  line-height: 1.42;
}

.case-toolbar {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.case-toolbar label,
.mail-draft label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.case-toolbar span,
.mail-draft span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.case-search input,
.case-toolbar input[type="date"],
.case-toolbar input[type="range"],
.case-toolbar select {
  width: 100%;
}

.case-toolbar select[multiple] {
  min-height: 122px;
  padding-right: 8px;
}

.range-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.range-field output {
  min-width: 64px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.case-search {
  grid-column: span 2;
}

.case-checkbox {
  min-height: 34px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.case-summary {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.case-summary article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.case-summary strong {
  display: block;
  font-size: 22px;
  color: #102a43;
}

.case-summary span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.case-workspace {
  min-height: 760px;
  display: grid;
  grid-template-columns: minmax(640px, 1fr) minmax(280px, 0.38fr);
  gap: 0;
  flex: 1;
}

.case-workspace.case-activity-collapsed {
  grid-template-columns: minmax(640px, 1fr) 48px;
}

.case-list-wrap {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
}

.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.case-table th,
.case-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.case-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f8;
  color: #243b53;
}

.case-table .compact-input {
  width: 120px;
  min-height: 34px;
  padding: 6px 8px;
}

.sort-header {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
}

.sort-header.active-sort {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.case-table td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.case-table button,
.case-re-link {
  min-height: 28px;
  padding: 4px 8px;
  color: var(--blue);
  font-weight: 700;
}

.case-re-link {
  display: inline-flex;
  align-items: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.case-table tbody tr {
  cursor: pointer;
}

.case-table tbody tr.selected-row {
  background: #eefcf8;
  box-shadow: inset 4px 0 0 var(--accent);
}

.link-button {
  border: 0;
  background: transparent;
  color: #0b5cab;
  padding: 0;
  min-height: 0;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.compact-action {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.outstanding-panel {
  background: #f6f9fc;
}

.outstanding-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 780px;
}

.outstanding-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.outstanding-filters label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: #334e68;
}

.outstanding-filters select,
.outstanding-filters input {
  width: 100%;
}

.outstanding-total-card {
  padding: 16px;
  background: #d7ebff;
  border: 1px solid #bdd7f3;
  border-radius: 8px;
}

.outstanding-total-card span {
  display: block;
  color: #334e68;
  font-size: 13px;
}

.outstanding-total-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  color: #102a43;
}

.outstanding-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.outstanding-main {
  min-width: 0;
}

.outstanding-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.outstanding-chart-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.outstanding-chart-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #102a43;
}

.outstanding-chart {
  height: 240px;
  min-width: 0;
}

.outstanding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: #fbfcfd;
}

.outstanding-action-status {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  font-size: 14px;
}

.outstanding-content-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(320px, 0.38fr);
  gap: 0;
  min-height: 420px;
  align-items: start;
}

.outstanding-content-grid.is-ai-collapsed {
  grid-template-columns: minmax(620px, 1fr) 48px;
}

.outstanding-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 300px);
  min-height: 420px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  scrollbar-gutter: stable both-edges;
}

.outstanding-table {
  min-width: 1260px;
}

.outstanding-table th:first-child,
.outstanding-table td:first-child {
  width: 42px;
  text-align: center;
}

.table-sort-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.table-sort-button:hover {
  color: var(--accent);
}

.column-filter-row th {
  background: #f8fafc;
  padding-top: 6px;
  padding-bottom: 8px;
}

.column-filter-row input {
  width: 100%;
  min-width: 74px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  background: #ffffff;
}

.outstanding-ai-panel {
  position: relative;
  padding: 16px 16px 16px 54px;
  background: #ffffff;
  max-height: calc(100vh - 300px);
  min-height: 420px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.outstanding-ai-panel.is-collapsed {
  padding: 0;
  overflow: hidden;
  border-left: 0;
}

.outstanding-ai-toggle {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  width: 42px;
  min-height: 100%;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  gap: 10px;
  padding: 14px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #f8fafc;
  color: #334e68;
  cursor: pointer;
}

.outstanding-ai-toggle:hover {
  background: #eef5fb;
  color: var(--accent);
}

.outstanding-ai-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.outstanding-ai-toggle-icon {
  font-size: 28px;
  line-height: 1;
}

.outstanding-ai-toggle-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.outstanding-ai-panel-content[hidden] {
  display: none;
}

.outstanding-ai-panel h3 {
  margin: 4px 0 12px;
}

.outstanding-ai-list ul {
  margin: 0;
  padding-left: 18px;
}

.outstanding-ai-list li + li {
  margin-top: 8px;
}

.outstanding-selected-detail {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.outstanding-incasso-date {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.outstanding-detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  font-size: 13px;
}

.outstanding-detail-list dt {
  color: var(--muted);
}

.outstanding-detail-list dd {
  margin: 0;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .outstanding-layout,
  .outstanding-content-grid {
    grid-template-columns: 1fr;
  }

  .outstanding-content-grid.is-ai-collapsed {
    grid-template-columns: 1fr;
  }

  .outstanding-filters,
  .outstanding-table-wrap {
    border-right: 0;
  }

  .outstanding-table-wrap,
  .outstanding-ai-panel {
    max-height: none;
  }

  .outstanding-ai-panel,
  .outstanding-ai-panel.is-collapsed {
    min-height: 48px;
  }

  .outstanding-ai-panel.is-collapsed {
    border-top: 1px solid var(--line);
  }

  .outstanding-ai-toggle {
    width: 100%;
    min-height: 48px;
    flex-direction: row;
    justify-content: center;
    border-right: 0;
  }

  .outstanding-ai-toggle-label {
    writing-mode: initial;
    transform: none;
  }

  .outstanding-charts {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

.selected-row {
  background: #eef8f6;
}

.case-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.case-badge-due {
  background: #fff3dc;
  color: var(--amber);
}

.case-badge-ok {
  background: #e5f6ee;
  color: var(--green);
}

.case-badge-info {
  background: #e7f0ff;
  color: #1c5f9f;
}

.agenda-task-panel {
  padding: 12px;
  border: 1px solid #d8e4ef;
  border-radius: 8px;
  background: #f8fbfd;
}

.agenda-task-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agenda-task-list li {
  padding: 9px;
  border-left: 4px solid var(--amber);
  border-radius: 6px;
  background: #ffffff;
}

.agenda-task-list span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.agenda-task-list p {
  margin: 6px 0 0;
}

.case-detail {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.case-inline-detail-row {
  cursor: default;
}

.case-inline-detail-row:hover {
  background: transparent;
}

.case-inline-detail-row > td {
  padding: 0 12px 14px 42px;
  background: #ffffff;
}

.case-inline-detail {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.case-inline-detail .case-meta {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.case-activity-panel {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border-left: 1px solid var(--line);
  background: #f9fbfc;
}

.case-workspace.case-activity-collapsed .case-activity-panel {
  padding: 8px;
  overflow: hidden;
}

.case-workspace.case-activity-collapsed .case-activity-header {
  justify-content: center;
}

.case-workspace.case-activity-collapsed .case-activity-header > div,
.case-workspace.case-activity-collapsed #clearCaseActivityButton,
.case-workspace.case-activity-collapsed .case-activity-list {
  display: none;
}

.case-activity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.case-activity-header h3 {
  margin: 3px 0 0;
  font-size: 16px;
}

.case-activity-header button {
  min-height: 32px;
  padding: 5px 9px;
  white-space: nowrap;
}

.case-activity-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--brand);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

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

.case-activity-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #ffffff;
}

.case-activity-success {
  border-left-color: var(--green);
}

.case-activity-error {
  border-left-color: var(--danger);
}

.case-activity-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.case-activity-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.case-activity-retry {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--brand);
}

.case-activity-retry svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.case-activity-item h4 {
  margin: 8px 0 5px;
  font-size: 14px;
}

.case-activity-item p {
  margin: 0;
  color: #334e68;
  font-size: 13px;
  line-height: 1.35;
}

.case-activity-time {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.case-activity-running .case-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseStatus 1.2s ease-in-out infinite;
}

.case-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.case-detail h3 {
  margin: 3px 0 5px;
  font-size: 18px;
}

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

.case-meta div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.case-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.case-meta dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.mail-draft {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #badbd5;
  border-radius: 8px;
  background: #f4fbff;
}

.erp-repair-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #d7dee6;
  border-radius: 8px;
  background: #fbfcfd;
}

.agenda-draft-panel {
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid #badbd5;
  border-radius: 8px;
  background: #f7fffd;
}

.agenda-draft-panel h4,
.agenda-draft-panel p {
  margin-top: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 24, 38, 0.48);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(1040px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #c8d6e2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 37, 58, 0.28);
}

.new-repair-modal .erp-repair-panel {
  margin-top: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.erp-action-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.erp-action-palette button {
  min-height: 44px;
  white-space: normal;
  line-height: 1.2;
}

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

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

.lookup-results-grid {
  align-items: start;
}

.lookup-results {
  min-height: 76px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.lookup-result-button {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 3px;
  margin-bottom: 7px;
  padding: 9px;
  text-align: left;
  background: #fbfcfd;
}

.lookup-result-button:hover {
  background: #eef8f6;
}

.lookup-result-button span,
.lookup-result-button small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.selected-order-card {
  margin: 10px 0 12px;
}

.selected-order {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #badbd5;
  border-radius: 8px;
  background: #eef8f6;
}

.selected-order h4 {
  margin: 4px 0 5px;
}

.selected-order p {
  margin: 0 0 5px;
  color: #334e68;
  font-size: 13px;
}

.erp-repair-panel label {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.erp-repair-panel label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.erp-repair-panel input,
.erp-repair-panel select,
.erp-repair-panel textarea {
  width: 100%;
}

.erp-repair-panel textarea {
  min-height: 110px;
}

.mail-action-palette {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.mail-action-palette button {
  min-height: 42px;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

.mail-draft input,
.mail-draft textarea {
  width: 100%;
}

.mail-draft textarea {
  min-height: 190px;
}

.close-options {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.close-option {
  min-height: 40px;
}

.close-option:has(input:disabled) {
  opacity: 0.55;
}

.case-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.live-context-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 92px 92px repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.live-context-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.live-context-grid label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-toggle {
  min-height: 57px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.live-toggle input {
  width: 16px;
  height: 16px;
}

.field-label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea,
select,
input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

select {
  min-height: 34px;
  padding: 6px 28px 6px 8px;
}

textarea {
  width: calc(100% - 32px);
  resize: vertical;
  min-height: 118px;
  padding: 12px;
  line-height: 1.45;
}

input[type="search"] {
  min-width: 0;
  min-height: 34px;
  padding: 7px 9px;
}

.field-label.compact {
  margin: 0 0 6px;
}

.inline-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.erp-results {
  margin-top: 10px;
}

.repair-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.repair-item + .repair-item {
  margin-top: 8px;
}

.repair-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.repair-item p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
}

.chat-log {
  margin: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  overflow: auto;
  flex: 1;
}

.chat-message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.chat-message + .chat-message {
  margin-top: 14px;
}

.user-message {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.user-message .avatar {
  grid-column: 2;
  background: #dce8f2;
  color: #243b53;
}

.user-message .bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: #e7f0fb;
  border-color: #b9cfe7;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--teal);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.bubble {
  max-width: 920px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.typing-line {
  color: var(--muted);
}

.progress-card {
  min-width: min(760px, 100%);
}

.progress-card > p {
  margin-bottom: 12px;
}

.progress-activity {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #badbd5;
  border-radius: 8px;
  background: #f4fbff;
}

.progress-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #c8d8e8;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.progress-status {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
}

.progress-elapsed {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.progress-bar {
  position: relative;
  height: 5px;
  margin: 10px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e4edf5;
}

.progress-bar span {
  display: block;
  width: 16%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--teal));
  background-size: 180% 100%;
  transition: width 0.35s ease;
}

.progress-bar-estimated span,
.progress-bar-indeterminate span {
  width: 12%;
  animation: progressEstimate 40s cubic-bezier(0.18, 0.82, 0.24, 1) forwards;
}

.progress-updates {
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.progress-updates li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  padding: 3px 0;
  line-height: 1.35;
}

.progress-updates span {
  font-weight: 700;
  color: #243b53;
}

.lead-loading-card {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid #cfe3e0;
  border-radius: 8px;
  background: #f4fbfa;
}

.lead-loading-card.lead-loading-compact {
  padding: 10px 12px;
}

.lead-loading-card.lead-loading-compact .progress-bar {
  margin: 8px 0 0;
}

.lead-loading-head,
.lead-loading-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.lead-loading-head strong,
.lead-loading-row strong {
  display: block;
  margin-bottom: 3px;
  color: #102a43;
  font-size: 15px;
}

.lead-loading-head span,
.lead-loading-row span {
  color: var(--muted);
  font-size: 13px;
}

.lead-loading-row {
  padding: 8px 0;
}

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

@keyframes pulseStatus {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes progressShimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 180% 50%;
  }
}

@keyframes progressEstimate {
  0% {
    width: 10%;
  }
  35% {
    width: 62%;
  }
  70% {
    width: 86%;
  }
  100% {
    width: 98%;
  }
}

.chat-composer {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.chat-composer textarea {
  width: 100%;
  min-height: 86px;
}

.composer-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.colleague-reply {
  margin-bottom: 16px;
  padding: 14px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #eef8f6;
}

.colleague-reply p {
  margin-bottom: 9px;
  line-height: 1.45;
}

.colleague-reply p:last-child {
  margin-bottom: 0;
}

.customer-explanation {
  padding: 12px;
  border: 1px solid #badbd5;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f4fbff;
}

.customer-explanation p {
  margin-bottom: 8px;
  line-height: 1.45;
}

.customer-explanation p:last-child {
  margin-bottom: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.meta-chip {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.answer-section {
  margin-top: 16px;
}

.answer-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #243b53;
}

.live-status {
  border: 1px solid #c8d8e8;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

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

.status-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.status-grid strong {
  display: block;
  margin: 3px 0;
  font-size: 13px;
}

.status-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.bubble ul {
  margin: 0;
  padding-left: 18px;
}

.bubble li {
  margin-bottom: 7px;
  line-height: 1.42;
}

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

.source-list a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.source-type {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.knowledge-item h3 {
  font-size: 14px;
  margin-bottom: 6px;
}

.knowledge-item p,
.portal-card p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  min-height: 21px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f4f6f8;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.count-badge {
  min-width: 28px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #dff3ef;
  color: #0f6258;
  font-size: 12px;
  font-weight: 700;
}

.check-result {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.warning {
  color: var(--amber);
}

.danger {
  color: var(--red);
}

.success {
  color: var(--green);
}

@media (max-width: 1100px) {
  .layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 360px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .brand-lockup {
    min-width: 0;
  }

  .module-menu-panel {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .portal-list,
  .source-panel-content,
  .knowledge-list {
    height: auto;
    max-height: 420px;
  }

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

  .live-toggle {
    grid-column: span 3;
  }

  .case-toolbar,
  .case-summary,
  .case-workspace,
  .communication-toolbar,
  .communication-workspace,
  .lead-workspace,
  .users-workspace,
  .call-workspace,
  .erp-action-palette {
    grid-template-columns: 1fr;
  }

  .case-workspace.case-activity-collapsed {
    grid-template-columns: 1fr;
  }

  .case-workspace.case-activity-collapsed .case-activity-panel {
    min-height: 48px;
    max-height: 48px;
    border-bottom: 1px solid var(--line);
  }

  .case-search {
    grid-column: auto;
  }

  .case-list-wrap,
  .case-detail,
  .case-activity-panel,
  .communication-sellers,
  .communication-detail,
  .lead-preference-panel,
  .lead-manager-panel,
  .lead-plan-panel,
  .users-list-panel,
  .user-detail-panel,
  .call-side-panel {
    max-height: 520px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body.lead-plan-modal-open .lead-plan-panel {
    inset: 14px;
    max-height: none;
  }

  .lead-vacation-editor {
    grid-template-columns: 1fr;
  }

  .lead-week-row {
    grid-template-columns: 1fr;
  }

  .lead-week-numbers {
    text-align: left;
  }

  .case-activity-panel {
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-lockup {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-logo {
    width: min(210px, 100%);
  }

  .layout {
    padding: 10px;
    gap: 10px;
  }

  h1 {
    font-size: 20px;
  }

  .assistant-panel > .quick-row,
  .assistant-panel > .live-context-grid,
  .assistant-panel > .chat-log,
  .assistant-panel > .chat-composer {
    margin-left: 12px;
    margin-right: 12px;
  }

  textarea,
  .chat-composer textarea {
    width: calc(100% - 24px);
  }

  .live-context-grid,
  .status-grid,
  .case-meta,
  .erp-field-grid,
  .call-searchbar,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .live-toggle {
    grid-column: auto;
  }

  .module-menu,
  .app-menu {
    width: 100%;
  }

  .module-menu {
    justify-content: flex-start;
  }

  .module-menu-toggle {
    width: 100%;
  }

  .module-menu-panel {
    left: 0;
    width: min(100%, calc(100vw - 20px));
    grid-template-columns: 1fr;
    transform: none;
  }

  .menu-button {
    flex: 1;
  }
}

.marketing-toolbar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.marketing-toolbar label {
  display: grid;
  gap: 6px;
  grid-column: span 3;
  min-width: 0;
}

.marketing-toolbar label:nth-child(1),
.marketing-toolbar label:nth-child(2) {
  grid-column: span 2;
}

.marketing-toolbar select[multiple] {
  min-height: 92px;
}

.marketing-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.marketing-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.marketing-meta-right {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.marketing-filter-chip {
  width: auto;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(23, 74, 99, 0.15);
  background: rgba(23, 74, 99, 0.08);
  color: #174a63;
  font-size: 0.9rem;
}

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

.marketing-hero-kpi,
.marketing-kpi-card,
.marketing-loading-card,
.marketing-error-box {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.marketing-hero-kpi {
  grid-row: span 2;
  display: grid;
  align-content: center;
  gap: 8px;
  border-color: #9fcac4;
  background: linear-gradient(180deg, #eefaf8 0%, #ffffff 100%);
}

.marketing-hero-kpi h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.marketing-hero-kpi strong {
  font-size: 2.7rem;
  line-height: 1.05;
  color: #0e3854;
}

.marketing-hero-kpi p,
.marketing-kpi-card small {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.marketing-kpi-card {
  display: grid;
  gap: 8px;
}

.marketing-kpi-card.is-primary {
  grid-column: span 2;
  min-height: 116px;
  border-color: rgba(17, 134, 122, 0.28);
  background: linear-gradient(180deg, rgba(17, 134, 122, 0.08) 0%, #ffffff 100%);
}

.marketing-kpi-card.is-primary .marketing-kpi-value {
  font-size: 2rem;
}

.marketing-kpi-card.is-primary small {
  font-size: 0.9rem;
}

.marketing-kpi-card.is-primary .marketing-kpi-label {
  color: #174a63;
}

.marketing-kpi-label {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.marketing-kpi-value {
  font-size: 1.6rem;
  color: var(--ink);
}

.marketing-decision-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 12px;
  margin: -6px 0 18px;
}

.marketing-decision-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.marketing-quality-summary {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 94px;
}

.marketing-quality-score {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  border: 6px solid #d4e0e8;
  background: #f8fbfd;
}

.marketing-quality-score strong {
  font-size: 1.55rem;
  line-height: 1;
}

.marketing-quality-score span {
  color: var(--muted);
  font-size: 0.78rem;
}

.marketing-quality-score.is-good {
  border-color: #149365;
}

.marketing-quality-score.is-warning {
  border-color: #d79b23;
}

.marketing-quality-score.is-danger {
  border-color: #be4a4a;
}

.marketing-quality-lines p {
  margin: 0 0 4px;
  color: var(--ink);
}

.marketing-priority-actions {
  display: grid;
  gap: 8px;
}

.marketing-priority-item {
  text-align: left;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fbfdff;
  padding: 9px 11px;
  cursor: pointer;
}

.marketing-priority-item span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.marketing-priority-item strong {
  color: var(--ink);
}

.marketing-priority-item small {
  color: var(--muted);
}

.marketing-priority-item.is-high {
  border-left-color: #be4a4a;
}

.marketing-priority-item.is-medium {
  border-left-color: #d79b23;
}

.marketing-priority-item.is-opportunity {
  border-left-color: #149365;
}

.marketing-loading-card,
.marketing-error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.marketing-error-box {
  color: #a83d3d;
  background: #fff5f5;
}

.marketing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  align-items: start;
}

.marketing-grid-span-2 {
  grid-column: 1 / -1;
}

.marketing-chart,
.marketing-trend-chart {
  width: 100%;
  min-height: 320px;
  height: 320px;
}

.marketing-ai-block {
  align-self: stretch;
}

.marketing-ai-analysis ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.marketing-ai-analysis li {
  line-height: 1.42;
}

.marketing-mapping-block {
  margin: 18px 0 0;
}

.marketing-mapping-block details {
  display: grid;
  gap: 12px;
}

.marketing-mapping-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.marketing-mapping-block summary::-webkit-details-marker {
  display: none;
}

.marketing-mapping-block summary strong {
  display: block;
  margin-top: 2px;
  font-size: 1.1rem;
}

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

.marketing-mapping-layout h4 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1rem;
}

.marketing-rate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.marketing-rate-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 700;
}

.marketing-rate-grid input {
  width: 100%;
  font: inherit;
}

.marketing-mapping-wrap {
  max-height: 420px;
}

.marketing-mapping-table input,
.marketing-mapping-table select,
.marketing-mapping-table textarea {
  width: 100%;
  min-width: 160px;
  font: inherit;
}

.marketing-mapping-table textarea {
  min-width: 220px;
  resize: vertical;
}

.marketing-mapping-table td:first-child input {
  min-width: 210px;
  font-weight: 700;
}

.marketing-mapping-table td:first-child select {
  min-width: 150px;
  font-weight: 700;
}

.marketing-grid .table-wrap {
  overflow: auto;
  max-height: 540px;
}

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

.marketing-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(130px, 1.2fr) minmax(72px, auto);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
}

.marketing-bar-row:hover .marketing-bar-track,
.marketing-row-click:hover {
  outline: 2px solid rgba(17, 134, 122, 0.22);
  cursor: pointer;
}

.marketing-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marketing-bar-track {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e8eef2;
}

.marketing-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11867a 0%, #174a63 100%);
}

.marketing-bar-value {
  color: var(--muted);
  font-weight: 600;
  text-align: right;
}

.marketing-bar-secondary {
  grid-column: 2 / 4;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: -5px;
}

.marketing-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

.marketing-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.marketing-status-ok {
  background: #e3f6ef;
  color: #0c6a5f;
}

.marketing-status-verdacht {
  background: #fff4de;
  color: #9e6a15;
}

.marketing-status-niet-toegewezen,
.marketing-status-uitgesloten-wegens-google-ads-dubbeltelling {
  background: #fdeaea;
  color: #a83d3d;
}

@media (max-width: 1200px) {
  .marketing-toolbar,
  .marketing-kpi-grid,
  .marketing-decision-panel {
    grid-template-columns: 1fr;
  }

  .marketing-toolbar label,
  .marketing-toolbar label:nth-child(1),
  .marketing-toolbar label:nth-child(2) {
    grid-column: auto;
  }

  .marketing-grid {
    grid-template-columns: 1fr;
  }

  .marketing-grid-span-2 {
    grid-column: auto;
  }

  .marketing-kpi-card.is-primary,
  .marketing-mapping-layout {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
}

.leave-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  padding: 16px;
}

.leave-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.leave-card h3 {
  margin: 0 0 12px;
}

.leave-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.whatsapp-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.whatsapp-grid,
.whatsapp-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.whatsapp-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-bg);
}

.whatsapp-template-editor {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.whatsapp-template-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
}

.whatsapp-template-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.whatsapp-planning-table {
  max-height: 560px;
  overflow: auto;
}

.whatsapp-preview-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.whatsapp-log-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.whatsapp-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.warning-list {
  margin: 10px 0;
  color: var(--danger);
}

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

.leave-calendar-card {
  min-width: 0;
}

.leave-calendar-shell {
  display: grid;
  gap: 12px;
}

.leave-calendar-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.leave-calendar-toolbar h3 {
  margin: 2px 0 4px;
  font-size: 1.55rem;
}

.leave-calendar-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.leave-calendar-weekdays {
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #eaf2f8;
}

.leave-calendar-weekdays span {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  border-right: 1px solid var(--line);
}

.leave-calendar-weekdays span:last-child {
  border-right: 0;
}

.leave-calendar-grid {
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: #fff;
}

.leave-calendar-day {
  min-height: 126px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.leave-calendar-day-muted {
  background: #f6f8fb;
  color: #8aa0b4;
}

.leave-calendar-today {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: #f4fffd;
}

.leave-calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  margin-bottom: 6px;
  border-radius: 50%;
  font-weight: 800;
}

.leave-calendar-today .leave-calendar-day-number {
  background: var(--accent);
  color: #fff;
}

.leave-calendar-events {
  display: grid;
  gap: 5px;
}

.leave-calendar-event {
  display: grid;
  gap: 1px;
  padding: 5px 7px 6px;
  border-left: 4px solid #1f6fb2;
  border-radius: 5px;
  background: #e7f1fb;
  color: #073b67;
  line-height: 1.15;
  overflow: hidden;
}

.leave-calendar-event.leave-status-approved,
.leave-calendar-event.leave-type-legal {
  border-left-color: #1f6fb2;
  background: #e7f1fb;
  color: #073b67;
}

.leave-calendar-event.leave-status-approved.leave-type-legal {
  border-left-color: #1f6fb2;
  background: #e7f1fb;
  color: #073b67;
}

.leave-calendar-event.leave-status-approved.leave-type-recup,
.leave-calendar-event.leave-type-recup {
  border-left-color: #0f766e;
  background: #e6fffb;
  color: #134e4a;
}

.leave-calendar-event.leave-status-approved.leave-type-unpaid,
.leave-calendar-event.leave-type-unpaid {
  border-left-color: #7c3aed;
  background: #f3e8ff;
  color: #4c1d95;
}

.leave-calendar-event.leave-status-approved.leave-type-sick,
.leave-calendar-event.leave-type-sick {
  border-left-color: #be123c;
  background: #fff1f2;
  color: #7f1d1d;
}

.leave-calendar-event.leave-status-approved.leave-type-other,
.leave-calendar-event.leave-type-other {
  border-left-color: #64748b;
  background: #f1f5f9;
  color: #334155;
}

.leave-calendar-event.leave-status-pending {
  border-left-color: #f59e0b;
  background: #fff7ed;
  color: #7c2d12;
}

.leave-calendar-event.leave-status-rejected {
  border-left-color: #dc2626;
  background: #fef2f2;
  color: #7f1d1d;
}

.leave-calendar-event span,
.leave-calendar-event small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leave-calendar-event-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.leave-calendar-status-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: currentColor;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.leave-calendar-event small {
  color: currentColor;
  font-size: 0.75rem;
  opacity: 0.82;
}

.leave-calendar-more {
  width: 100%;
  padding: 3px 6px;
  border: 1px solid #c4ddf3;
  border-radius: 5px;
  background: #fff;
  color: #155f9e;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.leave-calendar-month-list {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.leave-calendar-month-list h4 {
  margin: 0;
}

.leave-calendar-list-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.leave-calendar-list-item.leave-status-pending {
  border-color: #fdba74;
  background: #fff7ed;
}

.leave-calendar-list-item.leave-status-rejected {
  border-color: #fecaca;
  background: #fef2f2;
}

.leave-calendar-list-item.leave-status-approved.leave-type-legal {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.leave-calendar-list-item.leave-status-approved.leave-type-recup {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.leave-calendar-list-item.leave-status-approved.leave-type-unpaid {
  border-color: #ddd6fe;
  background: #faf5ff;
}

.leave-calendar-list-item.leave-status-approved.leave-type-sick {
  border-color: #fecdd3;
  background: #fff1f2;
}

.leave-calendar-list-item.leave-status-approved.leave-type-other {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.leave-calendar-list-item div,
.leave-calendar-list-item p {
  min-width: 0;
}

.leave-calendar-list-item span:not(.leave-status-pill) {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.leave-calendar-list-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.leave-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfd;
}

.leave-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.leave-item-meta {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  color: var(--muted);
}

.leave-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.leave-status-pill::before {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 900;
}

.leave-status-approved {
  background: #e3f6ef;
  color: #0c6a5f;
}

.leave-status-approved.leave-status-pill::before {
  content: "✓";
  background: #0c6a5f;
  color: #fff;
}

.leave-status-pending {
  background: #fff4de;
  color: #9e6a15;
}

.leave-status-pending.leave-status-pill::before {
  content: "?";
  background: #f59e0b;
  color: #fff;
}

.leave-status-rejected {
  background: #fdeaea;
  color: #a83d3d;
}

.leave-rejection {
  margin: 10px 0 0;
  color: #a83d3d;
}

.leave-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.leave-sick-form {
  display: grid;
  gap: 0;
}

.leave-admin-panel {
  margin: 0 16px 16px;
}

@media (max-width: 1000px) {
  .leave-grid,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .leave-calendar-weekdays,
  .leave-calendar-grid {
    grid-template-columns: repeat(7, minmax(72px, 1fr));
    overflow-x: auto;
  }

  .leave-calendar-toolbar,
  .leave-calendar-list-item {
    grid-template-columns: 1fr;
    display: grid;
  }

  .leave-calendar-nav {
    justify-content: flex-start;
  }
}

/* Planningopvolging */
.planning-followup-view {
  min-width: 0;
}

.planning-sync-status {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.planning-sync-status strong {
  color: var(--ink);
}

.planning-sync-status small {
  color: #9b4b19;
}

.planning-sync-status.is-error {
  background: #fff5f5;
  color: #a83d3d;
}

.planning-sync-status.is-ok {
  background: #f2fbf8;
}

.planning-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.planning-tab {
  padding: 11px 14px 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.planning-tab.active {
  border-bottom-color: #087f76;
  color: var(--ink);
}

.planning-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(135px, 1fr));
  gap: 10px 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.planning-filters label,
.planning-settings-grid label,
.planning-review-form label,
.planning-review-resolved form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.planning-filters label > span,
.planning-settings-grid label > span,
.planning-review-form label > span,
.planning-review-resolved form label > span,
.planning-table-toolbar label > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.planning-filter-search {
  grid-column: span 2;
}

.planning-check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 39px;
  padding-top: 18px;
}

.planning-check input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.planning-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-bottom: 1px solid var(--line);
}

.planning-kpi {
  display: grid;
  gap: 3px;
  min-height: 94px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-left: 3px solid transparent;
}

.planning-kpi > span,
.planning-section-title > span,
.planning-dialog-heading span,
.planning-detail-header span,
.planning-review-heading span,
.planning-review-resolved > div > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.planning-kpi strong {
  color: var(--ink);
  font-size: 1.45rem;
}

.planning-kpi small {
  color: var(--muted);
}

.planning-kpi-good { border-left-color: #18845b; }
.planning-kpi-warn { border-left-color: #d69b27; }
.planning-kpi-bad { border-left-color: #c64b45; }

.planning-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.planning-chart-panel {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.planning-section-title h3,
.planning-dialog-heading h3,
.planning-detail-header h3,
.planning-detail h4,
.planning-review-heading h4,
.planning-review-resolved h4 {
  margin: 2px 0 0;
}

.planning-chart {
  width: 100%;
  height: 300px;
}

.planning-table-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.planning-table-toolbar > strong {
  margin-right: auto;
}

.planning-table-toolbar label {
  display: grid;
  gap: 4px;
}

.planning-table-wrap {
  max-height: 66vh;
  overflow: auto;
  overscroll-behavior: contain;
}

.planning-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.planning-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eaf1f7;
  color: #344b61;
  text-align: left;
}

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

.planning-row {
  cursor: pointer;
}

.planning-row:hover,
.planning-row:focus,
.planning-row.is-expanded {
  background: #f2faf8;
  outline: 0;
}

.planning-row td:nth-child(3) small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.planning-dossier-link {
  font-weight: 800;
}

.planning-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: #455d71;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.planning-pill-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-right: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.68rem;
  line-height: 1;
}

.planning-pill-completed,
.planning-pill-ftf,
.planning-pill-feff,
.planning-pill-solved_no_ftf,
.planning-pill-within,
.planning-pill-complete { background: #e3f6ef; color: #0b6b51; }
.planning-pill-partial,
.planning-pill-replan,
.planning-pill-near,
.planning-pill-insufficient,
.planning-pill-pending_review { background: #fff2d7; color: #8b5b00; }
.planning-pill-incomplete,
.planning-pill-breached { background: #fde8e8; color: #a63b35; }
.planning-pill-unknown,
.planning-pill-not_applicable { background: #edf0f3; color: #5c6875; }

.planning-detail-row > td {
  padding: 0;
  border-left: 3px solid #1670ad;
  background: #fff;
}

.planning-detail {
  padding: 18px;
}

.planning-detail-header,
.planning-review-heading,
.planning-dialog-heading,
.planning-review-resolved {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.planning-detail-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.planning-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.planning-detail-grid section {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.planning-detail dl {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px 12px;
  margin: 12px 0 0;
}

.planning-detail dt { color: var(--muted); }
.planning-detail dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.planning-review-form,
.planning-review-resolved {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #b9ddd7;
  border-radius: 8px;
  background: #f2fbf9;
}

.planning-review-heading,
.planning-review-resolved > div,
.planning-review-form .wide,
.planning-review-help {
  grid-column: 1 / -1;
}

.planning-review-resolved form {
  display: flex;
  align-items: end;
  gap: 8px;
}

.planning-review-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.planning-audit {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.planning-audit summary {
  font-weight: 800;
  cursor: pointer;
}

.planning-audit li {
  margin: 8px 0;
}

.planning-audit li span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.planning-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.planning-empty,
.planning-detail-loading,
.planning-error {
  padding: 22px !important;
  color: var(--muted);
  text-align: center;
}

.planning-settings-dialog {
  width: min(780px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgb(14 35 52 / 28%);
}

.planning-settings-dialog::backdrop {
  background: rgb(13 30 45 / 58%);
}

.planning-settings-dialog form {
  padding: 20px;
}

.planning-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.planning-settings-grid .wide {
  grid-column: 1 / -1;
}

.planning-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 1200px) {
  .planning-filters { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
}

@media (max-width: 800px) {
  .planning-followup-view .panel-heading,
  .planning-table-toolbar,
  .planning-detail-header,
  .planning-review-resolved {
    align-items: stretch;
    flex-direction: column;
  }

  .planning-filters { grid-template-columns: 1fr 1fr; }
  .planning-filter-search { grid-column: 1 / -1; }
  .planning-chart-grid { grid-template-columns: 1fr; }
  .planning-chart-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .planning-detail-grid,
  .planning-review-form,
  .planning-settings-grid { grid-template-columns: 1fr; }
  .planning-detail-grid section { border-right: 0; border-bottom: 1px solid var(--line); }
  .planning-review-form .wide,
  .planning-settings-grid .wide { grid-column: auto; }
  .planning-table-toolbar > strong { margin-right: 0; }
}

@media (max-width: 520px) {
  .planning-filters { grid-template-columns: 1fr; }
  .planning-filter-search { grid-column: auto; }
  .planning-tabs { overflow-x: auto; }
  .planning-kpis { grid-template-columns: 1fr 1fr; }
  .planning-chart { height: 250px; }
}
.repairs-next-banner {
  padding: 12px 16px;
  border-bottom: 1px solid #c9d7df;
  background: #eef8f6;
  color: #173f45;
}
.repairs-next-status { padding: 12px 16px; min-height: 48px; }
.repairs-next-filters {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  padding: 12px 16px;
  border-block: 1px solid #d6e0e6;
}
.repairs-next-filters label { display: grid; gap: 5px; }
.repairs-next-table-wrap { overflow: auto; max-height: 64vh; }
.repairs-next-table-wrap table { min-width: 1120px; }
@media (max-width: 900px) { .repairs-next-filters { grid-template-columns: 1fr 1fr; } }
