:root {
  --bg: #f3efe8;
  --card: #ffffff;
  --ink: #1d1f24;
  --muted: #6d737d;
  --accent: #0f766e;
  --accent-dark: #0a5c55;
  --danger: #b91c1c;
  --line: #d9dee7;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, #fffdf8 0%, var(--bg) 40%, #ece5da 100%);
  position: relative;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  z-index: -1;
}

.bg-shape-a {
  width: 340px;
  height: 340px;
  background: rgba(15, 118, 110, 0.2);
  top: -80px;
  right: -80px;
}

.bg-shape-b {
  width: 300px;
  height: 300px;
  background: rgba(245, 158, 11, 0.16);
  bottom: -100px;
  left: -100px;
}

.app {
  width: min(920px, 94vw);
  margin: calc(14px + env(safe-area-inset-top)) auto calc(20px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
}

.card {
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--line) 65%, #ffffff);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 12px 30px rgba(20, 28, 41, 0.08);
}

.header h1,
.header h2,
.header h3,
.header h4,
.header p,
.card h1,
.card h2,
.card h3,
.card h4,
.card p {
  margin: 0;
}

.kicker {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls {
  display: grid;
  gap: 10px;
}

.controls.is-collapsed {
  display: none;
}

.quick-context {
  padding: 10px 12px;
  position: sticky;
  top: calc(6px + env(safe-area-inset-top));
  z-index: 5;
}

.context-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.context-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 700;
  background: #fff;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
button {
  font-family: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  font-size: 0.98rem;
  background: #fff;
  min-height: 44px;
}

input:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary-btn,
.secondary-btn,
.nav-btn,
.delete-btn,
.save-btn {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  min-height: 44px;
}

.compact-btn {
  min-width: 70px;
  padding: 10px 12px;
}

.primary-btn {
  background: linear-gradient(120deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.secondary-btn,
.nav-btn,
.save-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

button:hover {
  filter: brightness(1.02);
}

.calendar-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.calendar-header h2 {
  text-align: center;
  font-size: 1.1rem;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.dot-free {
  background: #16a34a;
}

.dot-some {
  background: #ea580c;
}

.dot-busy {
  background: #b91c1c;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekdays {
  margin-bottom: 6px;
}

.weekday {
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.day {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  min-height: 60px;
  padding: 6px;
  display: grid;
  align-content: space-between;
  cursor: pointer;
  text-align: left;
}

.day.day-free {
  border-color: color-mix(in srgb, #16a34a 36%, var(--line));
  background: color-mix(in srgb, #16a34a 8%, #fff);
}

.day.day-some {
  border-color: color-mix(in srgb, #ea580c 38%, var(--line));
  background: color-mix(in srgb, #ea580c 9%, #fff);
}

.day.day-busy {
  border-color: color-mix(in srgb, #b91c1c 45%, var(--line));
  background: color-mix(in srgb, #b91c1c 8%, #fff);
}

.day.out {
  opacity: 0.45;
}

.day.selected {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 0 0 2px #fff inset;
}

.day.today {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-dark) 35%, transparent) inset;
}

.day-number {
  font-weight: 800;
  font-size: 0.9rem;
}

.day-meta {
  font-size: 0.72rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.day.day-busy .day-meta {
  color: #8a1111;
}

.booking-form {
  margin: 12px 0 16px;
  display: grid;
  gap: 10px;
}

.booking-submit {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 3;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.booking-list,
.admin-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.booking-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: #fff;
}

.booking-item b {
  font-size: 0.94rem;
}

.delete-btn {
  background: color-mix(in srgb, var(--danger) 14%, #fff);
  color: var(--danger);
  min-height: 36px;
  padding: 8px 12px;
}

.admin-grid {
  display: grid;
  gap: 12px;
}

.admin-card {
  overflow: hidden;
}

.admin-card summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 3px;
}

.admin-card summary .subtle {
  margin-top: 0;
}

.admin-card summary::-webkit-details-marker {
  display: none;
}

.admin-card summary::after {
  content: "Visa";
  justify-self: start;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.admin-card[open] summary::after {
  content: "Dölj";
}

.admin-content {
  margin-top: 10px;
}

.admin-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.admin-row-user {
  grid-template-columns: 1fr 1fr auto auto;
}

.admin-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 420px;
  width: min(92vw, 420px);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-form {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  background: #1f2937;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 420px) {
  .day {
    min-height: 54px;
    padding: 5px;
  }

  .day-number {
    font-size: 0.84rem;
  }

  .day-meta {
    font-size: 0.68rem;
  }

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

@media (max-width: 740px) {
  .admin-row-user {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) {
  .app {
    gap: 14px;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .context-row {
    justify-content: flex-start;
    gap: 12px;
  }

  .calendar-header h2 {
    font-size: 1.25rem;
  }

  .day {
    min-height: 72px;
    padding: 8px;
  }
}
