:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --text: #182230;
  --muted: #697586;
  --line: #d9e1ea;
  --brand: #d71920;
  --brand-dark: #a90f16;
  --nav: #101828;
  --green: #0f8a5f;
  --teal: #087c89;
  --amber: #b46b00;
  --blue: #2457a6;
  --danger: #c4232d;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.app-content {
  min-width: 0;
}

.topbar {
  z-index: 10;
  display: flex;
  gap: 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  flex-direction: column;
  align-items: stretch;
  height: 100vh;
  min-height: 100vh;
  overflow: auto;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.public-topbar {
  position: sticky;
  top: 0;
  min-height: 72px;
  align-items: center;
  padding: 12px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
}

.topbar-main,
.topbar-menu {
  display: flex;
  min-width: 0;
}

.topbar-main {
  flex: 0 0 auto;
  align-items: center;
}

.app-sidebar .topbar-main {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar-menu {
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  min-height: 0;
  padding-top: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 230px;
  max-width: 330px;
  flex: 0 1 auto;
}

.app-sidebar .brand {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small,
.userbox strong,
.userbox small {
  display: block;
}

.brand > span:last-child,
.userbox > span {
  min-width: 0;
}

.brand strong,
.brand small,
.userbox strong,
.userbox small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small,
.userbox small {
  color: var(--muted);
  font-size: 12px;
}

.topnav {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.topnav a {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px 10px 16px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.topnav a:hover,
.topnav a.is-active {
  color: var(--text);
  background: var(--surface-strong);
}

.topnav a.is-active {
  background: rgba(215, 25, 32, 0.08);
  color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.topnav a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.topnav a.is-active::before {
  background: var(--brand);
}

.userbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  min-width: 0;
}

.userbox > span {
  display: block;
  min-width: 0;
}

.userbox form {
  margin: 0;
}

.icon-button {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.logout-button {
  width: auto;
  min-width: 62px;
  padding: 0 12px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 850;
}

.logout-button:hover {
  border-color: rgba(196, 35, 45, 0.28);
  background: rgba(196, 35, 45, 0.08);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 34px);
}

.flash {
  width: min(960px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.flash-success {
  border-color: rgba(15, 138, 95, 0.35);
  color: var(--green);
}

.flash-danger {
  border-color: rgba(196, 35, 45, 0.35);
  color: var(--danger);
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 150px);
  place-items: center;
}

.auth-panel,
.panel,
.lead-card,
.agent-rail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(430px, 100%);
  padding: 30px;
}

.panel {
  padding: 22px;
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading.compact {
  margin-bottom: 16px;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h1,
.panel-heading h2,
.section-title h1,
.lead-main h1,
.empty-lead h1,
.empty-state h1 {
  margin: 0;
  letter-spacing: 0;
}

.panel-heading h1,
.section-title h1 {
  font-size: 28px;
  line-height: 1.12;
}

.panel-heading h2 {
  font-size: 19px;
}

.panel-heading p,
.empty-lead p,
.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 9px 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(36, 87, 166, 0.65);
  box-shadow: 0 0 0 3px rgba(36, 87, 166, 0.12);
}

.primary-action,
.secondary-action,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.primary-action {
  padding: 10px 15px;
  background: var(--brand);
  color: #fff;
}

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

.secondary-action,
.table-action {
  padding: 9px 13px;
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.table-action {
  min-height: 34px;
  white-space: nowrap;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

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

.check-row span {
  margin: 0;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  display: grid;
  min-height: 102px;
  align-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
}

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

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

.admin-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.filter-panel {
  overflow: hidden;
  padding: 0;
}

.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.filter-panel-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0;
}

.filter-state {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px 12px;
  align-items: start;
  padding: 20px 22px 22px;
}

.filter-field {
  grid-column: span 3;
  min-width: 0;
}

.filter-field-group,
.filter-field-search,
.filter-field-actions,
.filter-wide,
.filter-actions {
  grid-column: span 6;
}

.filter-actions,
.filter-field-actions {
  display: grid;
  align-self: end;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.filter-actions > *,
.filter-field-actions > * {
  min-height: 44px;
}

.filter-checkset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-checkset legend {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.filter-checks .check-row {
  position: relative;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.filter-checks .check-row:hover {
  border-color: var(--line);
  background: #fff;
}

.filter-checks .check-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-checks .check-row span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  color: #526173;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-checks .check-row span::before {
  content: "";
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border: 1px solid #9aa8b7;
  border-radius: 4px;
  background: #fff;
}

.filter-checks .check-row input:checked + span {
  color: var(--text);
}

.filter-checks .check-row input:checked + span::before {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 3px #fff;
}

.filter-checks .check-row:has(input:checked) {
  border-color: rgba(215, 25, 32, 0.34);
  background: #fff;
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.07);
}

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

.access-card {
  position: relative;
  display: grid;
  gap: 14px;
  align-items: stretch;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.access-card:hover {
  border-color: rgba(36, 87, 166, 0.34);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
}

.access-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 58px;
  align-items: center;
  padding-left: 30px;
  cursor: pointer;
}

.access-toggle input {
  position: absolute;
  left: 0;
  top: 18px;
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.access-card.is-active {
  border-color: rgba(215, 25, 32, 0.38);
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.07);
}

.access-card.has-error {
  border-color: rgba(194, 40, 50, 0.58);
  box-shadow: 0 10px 24px rgba(194, 40, 50, 0.12);
}

.access-card-main,
.access-card-stats {
  min-width: 0;
}

.access-card-main strong,
.access-card-main small,
.access-card-stats strong,
.access-card-stats small {
  display: block;
}

.access-card-main strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-card-main small,
.access-card-stats small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.access-card-stats {
  text-align: right;
}

.access-card-stats strong {
  color: var(--brand);
  font-size: 20px;
  line-height: 1.1;
}

.dealer-access {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
}

.global-dealer-access {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.global-dealer-access.has-error {
  border-color: rgba(194, 40, 50, 0.58);
  box-shadow: 0 10px 24px rgba(194, 40, 50, 0.12);
}

.global-dealer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: end;
}

.global-dealer-head strong,
.global-dealer-head small {
  display: block;
}

.global-dealer-head strong {
  color: var(--text);
  font-size: 16px;
}

.global-dealer-head small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dealer-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.dealer-picker legend {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dealer-picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.dealer-picker-head input {
  min-height: 38px;
}

.dealer-picker-head strong {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dealer-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 210px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.dealer-check {
  position: relative;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px 8px 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.65);
  cursor: pointer;
}

.dealer-check:hover {
  border-color: rgba(36, 87, 166, 0.24);
  background: #fff;
}

.dealer-check input {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 16px;
  min-height: 16px;
  accent-color: var(--brand);
}

.dealer-check span {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dealer-check:has(input:checked) {
  border-color: rgba(215, 25, 32, 0.34);
  background: #fff;
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.06);
}

.dealer-picker:disabled {
  opacity: 0.62;
}

.dealer-warning {
  display: none;
  margin-top: 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.access-card.has-error .dealer-warning,
.global-dealer-access.has-error .dealer-warning {
  display: block;
}

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

.field-choice {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  cursor: pointer;
}

.field-choice input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.field-choice span {
  min-width: 0;
}

.field-choice strong,
.field-choice small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-choice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.field-choice:has(input:checked) {
  border-color: rgba(215, 25, 32, 0.34);
  background: #fff;
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.06);
}

.settings-actions {
  margin-top: 14px;
}

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

.site-settings-grid .action-row {
  grid-column: 1 / -1;
}

.user-create-panel {
  margin-bottom: 18px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.user-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.user-card-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.user-card {
  display: block;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
  overflow: hidden;
}

.user-card-summary {
  display: block;
  padding: 16px;
  list-style: none;
  cursor: pointer;
}

.user-card-summary::-webkit-details-marker {
  display: none;
}

.user-card-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.user-card[open] .user-card-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.user-card-form {
  display: grid;
  gap: 16px;
  padding: 0 16px 16px;
}

.user-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 850;
  text-transform: uppercase;
}

.user-card-head strong,
.user-card-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.user-card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.user-expand-indicator {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.user-card[open] .user-expand-indicator {
  background: #fff;
  color: var(--brand);
}

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

.user-active-check {
  justify-self: start;
  padding: 8px 0;
}

.permission-set {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.permission-set legend {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.permission-choice {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.permission-choice:hover {
  border-color: rgba(36, 87, 166, 0.3);
  background: #fff;
}

.permission-choice input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.permission-choice span {
  min-width: 0;
}

.permission-choice strong,
.permission-choice small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-choice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.permission-choice:has(input:checked) {
  border-color: rgba(215, 25, 32, 0.34);
  background: #fff;
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.06);
}

.permission-choice.is-muted {
  opacity: 0.66;
}

.user-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.user-card-foot span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
}

.table-summary strong {
  color: var(--text);
  font-size: 22px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.wide {
  margin-bottom: 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.responsive-table form {
  margin: 0;
}

.data-table {
  min-width: 1360px;
}

.stats-table {
  min-width: 980px;
}

.history-table {
  min-width: 1120px;
}

.stats-wide-table {
  min-width: 1320px;
}

.stats-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
}

.stats-filter-bar {
  align-items: end;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  line-height: 1.35;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
  background: #fbfcfe;
}

td {
  overflow-wrap: anywhere;
}

td small {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.pill-green {
  background: rgba(15, 138, 95, 0.12);
  color: var(--green);
}

.pill-muted {
  background: #edf1f6;
  color: var(--muted);
}

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

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

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

.activity-item {
  display: grid;
  gap: 3px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  margin-bottom: 18px;
}

.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.record-head h2 {
  margin: 0;
  font-size: 24px;
}

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

.detail-grid div,
.summary-list div {
  min-width: 0;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.detail-grid dt,
.summary-list span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid dd,
.summary-list strong {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 800;
}

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

.summary-list div {
  display: grid;
  align-content: center;
}

.activity-item span,
.activity-item small {
  color: var(--muted);
}

.agent-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.agent-rail {
  align-self: start;
  padding: 18px;
}

.mini-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  min-width: 0;
}

.avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: #1d2b3f;
  color: #fff;
  font-weight: 900;
}

.mini-profile small {
  color: var(--muted);
}

.mini-profile div {
  min-width: 0;
}

.mini-profile strong,
.mini-profile small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-button {
  width: 100%;
  min-height: 68px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.start-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.agent-message {
  min-height: 44px;
  margin: 12px 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 700;
}

.note-label,
.callback-label,
.contract-label {
  display: block;
  margin-top: 14px;
}

.call-surface {
  min-height: calc(100vh - 140px);
}

.empty-lead,
.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  padding: 36px;
  border: 1px dashed #cbd5e3;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.lead-card {
  padding: clamp(18px, 3vw, 28px);
}

.lead-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.lead-main h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
}

.phone-link {
  display: inline-flex;
  min-width: 142px;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #142237;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.lead-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.lead-details div {
  display: grid;
  align-content: start;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.lead-details dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.lead-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

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

.outcome-button {
  min-height: 58px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.outcome-accepted,
.outcome-yesil {
  background: var(--green);
}

.outcome-rejected,
.outcome-kirmizi {
  background: var(--danger);
}

.outcome-not_vodafone,
.outcome-turkuaz {
  background: var(--teal);
}

.outcome-no_answer,
.outcome-sari {
  background: var(--amber);
}

.outcome-unreachable,
.outcome-mavi {
  background: var(--blue);
}

.outcome-wrong_number,
.outcome-gri {
  background: #505a68;
}

.outcome-callback,
.outcome-kahve {
  background: #7a4d18;
}

.is-hidden {
  display: none !important;
}

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

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

  .site-settings-grid,
  .user-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-card-grid {
    grid-template-columns: 1fr;
  }

  .lead-details,
  .outcome-grid,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .filter-field {
    grid-column: span 3;
  }

  .filter-field-group,
  .filter-field-search,
  .filter-field-actions,
  .filter-wide,
  .filter-actions {
    grid-column: span 6;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    display: block;
  }

  .topbar {
    position: sticky;
    top: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-sidebar {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .topbar-main {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .brand {
    max-width: calc(100% - 56px);
    min-width: 0;
  }

  .menu-toggle {
    display: grid;
    flex: 0 0 auto;
  }

  .topbar-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.07);
  }

  .topbar.is-open .topbar-menu {
    display: flex;
  }

  .topnav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 0;
  }

  .topnav a {
    min-width: auto;
    width: 100%;
  }

  .userbox {
    width: 100%;
    margin-left: 0;
  }

  .admin-columns,
  .agent-grid {
    grid-template-columns: 1fr;
  }

  .agent-rail {
    position: static;
  }
}

@media (max-width: 620px) {
  .page {
    padding: 14px;
  }

  .auth-panel,
  .panel,
  .agent-rail,
  .lead-card {
    padding: 16px;
  }

  .filter-panel {
    padding: 0;
  }

  .filter-panel-head,
  .filter-bar {
    padding: 16px;
  }

  .metric-grid,
  .lead-details,
  .outcome-grid,
  .form-row,
  .site-settings-grid,
  .user-form-grid,
  .user-edit-grid,
  .permission-grid,
  .filter-bar,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-state {
    width: 100%;
  }

  .action-row,
  .pagination {
    justify-content: stretch;
  }

  .action-row > *,
  .pagination > *,
  .filter-bar > button,
  .filter-bar > a,
  .filter-actions > *,
  .filter-field-actions > * {
    width: 100%;
  }

  .filter-field,
  .filter-field-group,
  .filter-field-search,
  .filter-field-actions,
  .filter-wide,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions {
    grid-template-columns: 1fr;
  }

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

  .access-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .access-toggle,
  .global-dealer-head,
  .dealer-access,
  .dealer-checks,
  .field-choice-grid {
    grid-template-columns: 1fr;
  }

  .user-card-head {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .user-card-tags {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .user-expand-indicator {
    grid-column: 1 / -1;
    width: 100%;
  }

  .user-card-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .user-card-foot .primary-action {
    width: 100%;
  }

  .access-card-stats {
    text-align: left;
  }

  .filter-checks {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 14px;
  }

  .userbox {
    width: 100%;
    margin-left: 0;
  }

  .brand {
    width: auto;
    max-width: calc(100% - 56px);
  }

  .brand small {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  table.responsive-table {
    min-width: 0;
  }

  .table-wrap {
    border: 0;
    background: transparent;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .responsive-table td:last-child {
    border-bottom: 0;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

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

  .phone-link {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .responsive-table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .panel-heading h1,
  .section-title h1 {
    font-size: 24px;
  }
}
