/* Manrope, shared with the public pages (wwwroot/fonts/public, no CDN). */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/public/manrope-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/public/manrope-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Design tokens after byteloop.eu: dark navy navigation, light working area, blue accent on light,
   cyan only as a highlight on dark ground (cyan on white lacks contrast). */
:root {
  --crm-canvas: #f5f7fc;
  --crm-surface: #ffffff;
  --crm-surface-alt: #f8fafd;
  --crm-ink: #0b1430;
  --crm-muted: #5b6785;
  --crm-faint: #8a94ad;
  --crm-line: #e3e8f2;
  --crm-line-strong: #c9d2e3;
  --crm-nav: #050a1c;
  --crm-nav-hover: #0c1735;
  --crm-nav-text: #eaf0ff;
  --crm-nav-muted: #97a6c8;
  --crm-nav-line: rgba(234, 240, 255, 0.08);
  --crm-cyan: #40d4f5;
  --crm-accent: #0f4bb4;
  --crm-accent-hover: #1c92e6;
  --crm-accent-pressed: #0b3a8c;
  --crm-accent-soft: #e8f0fe;
  --crm-accent-line: #bcd0f7;
  --crm-focus: 0 0 0 3px rgba(15, 75, 180, 0.18);
  --crm-danger: #B42318;
  --crm-warning: #B54708;
  --crm-success: #067647;
  --crm-info: #175CD3;
  --crm-radius: 10px;
  --crm-radius-card: 16px;
  --crm-control: 40px;
  --crm-sidebar: 236px;
  --crm-sidebar-collapsed: 76px;
  --crm-header: 64px;
  --crm-shadow: 0 1px 2px rgba(11, 20, 48, 0.04), 0 2px 8px rgba(11, 20, 48, 0.03);
  --crm-shadow-pop: 0 12px 32px rgba(11, 20, 48, 0.12);
  --crm-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body.crm {
  --bs-body-font-family: var(--crm-font);
  --bs-body-color: var(--crm-ink);
  --bs-primary: var(--crm-accent);
  --bs-primary-rgb: 15, 75, 180;
  --bs-link-color: var(--crm-accent);
  --bs-link-color-rgb: 15, 75, 180;
  --bs-link-hover-color: var(--crm-accent-hover);
  --bs-link-hover-color-rgb: 28, 146, 230;
  --bs-border-color: var(--crm-line);
  --bs-secondary-color: var(--crm-muted);
  --bs-focus-ring-color: rgba(15, 75, 180, 0.18);
  margin: 0;
  background: var(--crm-canvas);
  color: var(--crm-ink);
  font-family: var(--crm-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 28, 0.5);
  z-index: 30;
}

.crm-nav {
  width: var(--crm-sidebar);
  flex: 0 0 var(--crm-sidebar);
  background: var(--crm-nav);
  color: var(--crm-nav-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.crm-nav a.crm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--crm-header);
  padding: 0 20px;
  margin: 0;
  border-radius: 0;
  color: var(--crm-nav-text);
  text-decoration: none;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--crm-nav-line);
}
.crm-nav a.crm-brand:hover { background: none; color: var(--crm-nav-text); }
.crm-nav a.crm-brand:focus-visible { outline: 2px solid var(--crm-cyan); outline-offset: -4px; }

/* byteLoop logo (light variant for dark ground); collapsed, only its mark stays visible. */
.brand-logo { display: block; width: auto; height: 26px; }
.brand-product {
  padding-left: 10px;
  border-left: 1px solid rgba(234, 240, 255, 0.18);
  color: var(--crm-nav-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 16px;
  white-space: nowrap;
}

.brand-mark {
  color: var(--crm-accent);
  font-size: 28px;
  line-height: 1;
}

.brand-text { color: var(--crm-muted); font-size: 17px; font-weight: 400; white-space: nowrap; }
.brand-text strong { color: var(--crm-ink); font-weight: 700; }

.nav-scroll { overflow-y: auto; padding: 8px 12px 20px; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(234, 240, 255, .14) transparent; }
.nav-section {
  margin: 18px 12px 6px;
  color: var(--crm-nav-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.crm-nav .nav-scroll a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 36px;
  color: var(--crm-nav-text);
  text-decoration: none;
  border-radius: 10px;
  padding: 0 12px;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color .12s ease, color .12s ease;
}

.crm-nav .nav-scroll a i { width: 18px; text-align: center; font-size: 15px; color: var(--crm-nav-muted); transition: color .12s ease; }
.crm-nav .nav-scroll a:hover { background: var(--crm-nav-hover); color: #ffffff; }
.crm-nav .nav-scroll a:hover i { color: var(--crm-nav-text); }
.crm-nav .nav-scroll a:focus-visible { outline: 2px solid var(--crm-cyan); outline-offset: -2px; }
.crm-nav .nav-scroll a.active {
  background: var(--crm-nav-hover);
  color: #ffffff;
  font-weight: 650;
}
.crm-nav .nav-scroll a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--crm-cyan);
}
.crm-nav .nav-scroll a.active i { color: var(--crm-cyan); }

.crm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.crm-top {
  height: var(--crm-header);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--crm-line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-toggle {
  border: 1px solid var(--crm-line);
  background: var(--crm-surface);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--crm-ink);
  transition: border-color .12s ease, background-color .12s ease;
}
.nav-toggle:hover { border-color: var(--crm-line-strong); background: var(--crm-surface-alt); }
.nav-toggle:focus-visible { outline: none; border-color: var(--crm-accent); box-shadow: var(--crm-focus); }

.header-search {
  flex: 1;
  max-width: 560px;
  position: relative;
  margin: 0 auto;
}

.header-search i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--crm-muted);
}

.header-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  padding: 0 76px 0 42px;
  background: var(--crm-canvas);
  color: var(--crm-ink);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.header-search input::placeholder { color: var(--crm-faint); }
.header-search input:hover { border-color: var(--crm-line-strong); }

.header-search input:focus {
  outline: none;
  border-color: var(--crm-accent);
  box-shadow: var(--crm-focus);
  background: var(--crm-surface);
}

.header-search kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  padding: 2px 8px;
  font-family: var(--crm-font);
  font-size: 11px;
  font-weight: 600;
  color: var(--crm-muted);
  background: var(--crm-surface);
  box-shadow: none;
}

.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--crm-line);
  background: var(--crm-surface);
  border-radius: 999px;
  color: var(--crm-ink);
  padding: 0;
  line-height: 1;
}

.notif-btn:hover {
  background: var(--crm-surface-alt);
  border-color: var(--crm-line-strong);
}

.notif-btn:focus-visible {
  outline: none;
  box-shadow: var(--crm-focus);
  border-color: var(--crm-accent);
}

.notif-btn > i { font-size: 16px; color: var(--crm-muted); }
.notif-btn:hover > i,
.notif-btn[aria-expanded="true"] > i { color: var(--crm-ink); }

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--crm-danger);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--crm-surface);
  box-shadow: 0 1px 2px rgba(11, 20, 48, 0.12);
}

.notif-menu {
  width: min(340px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--crm-line);
  border-radius: 14px;
  box-shadow: var(--crm-shadow-pop);
  overflow: hidden;
}

.notif-menu__head {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crm-muted);
  background: var(--crm-surface-alt);
  border-bottom: 1px solid var(--crm-line);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--crm-line);
}

.notif-item:last-child { border-bottom: none; }

.notif-item__body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  color: var(--crm-ink);
  font-size: 13.5px;
  line-height: 1.4;
}

.notif-item__body i {
  margin-top: 2px;
  color: var(--crm-danger);
  font-size: 14px;
  flex: 0 0 auto;
}

.notif-dismiss {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  background: var(--crm-surface);
  color: var(--crm-muted);
  font-size: 12px;
  font-weight: 650;
}

.notif-dismiss:hover {
  background: var(--crm-surface-alt);
  color: var(--crm-ink);
  border-color: var(--crm-line-strong);
}

.lang-select, .signout-btn {
  height: 36px;
  border: 1px solid var(--crm-line);
  background-color: var(--crm-surface);
  border-radius: 999px;
  color: var(--crm-ink);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  transition: border-color .12s ease, background-color .12s ease;
}
.lang-select { padding-right: 10px; }
.lang-select:hover, .signout-btn:hover { border-color: var(--crm-line-strong); background-color: var(--crm-surface-alt); }
.lang-select:focus-visible, .signout-btn:focus-visible { outline: none; border-color: var(--crm-accent); box-shadow: var(--crm-focus); }

.signout-btn { display: inline-flex; align-items: center; gap: 6px; }

.crm-content { padding: 28px 32px 48px; }

