:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --primary: #0071e3;
  --primary-dark: #005bbd;
  --green: #168a5b;
  --amber: #b26a00;
  --danger: #c7352b;
  --sidebar: rgba(250, 250, 252, 0.72);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
  --soft-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 113, 227, 0.12), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(22, 138, 91, 0.1), transparent 26%),
    linear-gradient(135deg, #fbfbfd 0%, #f2f4f7 48%, #ebeef3 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100vh;
  padding: 14px;
  gap: 14px;
}

.sidebar {
  min-height: 0;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sidebar);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0a84ff, #34c759);
  color: #fff;
  font-weight: 800;
}

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

.brand strong {
  font-size: 15px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  height: 38px;
  border-radius: 8px;
  text-align: left;
  padding: 0 12px;
  color: #3a3a3c;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(0, 113, 227, 0.11);
  color: #005bbd;
}

.main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px);
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.15;
  margin: 0;
  font-weight: 760;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.filter-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.filter-field input {
  min-width: 142px;
}

.primary,
.secondary {
  height: 34px;
  border-radius: 8px;
  padding: 0 14px;
  white-space: nowrap;
  transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 7px 18px rgba(0, 113, 227, 0.22);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}

.primary:active,
.secondary:active {
  transform: scale(0.98);
}

.view {
  display: none;
  min-height: 0;
  overflow: hidden;
}

.view.active {
  display: grid;
  gap: 14px;
}

#dashboard.view.active {
  grid-template-rows: auto minmax(0, 1fr);
}

#settings.view.active {
  grid-template-columns: minmax(0, 1fr);
}

#import-upload.view.active,
#subjects.view.active {
  grid-template-columns: minmax(0, 1fr);
}

#screening.view.active {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: auto;
}

#leads.view.active,
#workbench.view.active {
  grid-template-columns: minmax(0, 1fr);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  min-height: 104px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 14px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}

.metric:nth-child(2)::before,
.metric:nth-child(4)::before {
  background: var(--green);
}

.metric:nth-child(3)::before,
.metric:nth-child(6)::before {
  background: var(--amber);
}

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

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-top: 12px;
  font-weight: 760;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
  gap: 14px;
  min-height: 0;
}

.panel {
  min-height: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-head.compact {
  align-items: center;
}

.panel h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.task-list,
.breakdown,
.user-list,
.lead-cards,
.user-table,
.integration-list,
.group-list,
.table-wrap,
.code-box {
  min-height: 0;
  overflow: auto;
}

.user-table,
.integration-list,
.group-list {
  flex: 1 1 auto;
  margin-top: 4px;
}

.task-list,
.breakdown,
.user-list,
.lead-cards,
.integration-list,
.group-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.user-summary > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.74);
}

.user-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.user-summary strong {
  font-size: 24px;
}

.group-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(0, 113, 227, 0.12);
  color: #005bbd;
  font-weight: 800;
}

