* {
  box-sizing: border-box;
}

:root {
  --ink: #23272f;
  --muted: #6b7280;
  --paper: #ffffff;
  --line: #d7dde2;
  --field: #f7f9fb;
  --brand: #2f6b73;
  --brand-dark: #24555b;
  --ok: #2f7254;
  --warn: #9b641d;
  --bad: #a33d3d;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: #eef2f4;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel,
.panel,
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(35, 39, 47, 0.08);
}

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

.portal-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 22px;
}

.content {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 34px;
}

h2 {
  margin-bottom: 16px;
  font-size: 21px;
}

h3 {
  margin-bottom: 5px;
  font-size: 17px;
}

.nav,
.login-form,
.form-panel {
  display: grid;
  gap: 12px;
}

.nav-button,
.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.nav-button {
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  text-align: left;
}

.nav-button.active,
.primary-button {
  background: var(--brand);
  color: #ffffff;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 11px 14px;
}

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

.secondary-button {
  background: #dce7e9;
  color: var(--ink);
}

.danger-button {
  background: #efd7d7;
  color: var(--bad);
}

label {
  display: grid;
  gap: 6px;
  color: #3f4752;
  font-size: 14px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid #c8d0d7;
  border-radius: 6px;
  background: var(--field);
  padding: 11px 12px;
}

.message {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--bad);
  font-size: 14px;
}

.field-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.topbar,
.section-header,
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.test-banner {
  margin-bottom: 16px;
  border: 1px solid #e0c37a;
  border-radius: 8px;
  background: #fff6d8;
  color: #5f4818;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.topbar {
  margin-bottom: 18px;
}

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

.file-input {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
}

.stat-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 28px;
}

.stat-card span,
.item-row p,
.section-header p {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.lpis-import-panel {
  display: grid;
  gap: 12px;
}

.lpis-import-panel .secondary-button {
  width: 100%;
}

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

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

.apartment-card {
  border-left: 6px solid var(--accent);
}

.calendar-controls,
.booking-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.calendar-controls strong {
  min-width: 150px;
  text-align: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: #dce7e9;
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.booking-filters {
  margin-bottom: 14px;
}

.filter-button {
  border: 0;
  border-radius: 6px;
  background: #dce7e9;
  color: var(--ink);
  padding: 9px 10px;
  font-weight: 800;
}

.filter-button.active {
  background: var(--brand);
  color: #ffffff;
}

.booking-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.weekday,
.calendar-day {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday {
  padding: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  min-height: 86px;
  padding: 7px;
  background: #ffffff;
  cursor: pointer;
}

.calendar-day:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

.calendar-day.outside {
  background: #f3f5f6;
  color: #9aa2aa;
}

.calendar-day.today {
  position: relative;
  outline: 3px solid var(--brand);
  outline-offset: -3px;
  background: #f0f7f8;
}

.calendar-day.today .day-number {
  display: inline-grid;
  min-width: 28px;
  min-height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
}

.day-number {
  display: block;
  margin-bottom: 5px;
  font-weight: 800;
}

.booking-chip {
  display: block;
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  color: #ffffff;
  padding: 5px 6px;
  font-size: 12px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-chip.checkout {
  width: 50%;
  min-width: 34px;
  opacity: 0.75;
}

.bookings-panel {
  margin-top: 18px;
}

.panel {
  padding: 18px;
}

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

.service-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #c8d0d7;
  border-radius: 8px;
  background: #f3f7fb;
}

.service-box h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

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

.service-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 10px;
}

@media (max-width: 640px) {
  .service-inputs {
    grid-template-columns: 1fr;
  }
}

.item-list,
.user-list {
  display: grid;
  gap: 10px;
}

.item-row,
.user-row {
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.item-row p,
.item-row h3 {
  margin-bottom: 4px;
}

.detail-card,
.vehicle-card {
  padding: 0;
  overflow: hidden;
}

.detail-card summary,
.vehicle-card summary {
  min-height: 58px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.detail-card summary::-webkit-details-marker,
.vehicle-card summary::-webkit-details-marker {
  display: none;
}

.detail-card summary::before,
.vehicle-card summary::before {
  content: "+";
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

.detail-card[open] summary::before,
.vehicle-card[open] summary::before {
  content: "-";
}

.detail-card summary span:first-child,
.vehicle-card summary span:first-child {
  flex: 1;
  font-weight: 900;
  font-size: 17px;
}

.vehicle-type-card {
  background: #f7fbff;
}

.vehicle-type-card > summary {
  min-height: 66px;
}

.vehicle-type-card > summary span:first-child {
  font-size: 18px;
}

.vehicle-group-body {
  background: #fbfcfd;
}

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

.vehicle-group-list .vehicle-card {
  background: #fff;
}

.detail-body,
.vehicle-detail-body {
  padding: 0 12px 12px 42px;
  border-top: 1px solid var(--line);
}

.detail-list,
.vehicle-detail-list {
  margin: 12px 0 0;
  display: grid;
  gap: 7px;
}

.detail-list div,
.vehicle-detail-list div {
  min-height: 28px;
  display: grid;
  align-items: center;
  border-bottom: 1px solid #edf1f5;
}

.detail-list dd,
.vehicle-detail-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: #dcece3;
  color: var(--ok);
}

.badge.warn {
  background: #f4e7d1;
  color: var(--warn);
}

.badge.bad {
  background: #efd7d7;
  color: var(--bad);
}

.badge.stop {
  background: #3b2f2f;
  color: #ffffff;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  --accent: var(--brand);
}

@media (max-width: 900px) {
  .portal-screen,
  .workspace,
  .fields-workspace,
  .stats,
  .apartment-summary {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .topbar,
  .section-header,
  .item-row {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-card summary,
  .vehicle-card summary {
    align-items: flex-start;
  }

  .detail-body,
  .vehicle-detail-body {
    padding-left: 12px;
  }

  .topbar-actions {
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .form-grid,
  .user-row {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 62px;
    padding: 5px;
  }

  .booking-chip {
    padding: 4px;
    font-size: 11px;
  }
}

.form-panel.disabled {
  opacity: 0.55;
  pointer-events: none;
}


.weather-embed-panel {
  min-height: calc(100vh - 130px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 16px 34px rgba(35, 39, 47, 0.08);
}

.weather-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 132px);
  border: 0;
  background: #edf4ff;
}


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

.modal-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(35, 39, 47, 0.22);
  padding: 18px;
}

.modal-header,
.cost-row,
.cost-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.cost-form {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.cost-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.cost-row {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.cost-row h3,
.cost-row p {
  margin-bottom: 4px;
}

.cost-amount {
  align-items: flex-end;
  flex-direction: column;
}

.cost-amount strong {
  font-size: 18px;
}

@media (max-width: 700px) {
  .modal-header,
  .cost-row,
  .cost-amount {
    align-items: stretch;
    flex-direction: column;
  }

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