.page-head {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.page-head h1 { margin: 0; font-size: 30px; font-weight: 350; line-height: 1.15; letter-spacing: -0.025em; }
.page-head p { margin: 6px 0 0; color: var(--crm-muted); }
.page-head .page-actions { margin-left: auto; }
.page-back {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--crm-ink);
  text-decoration: none;
}
.page-back:hover { background: var(--crm-surface); border-color: var(--crm-line); color: var(--crm-accent); }

.section-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  box-shadow: var(--crm-shadow);
  padding: 22px;
  margin-bottom: 16px;
}

.section-card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.section-card .section-lead { color: var(--crm-muted); margin: 0 0 16px; }

.crm-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  box-shadow: var(--crm-shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.crm-card > .h6,
.section-card > .h6 { margin-bottom: 14px; }

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.admin-panel-head .h6 { margin: 0; }
.admin-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--crm-muted);
  background: #eef2f9;
  border-radius: 999px;
  padding: 4px 10px;
}

.product-name { font-weight: 650; color: var(--crm-ink); }
.product-code {
  display: inline-block;
  margin-top: 2px;
  font-size: 12px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--crm-muted);
  background: var(--crm-surface-alt);
  border: 1px solid var(--crm-line);
  border-radius: 6px;
  padding: 1px 6px;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 72px;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--crm-ink);
  background: var(--crm-surface-alt);
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  padding: 4px 10px;
}
.stat-pill i { color: var(--crm-muted); font-size: 13px; }
.crm-card .crm-table { margin: 0; border: 0; box-shadow: none; }

.admin-shell {
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  box-shadow: var(--crm-shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--crm-line);
  background: var(--crm-surface);
}
.admin-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--crm-muted);
  font-size: 13.5px;
  font-weight: 650;
  text-decoration: none;
}
.admin-tabs .nav-link i { font-size: 15px; line-height: 1; width: 1em; margin-right: 4px; }
.admin-tabs .nav-link .bi-paperclip,
.org-history-tab .nav-link i { margin-right: 0; }
.admin-tabs .nav-link .admin-tab-count { margin-left: 6px; }
.admin-tabs .nav-link:hover { color: var(--crm-ink); background: transparent; border-bottom-color: var(--crm-line-strong); }
.admin-tabs .nav-link:focus-visible { outline: none; box-shadow: var(--crm-focus); border-radius: 8px 8px 0 0; }
.admin-tabs .nav-link.active {
  color: var(--crm-ink);
  background: transparent;
  border-bottom-color: var(--crm-accent);
}
.admin-tabs .nav-link.active i { color: var(--crm-accent); }
.admin-tab-count {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2f9;
  color: var(--crm-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.admin-tabs .nav-link.active .admin-tab-count {
  background: var(--crm-accent-soft);
  color: var(--crm-accent);
}
.org-history-tab { margin-left: auto; }
.org-history-tab .nav-link { padding: 0 12px; }
.admin-tab-body { padding: 20px; }
.admin-products .admin-tabs { align-items: flex-end; }
.admin-products .admin-tab-action {
  margin-left: auto;
  margin-bottom: 8px;
  list-style: none;
}
.admin-products .admin-tab-body .dataTables_wrapper,
.admin-products .admin-tab-body .crm-table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
  background: transparent;
}
.admin-tab-body .crm-card:last-child,
.admin-tab-body .section-card:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .admin-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .admin-tabs .nav-link { white-space: nowrap; }
}

.admin-modal .modal-content {
  border: 1px solid var(--crm-line);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(11, 20, 48, 0.16);
  overflow: hidden;
}
.admin-modal .modal-header {
  border-bottom: 1px solid var(--crm-line);
  padding: 14px 20px;
  min-height: 0;
  background: var(--crm-surface);
}
.admin-modal .modal-header .modal-title {
  margin: 0;
  line-height: 1.3;
  font-size: 15px;
  font-weight: 700;
}
.admin-modal .modal-header .btn-close {
  padding: 0.4rem;
  margin: -0.2rem -0.2rem -0.2rem auto;
}
.admin-modal .modal-body {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.admin-modal.role-history-dialog .modal-dialog {
  max-width: 520px;
}
.admin-modal.role-history-dialog .modal-body {
  display: block;
  padding: 0;
}
.admin-modal.role-history-dialog .crm-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.admin-modal.role-history-dialog .crm-table th,
.admin-modal.role-history-dialog .crm-table td {
  border-radius: 0;
}
.admin-modal.role-history-dialog .modal-body > .text-muted {
  padding: 20px;
}
/* Shared create/edit dialog (crm-modal tag helper, Pages/ModalTagHelpers.cs).
   The form sits between .modal-content and body/footer, so it takes over the flex column for scrolling. */
.crm-modal .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.crm-modal .modal-dialog-scrollable .modal-content > form { overflow: hidden; }
.crm-modal .modal-body { display: block; }
.crm-modal .modal-body.crm-form { display: grid; }
.crm-modal .modal-body > .section-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 20px;
  background: transparent;
}
.crm-modal .modal-body > .section-card + .section-card {
  border-top: 1px solid var(--crm-line);
  padding-top: 20px;
}
.crm-modal .modal-body > .section-card h2 { font-size: 14px; }
.crm-modal .modal-body > :last-child { margin-bottom: 0; }
.crm-modal .modal-legend { color: var(--crm-muted); font-size: 0.875rem; margin: 0 0 16px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.list-tools > h2 { margin: 0 auto 0 0; }
.org-role-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.org-role-list .org-role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
}
.admin-modal .modal-footer {
  border-top: 1px solid var(--crm-line);
  padding: 12px 20px;
  gap: 8px;
  background: var(--crm-surface-alt);
}
.admin-modal .crm-form { margin: 0; }
.admin-modal.status-dialog .modal-dialog { max-width: 440px; }
.admin-modal.status-dialog .modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-modal.status-dialog .crm-field { margin: 0; }
.admin-modal.status-dialog .form-label {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.2;
}
.admin-modal.status-dialog .form-control,
.admin-modal.status-dialog .form-select {
  width: 100%;
  height: 34px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}
.admin-modal.status-dialog .form-select {
  padding-right: 28px;
  background-position: right 8px center;
}
.admin-modal.contact-dialog .modal-body { align-items: start; gap: 12px 14px; padding: 16px 18px; }
.admin-modal.contact-dialog .form-label {
  display: block;
  height: 16px;
  margin: 0 0 4px;
  padding: 0;
  color: var(--crm-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0;
}
.admin-modal.contact-dialog .crm-field:not(.span-2):has(> .fact-value) > .form-label {
  transform: translateY(1px);
}
.admin-modal.contact-dialog .form-control,
.admin-modal.contact-dialog .form-select {
  height: 34px;
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 8px;
}
.admin-modal.contact-dialog .form-select {
  padding-right: 28px;
  background-position: right 8px center;
}
.admin-modal.contact-dialog .fact-value {
  height: 34px;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
}
.admin-panel-head .btn-sm {
  height: 34px;
  min-width: 0;
  padding: 0 12px;
}
.crm-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.crm-field label, .form-label {
  display: block;
  color: var(--crm-ink);
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 6px;
}

.span-2 { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.form-control, .form-select {
  height: var(--crm-control);
  border: 1px solid var(--crm-line-strong);
  border-radius: 12px;
  background-color: var(--crm-surface);
  color: var(--crm-ink);
  font-size: 14px;
  box-shadow: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--crm-faint); }
.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: #aab5cb; }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--crm-surface-alt); color: var(--crm-muted); }

textarea.form-control { height: auto; min-height: 96px; }
input[type="file"].form-control { height: auto; padding: 8px 12px; }

.form-control:focus, .form-select:focus {
  border-color: var(--crm-accent);
  box-shadow: var(--crm-focus);
}

.form-check-input { border-color: var(--crm-line-strong); }
.form-check-input:checked { background-color: var(--crm-accent); border-color: var(--crm-accent); }
.form-check-input[type="checkbox"]:indeterminate { background-color: var(--crm-accent); border-color: var(--crm-accent); }
.form-check-input:focus { border-color: var(--crm-accent); box-shadow: var(--crm-focus); }
.form-switch .form-check-input:focus:not(:checked) {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230f4bb4'/%3e%3c/svg%3e");
}
.form-range::-webkit-slider-thumb { background-color: var(--crm-accent); }
.form-range::-moz-range-thumb { background-color: var(--crm-accent); }

.form-control.is-invalid,
.form-select.is-invalid,
.form-control.input-validation-error,
.form-select.input-validation-error,
.form-control:user-invalid,
.form-select:user-invalid {
  border-color: var(--crm-danger) !important;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12) !important;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
.form-control.input-validation-error:focus,
.form-select.input-validation-error:focus {
  border-color: var(--crm-danger) !important;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18) !important;
}

