:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #dde5ef;
  --text: #172033;
  --muted: #687385;
  --primary: #1f7ae0;
  --primary-strong: #145bb2;
  --success: #168a4a;
  --warning: #b7791f;
  --danger: #c2413a;
  --vip: #7c3aed;
  --disabled: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef6ff 0%, #f7fbf6 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(35, 54, 88, 0.12);
}

.login-card h1 {
  margin: 0 0 24px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: #334155;
  font-size: 14px;
}

.field input,
.field select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

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

.button.secondary {
  color: var(--primary);
  background: #e8f2ff;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: #162033;
  color: #e6eef8;
  padding: 22px 16px;
}

.brand {
  padding: 0 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand strong {
  display: block;
  font-size: 20px;
  margin-bottom: 6px;
}

.brand span {
  color: #9fb0c6;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.nav button {
  width: 100%;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 12px;
  text-align: left;
  color: #c9d6e6;
  background: transparent;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
}

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

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.filters .field {
  min-width: 180px;
  margin: 0;
}

.space-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.space {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.space strong {
  display: block;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  color: #334155;
  background: #edf2f7;
}

.badge.NORMAL {
  color: #1d4ed8;
  background: #dbeafe;
}

.badge.VIP {
  color: var(--vip);
  background: #ede9fe;
}

.badge.DISABLED {
  color: var(--disabled);
  background: #ccfbf1;
}

.status-FREE {
  border-color: rgba(22, 138, 74, 0.45);
}

.status-OCCUPIED {
  border-color: #ef4444;
  background: #fee2e2;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.18);
}

.status-MAINTENANCE {
  border-color: rgba(183, 121, 31, 0.42);
  background: #fffaf0;
}

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

.result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  white-space: pre-wrap;
}

.error {
  margin-top: 12px;
  color: var(--danger);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

.table th {
  color: var(--muted);
  font-size: 13px;
}

.table input {
  width: 96px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.income {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mini-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.plate-line {
  margin-top: 8px;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
  word-break: break-all;
}

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

  .sidebar {
    position: static;
  }

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