:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --line: #dfe7e2;
  --text: #1f2a24;
  --muted: #5b6c63;
  --accent: #DB2919;
  --accent-dark: #0f562b;
  --free: #8ee29d;
  --medium: #f1db65;
  --high: #f5a35c;
  --full: #e56b6b;
  --closed: #b7c1bb;
  --shadow: 0 14px 38px rgba(12, 34, 20, 0.08);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
code { background: #eef3f0; padding: 0.15rem 0.35rem; border-radius: 0.35rem; }

.shell {
  max-width: 1250px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.shell.narrow { max-width: 1180px; }

.hero {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #B82115, #DB2919);
  color: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero.small { margin-bottom: 18px; }
.hero h1 { margin: 6px 0 8px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.hero p { margin: 0; max-width: 760px; color: rgba(255,255,255,0.9); }
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
}

.link-button,
button {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
button:hover,
.link-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
button.secondary,
.link-button.secondary {
  background: #edf4ef;
  color: var(--text);
}
button.secondary:hover { background: #dde8e0; }
button.danger { color: #8a1f1f; }
button:disabled { cursor: not-allowed; opacity: 0.6; transform: none; }

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 22px;
}
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.card.inset {
  background: #f8fbf9;
  border: 1px solid var(--line);
  box-shadow: none;
}
.card h2, .card h3 { margin-top: 0; }
.auth-card { max-width: 460px; margin: 0 auto; }

.stack-form { display: grid; gap: 16px; }
.stack-form.compact { gap: 12px; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.hidden { display: none !important; }
label { display: grid; gap: 8px; }
label span { font-size: 0.94rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(21, 111, 56, 0.14);
  border-color: var(--accent);
}
.price-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eff7f1;
  border: 1px solid #d8e8dc;
}
.price-box strong { font-size: 1.2rem; }
.form-message { margin: 0; min-height: 1.2rem; color: var(--muted); }
.form-message.error { color: #b12222; }
.form-message.success { color: #16703a; }
.hint, .muted { color: var(--muted); }
.hint { font-size: 0.92rem; }

.calendar-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-nav button {
  min-width: 42px;
  padding-inline: 0;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -2px;
}
.swatch.free { background: var(--free); }
.swatch.medium { background: var(--medium); }
.swatch.high { background: var(--high); }
.swatch.full { background: var(--full); }
.swatch.closed { background: var(--closed); }
.weekday-row, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.weekday-row {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
.calendar-grid { min-height: 470px; }
.calendar-cell {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.03);
  display: grid;
  place-items: start end;
  padding: 10px;
  font-weight: 700;
  color: #16311e;
}
.calendar-cell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
}
.calendar-cell.free { background: var(--free); }
.calendar-cell.medium { background: var(--medium); }
.calendar-cell.high { background: var(--high); }
.calendar-cell.full { background: var(--full); }
.calendar-cell.closed { background: var(--closed); }
.calendar-cell.outside { opacity: 0.35; }
.day-detail {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.day-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.slot-block {
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  font-weight: 700;
}
.slot-block.available {
  background: var(--free);
  color: #14381f;
}
.slot-block.blocked {
  background: var(--full);
  color: #fff;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.full-span { grid-column: 1 / -1; }
.hour-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.checkbox-wrap input { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
small { color: var(--muted); }

@media (max-width: 980px) {
  .layout,
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { padding-inline: 14px; }
  .hero,
  .calendar-header,
  .toolbar,
  .grid-2,
  .hour-row { grid-template-columns: 1fr; display: grid; }
  .hero { gap: 14px; }
  .calendar-grid { min-height: auto; }
  .calendar-cell { min-height: 70px; }
  .day-slots { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}
