:root {
  --ecite-bg: #f5f7fa;
  --ecite-surface: #ffffff;
  --ecite-surface-soft: #f8fbff;
  --ecite-border: #d8e1ec;
  --ecite-border-strong: #bfcbda;
  --ecite-text: #17212b;
  --ecite-muted: #64717f;
  --ecite-blue: #2563eb;
  --ecite-blue-strong: #1d4ed8;
  --ecite-blue-soft: #dbeafe;
  --ecite-navy: #0b1f3a;
  --ecite-navy-deep: #07172d;
  --ecite-success: #15803d;
  --ecite-success-soft: #dcfce7;
  --ecite-warning: #b45309;
  --ecite-warning-soft: #ffedd5;
  --ecite-danger: #b42318;
  --ecite-danger-soft: #fee2e2;
  --ecite-radius: 8px;
  --ecite-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --bs-primary: var(--ecite-blue);
  --bs-primary-rgb: 37, 99, 235;
  --bs-body-color: var(--ecite-text);
  --bs-body-bg: var(--ecite-bg);
  --bs-border-color: var(--ecite-border);
  --bs-border-radius: var(--ecite-radius);
  --bs-border-radius-lg: var(--ecite-radius);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

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

a {
  color: var(--ecite-blue);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ecite-blue-strong);
}

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

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0) 22rem),
    linear-gradient(180deg, var(--ecite-navy) 0%, var(--ecite-navy-deep) 100%);
  border-right: 1px solid rgba(191, 203, 218, 0.16);
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.15rem 1.15rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.85rem;
  color: #ffffff;
  text-decoration: none;
}

.brand-link:hover {
  color: #ffffff;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0.7rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-mark svg,
.nav-icon svg,
.sidebar-footer-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.brand-mark svg {
  width: 2rem;
  height: 2rem;
}

.brand-name,
.brand-subtitle {
  display: block;
  white-space: nowrap;
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.05;
}

.brand-subtitle {
  margin-top: 0.2rem;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.9rem;
}

.sidebar-menu-button {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.22rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--ecite-radius);
}

.sidebar-menu-button span {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin-inline: auto;
  background: currentColor;
  border-radius: 999px;
}

.app-nav {
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 3.1rem;
  padding: 0.72rem 0.85rem;
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid transparent;
  border-radius: var(--ecite-radius);
  font-weight: 700;
  text-decoration: none;
}

.app-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.app-nav-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--ecite-blue), #0b5ff1);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.32);
}

