@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/manrope-600-greek.woff2') format('woff2');
  unicode-range: U+0370-03FF, U+1F00-1FFF;
}
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/manrope-800-greek.woff2') format('woff2');
  unicode-range: U+0370-03FF, U+1F00-1FFF;
}
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/manrope-600-latin.woff2') format('woff2');
}
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/manrope-800-latin.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --crm-ink: #20242b;
  --crm-secondary: #505761;
  --crm-muted: #69717c;
  --crm-line: #d6dae0;
  --crm-line-soft: #e8ebef;
  --crm-surface: #f7f8fa;
  --crm-inset: #fcfcfd;
  --crm-blue: #0067c7;
  --crm-blue-hover: #0056aa;
  --crm-selected: #edf5ff;
  --crm-info: var(--crm-blue);
  --crm-info-hover: #0056aa;
  --crm-utility: oklch(43% 0.035 255);
  --crm-utility-hover: oklch(35% 0.035 255);
  --crm-success: oklch(46% 0.12 155);
  --crm-success-hover: oklch(39% 0.11 155);
  --crm-warning: oklch(48% 0.13 63);
  --crm-warning-hover: oklch(40% 0.12 63);
  --crm-danger: oklch(47% 0.17 25);
  --crm-danger-hover: oklch(39% 0.15 25);
  --rail: #050505;
  --rail-hover: #181a1e;
  --rail-text: #c2c6ce;
  --rail-muted: #8e96a3;
  --rail-line: rgb(255 255 255 / 0.1);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: white;
  color: var(--crm-ink);
  font: 600 13px/1.55 Manrope, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--crm-blue);
  outline-offset: 2px;
}
.skip-link {
  position: fixed;
  z-index: 80;
  top: -80px;
  left: 12px;
  padding: 8px 10px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: white;
}
.skip-link:focus { top: 12px; }
.icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: flex;
  min-height: 100dvh;
}
.side {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  width: 280px;
  height: 100dvh;
  flex: 0 0 280px;
  flex-direction: column;
  overflow: hidden;
  background: var(--rail);
  color: var(--rail-text);
}
.brand {
  display: flex;
  height: 64px;
  flex: none;
  align-items: center;
  padding: 0 16px;
  color: white;
}
.brand-logo { display: block; width: 174px; max-width: 100%; height: auto; object-fit: contain; }
.avatar {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: #1d2630;
  color: #cfe6ff;
  font-size: 10px;
  font-weight: 800;
}
.side nav {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #444 var(--rail);
  scrollbar-width: thin;
}
.nav-label {
  margin: 14px 18px 6px;
  color: var(--rail-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.055em;
  white-space: nowrap;
}
.side nav > .nav-label:not(:first-child) { margin-top: 20px; }
.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  height: 44px;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 6px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--rail-text);
  font-size: 14px;
  line-height: 22px;
  text-align: left;
  white-space: nowrap;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--rail-muted); }