.field-error,
span.field-validation-error {
  display: block;
  margin-top: 6px;
  color: var(--crm-danger);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
}

.field-error:empty,
span.field-validation-valid { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  min-width: 88px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn i { font-size: 15px; line-height: 1; }
.btn-sm { height: 32px; min-width: 0; padding: 0 14px; font-size: 13px; }
.btn-link { min-width: 0; padding: 0 6px; color: var(--crm-accent); font-weight: 600; text-decoration: none; }
.btn-link:hover { color: var(--crm-accent-hover); }
.btn:focus-visible { outline: none; box-shadow: var(--crm-focus); }
.btn-group > .btn:not(:last-child):not(.dropdown-toggle) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* Primary: filled navy blue. The light hover blue (#1c92e6) is too light for white text,
   so filled buttons darken on hover; links use the lighter blue. */
.btn-accent,
.btn-primary {
  background: var(--crm-accent);
  color: #ffffff;
  border: 1px solid var(--crm-accent);
}
.btn-accent:hover, .btn-accent:focus, .btn-accent:active, .btn-accent:first-child:active,
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary:first-child:active { background: var(--crm-accent-pressed); border-color: var(--crm-accent-pressed); color: #ffffff; }
.btn-accent:disabled, .btn-primary:disabled { background: var(--crm-accent); border-color: var(--crm-accent); color: #ffffff; opacity: .5; }

.btn-outline-secondary {
  background: var(--crm-surface);
  border: 1px solid var(--crm-line-strong);
  color: var(--crm-ink);
}
.btn-outline-secondary:hover, .btn-outline-secondary:active, .btn-outline-secondary:first-child:active,
.btn-outline-secondary.active { background: var(--crm-surface); border-color: var(--crm-accent); color: var(--crm-accent); }
.btn-outline-primary { background: var(--crm-surface); border: 1px solid var(--crm-accent); color: var(--crm-accent); }
.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary:first-child:active { background: var(--crm-accent-soft); border-color: var(--crm-accent); color: var(--crm-accent); }
.btn-outline-danger { background: var(--crm-surface); }
.btn-check:checked + .btn-outline-secondary { background: var(--crm-accent-soft); border-color: var(--crm-accent); color: var(--crm-accent); }

h1 { font-size: 26px; font-weight: 400; letter-spacing: -0.02em; margin-bottom: 16px; }
h2.h6 { font-weight: 700; color: var(--crm-ink); }

.crm-table, table.table {
  width: 100%;
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
}

.crm-table th, table.table th {
  background: var(--crm-surface-alt);
  color: var(--crm-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--crm-line);
}

.crm-table td, table.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--crm-line);
  vertical-align: middle;
}

.crm-table.crm-table-compact th,
.crm-table.crm-table-compact td {
  padding: 6px 10px;
}
.crm-table.crm-table-compact .org-role-list {
  gap: 2px;
}
.crm-table.crm-table-compact .org-role {
  margin: 0;
  gap: 4px 6px;
}
.crm-table.crm-table-compact .org-role .btn-link {
  padding: 0;
  font-size: 12px;
  line-height: 1.2;
  vertical-align: baseline;
}
.crm-table.crm-table-compact .badge {
  padding: 0.2em 0.55em;
  font-size: 11px;
  line-height: 1.2;
}

.crm-table tr:last-child td, table.table tr:last-child td { border-bottom: 0; }
.crm-table a, table.table a { color: var(--crm-ink); font-weight: 600; text-decoration: none; }
.crm-table a:hover, table.table a:hover { color: var(--crm-accent); text-decoration: underline; text-underline-offset: 3px; }

.crm-table th.col-actions,
.crm-table td.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: end;
}

.cell-wrap {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  box-shadow: var(--crm-shadow);
}

.table-scroll .crm-table {
  margin: 0;
  border: 0;
  border-radius: 0;
  min-width: 640px;
  width: 100%;
}

.status-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -6px 0 10px;
}
.table-scroll .status-table { min-width: 720px; table-layout: fixed; }
.status-table th:nth-child(1),
.status-table td:nth-child(1) { width: 14%; }
.status-table th:nth-child(2),
.status-table td:nth-child(2) { width: 16%; }
.status-table th:nth-child(3),
.status-table td:nth-child(3) { width: 16%; }
.status-table th:nth-child(4),
.status-table td:nth-child(4) { width: 22%; }
.status-table th.col-actions,
.status-table td.col-actions { width: 32%; white-space: nowrap; }
.status-table .form-select,
.status-table .form-control {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 2px 8px;
  font-size: 13px;
}
.status-table .status-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}
.status-table .status-current .badge { font-size: 11px; font-weight: 600; }
.status-table .status-actions {
  display: inline-flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: max-content;
  margin-left: auto;
}
.status-table .status-actions form {
  display: inline-flex;
  width: auto;
  margin: 0;
}
.status-table .status-actions .btn {
  width: auto;
  height: 28px;
  min-width: 0;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.status-table .status-save {
  width: 28px;
  min-width: 28px;
  padding: 0;
}

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

.instance-detail-actions__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.instance-detail-actions__btns form { display: inline; margin: 0; }

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  background: var(--crm-surface);
  color: var(--crm-muted) !important;
  font-weight: 500 !important;
  text-decoration: none !important;
}

.row-action:hover {
  color: var(--crm-accent) !important;
  border-color: var(--crm-accent-line);
  background: var(--crm-accent-soft);
}
.row-action:focus-visible { outline: none; box-shadow: var(--crm-focus); }

.row-action i { font-size: 12px; line-height: 1; }

.dataTables_wrapper {
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  box-shadow: var(--crm-shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.dataTables_wrapper::after { content: ""; display: block; clear: both; }

.dataTables_wrapper table.crm-table,
.dataTables_wrapper table.dataTable {
  border: 0;
  border-radius: 0;
  margin: 0 !important;
  border-top: 1px solid var(--crm-line);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  padding: 12px 16px;
  color: var(--crm-muted);
  font-size: 13px;
}

.dataTables_wrapper .dataTables_length select {
  height: 36px;
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  padding: 0 28px 0 14px;
  margin: 0 6px;
  background-color: var(--crm-surface);
  color: var(--crm-ink);
}

.dataTables_wrapper .dataTables_filter label { margin: 0; }

.dataTables_wrapper .dataTables_filter input {
  width: 280px;
  height: 36px;
  margin: 0 !important;
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  padding: 0 14px 0 38px;
  background: var(--crm-canvas) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%235b6785' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") no-repeat 14px center;
  color: var(--crm-ink);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.dataTables_wrapper .dataTables_filter input::placeholder { color: var(--crm-faint); }

.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--crm-accent);
  background-color: var(--crm-surface);
  box-shadow: var(--crm-focus);
}

.dataTables_wrapper .dataTables_info {
  padding: 12px 16px !important;
  color: var(--crm-muted);
  font-size: 13px;
}

.dataTables_wrapper .dataTables_paginate {
  padding: 8px 12px !important;
  font-size: 13px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px !important;
  margin-left: 4px !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 999px !important;
  font-weight: 600;
  background: var(--crm-surface) !important;
  color: var(--crm-ink) !important;
  line-height: 30px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #eef2f9 !important;
  color: var(--crm-ink) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--crm-accent) !important;
  border-color: var(--crm-accent) !important;
  color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: .5;
  background: var(--crm-surface) !important;
  color: var(--crm-muted) !important;
}

table.dataTable thead th { border-bottom: 1px solid var(--crm-line) !important; }
/* Sort arrows: muted, the active direction in the accent blue. */
table.dataTable thead > tr > th.sorting::before,
table.dataTable thead > tr > th.sorting::after,
table.dataTable thead > tr > th.sorting_asc::before,
table.dataTable thead > tr > th.sorting_asc::after,
table.dataTable thead > tr > th.sorting_desc::before,
table.dataTable thead > tr > th.sorting_desc::after { color: var(--crm-faint); opacity: 0.45; }
table.dataTable thead > tr > th.sorting_asc::before,
table.dataTable thead > tr > th.sorting_desc::after { color: var(--crm-accent); opacity: 1; }
table.dataTable thead > tr > th.sorting_asc,
table.dataTable thead > tr > th.sorting_desc { color: var(--crm-ink); }
table.dataTable tbody tr:hover > td { background: var(--crm-surface-alt); }
table.dataTable.no-footer { border-bottom: 0 !important; }