.nav-icon {
  display: grid;
  flex: 0 0 auto;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  margin: auto 1rem 1rem;
  color: rgba(255, 255, 255, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-footer-icon {
  display: grid;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  color: #dbeafe;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--ecite-radius);
}

.sidebar-footer-label,
.sidebar-footer-name {
  display: block;
}

.sidebar-footer-label {
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.72rem;
}

.sidebar-footer-name {
  max-width: 12rem;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-workspace {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
  padding: 0 2rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--ecite-border);
  backdrop-filter: blur(14px);
}

.topbar-title {
  min-width: 0;
}

.topbar-title strong,
.topbar-kicker {
  display: block;
}

.topbar-kicker {
  color: var(--ecite-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.topbar-title strong {
  overflow: hidden;
  color: var(--ecite-text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions,
.account-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 0 0.7rem;
  color: var(--ecite-blue-strong);
  background: var(--ecite-blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.account-name {
  max-width: 16rem;
  overflow: hidden;
  color: var(--ecite-text);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name:hover {
  color: var(--ecite-blue);
}

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

.app-content {
  width: min(100%, 1320px);
  padding: 2rem;
  margin: 0 auto;
}

.app-footer {
  padding: 1rem 2rem 1.5rem;
  color: var(--ecite-muted);
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--ecite-muted);
}

.app-content h1,
.app-content h2,
.app-content h3 {
  color: #101828;
  font-weight: 800;
  letter-spacing: 0;
}

.app-content h1.h3 {
  font-size: clamp(1.7rem, 1.5rem + 0.6vw, 2.25rem);
  line-height: 1.1;
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.25rem;
  margin-bottom: 1.5rem;
}

.content-header p {
  max-width: 52rem;
}

.page-kicker {
  margin-bottom: 0.35rem;
  color: var(--ecite-blue-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ecite-panel {
  background: var(--ecite-surface);
  border: 1px solid var(--ecite-border);
  border-radius: var(--ecite-radius);
}

.ecite-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(180deg, #ffffff 0%, var(--ecite-surface-soft) 100%);
  border-bottom: 1px solid var(--ecite-border);
}

.ecite-panel-header h2 {
  color: #0f2748;
}

.text-muted {
  color: var(--ecite-muted) !important;
}

.bg-white {
  background-color: var(--ecite-surface) !important;
}

.border {
  border-color: var(--ecite-border) !important;
}

.rounded-3 {
  border-radius: var(--ecite-radius) !important;
}

.shadow-sm {
  box-shadow: var(--ecite-shadow) !important;
}

.app-content .border.rounded-3.bg-white,
.app-content .border.rounded-3 {
  border-color: var(--ecite-border) !important;
  box-shadow: var(--ecite-shadow) !important;
}

.display-6 {
  color: #0b1f3a;
  font-size: clamp(2rem, 1.55rem + 1vw, 2.8rem);
  line-height: 1;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-height: 10rem;
}

.metric-icon {
  display: grid;
  flex: 0 0 auto;
  width: 4.1rem;
  height: 4.1rem;
  place-items: center;
  border-radius: 999px;
}

.metric-icon svg {
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.metric-blue {
  color: var(--ecite-blue);
  background: var(--ecite-blue-soft);
}

.metric-warning {
  color: var(--ecite-warning);
  background: var(--ecite-warning-soft);
}

.metric-danger {
  color: var(--ecite-danger);
  background: var(--ecite-danger-soft);
}

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

.citation-map {
  width: 100%;
  min-height: 36rem;
  overflow: hidden;
  border-radius: 0 0 var(--ecite-radius) var(--ecite-radius);
}

.citation-map-popup {
  min-width: 12rem;
  color: var(--ecite-text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.35;
}

.citation-map-popup strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #101828;
  font-weight: 800;
}

.citation-map-popup a {
  display: inline-flex;
  margin-top: 0.45rem;
  font-weight: 800;
}

.citation-map-marker {
  width: 18px;
  height: 18px;
  background: var(--ecite-blue);
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.32);
}

.citation-map-marker-police {
  background: var(--ecite-warning);
}

.citation-map-marker-parking {
  background: var(--ecite-blue);
}

.citation-map-cluster {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(37, 99, 235, 0.9);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.32);
  font-weight: 900;
}

.citation-map-cluster span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: inherit;
}

.citation-map-cluster-md {
  background: rgba(180, 83, 9, 0.92);
}

.citation-map-cluster-lg {
  background: rgba(180, 35, 24, 0.94);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  border-radius: var(--ecite-radius);
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.btn-sm {
  min-height: 2rem;
  font-size: 0.82rem;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--ecite-blue), #0b5ff1);
  border-color: var(--ecite-blue-strong);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #ffffff;
  background: var(--ecite-blue-strong);
  border-color: #1e40af;
}

.btn-outline-primary {
  color: var(--ecite-blue-strong);
  border-color: #9cc3ff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #ffffff;
  background: var(--ecite-blue);
  border-color: var(--ecite-blue);
}

.btn-outline-secondary {
  color: #26374a;
  background: #ffffff;
  border-color: var(--ecite-border-strong);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: var(--ecite-blue-strong);
  background: var(--ecite-surface-soft);
  border-color: #9cc3ff;
}

.btn-outline-success {
  color: var(--ecite-success);
  border-color: #86efac;
}

.btn-outline-danger {
  color: var(--ecite-danger);
  border-color: #fecaca;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.18);
}

.form-label,
dt {
  color: #344054;
  font-size: 0.84rem;
  font-weight: 800;
}

.form-control,
.form-select {
  min-height: 2.55rem;
  color: var(--ecite-text);
  background-color: #ffffff;
  border-color: var(--ecite-border-strong);
  border-radius: var(--ecite-radius);
}

.form-control::placeholder {
  color: #98a2b3;
}

.form-text {
  color: var(--ecite-muted);
}

.form-check-input:checked {
  background-color: var(--ecite-blue);
  border-color: var(--ecite-blue);
}

.form-switch .form-check-input {
  width: 2.7rem;
}

.list-group {
  overflow: hidden;
  border: 1px solid var(--ecite-border);
  border-radius: var(--ecite-radius);
  box-shadow: var(--ecite-shadow) !important;
}

.list-group-item {
  padding: 0.95rem 1rem;
  color: var(--ecite-text);
  border-color: var(--ecite-border);
}

.list-group-item-action:hover {
  color: var(--ecite-blue-strong);
  background: var(--ecite-surface-soft);
}

.list-group-item.active {
  color: var(--ecite-blue-strong);
  background: var(--ecite-blue-soft);
  border-color: #bfdbfe;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ecite-text);
  margin-bottom: 0;
}

.table thead th {
  padding: 0.9rem 1rem;
  color: #0f2748;
  background: var(--ecite-surface-soft);
  border-bottom-color: var(--ecite-border);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.table-sm > :not(caption) > * > * {
  padding: 0.85rem 1rem;
}

.table tbody td {
  border-color: #e5ebf2;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #f8fbff;
}

.table-responsive {
  border-radius: var(--ecite-radius);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.45rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-success {
  color: var(--ecite-success);
  background: var(--ecite-success-soft);
  border-color: #86efac;
}

.status-warning {
  color: var(--ecite-warning);
  background: var(--ecite-warning-soft);
  border-color: #fdba74;
}

.status-danger {
  color: var(--ecite-danger);
  background: var(--ecite-danger-soft);
  border-color: #fecaca;
}

.status-blue {
  color: var(--ecite-blue-strong);
  background: var(--ecite-blue-soft);
  border-color: #bfdbfe;
}

.status-muted {
  color: #475467;
  background: #f2f4f7;
  border-color: #d0d5dd;
}

.readonly-status {
  display: flex;
  align-items: center;
  min-height: 2.55rem;
  padding-inline: 0.75rem;
  background: var(--ecite-surface-soft);
  border: 1px solid var(--ecite-border-strong);
  border-radius: var(--ecite-radius);
}

.tenant-directory-panel {
  overflow: hidden;
}

.tenant-directory-table .tenant-primary {
  min-width: 15rem;
}

.tenant-primary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tenant-name-link {
  color: #0f2748;
  font-weight: 800;
  text-decoration: none;
}

.tenant-name-link:hover {
  color: var(--ecite-blue);
  text-decoration: underline;
}

.tenant-slug {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  max-width: 18rem;
  padding: 0.18rem 0.5rem;
  overflow: hidden;
  color: #0f2748;
  background: #eef5ff;
  border: 1px solid #cfe2ff;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-host-list {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.3rem;
}

.tenant-host-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  max-width: 20rem;
  padding: 0.18rem 0.5rem;
  overflow: hidden;
  color: #26374a;
  background: var(--ecite-surface-soft);
  border: 1px solid var(--ecite-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 12rem;
  padding: 2rem;
  text-align: center;
}

.tenant-detail-summary {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(4, minmax(9rem, 1fr)) auto;
  gap: 1rem;
  padding: 1rem 1.15rem;
}

.tenant-summary-item {
  min-width: 0;
  padding: 0.25rem 0;
}

.tenant-summary-item strong {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  color: #0f2748;
  font-weight: 800;
}

.tenant-summary-action {
  justify-self: end;
}

.tenant-summary-action form {
  margin: 0;
}

.tenant-detail-form {
  display: grid;
  gap: 1rem;
}

.tenant-form-section {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
}

.tenant-form-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ecite-border);
}

.tenant-toggle-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
}

.tenant-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
}

.text-bg-primary {
  color: var(--ecite-blue-strong) !important;
  background-color: var(--ecite-blue-soft) !important;
}

.text-bg-success {
  color: var(--ecite-success) !important;
  background-color: var(--ecite-success-soft) !important;
}

.text-bg-warning {
  color: var(--ecite-warning) !important;
  background-color: var(--ecite-warning-soft) !important;
}

.text-bg-danger {
  color: var(--ecite-danger) !important;
  background-color: var(--ecite-danger-soft) !important;
}

.alert {
  border: 1px solid;
  border-radius: var(--ecite-radius);
  box-shadow: var(--ecite-shadow);
}

.alert-success {
  color: var(--ecite-success);
  background: var(--ecite-success-soft);
  border-color: #86efac;
}

.alert-danger,
.text-danger {
  color: var(--ecite-danger) !important;
}

.alert-danger {
  background: var(--ecite-danger-soft);
  border-color: #fecaca;
}

.btn-group-sm > .btn,
.btn-sm {
  border-radius: var(--ecite-radius);
}

.app-content > .d-flex.align-items-center.justify-content-between.gap-3.mb-4 {
  padding-bottom: 0.25rem;
}

.app-content > .d-flex.align-items-center.justify-content-between.gap-3.mb-4 p {
  max-width: 52rem;
}

.app-content .d-grid .btn {
  justify-content: flex-start;
  min-height: 3rem;
  padding-inline: 1rem;
}

dl.row dt,
dl.row dd {
  padding-block: 0.35rem;
}

dd {
  color: var(--ecite-text);
}

hr {
  border-color: var(--ecite-border);
  opacity: 1;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

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

  .app-sidebar {
    position: relative;
    height: auto;
  }

  .brand-lockup {
    padding: 1rem;
  }

  .app-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 1rem 1rem;
  }

  .app-nav-link {
    min-height: 2.85rem;
  }

  .sidebar-footer {
    display: none;
  }

  .app-topbar {
    min-height: 4.25rem;
    padding: 0.75rem 1rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .session-pill {
    display: none;
  }

  .app-content {
    padding: 1rem;
  }

  .citation-map {
    min-height: 28rem;
  }

  .content-header,
  .app-content > .d-flex.align-items-center.justify-content-between.gap-3.mb-4 {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .tenant-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tenant-summary-action {
    justify-self: start;
    grid-column: 1 / -1;
  }

  .tenant-form-section-header {
    flex-direction: column;
  }
}

@media (max-width: 575.98px) {
  .app-nav {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions,
  .account-menu {
    width: 100%;
  }

  .account-menu {
    justify-content: space-between;
  }

  .account-name {
    max-width: 12rem;
  }

  .btn {
    width: auto;
  }

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

  .tenant-toggle-group {
    align-items: flex-start;
    flex-direction: column;
  }
}
