:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --accent-light: #7CD992;
  --accent-dark: #4AB877;
  --card: #f1f5f9;
  --radius: 16px;
  --border: #cbd5e1;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}
#app { padding: 16px; max-width: 720px; margin: 0 auto; }
h1, h2 { margin: 0 0 12px; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
}
.cta {
  display: block; width: 100%;
  padding: 16px; border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  color: #fff; font-size: 17px; font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}
.cta:disabled {
  opacity: 0.5; cursor: not-allowed;
  background: var(--muted);
}
.cta-secondary {
  background: var(--card);
  color: var(--accent-dark);
  border: 1px solid var(--accent-dark);
}
.cta-danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #dc2626;
}
.cta-danger:hover { background: #fee2e2; }
.muted { color: var(--muted); font-size: 14px; }
.row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0;
}
.scheme {
  display: grid; gap: 6px;
  grid-template-columns: repeat(5, 1fr);
  margin: 16px 0;
}
.scheme .cell {
  aspect-ratio: 1 / 2;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 600; color: #0f172a;
  cursor: pointer;
}
.cell.free     { background: #d9f7c4; }
.cell.booked   { background: #fff4c2; }
.cell.occupied { background: #c2dfff; }
.cell.overdue  { background: #ffc2c2; }
.cell.disabled { background: #e2e8f0; color: #94a3b8; cursor: not-allowed; }

input[type="text"], input:not([type]) {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 6px 0;
  font-size: 16px;
  background: #fff;
  color: var(--fg);
}
input:focus { outline: none; border-color: var(--accent-dark); }

.back {
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 4px 0;
  font-size: 15px;
  margin-bottom: 8px;
}
.back:hover { text-decoration: underline; }

.tabs {
  display: flex; gap: 6px;
  margin: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  background: var(--card);
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.stat-card.stat-bad { background: #fee2e2; }
.stat-card.stat-bad .stat-num { color: #dc2626; }
.stat-card.stat-good { background: #dcfce7; }
.stat-card.stat-good .stat-num { color: #16a34a; }

.unpaid-card {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
}
.unpaid-card.unpaid-red {
  border-left-color: #dc2626;
  background: #fee2e2;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
}
.stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

h3 { font-size: 17px; margin: 18px 0 10px; }