.avatar.small {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.employee-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-table {
  min-width: 1040px;
}

.employee-name {
  display: flex;
  align-items: center;
  gap: 9px;
}

.employee-name strong,
.employee-name span {
  display: block;
}

.employee-name span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.group-card-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.task,
.break-item,
.user-row,
.lead-card,
.integration-card,
.group-card {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.task strong,
.lead-card strong,
.user-row strong,
.integration-card strong,
.group-card strong {
  display: block;
  margin-bottom: 5px;
}

.task-meta,
.split,
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.order-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

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

.order-card {
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.order-card:hover,
.order-card:focus-visible {
  border-color: rgba(0, 113, 227, 0.34);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

.order-card:active {
  transform: scale(0.995);
}

.progress {
  height: 7px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  margin: 10px 0 6px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.task-start {
  margin-top: 10px;
}

.task-logs {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.split {
  justify-content: space-between;
  margin-top: 8px;
}

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

.subnav {
  display: none;
  gap: 4px;
  padding: 0 0 6px 14px;
}

.subnav.open {
  display: grid;
}

.settings-nav-item {
  flex: 0 0 auto;
  height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}

.settings-nav-item.active,
.settings-nav-item:hover {
  background: rgba(0, 113, 227, 0.11);
  color: #005bbd;
}

.settings-pages {
  min-height: 0;
  overflow: hidden;
  display: grid;
}

.settings-page {
  min-height: 0;
  display: none;
}

.settings-page.active {
  display: flex;
}

.integration-card,
.group-card {
  display: grid;
  gap: 8px;
}

.link-btn {
  background: transparent;
  color: #0066cc;
  padding: 0;
  text-align: left;
  font-weight: 700;
}

.link-btn:hover {
  color: #004c99;
}

.upload-box,
.screen-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.match-logic,
.import-summary {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.match-logic strong,
.match-logic span {
  display: block;
}

.match-logic span,
.logic-note {
  color: var(--muted);
  font-size: 12px;
}

.match-logic ol {
  margin: 0;
  padding-left: 18px;
  color: #3a3a3c;
  font-size: 13px;
  line-height: 1.7;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 8px;
}

.summary-grid > div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(245, 245, 247, 0.88);
}

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

.summary-grid span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.summary-grid strong {
  font-size: 18px;
}

.upload-box {
  border-style: dashed;
}

.screen-controls {
  align-items: end;
  margin: 10px 0;
}

#screening #import-progress-summary {
  overflow: visible;
}

#screening #import-progress-summary .summary-grid {
  grid-template-columns: repeat(5, minmax(92px, 1fr));
}

.screen-order-detail-summary .summary-grid {
  grid-template-columns: repeat(6, minmax(92px, 1fr));
}

.summary-actions,
.record-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.record-filter-bar {
  margin-top: 12px;
}

.record-filter {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.78);
  color: #3a3a3c;
  font-size: 13px;
}

.record-filter span {
  color: var(--muted);
  margin-left: 4px;
}

.record-filter.active,
.record-filter:hover {
  border-color: rgba(0, 113, 227, 0.42);
  background: rgba(0, 113, 227, 0.11);
  color: #005bbd;
}

.record-filter.active span,
.record-filter:hover span {
  color: #005bbd;
}

.rule-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(0, 113, 227, 0.14);
  border-radius: 8px;
  background: rgba(0, 113, 227, 0.06);
}

.rule-note strong {
  font-size: 13px;
}

.rule-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.screen-record-wrap {
  margin-top: 12px;
  min-height: 360px;
}

.screen-record-table {
  min-width: 1320px;
}

.screen-record-table th:nth-child(1),
.screen-record-table td:nth-child(1) {
  width: 230px;
}

.screen-record-table th:nth-child(2),
.screen-record-table td:nth-child(2) {
  width: 110px;
  min-width: 110px;
}

.screen-record-table th:nth-child(3),
.screen-record-table td:nth-child(3) {
  width: 230px;
  min-width: 230px;
}

.screen-record-table th:nth-child(4),
.screen-record-table td:nth-child(4),
.screen-record-table th:nth-child(5),
.screen-record-table td:nth-child(5) {
  width: 150px;
  min-width: 150px;
}

.screen-record-table th:nth-child(6),
.screen-record-table td:nth-child(6) {
  width: 420px;
  min-width: 420px;
}

.screen-controls label,
.follow-form label,
.settings-grid label,
.modal-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.check-row {
  display: flex !important;
  align-items: center;
  min-height: 34px;
  color: var(--text) !important;
}

.check-row input {
  width: 16px;
  min-width: 16px;
  height: 16px;
}

.switch-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--text) !important;
}

.switch-row input {
  width: 18px;
  min-width: 18px;
  height: 18px;
}

.hidden {
  display: none !important;
}

.code-box {
  flex: 1 1 auto;
  min-height: 140px;
  margin: 10px 0 0;
  background: rgba(29, 29, 31, 0.92);
  color: #f5f5f7;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
}

input,
select,
textarea {
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.86);
  min-width: 136px;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 113, 227, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

textarea {
  height: 88px;
  padding: 10px;
  resize: vertical;
}

.table-wrap {
  flex: 1 1 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: rgba(245, 245, 247, 0.96);
  color: #3a3a3c;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td {
  background: rgba(0, 113, 227, 0.04);
}

th:nth-child(1),
td:nth-child(1) {
  min-width: 190px;
  width: 210px;
}

th:nth-child(2),
td:nth-child(2) {
  min-width: 260px;
  overflow-wrap: anywhere;
}

th:nth-child(3),
td:nth-child(3) {
  min-width: 230px;
  overflow-wrap: anywhere;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7) {
  min-width: 110px;
}

