:root {
  --bg: #eef6fb;
  --panel: #ffffff;
  --ink: #10253a;
  --muted: #5d7186;
  --line: #c9dced;
  --brand-blue: #00569d;
  --brand-blue-dark: #003f78;
  --brand-green: #8bd000;
  --brand-green-dark: #65a900;
  --available: #42a948;
  --current: #0064b6;
  --prepaid: #0064b6;
  --overdue: #d93025;
  --liened: #6f2c2c;
  --warning: #ffb000;
  --map: #fbfdff;
  --map-line: #9db7cc;
  --shadow: 0 18px 50px rgba(0, 63, 120, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(0, 86, 157, 0.1), rgba(139, 208, 0, 0.08) 34%, transparent 68%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 7px;
  background: var(--brand-blue);
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 0.75rem 1rem;
}

.button-link {
  border-radius: 7px;
  display: inline-flex;
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-decoration: none;
}

button:hover {
  filter: brightness(0.96);
}

.danger-button {
  background: #fff0ee;
  border: 1px solid rgba(217, 48, 37, 0.34);
  color: var(--overdue);
}

.lien-button {
  background: #f9eeee;
  border-color: rgba(111, 44, 44, 0.36);
  color: var(--liened);
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1500px;
}

.topbar h1,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.6rem, 3vw, 2.55rem);
  letter-spacing: 0;
}

