:root {
  --bg: #f5f0e8;
  --card: #fff;
  --forest: #2d4a3e;
  --forest-dark: #1e3329;
  --text: #2c2416;
  --muted: #6b5e4f;
  --border: #e8dfd0;
  --danger: #b42318;
  --ok: #1da851;
  --warn: #b54708;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-view.is-hidden,
.dashboard.is-hidden,
.is-hidden {
  display: none !important;
}
.dashboard {
  min-height: 100vh;
  display: block;
}
.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 16px 40px rgba(44, 36, 22, 0.08);
  display: grid;
  gap: 10px;
}
.login-logo {
  height: 56px;
  width: auto;
  margin: 0 auto 8px;
  display: block;
}
.login-card h1 {
  font-family: var(--display);
  text-align: center;
  margin: 0;
  color: var(--forest);
}
.login-card p {
  text-align: center;
  color: var(--muted);
  margin: 0 0 8px;
}
.login-card label {
  font-size: 0.88rem;
  font-weight: 600;
}
.login-card input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}
.login-card button,
.block-form button,
.header-actions button,
dialog button,
.actions button {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--forest);
  color: #fff;
}
.login-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 4px 0 0;
}
.login-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 24px;
  background: var(--forest-dark);
  color: #fff;
}
.admin-header span {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  opacity: 0.75;
}
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.header-actions a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  opacity: 0.85;
}
.header-actions button {
  background: rgba(255,255,255,0.12);
}

.admin-main {
  display: grid;
  gap: 20px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.admin-panel {
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(44, 36, 22, 0.06);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  color: var(--forest);
  font-size: 1.3rem;
}
.panel-head select,
.block-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}
.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.panel-head-actions button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--forest);
  color: #fff;
  white-space: nowrap;
}

.source-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--forest);
  background: #e8f0ec;
  padding: 2px 8px;
  border-radius: 999px;
}
.source-badge.source-web {
  color: var(--muted);
  background: #f0ebe3;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.status.pending { background: #fff4e5; color: var(--warn); }
.status.confirmed { background: #e8f8ef; color: var(--ok); }
.status.cancelled { background: #fdecea; color: var(--danger); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.actions button {
  padding: 7px 12px;
  font-size: 0.8rem;
}
.actions .secondary { background: #5b6b63; }
.actions .danger { background: var(--danger); }
.actions .ghost {
  background: transparent;
  color: var(--forest);
  border: 1px solid var(--border);
}

.block-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.block-form .form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.block-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}
.block-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.block-actions button,
.secondary-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.secondary-btn {
  background: #5b6b63;
  color: #fff;
}

.calendar-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 20px;
  align-items: start;
}
.panel-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.calendar-panel .panel-head {
  flex-wrap: wrap;
  align-items: flex-start;
}

.calendar-widget {
  background: var(--bg);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
}
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.cal-toolbar h3 {
  margin: 0;
  font-family: var(--display);
  color: var(--forest);
  font-size: 1.15rem;
  text-align: center;
  flex: 1;
}
.cal-nav {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--forest);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.cal-nav:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.cal-weekdays {
  margin-bottom: 8px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 0;
}
.cal-day {
  aspect-ratio: 1;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}
.cal-day:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(45, 74, 62, 0.25);
}
.cal-day.muted {
  opacity: 0.35;
  background: transparent;
  cursor: default;
}
.cal-day.today {
  box-shadow: inset 0 0 0 2px var(--forest);
}
.cal-day.selected {
  background: var(--forest);
  color: #fff;
}
.cal-day.blocked {
  background: #fdecea;
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
}
.cal-day.blocked.selected {
  background: var(--danger);
  color: #fff;
}
.cal-day:disabled {
  cursor: default;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.cal-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.cal-legend .dot.available { background: #fff; border: 1px solid var(--border); }
.cal-legend .dot.selected { background: var(--forest); }
.cal-legend .dot.blocked { background: #f04438; }
.cal-legend .dot.today { box-shadow: inset 0 0 0 2px var(--forest); background: transparent; }

.calendar-side {
  display: grid;
  gap: 14px;
}
.blocked-panel h4 {
  margin: 0 0 10px;
  color: var(--forest);
  font-size: 0.95rem;
}
.blocked-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}
.blocked-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
}
.blocked-list button {
  background: var(--danger);
  padding: 7px 12px;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .blocked-list {
    max-height: 220px;
  }
}

@media (max-width: 800px) {
  .admin-header { flex-direction: column; align-items: flex-start; }
  .block-actions { grid-template-columns: 1fr; }
  .cal-day {
    min-height: 36px;
    font-size: 0.82rem;
    border-radius: 10px;
  }
  .cal-weekdays span { font-size: 0.65rem; }
  .admin-main { padding: 16px; }
  .admin-panel { padding: 16px; }
  .actions { flex-direction: column; }
  .actions button { width: 100%; }
}

@media (max-width: 480px) {
  .cal-grid,
  .cal-weekdays { gap: 4px; }
  .calendar-widget { padding: 12px; }
  .cal-day { min-height: 34px; border-radius: 8px; }
}

dialog {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: min(480px, calc(100% - 32px));
}
dialog::backdrop { background: rgba(0,0,0,0.4); }
.dialog-inner { padding: 24px; }
.dialog-inner.dialog-wide {
  width: min(640px, 100%);
}
.dialog-inner h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  color: var(--forest);
}
.dialog-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.detail-row span { color: var(--muted); }
.detail-row strong { text-align: right; }

.add-booking-form { display: grid; gap: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.form-field {
  display: grid;
  gap: 6px;
}
.form-field.form-span-2 { grid-column: 1 / -1; }
.form-field label {
  font-size: 0.85rem;
  font-weight: 600;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.form-field textarea { resize: vertical; min-height: 72px; }
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 500 !important;
  margin-top: 28px;
  cursor: pointer;
}
.checkbox-label input {
  width: auto;
  margin: 0;
}
.form-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.dialog-actions button {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.dialog-actions .secondary-btn {
  width: auto;
  background: #5b6b63;
  color: #fff;
}
.dialog-actions button[type="submit"] {
  background: var(--forest);
  color: #fff;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .checkbox-label { margin-top: 0; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .panel-head-actions { width: 100%; }
  .panel-head-actions select,
  .panel-head-actions button { flex: 1; }
}