.badge { border-radius: 999px; font-weight: 650; letter-spacing: 0.01em; }
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--crm-accent-soft) !important; color: var(--crm-accent) !important; }
.badge.bg-secondary, .badge.text-bg-secondary { background-color: #eef2f9 !important; color: var(--crm-muted) !important; }
.badge.text-bg-light { background-color: var(--crm-surface-alt) !important; color: var(--crm-muted) !important; border: 1px solid var(--crm-line); }
.badge-new { background: var(--crm-accent-soft); color: var(--crm-accent); }
.badge-progress { background: #FFFAEB; color: var(--crm-warning); }
.badge-success { background: #ECFDF3; color: var(--crm-success); }
.badge-danger { background: #FEF3F2; color: var(--crm-danger); }
.badge-neutral { background: #eef2f9; color: var(--crm-muted); }

.fact-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.fact-strip .crm-card { margin-bottom: 0; padding: 16px 18px; }
.fact-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--crm-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.fact-value { color: var(--crm-ink); font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
a.fact-value { text-decoration: none; }
a.fact-value:hover { color: var(--crm-accent); }
.org-details-form .form-actions { justify-content: flex-end; }
.org-panel-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--crm-line);
}
.org-merge { max-width: 440px; }
.org-role { display: inline-flex; align-items: center; gap: 4px; margin: 2px 8px 2px 0; }
.org-actions { white-space: nowrap; }
.org-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 0;
  padding: 0;
  border: 1px solid var(--crm-line);
  border-radius: 999px;
  background: var(--crm-surface);
  color: var(--crm-muted);
  vertical-align: middle;
}
.org-icon-btn i { font-size: 12px; line-height: 1; }
a.org-icon-btn { color: var(--crm-muted); font-weight: 500; text-decoration: none; }
a.org-icon-btn:hover { color: var(--crm-accent); }
.org-icon-btn:hover { color: var(--crm-accent); border-color: var(--crm-accent-line); background: var(--crm-accent-soft); }

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col {
  min-width: 260px;
  background: #eef2f9;
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  padding: 12px;
}

.alert { border-radius: 12px; padding: 10px 14px; }
.alert-info { background: var(--crm-accent-soft); border-color: var(--crm-accent-line); color: #0b3a8c; }

/* Bootstrap components in the CRM palette */
.dropdown-menu {
  --bs-dropdown-border-color: var(--crm-line);
  --bs-dropdown-border-radius: 14px;
  --bs-dropdown-link-color: var(--crm-ink);
  --bs-dropdown-link-hover-bg: var(--crm-accent-soft);
  --bs-dropdown-link-hover-color: var(--crm-accent);
  --bs-dropdown-link-active-bg: var(--crm-accent);
  --bs-dropdown-link-active-color: #ffffff;
  --bs-dropdown-font-size: 13.5px;
  padding: 6px;
  box-shadow: var(--crm-shadow-pop);
}
.dropdown-item { border-radius: 8px; padding: 7px 10px; }
.nav-tabs {
  --bs-nav-tabs-border-color: var(--crm-line);
  --bs-nav-tabs-link-hover-border-color: transparent transparent var(--crm-line-strong);
  --bs-nav-tabs-link-active-color: var(--crm-ink);
  --bs-nav-tabs-link-active-bg: transparent;
  --bs-nav-tabs-link-active-border-color: transparent transparent var(--crm-accent);
  --bs-nav-link-color: var(--crm-muted);
  --bs-nav-link-hover-color: var(--crm-ink);
  --bs-nav-link-font-weight: 650;
}
.nav-tabs .nav-link { border-width: 0 0 2px; border-radius: 0; }
.nav-pills { --bs-nav-pills-border-radius: 999px; --bs-nav-pills-link-active-bg: var(--crm-accent); --bs-nav-link-color: var(--crm-muted); --bs-nav-link-hover-color: var(--crm-ink); }
.pagination {
  --bs-pagination-color: var(--crm-ink);
  --bs-pagination-border-color: var(--crm-line);
  --bs-pagination-hover-color: var(--crm-ink);
  --bs-pagination-hover-bg: #eef2f9;
  --bs-pagination-hover-border-color: var(--crm-line);
  --bs-pagination-focus-color: var(--crm-accent);
  --bs-pagination-focus-box-shadow: var(--crm-focus);
  --bs-pagination-active-bg: var(--crm-accent);
  --bs-pagination-active-border-color: var(--crm-accent);
  --bs-pagination-disabled-color: var(--crm-faint);
  gap: 4px;
}
.pagination .page-link { border-radius: 999px !important; min-width: 32px; text-align: center; font-weight: 600; }
.progress { --bs-progress-bg: #eef2f9; --bs-progress-bar-bg: var(--crm-accent); --bs-progress-border-radius: 999px; }
.list-group { --bs-list-group-border-color: var(--crm-line); --bs-list-group-active-bg: var(--crm-accent); --bs-list-group-active-border-color: var(--crm-accent); --bs-list-group-border-radius: 12px; }
.card { --bs-card-border-color: var(--crm-line); --bs-card-border-radius: var(--crm-radius-card); --bs-card-cap-bg: var(--crm-surface-alt); }
.btn-close:focus { box-shadow: var(--crm-focus); }
.alert ul { margin: 0; padding-left: 1.1rem; }

.portal-body { background: var(--crm-canvas); }
.portal-brand { display: flex; align-items: center; gap: 10px; }
.portal-top .brand-text { color: var(--crm-muted); }
.portal-top .brand-text strong { color: var(--crm-ink); }
.portal-top {
  height: var(--crm-header);
  background: var(--crm-surface);
  border-bottom: 1px solid var(--crm-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.portal-shell { max-width: 880px; margin: 24px auto; padding: 0 16px 40px; }
a.crm-card { color: var(--crm-ink); text-decoration: none; font-weight: 650; }
a.crm-card:hover { border-color: var(--crm-accent-line); color: var(--crm-accent); }

.crm-shell.is-collapsed .crm-nav { width: var(--crm-sidebar-collapsed); flex-basis: var(--crm-sidebar-collapsed); }
.crm-shell.is-collapsed .brand-text,
.crm-shell.is-collapsed .brand-product,
.crm-shell.is-collapsed .nav-section,
.crm-shell.is-collapsed .nav-label { display: none; }
.crm-shell.is-collapsed .brand-logo { width: 27px; height: 27px; object-fit: cover; object-position: left center; }
.crm-shell.is-collapsed .crm-nav a.crm-brand { justify-content: center; padding: 0; }
.crm-shell.is-collapsed .crm-nav .nav-scroll a { justify-content: center; padding: 0; }
.crm-shell.is-collapsed .nav-scroll { padding-top: 12px; }
.crm-shell.is-collapsed .crm-nav .nav-scroll a { height: 40px; }
.crm-shell.is-collapsed .crm-nav .nav-scroll a i { font-size: 16px; }

.nav-tooltip {
  position: fixed;
  z-index: 1080;
  transform: translate(-4px, -50%);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--crm-nav);
  color: var(--crm-nav-text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(11, 20, 48, 0.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
}
.nav-tooltip::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--crm-nav);
  transform: translateY(-50%) rotate(45deg);
}
.nav-tooltip.is-visible { opacity: 1; transform: translate(0, -50%); }

@media (max-width: 991px) {
  .crm-nav {
    position: fixed;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .crm-shell.is-open .crm-nav { transform: none; }
  .crm-shell.is-open .nav-backdrop { display: block; }
  .crm-shell.is-collapsed .crm-nav { width: var(--crm-sidebar); flex-basis: var(--crm-sidebar); }
  .crm-shell.is-collapsed .brand-text,
  .crm-shell.is-collapsed .brand-product,
  .crm-shell.is-collapsed .nav-label { display: inline; }
  .crm-shell.is-collapsed .brand-logo { width: auto; height: 26px; object-fit: contain; }
  .crm-shell.is-collapsed .crm-nav .nav-scroll a { height: 36px; }
  .crm-shell.is-collapsed .nav-section { display: block; }
  .crm-shell.is-collapsed .crm-nav a.crm-brand { justify-content: flex-start; padding: 0 20px; }
  .crm-shell.is-collapsed .crm-nav .nav-scroll a { justify-content: flex-start; padding: 0 12px; }
  .header-search kbd { display: none; }
  .crm-form, .fact-strip, .fact-strip--3 { grid-template-columns: 1fr; }
  .crm-content { padding: 16px; }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head > div { min-width: 0; }
  .page-head h1 {
    font-size: 20px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .page-head p { overflow-wrap: anywhere; word-break: break-word; }
  .page-head .page-actions {
    margin-left: 0;
    width: 100%;
  }
  .page-head .page-actions .btn { flex: 1 1 auto; }
  .section-card { padding: 16px; }
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions .btn { flex: 1 1 auto; min-width: 120px; }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    display: block;
    text-align: left;
    padding: 10px 12px;
  }
  .dataTables_wrapper .dataTables_filter input { width: 100%; max-width: 100%; }
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: left !important;
    width: 100% !important;
  }
  .dataTables_wrapper .dataTables_paginate { padding-bottom: 12px !important; }
}

@media (max-width: 640px) {
  .crm-top { padding: 0 12px; gap: 8px; }
  .header-search { max-width: none; min-width: 0; }
  .header-tools { gap: 6px; }
  .lang-select { max-width: 104px; }
  .signout-label { display: none; }
  .page-head .page-actions { margin-left: 0; }
  .crm-content { padding: 12px; }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter { float: none; text-align: left; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; }
  .instance-detail-actions__btns .btn {
    width: 100%;
  }
  .instance-detail-actions__btns form { width: 100%; }
}

/* Home — My tasks worklist */
.home-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.home-panel {
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: var(--crm-radius-card);
  box-shadow: var(--crm-shadow);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--crm-line);
  background: var(--crm-surface);
}

.home-panel__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.home-panel__title h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--crm-ink);
}

.home-panel__icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 14px;
}

.home-panel--overdue .home-panel__icon { background: #FEF3F2; color: var(--crm-danger); }
.home-panel--today .home-panel__icon { background: #FFFAEB; color: var(--crm-warning); }
.home-panel--leads .home-panel__icon { background: var(--crm-accent-soft); color: var(--crm-accent); }
.home-panel--tickets .home-panel__icon { background: #eef2f9; color: var(--crm-ink); }

.home-panel__count {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2f9;
  color: var(--crm-muted);
  font-size: 12px;
  font-weight: 700;
}

.home-panel__count.is-alert {
  background: #FEF3F2;
  color: var(--crm-danger);
}

.home-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  flex: 1;
}

.home-list li + li { margin-top: 2px; }

.home-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--crm-ink);
  text-decoration: none;
  transition: background-color .12s ease;
}

a.home-item:hover {
  background: #eef2f9;
  color: var(--crm-ink);
}

.home-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.home-item__title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-item__sub,
.home-item__meta {
  font-size: 12px;
  color: var(--crm-muted);
  font-weight: 500;
  white-space: nowrap;
}

.home-item__meta--danger { color: var(--crm-danger); font-weight: 650; }

.home-empty {
  margin: 0;
  padding: 28px 20px;
  color: var(--crm-muted);
  font-size: 13px;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 991px) {
  .home-board { grid-template-columns: 1fr; }
}

/* Landing: public sign-in page, styled after byteloop.eu (Pages/Landing.cshtml, _LandingLayout.cshtml). Manrope: see top of file. */

.landing-body {
  --lp-bg: #050a1c;
  --lp-surface: #0c1735;
  --lp-line: rgb(255 255 255 / 0.12);
  --lp-line-strong: rgb(255 255 255 / 0.22);
  --lp-text: #eaf0ff;
  --lp-muted: #97a6c8;
  --lp-cyan: #40d4f5;
  --lp-cyan-hot: #8ae8ff;
  --lp-gutter: clamp(16px, 5vw, 48px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--lp-bg);
  color: var(--lp-text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.landing-body a { color: inherit; }
.landing-body :focus-visible { outline: 2px solid var(--lp-cyan); outline-offset: 3px; }

.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
  padding: 0 var(--lp-gutter);
}

.landing-brand { display: inline-flex; line-height: 0; border-radius: 6px; }
.landing-brand img { width: auto; height: 32px; }

.landing-lang {
  height: 34px;
  padding: 0 28px 0 12px;
  border: 1px solid var(--lp-line);
  border-radius: 999px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2397a6c8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
  color: var(--lp-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  appearance: none;
  cursor: pointer;
}
.landing-lang:hover { border-color: var(--lp-line-strong); color: var(--lp-text); }
.landing-lang option { background: var(--lp-surface); color: var(--lp-text); }

.landing-shell {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  padding: 32px var(--lp-gutter);
}

.landing-split {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 420px);
  align-items: center;
  gap: clamp(32px, 7vw, 112px);
}

.landing-welcome h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6.6vw, 5.25rem);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--lp-text);
  overflow-wrap: break-word;
}
.landing-welcome h1 strong { font-weight: 800; color: var(--lp-cyan); }