.eyebrow {
  color: var(--brand-green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.alert-button {
  height: auto;
  min-height: 44px;
  position: relative;
  width: 44px;
}

.alert-button.has-alerts {
  background: #fff0ee;
  color: var(--overdue);
}

.alert-badge {
  background: var(--overdue);
  border: 2px solid white;
  border-radius: 999px;
  color: white;
  display: grid;
  font-size: 0.68rem;
  font-weight: 900;
  min-height: 19px;
  min-width: 19px;
  padding: 0 4px;
  place-items: center;
  position: absolute;
  right: -5px;
  top: -5px;
}

.alert-badge[hidden] {
  display: none;
}

.lookup-results {
  display: grid;
  gap: 8px;
}

.lookup-result {
  align-items: center;
  background: #f5fbff;
  border: 1px solid #d5e7f6;
  color: var(--ink);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 44px;
  padding: 9px 10px;
  text-align: left;
}

.lookup-result span,
.lookup-result strong {
  overflow-wrap: anywhere;
}

.lookup-result strong {
  color: var(--brand-blue-dark);
  font-size: 0.82rem;
}

.lookup-result.selected-result {
  border-color: var(--brand-green-dark);
  box-shadow: 0 0 0 2px rgba(139, 208, 0, 0.24);
}

.compact-results {
  max-height: 230px;
  overflow: auto;
}

.search-button {
  height: auto;
  min-height: 44px;
  width: 44px;
}

.search-icon {
  fill: none;
  height: 23px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.35;
  width: 23px;
}

.bell-icon {
  fill: none;
  height: 23px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  width: 23px;
}

.search-overlay {
  align-items: start;
  background: rgba(16, 37, 58, 0.34);
  display: grid;
  inset: 0;
  padding: 12vh 18px 18px;
  position: fixed;
  z-index: 30;
}

.search-overlay[hidden] {
  display: none;
}

.search-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(16, 37, 58, 0.28);
  display: grid;
  gap: 10px;
  margin: 0 auto;
  max-width: 720px;
  padding: 12px;
  width: min(720px, 100%);
}

.search-input-shell {
  align-items: center;
  background: #f7fbff;
  border: 1px solid #bad3e8;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 7px 7px 7px 12px;
}

.search-input-shell > .search-icon {
  color: var(--muted);
  height: 25px;
  width: 25px;
}

.search-input-shell input {
  background: transparent;
  border: 0;
  font-size: 1.05rem;
  outline: 0;
  padding: 0.56rem 0.2rem;
}

.search-panel h2 {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  margin: 0 4px;
  text-transform: uppercase;
}

.overlay-results {
  max-height: min(58vh, 520px);
  overflow: auto;
}

.ghost-button {
  background: #e7f2fb;
  color: var(--brand-blue-dark);
}

.text-button {
  background: transparent;
  color: var(--brand-blue);
  padding: 0;
}

.tab-button {
  background: #e7f2fb;
  color: var(--brand-blue-dark);
}

.tab-button.active {
  background: var(--brand-blue);
  color: white;
}

.icon-button {
  align-items: center;
  background: #e7f2fb;
  color: var(--ink);
  display: inline-flex;
  font-size: 1.5rem;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 390px;
  margin: 18px auto 0;
  max-width: 1500px;
}

.map-panel,
.details-panel,
.list-panel,
.summary-card {
  background: var(--panel);
  border: 1px solid rgba(0, 86, 157, 0.15);
  box-shadow: var(--shadow);
}

.map-panel {
  border-radius: 8px;
  min-width: 0;
  padding: 12px;
}

.map-toolbar {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.map-toolbar h2 {
  font-size: 1.25rem;
}

.map-toolbar p {
  color: var(--muted);
  margin-top: 3px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 440px;
}

.legend span {
  align-items: center;
  background: #edf7ff;
  border: 1px solid #cae4f8;
  border-radius: 999px;
  color: #173451;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
  padding: 6px 9px;
}

.status-dot {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.available {
  background: var(--available);
}

.current {
  background: var(--current);
}

.prepaid {
  background: var(--prepaid);
}

.overdue {
  background: var(--overdue);
}

.liened {
  background: var(--liened);
}

.lot-wrap {
  overflow: auto;
  padding-bottom: 8px;
}

.lot-map {
  aspect-ratio: 0.78;
  background: linear-gradient(180deg, #ffffff, var(--map));
  border: 1px solid #9fc6e3;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 3px rgba(0, 86, 157, 0.06),
    inset 0 0 0 1px rgba(139, 208, 0, 0.14);
  min-height: 860px;
  min-width: 660px;
  position: relative;
}

.lot-map::before {
  border: 1px solid rgba(0, 86, 157, 0.18);
  content: "";
  inset: 0.4%;
  pointer-events: none;
  position: absolute;
}

.map-label {
  color: #234765;
  font-weight: 800;
  position: absolute;
  text-align: center;
}

.map-title {
  left: 38%;
  top: 20%;
}

.scale {
  left: 43%;
  top: 16%;
}

.chillbox-building,
.trash,
.gate,
.map-note {
  background: rgba(244, 247, 249, 0.94);
  border: 1px dashed rgba(93, 113, 134, 0.42);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(16, 37, 58, 0.06);
  color: #526170;
  display: grid;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  overflow: hidden;
  place-items: center;
  position: absolute;
  text-align: center;
  text-transform: uppercase;
  z-index: 3;
}

.chillbox-building {
  height: 32%;
  left: 3.6%;
  top: 20%;
  width: 14%;
}

.trash {
  height: 7%;
  left: 23%;
  top: 45%;
  width: 5.6%;
}

.gate {
  height: 7.6%;
  left: 3%;
  line-height: 1.25;
  padding: 4px;
  top: 74%;
  width: 8%;
}

.map-note {
  border: 0;
  bottom: 45%;
  left: 43%;
}

.spot {
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #9bb7ce;
  color: #10253a;
  display: flex;
  font-size: 0.75rem;
  font-weight: 800;
  justify-content: center;
  min-height: 22px;
  overflow: visible;
  padding: 2px;
  position: absolute;
  text-overflow: ellipsis;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
  white-space: nowrap;
  z-index: 6;
}

.spot[data-customer-tooltip]::before,
.spot[data-customer-tooltip]::after {
  left: 50%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, 6px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
  z-index: 30;
}

.spot[data-customer-tooltip]::before {
  background: #10253a;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 37, 58, 0.22);
  color: white;
  content: attr(data-customer-tooltip);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  max-width: min(220px, 42vw);
  overflow: hidden;
  padding: 8px 10px;
  text-align: center;
  text-overflow: ellipsis;
  top: calc(100% + 9px);
  width: max-content;
  white-space: nowrap;
}

.spot[data-customer-tooltip]::after {
  border-bottom: 6px solid #10253a;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  content: "";
  top: calc(100% + 3px);
}

.spot[data-customer-tooltip]:hover::before,
.spot[data-customer-tooltip]:hover::after,
.spot[data-customer-tooltip]:focus-visible::before,
.spot[data-customer-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.spot.status-available {
  background: #ecf8ea;
  border-color: rgba(66, 169, 72, 0.62);
}

.spot.status-current,
.spot.status-prepaid {
  background: #edf6ff;
  border-color: rgba(0, 100, 182, 0.58);
}

.spot.status-overdue {
  background: #fff0ee;
  border-color: rgba(217, 48, 37, 0.62);
}

.spot.status-liened {
  background: #f9eeee;
  border-color: rgba(111, 44, 44, 0.72);
  box-shadow: inset 0 0 0 2px rgba(111, 44, 44, 0.12);
}

.spot:hover,
.spot:focus-visible,
.spot.selected {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(139, 208, 0, 0.3);
  outline: 0;
  transform: translateY(-1px);
  z-index: 20;
}

.spot.bundled {
  border-color: var(--brand-green-dark);
  box-shadow: 0 0 0 3px rgba(139, 208, 0, 0.42);
  z-index: 9;
}

.spot.bundle-mate {
  transform: translateY(-1px);
}

.bundle-links {
  height: 100%;
  inset: 0;
  overflow: visible;
  pointer-events: none;
  position: absolute;
  width: 100%;
  z-index: 5;
}

.bundle-links path {
  fill: none;
  stroke: var(--brand-green-dark);
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.95));
  opacity: 0.95;
  stroke-dasharray: 7 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.spot-label {
  display: inline-grid;
  line-height: 1;
  place-items: center;
  position: relative;
  z-index: 1;
}

.stacked-spot-label {
  gap: 1px;
}

.stacked-spot-label span:first-child {
  font-size: 0.68rem;
}

.stacked-spot-label span:last-child {
  font-size: 0.76rem;
}

.spot .customer-name {
  bottom: -21px;
  color: #4a4035;
  font-size: 0.62rem;
  font-weight: 700;
  left: 0;
  overflow: hidden;
  position: absolute;
  text-overflow: ellipsis;
  width: 100%;
}

.spot.top,
.spot.bottom {
  height: 4.7%;
  width: 2.95%;
}

.spot.right {
  height: 2.95%;
  width: 7%;
}

.spot.middle {
  height: 3.9%;
  width: 9%;
}

.spot.left-small {
  height: 5.2%;
  width: 3.4%;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

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

.summary-card {
  border-radius: 8px;
  min-height: 108px;
  padding: 16px;
}

.summary-card span {
  display: block;
  font-size: 1.75rem;
  font-weight: 900;
}

.summary-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.urgent-stat {
  border-color: rgba(217, 48, 37, 0.38);
}

.details-panel,
.list-panel {
  border-radius: 8px;
  padding: 16px;
}

.details-heading,
.list-heading {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.details-heading h2,
.list-heading h2 {
  font-size: 1.12rem;
}

.badge {
  border-radius: 999px;
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}

.badge.muted {
  background: #83796b;
}

.badge.available {
  background: var(--available);
}

.badge.current {
  background: var(--current);
}

.badge.prepaid {
  background: var(--prepaid);
}

.badge.overdue {
  background: var(--overdue);
}

.badge.liened {
  background: var(--liened);
}

.detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.detail-item {
  background: #f3f9fe;
  border: 1px solid #d5e7f6;
  border-radius: 7px;
  padding: 10px;
}

.detail-item span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.bundle-notice {
  background: #f5fbeb;
  border: 1px solid rgba(101, 169, 0, 0.32);
  border-radius: 7px;
  color: #27450b;
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
  padding: 10px;
}

.bundle-notice span {
  color: var(--brand-green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.last-payment-summary {
  border-top: 1px solid #d5e7f6;
  align-items: start;
  display: grid;
  gap: 8px 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 4px;
  padding-top: 10px;
}

.last-payment-summary > div {
  display: grid;
  gap: 2px;
}

.last-payment-summary strong {
  color: var(--ink);
  display: block;
  font-size: 0.95rem;
}

.last-payment-summary p {
  border-top: 1px solid #d5e7f6;
  color: #31475c;
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 8px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.primary-actions {
  margin-bottom: 14px;
  margin-top: 16px;
}

.empty-state {
  color: var(--muted);
  margin-top: 16px;
}

.login-page {
  background:
    radial-gradient(circle at top left, rgba(76, 143, 194, 0.16), transparent 34%),
    linear-gradient(135deg, #f7faf8 0%, #eef5f8 52%, #f7f4ed 100%);
  min-height: 100vh;
}

.login-brand {
  left: 28px;
  position: fixed;
  top: 24px;
  z-index: 1;
}

.login-brand h1 {
  font-size: 1.35rem;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 3px 0 0;
}

.login-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  margin: 0 auto;
  max-width: 440px;
  padding: 32px;
  width: min(100%, 440px);
}

.login-panel h2 {
  font-size: 2rem;
  margin: 6px 0 10px;
}

.login-panel p {
  color: var(--muted);
  margin-bottom: 22px;
}

.wide-item {
  margin-top: 10px;
}

.is-loading .lot-map {
  opacity: 0.68;
}

.modal {
  background: rgba(36, 30, 22, 0.42);
  display: grid;
  inset: 0;
  overflow: auto;
  padding: 20px;
  place-items: center;
  position: fixed;
  z-index: 20;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--panel);
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  max-width: 720px;
  padding: 18px;
  width: min(720px, 100%);
}

.modal-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

form {
  display: grid;
  gap: 12px;
}

.form-section {
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 12px;
}

.form-section[hidden] {
  display: none;
}

.form-section legend {
  color: var(--brand-blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
  padding: 0 6px;
}

.mode-section {
  background: #fbfdff;
}

.segmented-control {
  background: #e7f2fb;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
}

.segmented-control label {
  display: block;
}

.segmented-control input {
  position: absolute;
  transform: scale(0);
}

.segmented-control span {
  align-items: center;
  border-radius: 6px;
  color: var(--brand-blue-dark);
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 38px;
  padding: 8px;
}

.segmented-control input:checked + span {
  background: var(--brand-blue);
  color: white;
}

.segmented-control button {
  background: transparent;
  border-radius: 6px;
  color: var(--brand-blue-dark);
  min-height: 38px;
  padding: 8px;
}

.segmented-control button.active {
  background: var(--brand-blue);
  color: white;
}

.existing-customer-section {
  display: grid;
  gap: 8px;
}

.existing-customer-section[hidden] {
  display: none;
}

label {
  color: #4b4236;
  display: grid;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 5px;
}

input,
select,
textarea {
  background: white;
  border: 1px solid #bad3e8;
  border-radius: 7px;
  box-sizing: border-box;
  color: var(--ink);
  padding: 0.7rem 0.78rem;
  width: 100%;
}

textarea {
  resize: vertical;
}

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

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.danger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-right: auto;
}

.confirm-danger-button {
  background: var(--overdue);
  border-color: var(--overdue);
  color: white;
}

.payment-card {
  max-height: 88vh;
  max-width: 900px;
  overflow: auto;
  width: min(900px, 100%);
}

.alerts-card {
  max-height: 86vh;
  max-width: 780px;
  overflow: auto;
  width: min(780px, 100%);
}

.alerts-list {
  display: grid;
  gap: 12px;
}

.alert-thread {
  background: #fbfdff;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.alert-thread-heading {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.alert-thread-heading strong {
  display: block;
  font-size: 1rem;
}

.alert-thread-heading span:not(.badge) {
  color: var(--muted);
  display: block;
  font-size: 0.86rem;
  margin-top: 2px;
}

.alert-meta {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.alert-meta div {
  background: #f3f9fe;
  border: 1px solid #d5e7f6;
  border-radius: 7px;
  padding: 8px 10px;
}

.alert-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.alert-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.alert-comments {
  display: grid;
  gap: 8px;
}

.alert-comment {
  background: white;
  border: 1px solid #d8e8f4;
  border-radius: 7px;
  padding: 9px 10px;
}

.alert-comment p {
  overflow-wrap: anywhere;
}

.alert-comment time {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  margin-top: 5px;
}

.alert-comment-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.payment-editor {
  display: grid;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.payment-mode-toggle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-tab-panel {
  display: grid;
  gap: 14px;
}

.payment-tab-panel[hidden] {
  display: none;
}

.payment-entry-card {
  background: #fbfdff;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.payment-summary-strip {
  background: #eef7fd;
  border: 1px solid #d5e7f6;
  border-radius: 7px;
  color: var(--brand-blue-dark);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 8px 12px;
  padding: 9px 10px;
}

.allocation-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.allocation-heading h3 {
  font-size: 1rem;
  margin: 0;
}

.allocation-status {
  background: #fff7df;
  border: 1px solid rgba(255, 176, 0, 0.4);
  border-radius: 999px;
  color: #6d4a00;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 6px 10px;
}

.allocation-status.is-balanced {
  background: #ecf8ea;
  border-color: rgba(66, 169, 72, 0.42);
  color: #237027;
}

.payment-allocation-list,
.payment-history-list {
  display: grid;
  gap: 10px;
}

.allocation-row {
  align-items: center;
  background: white;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.7fr) minmax(170px, 1fr);
  padding: 12px;
}

.allocation-row.single-payment-preview {
  grid-template-columns: minmax(180px, 1fr) minmax(170px, 1fr);
}

.allocation-spot strong,
.allocation-result strong {
  color: var(--ink);
  display: block;
}

.allocation-spot span,
.allocation-result span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 2px;
}

.allocation-result {
  background: #f3f9fe;
  border: 1px solid #d5e7f6;
  border-radius: 7px;
  padding: 9px 10px;
}

.payment-total-strip {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  font-weight: 900;
  gap: 8px 12px;
  margin-right: auto;
}

.payment-total-strip strong {
  color: var(--overdue);
}

.payment-total-strip strong.is-balanced {
  color: var(--available);
}

.payment-total-strip strong.is-over {
  color: #9a5700;
}

input[readonly] {
  background: #f3f9fe;
  color: var(--muted);
}

.payment-history-section {
  display: grid;
  gap: 10px;
}

.history-payment-card {
  background: #fbfdff;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 12px;
  position: relative;
}

.history-payment-edit {
  height: 34px;
  opacity: 0;
  padding: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  transition: opacity 0.15s ease;
  width: 34px;
}

.history-payment-edit svg {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 17px;
}

.history-payment-card:hover .history-payment-edit,
.history-payment-edit:focus-visible {
  opacity: 1;
}

.history-payment-card.editing {
  display: block;
}

.history-payment-edit-form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(110px, 0.85fr) minmax(130px, 1fr) minmax(110px, 0.8fr) minmax(130px, 1fr);
}

.history-payment-note-field,
.history-payment-edit-actions {
  grid-column: 1 / -1;
}

.history-payment-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.history-payment-card span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 2px;
}

.history-payment-card p {
  border-top: 1px solid #d5e7f6;
  color: #31475c;
  grid-column: 1 / -1;
  padding-top: 8px;
}

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

.section-heading h3 {
  font-size: 1rem;
  margin: 0;
}

.compact-empty {
  margin-top: 0;
}

.reports-shell {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 1500px;
}

.admin-shell {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 1180px;
}

.admin-panel {
  background: var(--panel);
  border: 1px solid rgba(0, 86, 157, 0.15);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

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

.admin-action-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid rgba(0, 86, 157, 0.15);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 146px;
  padding: 16px;
}

.wide-action-card {
  grid-column: 1 / -1;
}

.admin-action-icon {
  background: #edf7ff;
  border: 1px solid #cae4f8;
  border-radius: 8px;
  color: var(--brand-blue-dark);
  display: grid;
  height: 54px;
  place-items: center;
  width: 54px;
}

.admin-action-icon svg {
  fill: none;
  height: 28px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 28px;
}

.admin-action-card h2 {
  font-size: 1.2rem;
}

.admin-action-card p:not(.eyebrow) {
  color: var(--muted);
  margin-top: 4px;
}

.admin-card-link {
  align-items: center;
  background: var(--brand-blue);
  border-radius: 7px;
  color: white;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0.68rem 0.9rem;
  text-decoration: none;
}

.admin-card-link:hover {
  filter: brightness(0.96);
}

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

.admin-heading h2 {
  font-size: 1.25rem;
}

.admin-settings-form {
  border-top: 1px solid #d5e7f6;
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
}

.compact-heading {
  align-items: center;
  border-top: 1px solid #d5e7f6;
  padding-top: 12px;
}

.compact-heading p {
  color: var(--muted);
}

.alert-settings-card {
  max-height: 88vh;
  max-width: 980px;
  overflow: auto;
  width: min(980px, 100%);
}

.alert-contact-composer {
  background: #f5fbff;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) auto;
  padding: 12px;
}

.alert-contact-composer > label {
  grid-column: 1 / -1;
}

.inline-checks {
  align-items: center;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.inline-checks legend {
  color: var(--brand-blue-dark);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 0 6px;
  text-transform: uppercase;
}

.inline-checks label,
.alert-contact-switches label {
  align-items: center;
  background: white;
  border: 1px solid #d5e7f6;
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.82rem;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
}

.inline-checks input,
.alert-contact-switches input {
  width: auto;
}

.alert-contact-list {
  display: grid;
  gap: 10px;
  max-height: 46vh;
  overflow: auto;
}

.alert-contact-row {
  align-items: stretch;
  background: #fbfdff;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1fr);
  padding: 12px;
}

.alert-contact-row > label {
  min-width: 0;
}

.alert-contact-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.alert-contact-row .danger-button {
  justify-self: end;
  max-width: 180px;
  width: 100%;
}

.admin-history-card {
  max-height: 90vh;
  max-width: 1180px;
  overflow: auto;
  padding: 0;
  width: min(1180px, 100%);
}

.admin-history-panel {
  border: 0;
  box-shadow: none;
  min-height: 640px;
}

.history-admin-layout {
  border-top: 1px solid #d5e7f6;
  display: grid;
  gap: 14px;
  grid-template-columns: 320px minmax(0, 1fr);
  margin-top: 14px;
  padding-top: 14px;
}

.history-admin-list,
.history-admin-editor {
  min-width: 0;
}

.history-admin-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.customer-history-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.customer-history-item {
  align-items: start;
  background: #f5fbff;
  border: 1px solid #d5e7f6;
  color: var(--ink);
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 76px;
  padding: 10px;
  text-align: left;
}

.customer-history-item strong,
.customer-history-item span,
.customer-history-item small {
  overflow-wrap: anywhere;
}

.customer-history-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.customer-history-item small {
  color: var(--brand-blue-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.history-admin-editor {
  align-content: start;
  display: grid;
  gap: 12px;
}

.history-admin-editor > .section-heading:first-of-type {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(26, 70, 112, 0.08);
  margin: -1px 0 2px;
  padding: 10px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.history-admin-editor[data-unsaved="1"] > .section-heading:first-of-type::after {
  background: #fff6d8;
  border: 1px solid #e8c55b;
  border-radius: 999px;
  color: #735400;
  content: "Unsaved edits";
  font-size: 0.76rem;
  font-weight: 900;
  padding: 6px 9px;
}

.history-rental-list {
  display: grid;
  gap: 12px;
}

.history-spot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-spot-button {
  align-items: start;
  background: #f5fbff;
  border: 1px solid #d5e7f6;
  color: var(--ink);
  display: grid;
  gap: 2px;
  justify-items: start;
  min-height: 68px;
  min-width: 118px;
  padding: 10px;
  text-align: left;
}

.history-spot-button.active {
  border-color: var(--brand-green-dark);
  box-shadow: 0 0 0 2px rgba(139, 208, 0, 0.24);
}

.history-spot-button span,
.history-spot-button small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.history-rental-card {
  background: #fbfdff;
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

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

.history-rental-details {
  border: 1px solid #d5e7f6;
  border-radius: 8px;
  padding: 10px;
}

.history-rental-details summary {
  color: var(--brand-blue-dark);
  cursor: pointer;
  font-weight: 900;
}

.history-rental-details[open] summary {
  margin-bottom: 10px;
}

.reports-toolbar {
  display: flex;
  gap: 10px;
}

.report-panel {
  background: var(--panel);
  border: 1px solid rgba(0, 86, 157, 0.15);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.report-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.report-heading h2 {
  font-size: 1.25rem;
}

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

.report-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.history-controls {
  align-items: end;
  border-top: 1px solid #d5e7f6;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 0.55fr) minmax(240px, 1fr) auto;
  margin-bottom: 14px;
  padding-top: 14px;
}

.pagination-controls {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.report-table-wrap {
  overflow: auto;
}

.report-table {
  border-collapse: collapse;
  min-width: 1180px;
  width: 100%;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid #d5e7f6;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #edf7ff;
  color: var(--brand-blue-dark);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
}

.report-table td {
  color: #20384f;
  font-size: 0.86rem;
}

.report-table td span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  margin-top: 2px;
}

.history-table {
  min-width: 0;
  table-layout: fixed;
}

.history-table th,
.history-table td {
  overflow-wrap: anywhere;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
  width: 6%;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  width: 17%;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 22%;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
  width: 15%;
}

.history-table th:nth-child(5),
.history-table td:nth-child(5) {
  width: 10%;
}

.history-table th:nth-child(6),
.history-table td:nth-child(6) {
  width: 15%;
}

.history-table th:nth-child(7),
.history-table td:nth-child(7) {
  width: 15%;
}

.overdue-table {
  min-width: 1050px;
}

.report-comment {
  border-bottom: 1px solid #d5e7f6;
  padding: 4px 0 6px;
}

.report-comment:last-child {
  border-bottom: 0;
}

.report-comment strong {
  color: var(--brand-blue-dark);
  display: block;
  font-size: 0.74rem;
}

.report-comment span {
  overflow-wrap: anywhere;
}

.status-pill {
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  padding: 6px 10px;
  white-space: nowrap;
  width: fit-content;
}

.report-table td .status-pill {
  display: inline-flex;
}

.status-pill.active {
  color: var(--available);
}

.status-pill.former {
  color: #66788a;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .summary-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .map-toolbar,
  .history-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .history-controls {
    display: flex;
  }

  .topbar-actions,
  .legend {
    justify-content: flex-start;
  }

  .side-panel,
  .summary-grid,
  .admin-board,
  .history-admin-layout,
  .alert-contact-composer,
  .alert-contact-row,
  .history-rental-summary-grid,
  .form-row,
  .allocation-row,
  .history-payment-card,
  .alert-comment-form,
  .alert-meta,
  .last-payment-summary {
    grid-template-columns: 1fr;
  }

  .lot-map {
    min-height: 760px;
    min-width: 590px;
  }

  .admin-action-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-card-link {
    grid-column: 1 / -1;
  }
}