.nav-item:hover { background: var(--rail-hover); color: white; }
.nav-item:hover .icon { color: inherit; }
.nav-item.active { background: white; color: var(--crm-ink); }
.nav-item.active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 2px;
  background: var(--crm-blue);
  content: '';
}
.nav-item.active .icon { color: var(--crm-blue); }
.nav-count {
  min-width: 18px;
  margin-left: auto;
  padding: 0 4px;
  border-radius: 4px;
  background: #282b30;
  color: white;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  text-align: center;
}
.nav-item.active .nav-count { background: #e7f1fd; color: var(--crm-blue); }
.nav-count.alert { background: #3a301c; color: #e0ba59; }
.nav-item.active .nav-count.alert { background: #fff4d7; color: #765817; }
.nav-children {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 0 12px 3px 34px;
  padding: 2px 0 2px 15px;
}
.nav-children::before {
  position: absolute;
  top: 0;
  bottom: 5px;
  left: 0;
  width: 1px;
  background: #34373d;
  content: '';
}
.nav-children a {
  position: relative;
  min-height: 31px;
  padding: 6px 8px;
  overflow: hidden;
  color: #aeb4bd;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-children a::before {
  position: absolute;
  top: 15px;
  left: -15px;
  width: 11px;
  height: 1px;
  background: #34373d;
  content: '';
}
.nav-children a:hover { background: var(--rail-hover); color: white; }
.nav-children a.active {
  background: var(--rail-hover);
  color: white;
  font-weight: 700;
}
.nav-children a.active::before { background: var(--crm-blue); }
.nav-children a:focus-visible { outline: 2px solid var(--crm-blue); outline-offset: -2px; }
.side-bottom {
  flex: none;
  padding-top: 10px;
  border-top: 1px solid var(--rail-line);
}
.side-bottom form { margin: 0; }
.collapse-sidebar { color: var(--rail-muted); font-size: 12px; }
.collapse-sidebar .icon { transform: rotate(180deg); }
.side :is(a, button):focus-visible { outline-offset: -2px; }
.sidebar-scrim,
.mobile-menu { display: none; }

.workspace {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: none;
  height: 64px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 16px;
  border-bottom: 1px solid #f0f0f3;
  background: white;
}
.topbar-left,
.topbar-tools { display: flex; min-width: 0; align-items: center; }
.topbar-left { gap: 10px; }
.topbar-tools { gap: 10px; }
.topbar h1 { margin: 0; font-size: 16px; font-weight: 800; }
.circle,
.global-search {
  min-height: 36px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: var(--crm-inset);
  color: var(--crm-secondary);
}
.circle {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.circle:hover,
.global-search:hover { border-color: #aeb7c3; background: var(--crm-surface); }
.global-search {
  display: flex;
  width: 240px;
  height: 36px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  font-size: 10px;
  text-align: left;
}
.global-search kbd {
  width: 18px;
  margin-left: auto;
  border: 1px solid var(--crm-line);
  border-radius: 3px;
  background: white;
  color: var(--crm-muted);
  font: 600 9px Manrope, sans-serif;
  line-height: 17px;
  text-align: center;
}
.notification-button { position: relative; }
.notification-button i {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 5px;
  height: 5px;
  border: 1px solid white;
  border-radius: 50%;
  background: var(--crm-blue);
}
.user-avatar { width: 36px; height: 36px; background: #1c1e22; color: white; }

main#content {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 8px;
  outline: none;
}
.page-heading {
  display: flex;
  min-height: 52px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 10px;
}
.page-heading > div { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.page-heading .page-heading-actions { align-items: center; flex: none; gap: 8px; }
.page-heading h2 { margin: 0; font-size: 20px; font-weight: 800; }
.record-total { color: var(--crm-muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: white;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}
.btn.primary { border-color: var(--crm-blue); background: var(--crm-blue); color: white; }
.btn.primary:hover { border-color: var(--crm-blue-hover); background: var(--crm-blue-hover); }
.btn.secondary { border-color: #292d33; background: #292d33; color: white; }
.btn.secondary:hover { border-color: #111317; background: #111317; }
.btn.outline { border-color: var(--crm-utility); background: var(--crm-utility); color: white; }
.btn.outline:hover { border-color: var(--crm-utility-hover); background: var(--crm-utility-hover); color: white; }
.btn:is(.info,.success,.warning,.danger) { color: white; }
.btn.info { border-color: var(--crm-info); background: var(--crm-info); }
.btn.success { border-color: var(--crm-success); background: var(--crm-success); }
.btn.warning { border-color: var(--crm-warning); background: var(--crm-warning); }
.btn.danger { border-color: var(--crm-danger); background: var(--crm-danger); }
.btn.info:hover { border-color: var(--crm-info-hover); background: var(--crm-info-hover); color: white; }
.btn.success:hover { border-color: var(--crm-success-hover); background: var(--crm-success-hover); color: white; }
.btn.warning:hover { border-color: var(--crm-warning-hover); background: var(--crm-warning-hover); color: white; }
.btn.danger:hover { border-color: var(--crm-danger-hover); background: var(--crm-danger-hover); color: white; }
.btn:disabled { cursor: not-allowed; border-color: var(--crm-line); opacity: 1; background: var(--crm-surface); color: var(--crm-muted); box-shadow: none; }
.btn .icon { width: 15px; height: 15px; }
.compact-button { min-height: 26px; padding: 2px 8px; font-size: 10px; }

.contacts-erp {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}
.erp-commandbar,
.erp-record-actions,
.erp-search-controls,
.erp-view-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.erp-commandbar { flex: none; flex-wrap: wrap; padding-bottom: 8px; }
.erp-record-actions { flex: none; padding-right: 10px; border-right: 1px solid var(--crm-line-soft); }
.erp-search-controls { flex: 1 1 260px; }
.erp-view-actions { flex: none; }
.inline-search { position: relative; display: flex; min-width: 160px; flex: 1; align-items: center; }
.inline-search .icon { position: absolute; left: 10px; z-index: 1; color: var(--crm-muted); pointer-events: none; }
.inline-search input {
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 5px 10px 5px 34px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: white;
  color: var(--crm-ink);
  font-size: 11px;
  outline: none;
}
.inline-search input::placeholder { color: #8b929d; }
.inline-search input:hover { border-color: #aeb7c3; }
.inline-search input:focus { border-color: var(--crm-blue); box-shadow: 0 0 0 2px rgb(0 103 199 / 0.12); }

.erp-phase-tabs {
  display: flex;
  min-height: 36px;
  flex: none;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  border: 1px solid var(--crm-line);
  border-radius: 5px 5px 0 0;
  background: var(--crm-surface);
  scrollbar-width: thin;
}
.erp-phase-tabs > a {
  display: inline-flex;
  min-height: 34px;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-right: 1px solid var(--crm-line);
  color: var(--crm-secondary);
  font-size: 11px;
  white-space: nowrap;
}
.erp-phase-tabs > a:hover { background: white; }
.erp-phase-tabs > a.active { background: var(--crm-selected); color: var(--crm-blue); box-shadow: inset 0 -2px var(--crm-blue); }
.count {
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgb(32 36 43 / 0.05);
  color: var(--crm-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.erp-phase-tabs .active .count { background: rgb(0 103 199 / 0.09); color: var(--crm-blue); }
.erp-viewbar {
  display: flex;
  min-width: 0;
  min-height: 40px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}
.contact-queues,
.quick-filters { display: flex; min-width: 0; align-items: center; gap: 4px; }
.contact-queues { overflow-x: auto; scrollbar-width: thin; }
.contact-queues a,
.contact-queues button,
.badge {
  display: inline-flex;
  min-height: 28px;
  flex: none;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--crm-secondary);
  font-size: 10px;
  white-space: nowrap;
}
.contact-queues button { font-family: inherit; cursor: pointer; }
.contact-queues :is(a,button):hover { background: var(--crm-surface); }
.contact-queues :is(a,button).active { border-color: rgb(0 103 199 / 0.18); background: var(--crm-selected); color: var(--crm-blue); }
.badge { border-color: var(--crm-line-soft); background: white; }
.badge:hover { border-color: var(--crm-line); background: var(--crm-surface); }

.filter-options {
  display: grid;
  flex: none;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: var(--crm-surface);
}
.filter-options label { display: grid; min-width: 0; gap: 4px; }
.filter-options label > span { color: var(--crm-secondary); font-size: 9px; }
.filter-options select {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: white;
  color: var(--crm-ink);
  font-size: 11px;
}

.erp-grid-toolbar {
  position: relative;
  display: flex;
  min-height: 34px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid var(--crm-line);
  border-bottom: 0;
  background: #f5f7fa;
  color: var(--crm-secondary);
  font-size: 10px;
}
.erp-grid-toolbar-left,
.erp-grid-toolbar-right { display: flex; min-width: 0; align-items: center; gap: 6px; }
.selection-status { min-width: 90px; font-variant-numeric: tabular-nums; }
.text-button { border: 0; background: transparent; color: var(--crm-blue); font-size: 10px; }
.erp-grid-menu { position: relative; }
.erp-grid-menu summary {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--crm-line);
  border-radius: 4px;
  background: white;
  color: var(--crm-secondary);
  cursor: pointer;
  list-style: none;
}
.erp-grid-menu summary::-webkit-details-marker { display: none; }
.erp-grid-menu summary::after { color: var(--crm-muted); content: '▾'; }
.erp-grid-menu[open] summary { border-color: var(--crm-blue); }
.erp-grid-menu-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  width: min(260px, calc(100vw - 24px));
  gap: 7px;
  padding: 10px;
  border: 1px solid #aeb7c3;
  background: white;
  box-shadow: 0 8px 22px rgb(20 30 40 / 0.16);
}
.erp-grid-menu-panel strong { color: var(--crm-muted); font-size: 9px; }
.erp-grid-menu-panel label { display: flex; min-height: 28px; align-items: center; gap: 7px; }

.contact-grid {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100px;
  flex: 1;
  flex-direction: column;
}
.table-wrap {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  border: 1px solid var(--crm-line);
  scrollbar-color: #b5bdc8 var(--crm-surface);
  scrollbar-width: thin;
}
.register {
  width: max-content;
  min-width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
}
.register th,
.register td {
  height: 36px;
  padding: 3px 10px;
  overflow: hidden;
  border-right: 1px solid var(--crm-line);
  border-bottom: 1px solid var(--crm-line-soft);
  background: white;
  color: var(--crm-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.register th {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 30px;
  background: var(--crm-surface);
  color: var(--crm-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.025em;
}
.register tbody tr:nth-child(even) td { background: #fcfcfd; }
.register tbody tr:is(:hover, :focus-within) td { background: var(--crm-selected); }
.register th:nth-child(1), .register td:nth-child(1) { width: 38px; min-width: 38px; max-width: 38px; text-align: center; }
.register th:nth-child(2), .register td:nth-child(2) { width: 130px; min-width: 130px; }
.register th:nth-child(3), .register td:nth-child(3) { width: 155px; min-width: 155px; }
.register th:nth-child(4), .register td:nth-child(4) { width: 210px; min-width: 210px; }
.register th:nth-child(5), .register td:nth-child(5) { width: 185px; min-width: 185px; }
.register th:nth-child(6), .register td:nth-child(6) { width: 250px; min-width: 250px; }
.register th:nth-child(7), .register td:nth-child(7) { width: 165px; min-width: 165px; }
.register th:nth-child(8), .register td:nth-child(8) { width: 160px; min-width: 160px; }
.register th:nth-child(9), .register td:nth-child(9) { width: 140px; min-width: 140px; }
.register th:nth-child(10), .register td:nth-child(10) { width: 165px; min-width: 165px; }
.register th:nth-child(11), .register td:nth-child(11) { width: 165px; min-width: 165px; }
.register th:nth-child(12), .register td:nth-child(12) { width: 195px; min-width: 195px; }
.register th:nth-child(13), .register td:nth-child(13) { width: 140px; min-width: 140px; }
.register .select-cell {
  position: sticky;
  z-index: 20;
  left: 0;
  background: white;
}
.register thead .select-cell { z-index: 30; background: var(--crm-surface); }
.register .sticky-name {
  position: sticky;
  z-index: 10;
  left: 38px;
  box-shadow: 1px 0 var(--crm-line);
  background: white;
}
.register input[type='checkbox'],
.erp-grid-menu input[type='checkbox'] { width: 14px; height: 14px; margin: 0; accent-color: var(--crm-blue); }
.record-link { min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--crm-ink); }
.record-link strong,
.cell-strong { font-weight: 600; color: var(--crm-ink); }
.register a { color: var(--crm-blue); }
.pipeline-tag {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 6px;
  overflow: hidden;
  border: 1px solid var(--crm-line-soft);
  border-radius: 4px;
  background: var(--crm-surface);
  font-size: 10px;
  text-overflow: ellipsis;
}
.contact-status,
.next-action { display: inline-flex; align-items: center; gap: 6px; }
.contact-status::before {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: #74808d;
  content: '';
}
.contact-status[data-state='Νέα'],
.contact-status[data-state='Σε εξέλιξη'],
.contact-status[data-state='Επανάκληση'] { color: var(--crm-info); }
.contact-status[data-state='Ενδιαφέρεται'] { color: var(--crm-success); }
.contact-status[data-state='Δεν απάντησε'],
.contact-status[data-state='Προτεραιότητα'] { color: var(--crm-warning); }
.contact-status[data-state='Δεν ενδιαφέρεται'],
.contact-status[data-state='Εκπρόθεσμο'],
.contact-status[data-state='Μη έγκυρο τηλέφωνο'],
.contact-status[data-state='Να μην κληθεί'] { color: var(--crm-danger); }
.contact-status::before { background: currentColor; }
.next-action.overdue { color: var(--crm-danger); }
.tabular { font-variant-numeric: tabular-nums; }
.empty-state {
  position: absolute;
  inset: 31px 1px 1px;
  z-index: 10;
  display: grid;
  place-content: center;
  gap: 5px;
  background: white;
  color: var(--crm-muted);
  text-align: center;
}
.empty-state strong { color: var(--crm-ink); font-size: 14px; }
.table-footer {
  display: flex;
  min-height: 36px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 10px;
  border: 1px solid var(--crm-line);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  background: var(--crm-surface);
  color: var(--crm-secondary);
  font-size: 10px;
}
.table-footer nav { display: flex; align-items: center; gap: 8px; }
.table-footer .btn { min-height: 26px; padding: 2px 8px; font-size: 10px; }

@media (min-width: 1024px) {
  body { overflow: hidden; }
  .app-shell { height: 100dvh; min-height: 0; }
  .sidebar-collapsed .side { width: 60px; flex-basis: 60px; }
  .sidebar-collapsed .brand { justify-content: center; padding-inline: 0; }
  .sidebar-collapsed .brand-logo { width: 44px; height: auto; }
  .sidebar-collapsed :is(.nav-label, .nav-item > span, .nav-item .nav-count, .nav-children) { display: none; }
  .sidebar-collapsed .nav-item { justify-content: center; padding-inline: 0; }
  .sidebar-collapsed .collapse-sidebar .icon { transform: none; }
  .sidebar-collapsed .side nav { padding-top: 10px; }
}

@media (max-width: 1180px) {
  .filter-options { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .scroll-hint { display: none; }
}

@media (max-width: 1023px) {
  .side,
  .sidebar-collapsed .side {
    position: fixed;
    left: 0;
    width: 280px;
    flex-basis: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease-out;
  }
  .sidebar-open .side { transform: translateX(0); }
  .sidebar-open .sidebar-scrim {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: block;
    border: 0;
    background: rgb(0 0 0 / 0.36);
  }
  .mobile-menu { display: inline-flex; }
  .topbar { display: flex; height: 52px; }
  .collapse-sidebar { display: none; }
  .nav-item { min-height: 44px; height: 44px; }
  .contact-grid { height: clamp(360px, 62dvh, 720px); flex: none; }
  .workspace { overflow: visible; }
}

@media (max-width: 760px) {
  .topbar { padding-inline: 10px; }
  .global-search { width: 36px; padding: 0; justify-content: center; }
  .global-search > span,
  .global-search kbd { display: none; }
  .topbar-tools { gap: 6px; }
  .topbar-tools .circle:first-of-type { display: none; }
  .page-heading { min-height: 48px; }
  .page-heading h2 { font-size: 18px; }
  .erp-record-actions { width: 100%; padding-right: 0; border-right: 0; }
  .erp-record-actions .btn:first-child { flex: 1; }
  .erp-search-controls { order: 3; flex-basis: 100%; }
  .erp-viewbar { flex-wrap: wrap; }
  .contact-queues { width: 100%; }
  .quick-filters { margin-left: auto; }
  .erp-grid-toolbar { flex-wrap: wrap; }
  .table-footer { justify-content: center; flex-wrap: wrap; }
  .filter-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  main#content { padding: 6px; }
  .page-heading .btn { padding-inline: 9px; }
  .page-heading .btn > span { display: none; }
  .page-heading .btn .icon { width: 16px; height: 16px; }
  .erp-record-actions,
  .erp-view-actions { gap: 4px; }
  .erp-view-actions .btn { padding-inline: 8px; }
  .filter-options { grid-template-columns: 1fr; }
  .contact-grid { height: 58dvh; }
  .table-footer nav { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Record workspace — same compact CRM geometry, mapped to the contact reference flow. */
.record-drawer {
  width: 60vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--crm-line);
  border-radius: 0;
  background: white;
  color: var(--crm-ink);
  box-shadow: -12px 0 28px rgb(20 30 45 / 0.14);
}
.record-drawer::backdrop { background: rgb(12 16 22 / 0.28); }
.drawer-shell { display: flex; height: 100%; min-height: 0; flex-direction: column; }
.drawer-header {
  display: flex;
  min-height: 64px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--crm-line-soft);
  background: white;
}
.drawer-title-group { min-width: 0; }
.drawer-title-group h2 {
  margin: 1px 0 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-kicker { color: var(--crm-muted); font-size: 8px; letter-spacing: 0.06em; }
.drawer-head-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.drawer-head-actions .btn { min-height: 34px; }
.drawer-head-actions :is([data-call-settings], [data-more-toggle], [data-close-drawer]) { width: 34px; padding: 0; }
.drawer-more { position: relative; }
.drawer-more-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  right: 0;
  width: 172px;
  padding: 4px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: white;
  box-shadow: 0 10px 24px rgb(20 30 45 / 0.14);
}
.drawer-more-menu :is(button, a) {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  padding: 6px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--crm-ink);
  font-size: 10px;
  text-align: left;
  text-decoration: none;
}
.drawer-more-menu :is(button, a):hover { background: var(--crm-selected); color: var(--crm-blue); }
.danger-outline { border-color: var(--crm-danger); background: var(--crm-danger); color: white; }
.danger-outline:hover { border-color: var(--crm-danger-hover); background: var(--crm-danger-hover); color: white; }

.drawer-tabs {
  display: grid;
  min-height: 44px;
  flex: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 5px 12px 0;
  border-bottom: 1px solid var(--crm-line);
  background: var(--crm-surface);
}
.drawer-tabs button {
  display: flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--crm-secondary);
  font-size: 12px;
  white-space: nowrap;
}
.drawer-tabs button:hover { background: white; }
.drawer-tabs button[aria-selected='true'] { border-bottom-color: var(--crm-blue); background: white; color: var(--crm-blue); }
.tab-count {
  min-width: 19px;
  padding-inline: 4px;
  border-radius: 4px;
  background: rgb(32 36 43 / 0.06);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  text-align: center;
}
.drawer-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 12px 12px calc(18px + env(safe-area-inset-bottom)); }
.drawer-scroll > [role='tabpanel'] { max-width: 1040px; margin: 0 auto; }

.record-section {
  margin: 0 0 12px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: white;
}
details.record-section > summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  color: var(--crm-ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}
details.record-section > summary::-webkit-details-marker { display: none; }
details.record-section > summary::after {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 1.5px solid var(--crm-muted);
  border-bottom: 1.5px solid var(--crm-muted);
  content: '';
  transform: rotate(45deg);
}
details.record-section[open] > summary { border-bottom: 1px solid var(--crm-line-soft); }
details.record-section[open] > summary::after { transform: rotate(225deg); }
.summary-action { margin-left: auto; color: var(--crm-blue); font-size: 10px; font-weight: 600; }
details.record-section > summary:has(.summary-action)::after { margin-left: 2px; }

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 12px;
}
.record-grid label { display: grid; min-width: 0; gap: 4px; }
.record-grid label > span,
.reached-field legend {
  color: var(--crm-secondary);
  font-size: 10px;
  font-weight: 600;
}
.record-grid label > span b { color: var(--crm-danger); font-weight: 800; }
.record-grid :is(input, select, textarea),
.note-form > textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: var(--crm-inset);
  color: var(--crm-ink);
  font-size: 12px;
  outline: none;
}
.record-grid :is(input, select, textarea):hover,
.note-form > textarea:hover { border-color: #aeb7c3; }
.record-grid :is(input, select, select, textarea):focus,
.note-form > textarea:focus { border-color: var(--crm-blue); background: white; box-shadow: 0 0 0 2px rgb(0 103 199 / 0.12); }
.record-grid input[readonly] { background: var(--crm-surface); color: var(--crm-secondary); }
.record-grid textarea { resize: vertical; }
.span-2 { grid-column: 1 / -1; }

.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.meta-grid > div {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--crm-line-soft);
  background: var(--crm-surface);
}
.meta-grid span { color: var(--crm-muted); font-size: 8px; letter-spacing: 0.045em; }
.meta-grid strong { overflow: hidden; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.meta-grid .meta-id { grid-column: 1 / -1; padding-right: 44px; }
.meta-id button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--crm-line);
  border-radius: 4px;
  background: white;
  color: var(--crm-secondary);
}
.drawer-form-footer,
.inline-form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0 2px;
}
.drawer-form-footer {
  position: sticky;
  z-index: 10;
  bottom: -12px;
  margin: 0 -12px -18px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--crm-line);
  background: white;
}
.form-status { min-height: 18px; color: var(--crm-muted); font-size: 10px; }
.form-status.error { color: var(--crm-danger); }
.form-status.success { color: var(--crm-success); }

.activity-switch {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 10px;
  padding: 3px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: var(--crm-surface);
}
.activity-switch button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--crm-secondary);
  font-size: 11px;
}
.activity-switch button.active { background: white; color: var(--crm-blue); box-shadow: 0 1px 2px rgb(20 30 45 / 0.08); }
.activity-form { padding: 12px; }
.activity-form .record-grid { padding: 12px 0 0; }
.interested-next-step { display: grid; gap: 8px; margin: 0; padding: 10px; border: 1px solid rgb(36 129 90 / .35); border-radius: 5px; background: rgb(36 129 90 / .04); }
.interested-next-step legend { padding: 0 4px; color: var(--crm-ink); font-size: 11px; font-weight: 800; }
.interested-next-step > small { color: var(--crm-muted); font-size: 9px; line-height: 1.5; }
.interested-next-step-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.interested-next-step-options label { position: relative; display: flex; min-height: 38px; align-items: center; justify-content: center; padding: 7px 9px; border: 1px solid var(--crm-line); border-radius: 4px; background: white; color: var(--crm-secondary); cursor: pointer; font-size: 10px; font-weight: 700; line-height: 1.35; text-align: center; }
.interested-next-step-options label:hover { border-color: var(--crm-blue); color: var(--crm-blue); }
.interested-next-step-options label:has(input:checked) { border-color: var(--crm-blue); background: var(--crm-blue); color: white; }
.interested-next-step-options label:has(input:focus-visible) { outline: 2px solid var(--crm-blue); outline-offset: 2px; }
.interested-next-step-options input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.interested-callback-schedule { margin-top: 2px; padding-top: 8px; border-top: 1px solid rgb(36 129 90 / .18); }
.activity-blacklist-field { display: grid; grid-template-columns: minmax(180px,.7fr) minmax(220px,1fr); gap: 8px 12px; margin: 0; padding: 10px; border: 1px solid rgb(180 42 42 / .35); border-radius: 5px; background: rgb(180 42 42 / .04); }
.activity-blacklist-field legend { padding: 0 4px; color: var(--crm-danger); font-size: 11px; font-weight: 800; }
.activity-blacklist-field > p { grid-column: 1 / -1; margin: 0; color: var(--crm-muted); font-size: 9px; line-height: 1.5; }
.activity-blacklist-field label { display: grid; gap: 4px; }
.activity-blacklist-confirm { display: flex !important; align-items: center; gap: 8px !important; padding-top: 17px; }
.activity-blacklist-confirm input { width: 16px !important; min-height: 16px !important; flex: none; accent-color: var(--crm-danger); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title h3 { margin: 0; font-size: 14px; font-weight: 800; }
.section-title span { color: var(--crm-muted); font-size: 10px; }
.reached-field { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; border: 0; }
.reached-field legend { margin-bottom: 4px; }
.reached-field label {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--crm-line);
  border-radius: 5px;
  background: var(--crm-surface);
  color: var(--crm-secondary);
  font-size: 11px;
}
.reached-field label:has(input:checked) { border-color: rgb(0 103 199 / 0.35); background: var(--crm-selected); color: var(--crm-blue); }
.reached-field input { width: 14px; min-height: auto; accent-color: var(--crm-blue); }
.record-list-section { margin-top: 16px; }
.record-list-section > .section-title { margin-bottom: 8px; }
.record-list { border: 1px solid var(--crm-line); border-radius: 5px; background: white; }
.record-list-empty { padding: 28px 14px; color: var(--crm-muted); text-align: center; }
.record-list-empty strong { display: block; margin-bottom: 3px; color: var(--crm-ink); }
.record-list-item { display: grid; grid-template-columns: 140px minmax(0, 1fr) 150px; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--crm-line-soft); }
.record-list-item:last-child { border-bottom: 0; }
.record-list-item strong { color: var(--crm-ink); font-size: 11px; }
.record-list-item span,
.record-list-item p { margin: 0; color: var(--crm-secondary); font-size: 10px; }
.record-list-item p { white-space: pre-wrap; }
.record-list-item time { color: var(--crm-muted); font-size: 9px; font-variant-numeric: tabular-nums; text-align: right; }

.communication-history { display: grid; gap: 10px; }
.history-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 2px 2px 0; }
.history-heading h3 { margin: 3px 0 0; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.history-heading p { margin: 4px 0 0; color: var(--crm-muted); font-size: 10px; }
.history-summary { flex: none; color: var(--crm-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.history-filters { display: flex; width: fit-content; max-width: 100%; gap: 3px; padding: 3px; border: 1px solid var(--crm-line); border-radius: 5px; background: var(--crm-surface); }
.history-filters button { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 6px 11px; border: 0; border-radius: 3px; background: transparent; color: var(--crm-secondary); font: inherit; font-size: 10px; font-weight: 700; }
.history-filters button:hover { background: white; color: var(--crm-blue); }
.history-filters button[aria-pressed='true'] { background: var(--crm-blue); color: white; }
.history-filters button:focus-visible { outline: 2px solid var(--crm-blue); outline-offset: 2px; }
.history-filters button span { min-width: 18px; padding: 1px 5px; border-radius: 3px; background: rgb(32 36 43 / .08); font-size: 9px; font-variant-numeric: tabular-nums; text-align: center; }
.history-filters button[aria-pressed='true'] span { background: rgb(255 255 255 / .18); }
.communication-timeline { margin: 0; padding: 0; border: 1px solid var(--crm-line); border-radius: 5px; background: white; list-style: none; overflow: hidden; }
.history-entry { --history-accent: var(--crm-blue); border-bottom: 1px solid var(--crm-line-soft); box-shadow: inset 3px 0 var(--history-accent); }
.history-entry:last-child { border-bottom: 0; }
.history-entry[data-outcome='contacted'],.history-entry[data-outcome='interested'] { --history-accent: var(--crm-success); }
.history-entry[data-outcome='callback'],.history-entry[data-outcome='email'] { --history-accent: var(--crm-info); }
.history-entry[data-outcome='no_answer'] { --history-accent: var(--crm-warning); }
.history-entry[data-outcome='not_interested'],.history-entry[data-outcome='do_not_call'],.history-entry[data-outcome='invalid'] { --history-accent: var(--crm-danger); }
.history-entry-card { display: grid; gap: 10px; padding: 13px 15px 14px 17px; }
.history-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-entry-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.history-channel,.history-outcome { display: inline-flex; min-height: 22px; align-items: center; padding: 3px 7px; border-radius: 3px; font-size: 9px; font-weight: 800; }
.history-channel { border: 1px solid var(--crm-line); background: var(--crm-surface); color: var(--crm-secondary); }
.history-outcome { border: 1px solid var(--history-accent); background: var(--history-accent); color: white; }
.history-entry time { flex: none; color: var(--crm-muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.history-entry h4 { margin: 0; color: var(--crm-ink); font-size: 13px; font-weight: 800; }
.history-meta { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 18px; margin: 0; }
.history-meta div,.history-followups div { min-width: 0; }
.history-meta dt,.history-followups dt,.history-note > span { margin: 0 0 3px; color: var(--crm-muted); font-size: 8px; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.history-meta dd,.history-followups dd { margin: 0; color: var(--crm-secondary); font-size: 10px; overflow-wrap: anywhere; }
.history-note { padding: 9px 10px; border-left: 2px solid var(--crm-line); background: var(--crm-inset); }
.history-note > span { display: block; }
.history-note p { margin: 0; color: var(--crm-secondary); font-size: 10px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-followups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 18px; margin: 0; padding: 9px 10px; border: 1px solid var(--crm-line-soft); border-radius: 4px; background: var(--crm-surface); }
.history-followups dd { color: var(--crm-ink); font-weight: 700; }
.history-empty { box-shadow: none; }
.history-empty .record-list-empty { border: 0; }

.note-form { padding: 12px; }
.editor-toolbar {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 2px;
  margin-top: 12px;
  padding: 3px;
  border: 1px solid var(--crm-line);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: var(--crm-surface);
}
.editor-toolbar button { width: 30px; height: 26px; border: 0; border-radius: 3px; background: transparent; color: var(--crm-secondary); }
.editor-toolbar button:hover { background: white; color: var(--crm-ink); }
.note-form > textarea { min-height: 170px; border-radius: 0 0 5px 5px; resize: vertical; }
.database-status { display: inline-flex; align-items: center; gap: 5px; }
.database-status i { width: 6px; height: 6px; border-radius: 50%; background: #c67b16; }
.database-status i.online { background: #24815a; }
.record-drawer [hidden] { display: none !important; }

@media (max-width: 1023px) {
  .record-drawer { width: 100%; margin: 0; border-left: 0; }
}
@media (max-width: 760px) {
  .record-drawer { width: 100vw; border-left: 0; }
  .drawer-header { align-items: flex-start; padding: 10px; }
  .drawer-title-group { align-self: center; }
  .drawer-head-actions { gap: 4px; }
  .drawer-head-actions .btn { width: 34px; padding: 0; overflow: hidden; font-size: 0; }
  .drawer-tabs { padding-inline: 6px; }
  .drawer-tabs button { gap: 5px; padding-inline: 6px; font-size: 10px; }
  .drawer-tabs .icon { width: 14px; height: 14px; }
  .drawer-scroll { padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); }
  .record-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px; }
  .span-2 { grid-column: auto; }
  .activity-form { padding: 10px; }
  .activity-form .record-grid { padding-top: 10px; }
  .interested-next-step-options { grid-template-columns: minmax(0, 1fr); }
  .activity-blacklist-field { grid-template-columns: minmax(0, 1fr); }
  .activity-blacklist-field > p { grid-column: auto; }
  .activity-blacklist-confirm { padding-top: 2px; }
  .meta-grid { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .meta-grid .meta-id { grid-column: auto; }
  .record-list-item { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .record-list-item time { text-align: left; }
  .history-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .history-filters { width: 100%; }
  .history-filters button { flex: 1; justify-content: center; }
  .history-meta,.history-followups { grid-template-columns: minmax(0,1fr); }
  .drawer-form-footer { bottom: -8px; margin: 0 -8px -14px; padding-inline: 8px; }
}
@media (max-width: 420px) {
  .drawer-title-group h2 { max-width: 122px; font-size: 15px; }
  .record-kicker { display: none; }
  .drawer-tabs button { font-size: 0; }
  .drawer-tabs button .tab-count { font-size: 9px; }
  .drawer-tabs button .icon { width: 17px; height: 17px; }
  details.record-section > summary { font-size: 12px; }
  .summary-action { display: none; }
}