.landing-tagline {
  margin: 28px 0 0;
  color: var(--lp-muted);
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.landing-card {
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--lp-line);
  border-radius: 18px;
  background: var(--lp-surface);
}
.landing-card h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--lp-text);
}
.landing-card p {
  margin: 0 0 28px;
  color: var(--lp-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.landing-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--lp-cyan);
  color: #050a1c !important;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s;
}
.landing-btn:hover { background: var(--lp-cyan-hot); }
.landing-btn:active { transform: translateY(1px); }
.landing-btn__icon { flex: 0 0 auto; transition: transform 0.2s; }
.landing-btn:hover .landing-btn__icon { transform: translateX(3px); }

.landing-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  padding: 20px var(--lp-gutter) 24px;
  color: var(--lp-muted);
  font-size: 13px;
}
.landing-footer a { text-decoration: none; }
.landing-footer a:hover { color: var(--lp-text); text-decoration: underline; }

@media (max-width: 860px) {
  .landing-shell { align-items: flex-start; padding-top: clamp(24px, 8vh, 64px); }
  .landing-split { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .landing-card { max-width: 480px; }
}

@media (max-width: 420px) {
  .landing-brand img { height: 28px; }
  .landing-card { padding: 22px 20px; }
  .landing-btn { gap: 8px; padding: 10px 18px; font-size: 0.9375rem; }
  .landing-tagline { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .landing-btn, .landing-btn__icon { transition: none; }
  .landing-btn:active, .landing-btn:hover .landing-btn__icon { transform: none; }
}

.relationship-compose {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0 16px;
}
.relationship-compose .form-select {
  width: auto;
  flex: 1 1 220px;
  min-width: 0;
  height: 34px;
  font-size: 13px;
  font-weight: 400;
}
.relationship-compose .btn { height: 34px; }

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--crm-accent-soft);
  color: var(--crm-accent);
  font-size: 12px;
  font-weight: 650;
}
.timeline-compose {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--crm-line);
}
.timeline-compose .form-label { margin: 0; font-size: 13px; }
.timeline-compose .form-control,
.timeline-compose .form-select {
  height: 34px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}
.timeline-compose textarea.form-control {
  width: 100%;
  height: auto;
  min-height: 72px;
}
.timeline-compose .compose-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.timeline-compose .compose-row .form-control { flex: 1; min-width: 0; }
.timeline-compose .compose-row .form-select { width: 220px; max-width: 100%; }
.timeline-compose .btn { height: 34px; }

/* Form help: required marks, hint text and the info tooltip (Pages/Shared/_InfoTip.cshtml). */
.required-mark { color: var(--crm-danger); font-weight: 700; }
.optional-mark { color: var(--crm-muted); font-weight: 400; }
.form-text { color: var(--crm-muted); font-size: 12.5px; line-height: 1.4; margin-top: 6px; }
.field-hint-list { margin: 6px 0 0; padding-left: 18px; }
.field-hint-list li + li { margin-top: 2px; }
.field-label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.field-label-row .form-label { margin-bottom: 0; }