.lead-table {
  min-width: 1420px;
  table-layout: fixed;
}

.lead-table th,
.lead-table td {
  height: 44px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-table th:nth-child(1),
.lead-table td:nth-child(1) {
  width: 260px;
}

.lead-table th:nth-child(2),
.lead-table td:nth-child(2) {
  width: 180px;
  min-width: 180px;
}

.lead-table th:nth-child(3),
.lead-table td:nth-child(3) {
  width: 220px;
  min-width: 220px;
}

.lead-table th:nth-child(4),
.lead-table td:nth-child(4),
.lead-table th:nth-child(5),
.lead-table td:nth-child(5) {
  width: 150px;
  min-width: 150px;
}

.one-line {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  border-radius: 8px;
  padding: 0 7px;
  background: rgba(0, 0, 0, 0.06);
  color: #3a3a3c;
  font-size: 12px;
}

.tag.ok {
  background: rgba(22, 138, 91, 0.12);
  color: var(--green);
}

.tag.warn {
  background: rgba(178, 106, 0, 0.14);
  color: var(--amber);
}

.tag.danger {
  background: rgba(199, 53, 43, 0.12);
  color: var(--danger);
}

.lead-detail-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  z-index: 40;
}

.lead-detail-backdrop.open {
  display: grid;
}

.lead-detail-modal {
  width: min(1040px, 100%);
  height: min(820px, calc(100vh - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(26px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen-order-modal {
  width: min(1460px, calc(100vw - 42px));
  height: min(900px, calc(100vh - 24px));
}

.lead-detail-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.lead-detail-head h2 {
  margin: 0;
  font-size: 20px;
}

.lead-detail-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.lead-detail-body {
  padding: 18px;
  overflow: auto;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 22px;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.section-title {
  margin: 18px 0 10px;
  font-size: 16px;
}

.ai-box {
  border: 1px solid rgba(22, 138, 91, 0.2);
  border-radius: 8px;
  background: rgba(240, 250, 246, 0.86);
  padding: 12px;
}

.follow-form,
.settings-grid,
.user-form,
.modal-form,
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
}

.settings-grid {
  flex: 0 0 auto;
}

.inline-form {
  align-items: stretch;
}

.inline-form select {
  min-width: 240px;
}

.follow-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.follow-form textarea,
.settings-grid button {
  grid-column: 1 / -1;
}

.user-form {
  grid-template-columns: minmax(150px, 1fr) 140px minmax(150px, 1fr) auto;
  margin-bottom: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  z-index: 40;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.24);
}

.modal-narrow {
  width: min(620px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-form {
  overflow: auto;
  padding: 16px;
}

.permission-grid {
  grid-column: 1 / -1;
}

.span-all {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  body {
    overflow: hidden;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    min-height: 0;
  }

  .sidebar {
    min-height: auto;
    z-index: 10;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .subnav.open {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px 0 0;
  }

  .settings-nav-item {
    text-align: center;
    padding: 0 6px;
  }

  .main {
    min-height: 0;
    overflow: hidden;
  }

  .view.active {
    min-height: 0;
    overflow: auto;
  }

  .view.active,
  #import-upload.view.active,
  #subjects.view.active,
  #screening.view.active,
  #settings.view.active,
  .two-col,
  .metric-grid,
  .detail-grid,
  .follow-form,
  .settings-grid,
  .user-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  #leads.view.active,
  #workbench.view.active {
    overflow: hidden;
  }

  #leads .panel,
  #workbench .panel {
    min-height: 0;
  }

  .settings-pages {
    min-height: 0;
    overflow: auto;
  }

  .lead-detail-backdrop {
    padding: 0;
  }

  .lead-detail-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 8px;
    gap: 8px;
  }

  .sidebar,
  .topbar,
  .panel {
    border-radius: 8px;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    padding-bottom: 12px;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-item {
    height: 34px;
    padding: 0 6px;
    text-align: center;
    font-size: 13px;
  }

  .topbar {
    min-height: auto;
    padding: 12px;
  }

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

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: auto;
  }

  .filters,
  .screen-controls,
  .upload-box {
    display: grid;
    grid-template-columns: 1fr;
  }

  input,
  select,
  textarea,
  .primary,
  .secondary {
    width: 100%;
    min-width: 0;
  }
}