.info-tip { position: relative; display: inline-flex; }
.info-tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--crm-muted);
  font-size: 14px;
  line-height: 1;
  cursor: help;
}
.info-tip-btn:hover,
.info-tip-btn:focus-visible { color: var(--crm-accent); outline: none; box-shadow: var(--crm-focus); }
.info-tip-text {
  position: absolute;
  z-index: 1080;
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--crm-nav);
  color: var(--crm-nav-text);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  box-shadow: 0 4px 12px rgba(11, 20, 48, 0.18);
  transform: translate(-50%, 4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
.info-tip:hover .info-tip-text,
.info-tip-btn:focus-visible + .info-tip-text,
.info-tip.is-open .info-tip-text { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.info-tip.is-closed .info-tip-text { opacity: 0; visibility: hidden; }

.installation-form { margin-top: 24px; }
.installation-form-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.installation-form-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.installation-form .form-actions { justify-content: flex-end; }

/* Mailing lists */
.mailing-fact { display: block; font-size: 26px; font-weight: 400; letter-spacing: -0.02em; }
.mailing-report { margin: 8px 0; padding: 8px 10px; background: var(--crm-canvas); border-radius: 6px; font-size: 12px; white-space: pre-wrap; }
.mailing-logo-preview { display: block; max-height: 56px; max-width: 220px; margin-top: 8px; }
.mailing-add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.mailing-add-card { border: 1px solid var(--crm-line); border-radius: 14px; padding: 18px; }
.mailing-basis { border: 0; margin: 0; padding: 0; min-width: 0; }
.mailing-basis .form-check { margin-bottom: 6px; }
.mailing-invite { display: grid; grid-template-columns: minmax(0, 3fr) minmax(240px, 2fr); gap: 20px; align-items: start; }
.mailing-preview { width: 100%; height: 520px; border: 1px solid var(--crm-line); border-radius: var(--crm-radius); background: var(--crm-canvas); }
@media (max-width: 900px) { .mailing-invite { grid-template-columns: 1fr; } }

/* Colour fields of the public mailing pages (profile and list form) */
.theme-color { display: flex; gap: 8px; align-items: center; }
.theme-color .form-control-color { flex: none; width: 48px; height: 38px; padding: 4px; }
.theme-color .form-control:not(.form-control-color) { max-width: 140px; }
.mailing-logo-preview--dark { padding: 8px 12px; border-radius: 8px; background: #06110b; }
/* Browser icon of the public pages (Pages/Mailing/_FaviconField.cshtml) */
.favicon-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
.favicon-chip { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--crm-line); border-radius: 12px; background: var(--crm-surface); }
.favicon-chip img { display: block; object-fit: contain; }
.favicon-chip--dark { width: 36px; height: 36px; border-color: transparent; background: var(--crm-nav); }
.favicon-preview__text { color: var(--crm-muted); font-size: 13px; }
.favicon-preview__text strong { color: var(--crm-ink); font-weight: 650; }
.favicon-remove { margin: 0 0 0 auto; font-size: 13px; }
.favicon-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px 20px; }
.favicon-sublabel { color: var(--crm-muted); font-size: 12.5px; font-weight: 600; }
.favicon-url { display: flex; gap: 8px; }
.favicon-url .form-control { flex: 1 1 auto; min-width: 0; }
.favicon-url .btn { flex: 0 0 auto; height: var(--crm-control); }
@media (max-width: 760px) {
  .favicon-inputs { grid-template-columns: 1fr; }
  .favicon-url { flex-wrap: wrap; }
  .favicon-url .btn { width: 100%; }
  .favicon-remove { margin-left: 0; }
}

/* Newsletter editor */
.newsletter-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.newsletter-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 20px; align-items: start; }
.newsletter-side { position: sticky; top: calc(var(--crm-header) + 12px); }
.newsletter-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.newsletter-block-tools { display: flex; gap: 4px; }
.newsletter-rich { min-height: 96px; height: auto; overflow-wrap: anywhere; }
.newsletter-rich:focus { outline: none; }
.newsletter-rich p, .newsletter-rich ul { margin-bottom: 8px; }
.newsletter-rich h2 { font-size: 20px; }
.newsletter-rich h3 { font-size: 17px; }
.newsletter-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.newsletter-image-preview { display: block; max-width: 100%; max-height: 180px; margin-bottom: 8px; border-radius: 6px; }
.newsletter-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.newsletter-footer-note { color: var(--crm-muted); font-size: 13px; margin-bottom: 16px; }
.newsletter-preview-head { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.newsletter-preview-wrap { background: var(--crm-canvas); border: 1px solid var(--crm-line); border-radius: var(--crm-radius); margin-bottom: 16px; overflow: hidden; display: flex; justify-content: center; }
.newsletter-preview { width: 100%; height: 640px; border: 0; background: var(--crm-canvas); transition: width 0.2s; }
.newsletter-preview.is-mobile { width: 375px; max-width: 100%; }
@media (max-width: 1100px) { .newsletter-layout { grid-template-columns: 1fr; } .newsletter-side { position: static; } }
.newsletter-target-topics { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 6px 24px; }
.newsletter-target-topics.is-disabled { opacity: 0.5; }

/* Feedback zu Newsletter-Topics */
.newsletter-feedback-block .newsletter-feedback-new { margin: 6px 0 8px; padding: 10px; border: 1px dashed var(--crm-line); border-radius: var(--crm-radius); }
.newsletter-feedback-info { margin-top: 6px; }
.newsletter-post-image-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.newsletter-post-image { padding: 10px; border: 1px solid var(--crm-line); border-radius: var(--crm-radius); }
.newsletter-post-image .newsletter-image-preview { width: 100%; object-fit: cover; }
.newsletter-post-feedback { padding: 12px; border: 1px solid var(--crm-line); border-radius: var(--crm-radius); background: var(--crm-surface-2, transparent); }
.newsletter-post-feedback-details { margin-top: 10px; }
.fb-bar { display: flex; height: 12px; min-width: 140px; overflow: hidden; border-radius: 6px; background: var(--crm-line); }
.fb-bar span { display: block; height: 100%; }
.fb-bar__need { background: var(--crm-accent); }
.fb-bar__interesting { background: var(--crm-accent-hover); }
.fb-bar__not { background: var(--crm-faint); }
.fb-bar__legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; color: var(--crm-muted); }
.fb-dot { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; vertical-align: 0; }
.fb-eval .fact-strip { margin-top: 8px; }
.fb-eval__relevance { min-width: 0; }
.fb-counts th { width: 1%; white-space: nowrap; font-weight: 500; }
.fb-count-bar { display: block; height: 10px; min-width: 2px; border-radius: 5px; background: var(--crm-accent); }
.fb-answers, .fb-comments { margin: 0; padding: 0; list-style: none; }
.fb-answers li { padding: 6px 0; border-bottom: 1px solid var(--crm-line); }
.fb-comment { padding: 12px 0; border-bottom: 1px solid var(--crm-line); }
.fb-comment:target { background: var(--crm-accent-soft); }
.fb-comment__text { margin: 6px 0 8px; white-space: pre-line; }
.fb-reply { margin: 0 0 8px 16px; padding: 8px 12px; border-left: 3px solid var(--crm-accent); background: var(--crm-canvas); white-space: pre-line; }
.fb-reply-form summary { list-style: none; }
.fb-reply-form summary::-webkit-details-marker { display: none; }

.fb-kind-tag { display: inline-block; padding: 1px 8px; border: 1px solid; border-radius: 999px; font-size: 0.72rem; font-weight: 700; line-height: 1.5; letter-spacing: 0.02em; vertical-align: 0.15em; white-space: nowrap; }
.fb-group-title { display: flex; align-items: center; gap: 8px; margin: 24px 0 10px; font-size: 1rem; }
.fb-group-title .fb-kind-tag { font-size: 0.85rem; padding: 2px 10px; }
.fb-rating { position: relative; display: inline-block; font-size: 1.35rem; line-height: 1; letter-spacing: 2px; vertical-align: -0.1em; }
.fb-rating__base { color: var(--crm-line); }
.fb-rating__fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; white-space: nowrap; color: #E0A100; }
.fb-rating__value { margin-left: 6px; }
.fb-resolution li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 1.5rem; align-items: center; gap: 8px; margin-top: 4px; font-size: 0.875rem; }
.fb-resolution li strong { text-align: right; }
.fb-resolution--partly { background: var(--crm-accent-hover); }
.fb-resolution--no { background: var(--crm-danger); }
.fb-resolution--notaffected { background: var(--crm-faint); }

/* Inbox: mailboxes, conversation list, conversation */
.inbox-layout { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 16px; align-items: start; }
.inbox-boxes { padding: 12px; }
.inbox-group { margin: 12px 4px 4px; color: var(--crm-faint); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.inbox-group:first-child { margin-top: 0; }
.inbox-box { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--crm-ink); text-decoration: none; }
.inbox-box:hover { background: var(--crm-surface-alt); }
.inbox-box.active { background: var(--crm-accent-soft); color: var(--crm-accent); font-weight: 600; }
.inbox-box__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-unread { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--crm-accent); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 20px; text-align: center; }
.inbox-list__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.inbox-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.inbox-filters a { padding: 3px 10px; border: 1px solid var(--crm-line); border-radius: 999px; color: var(--crm-muted); font-size: 0.85rem; text-decoration: none; }
.inbox-filters a.active { border-color: var(--crm-accent-line); background: var(--crm-accent-soft); color: var(--crm-accent); }
.inbox-conversations { margin: 0; padding: 0; list-style: none; border: 1px solid var(--crm-line); border-radius: var(--crm-radius); background: var(--crm-surface); overflow: hidden; }
.inbox-conversations li + li { border-top: 1px solid var(--crm-line); }
.inbox-conversations a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 14px; color: var(--crm-ink); text-decoration: none; }
.inbox-conversations a:hover { background: var(--crm-surface-alt); }
.inbox-conversations li.unread a { box-shadow: inset 3px 0 0 var(--crm-accent); }
.inbox-conversations li.unread .inbox-conv__from, .inbox-conversations li.unread .inbox-conv__subject { font-weight: 700; }
.inbox-conv__from { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-conv__time { color: var(--crm-muted); font-size: 0.8rem; white-space: nowrap; }
.inbox-conv__subject { grid-column: 1 / -1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-conv__meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--crm-muted); font-size: 0.8rem; }
.inbox-status { border: 1px solid var(--crm-line); background: var(--crm-surface-alt); color: var(--crm-muted); font-weight: 600; }
.inbox-status--open { border-color: var(--crm-accent-line); background: var(--crm-accent-soft); color: var(--crm-accent); }
.inbox-status--waiting { color: var(--crm-warning); }
.inbox-status--done { color: var(--crm-success); }
.inbox-status--spam { color: var(--crm-danger); }
.inbox-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 16px; align-items: start; }
.inbox-thread { display: grid; gap: 12px; min-width: 0; }
.inbox-side { display: grid; gap: 12px; }
.inbox-message { min-width: 0; }
.inbox-message--out { border-left: 3px solid var(--crm-accent-line); }
.inbox-message__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.inbox-message__tools { display: flex; gap: 16px; margin-top: 4px; }
.inbox-html { display: block; width: 100%; min-height: 80px; border: 0; background: #fff; }
.inbox-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 0.9rem; }
.inbox-attachments { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--crm-line); list-style: none; }
@media (max-width: 900px) {
  .inbox-layout, .inbox-detail { grid-template-columns: minmax(0, 1fr); }
}
.inbox-note { border-left: 3px solid #E0A100; background: #fffbeb; }

/* Contacts: list filters, organisation badges and the search fields that pick a record. */
.contact-filters { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; }
.contact-filters__submit { align-self: end; }
.contact-org-list { display: grid; gap: 4px; }
.contact-org { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.contact-primary-row td:first-child { box-shadow: inset 3px 0 0 var(--crm-accent); }
.crm-lookup { position: relative; }
.crm-lookup__results { position: absolute; z-index: 1060; top: calc(100% + 2px); left: 0; right: 0; max-height: 320px; overflow-y: auto; box-shadow: 0 8px 24px rgba(5, 10, 28, 0.12); }
.crm-lookup__results .list-group-item.active { background: var(--crm-accent-soft); color: var(--crm-ink); border-color: var(--crm-line); }
.crm-lookup__name { font-weight: 600; }
.crm-lookup__meta { color: var(--crm-muted); font-size: 0.8rem; }
@media (max-width: 900px) {
  .contact-filters { grid-template-columns: minmax(0, 1fr); }
}

/* Inbox: sender card with the contact's organisations, actions for unknown senders. */
.inbox-conv__contact { font-weight: 600; margin-right: 6px; }
.inbox-sender__orgs li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 2px 0; }
.inbox-sender__orgs li.is-current > a { font-weight: 700; }
.inbox-sender__action > summary { cursor: pointer; color: var(--crm-accent); font-size: 0.875rem; font-weight: 600; }
/* Time tracking on tickets and budgets */
.ticket-message-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    flex-wrap: wrap;
}
.ticket-time { font-size: .8125rem; }
.ticket-time-badge {
    font-weight: 500;
    font-size: .75rem;
    cursor: pointer;
}
.time-stepper {
    display: grid;
    grid-template-columns: auto auto minmax(5rem, 1fr) auto auto;
    gap: .375rem;
    align-items: center;
}
.time-stepper .btn { white-space: nowrap; padding-inline: .5rem; }
@media (max-width: 480px) {
    .time-stepper { grid-template-columns: 1fr 1fr; }
    .time-stepper input { grid-column: 1 / -1; order: -1; }
}
.budget-bar {
    height: .375rem;
    border-radius: 999px;
    background: var(--bs-secondary-bg, #e9ecef);
    overflow: hidden;
    min-width: 6rem;
}
.budget-bar > span { display: block; height: 100%; background: var(--bs-success, #198754); }
.budget-bar.is-over > span { background: var(--bs-danger, #dc3545); }
.budget-bar.is-low > span { background: var(--bs-warning, #ffc107); }
.time-entries-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.admin-modal.time-dialog .modal-dialog { max-width: 560px; }
.admin-modal.time-dialog .modal-body,
.admin-modal.budget-dialog .modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.admin-modal.time-dialog .modal-body > *,
.admin-modal.budget-dialog .modal-body > * { margin-bottom: 0 !important; }
.admin-modal.time-dialog [hidden] { display: none !important; }

/* Rechtstexte: editor, preview, diff */
.legal-body { min-height: 60vh; font-size: .82rem; line-height: 1.45; }
.legal-preview { border: 1px solid var(--bs-border-color); border-radius: 8px; padding: 16px 20px; max-height: 75vh; overflow: auto; background: var(--bs-body-bg); font-size: .9rem; }
.legal-preview h2 { font-size: 1.25rem; margin-top: .5rem; }
.legal-preview h3 { font-size: 1.05rem; margin-top: 1rem; }
.legal-preview h4, .legal-preview h5 { font-size: .95rem; margin-top: .8rem; }
.legal-preview .legal-table { font-size: .8rem; }
.legal-preview .legal-page-break { border-top: 2px dashed var(--bs-border-color); margin: 1.5rem 0; opacity: 1; }
.legal-preview .legal-signatures { border: 1px dashed var(--bs-border-color); padding: 8px 12px; color: var(--bs-secondary-color); font-style: italic; }
.legal-diff { max-height: 70vh; overflow: auto; font-size: .78rem; white-space: pre-wrap; border: 1px solid var(--bs-border-color); border-radius: 8px; padding: 8px 0; }
.legal-diff span { display: block; padding: 0 10px; }
.legal-diff .diff-add { background: rgba(25, 135, 84, .14); }
.legal-diff .diff-del { background: rgba(220, 53, 69, .14); text-decoration: line-through; text-decoration-color: rgba(220, 53, 69, .5); }
.legal-diff .diff-same { color: var(--bs-secondary-color); }

/* Ticket list: clickable rows, columns moved by dragging their header */
.ticket-list-reset { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; margin: 0 0 .5rem; }
table.ticket-list tbody tr[data-href] { cursor: pointer; }
th[data-col][draggable="true"] { cursor: grab; }
th[data-col].is-dragging { opacity: .45; }
th[data-col].drop-before { box-shadow: inset 3px 0 0 var(--bs-primary, #0d6efd); }
th[data-col].drop-after { box-shadow: inset -3px 0 0 var(--bs-primary, #0d6efd); }

/* Position editor (quotes; later orders and invoices) and the read-only position list */
.line-editor__table { min-width: 980px; table-layout: fixed; }
.line-editor__table th { font-size: .78rem; color: var(--crm-muted); font-weight: 600; white-space: nowrap; }
.line-editor__handle-col, .line-editor__handle { width: 1.5rem; }
.line-editor__handle { cursor: grab; color: var(--crm-muted); padding-top: .55rem !important; }
.line-editor__pos { width: 2.5rem; }
td.line-editor__pos { padding-top: .55rem !important; }
.line-editor__num { width: 7rem; }
.line-editor__unit { width: 6.5rem; }
.line-editor__pct { width: 5rem; }
.line-editor__actions { width: 6.5rem; }
.line-editor__table .line-editor__amount, .line-editor__table th.text-end { width: 7.5rem; }
.line-editor__amount { padding-top: .55rem !important; }
.line-editor__main textarea { margin-top: .25rem; font-size: .82rem; resize: vertical; min-height: 1.9rem; }
.line-editor__badge { display: inline-block; margin: 0 .35rem .25rem 0; }
.line-editor__row--heading td { background: var(--crm-accent-soft, rgba(64, 212, 245, .08)); }
.line-editor__row--subtotal td { border-top: 1px solid var(--crm-line, #dee2e6); }
.line-editor__row.is-dragging { opacity: .45; }
.line-editor__row.drop-before td { box-shadow: inset 0 3px 0 var(--bs-primary, #0d6efd); }
.line-editor__row.drop-after td { box-shadow: inset 0 -3px 0 var(--bs-primary, #0d6efd); }
.line-editor__add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-top: .5rem; }
.line-editor__search { flex: 1 1 320px; max-width: 480px; }
.line-editor__totals { display: grid; grid-template-columns: auto auto; justify-content: end; column-gap: 1.5rem; row-gap: .15rem; margin: 1rem 0 0; }
.line-editor__totals dt { font-weight: 400; text-align: right; }
.line-editor__totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.line-items td, .line-editor__amount { font-variant-numeric: tabular-nums; }
.line-items__heading td { background: var(--crm-accent-soft, rgba(64, 212, 245, .08)); }
.line-items__subtotal td { font-weight: 600; }
.line-items__desc { white-space: pre-line; }
table.crm-row-links tbody tr[data-href] { cursor: pointer; }
/* Datenschutz: offen (tile, banner, proposal rows, nav counter) */
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #f5b400; color: #1d1d1d; font-size: .72rem; font-weight: 700; text-align: center; }
.nav-count.is-urgent { background: var(--crm-danger, #d92d20); color: #fff; }
.privacy-tile { border: 1px solid #f5d77a; background: #fffaeb; border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.privacy-tile.is-urgent { border-color: #f4a8a1; background: #fef3f2; }
.privacy-tile__head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.privacy-tile__head h2 { font-size: 1.05rem; margin: 0; }
.privacy-tile__head p { margin: 2px 0 0; font-size: .85rem; color: var(--bs-secondary-color); }
.privacy-tile__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #fff; font-size: 1.2rem; color: #b54708; }
.privacy-tile.is-urgent .privacy-tile__icon { color: var(--crm-danger, #d92d20); }
.privacy-tile__count { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: #1d1d1d; color: #fff; font-size: .8rem; vertical-align: middle; }
.privacy-tile__list { list-style: none; margin: 12px 0 0; padding: 0; }
.privacy-tile__list a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid rgba(0,0,0,.06); color: inherit; text-decoration: none; font-size: .88rem; }
.privacy-tile__list a:hover { text-decoration: underline; }
.privacy-banner { border: 1px solid #f5d77a; background: #fffaeb; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }
.privacy-banner__head { font-weight: 600; margin-bottom: 4px; }
.privacy-proposal { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.06); }
.privacy-banner .privacy-proposal:first-of-type, .section-card .privacy-proposal:first-of-type { border-top: 0; }
.privacy-proposal__main { display: flex; gap: 10px; align-items: flex-start; flex: 1 1 320px; }
.privacy-proposal__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #fff3cd; color: #b54708; flex: none; }
.privacy-proposal.is-urgent .privacy-proposal__icon { background: #fee4e2; color: var(--crm-danger, #d92d20); }
.privacy-proposal__title { font-weight: 600; }
.privacy-proposal__meta { font-size: .85rem; color: var(--bs-secondary-color); }
.privacy-proposal__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.privacy-proposal__defer { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; }
.privacy-proposal__defer.collapse:not(.show) { display: none; }
.privacy-proposal__defer input[name=reason] { flex: 1 1 260px; }
.privacy-proposal__defer input[type=date] { width: auto; }

/* Änderungsmitteilungen */
.notice-row { border-top: 1px solid rgba(0,0,0,.06); padding: 10px 0; }
.notice-row.is-urgent { background: linear-gradient(90deg, rgba(217,45,32,.06), transparent 40%); }
.notice-mail { border: 1px solid var(--bs-border-color); border-radius: 8px; padding: 8px 12px; background: var(--bs-tertiary-bg); }
.notice-mail pre { white-space: pre-wrap; font-family: inherit; font-size: .85rem; margin: 6px 0 0; }
.notice-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.notice-form.collapse:not(.show) { display: none; }
.notice-form input[name=note], .notice-form input[name=reason] { flex: 1 1 240px; }
.notice-form input[type=date], .notice-form select { width: auto; }
/* Searchable select (searchable-select.js) and staff names */
.crm-combobox { position: relative; }
.crm-combobox__list { position: absolute; z-index: 1080; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; box-shadow: 0 10px 24px rgba(15, 23, 42, .14); }
.crm-combobox__list[hidden] { display: none; }
.crm-combobox__option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 12px; font-size: .9rem; }
.crm-combobox__option--current:not(.active) { font-weight: 600; }
.crm-combobox__extra { font-size: .75rem; opacity: .7; }
.staff-name--unknown { word-break: break-all; }

/* Password vault: dialogs on the customer tab "Zugangsdaten" stack their fields (the admin-modal body is a grid). */
.vault-link-form,
.vault-caretaker-form,
.credential-request-form {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.vault-steps { padding-left: 1.2rem; margin-bottom: 0; }
.vault-steps li { margin-bottom: .35rem; }
.credential-created .input-group .form-control { font-family: var(--bs-font-monospace); font-size: .8rem; }
[data-copy-value].is-copied, [data-copy-from].is-copied, [data-copy-cell].is-copied { color: var(--bs-success); border-color: var(--bs-success); }

/* Organisation form: fields switched by organisation-kind.js (crm-field sets its own display). */
.crm-field[hidden] { display: none !important; }

/* ISMS (ISO 27001), Pages/Isms: tabs, key figures, filter row, open points. */
.isms-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--crm-line); }
.isms-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; color: var(--crm-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.isms-tab:hover { color: var(--crm-ink); }
.isms-tab.is-active { color: var(--crm-accent); border-bottom-color: var(--crm-accent); }
.isms-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.isms-kpis .isms-kpi { margin-bottom: 0; }
.isms-kpi__label { color: var(--crm-muted); font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.isms-kpi__value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }
.isms-kpi__of { font-size: 16px; color: var(--crm-muted); font-weight: 600; }
.isms-kpi__hint { color: var(--crm-muted); font-size: 12.5px; margin: 6px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.isms-progress { height: 8px; background: var(--crm-surface-alt); }
.isms-progress .progress-bar { background: var(--crm-success); }
.isms-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.isms-filter__actions { display: flex; gap: 8px; }
.isms-open { list-style: none; padding: 0; display: grid; gap: 6px; }
.isms-open li::before { content: "¹3"; color: var(--crm-success); font-weight: 700; margin-right: 8px; }
.isms-open li.is-open::before { content: "!"; color: var(--crm-warning); }
.isms-text { white-space: pre-line; }
.isms-facts { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 20px; margin: 0; }
.isms-facts dt { color: var(--crm-muted); font-weight: 600; }
.isms-facts dd { margin: 0; }

/* ISMS risks: heat maps (likelihood rows 5..1, impact columns 1..5), multi selects. */
.isms-heatmaps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.isms-heatmaps .section-card { margin-bottom: 0; }
.isms-heatmap { background: var(--crm-surface); border: 1px solid var(--crm-line); border-radius: var(--crm-radius-card); box-shadow: var(--crm-shadow); padding: 16px 18px; margin: 0; }
.isms-heatmap figcaption { font-weight: 700; margin-bottom: 8px; }
.isms-heatmap__body { display: flex; align-items: center; gap: 6px; }
.isms-heatmap__axis-y { writing-mode: vertical-rl; transform: rotate(180deg); color: var(--crm-muted); font-size: 12px; }
.isms-heatmap__axis-x { text-align: center; color: var(--crm-muted); font-size: 12px; margin: 4px 0 0; }
.isms-heatmap__grid { border-collapse: separate; border-spacing: 3px; }
.isms-heatmap__grid th { color: var(--crm-muted); font-weight: 600; font-size: 12px; text-align: center; width: 18px; }
.isms-heatmap__grid td { width: 40px; height: 34px; text-align: center; font-weight: 700; border-radius: 6px; color: #fff; }
.isms-heatmap__grid td.is-low { background: #3c9a6b; }
.isms-heatmap__grid td.is-medium { background: #e0a030; }
.isms-heatmap__grid td.is-high { background: #c2412d; }
.isms-heatmap__grid td.is-empty { opacity: .28; }
.isms-multi { min-height: 160px; }

/* ISMS documents: rendered policy text and the WYSIWYG editor. */
.isms-doc { max-width: 860px; line-height: 1.6; }
.isms-doc h1, .isms-doc h2, .isms-doc h3 { margin-top: 1.2em; font-weight: 700; }
.isms-doc h2 { font-size: 18px; }
.isms-doc h3 { font-size: 15px; }
.isms-doc table { border-collapse: collapse; margin: 8px 0 16px; width: 100%; }
.isms-doc th, .isms-doc td { border: 1px solid var(--crm-line-strong); padding: 6px 10px; vertical-align: top; }
.isms-doc th { background: var(--crm-surface-alt); }
.isms-doc blockquote { border-left: 3px solid var(--crm-line-strong); padding-left: 12px; color: var(--crm-muted); }
.isms-editor { margin-bottom: 8px; }
.isms-ack-box { border-color: var(--crm-accent-line); background: var(--crm-accent-soft); }
