:root {
  --ink: #10223b;
  --navy: #173b6c;
  --blue: #2d5bff;
  --blue-soft: #e8edff;
  --red: #ef5a3f;
  --red-soft: #ffe9e3;
  --paper: #fffaf0;
  --cream: #f5ebd8;
  --line: #d8d0c0;
  --muted: #6f7480;
  --white: #ffffff;
  --shadow: 0 22px 60px rgba(20, 38, 64, 0.13);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--cream); }

body {
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 255, 255, 0.8), transparent 23rem),
    linear-gradient(135deg, #f6edde 0%, #eee3d1 100%);
}

button, input { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(45, 91, 255, 0.35);
  outline-offset: 3px;
}

.app-shell { min-height: 100vh; }

.topbar {
  min-height: 76px;
  padding: 12px clamp(18px, 3vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--white);
  background: var(--navy);
  border-bottom: 4px solid var(--red);
}

.brand {
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  font: 800 1.45rem/1 "Fraunces", serif;
  transform: rotate(-7deg);
}

.brand strong { display: block; font: 800 1.4rem/1 "Fraunces", serif; }
.brand small { display: block; margin-top: 4px; font-size: 0.75rem; letter-spacing: 0.07em; opacity: 0.72; text-transform: uppercase; }

.top-actions { display: flex; align-items: center; gap: 24px; }
.availability { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.availability i { width: 8px; height: 8px; border-radius: 50%; background: #70df8e; box-shadow: 0 0 0 4px rgba(112, 223, 142, 0.15); }
.availability.offline i { background: #ffbd59; box-shadow: 0 0 0 4px rgba(255, 189, 89, 0.15); }

.button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: 0.58; cursor: wait; transform: none; }
.button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-light { color: var(--navy); background: var(--white); box-shadow: 0 5px 0 rgba(0,0,0,0.13); }
.button-primary { color: var(--white); background: var(--blue); box-shadow: 0 5px 0 #173cb3; }
.button-danger { color: #a72e1e; background: var(--red-soft); }

.workspace {
  width: min(1500px, 100%);
  min-height: calc(100vh - 80px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(310px, 0.72fr) minmax(600px, 1.55fr);
}

.luca-panel {
  position: relative;
  overflow: hidden;
  padding: 28px clamp(24px, 3.5vw, 58px) 34px;
  color: var(--white);
  background: var(--navy);
}

.luca-panel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -20px;
  height: 46px;
  background: var(--navy);
  clip-path: polygon(0 8%, 8% 22%, 17% 5%, 28% 25%, 38% 7%, 48% 23%, 60% 4%, 72% 23%, 84% 6%, 100% 19%, 100% 100%, 0 100%);
}

.classification {
  display: inline-block;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.portrait-wrap { position: relative; width: min(100%, 380px); height: 330px; margin: 4px auto -8px; }
.portrait-wrap img { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 17px 16px rgba(0,0,0,0.2)); }
.portrait-halo { position: absolute; inset: 42px 28px 24px; border-radius: 50%; background: var(--red); transform: rotate(-6deg); }
.portrait-halo::before, .portrait-halo::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,0.32); border-radius: 50%; inset: -14px 11px 14px -9px; }
.portrait-halo::after { inset: 8px -16px -9px 18px; }

.stamp {
  position: absolute;
  z-index: 3;
  right: -8px;
  bottom: 40px;
  color: var(--white);
  border: 3px solid currentColor;
  border-radius: 5px;
  padding: 7px 9px 5px;
  font: 800 1rem/1 "DM Sans", sans-serif;
  letter-spacing: 0.08em;
  transform: rotate(-9deg);
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
}

.eyebrow { margin: 0 0 7px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.luca-copy .eyebrow { color: #9bb6ff; }
.luca-copy h1 { margin: 0; font: 800 clamp(2.4rem, 4vw, 4.2rem)/0.93 "Fraunces", serif; letter-spacing: -0.04em; }
.rules { max-width: 36rem; margin: 18px 0 26px; color: rgba(255,255,255,0.78); }
.rules strong { color: var(--white); font-size: 0.8rem; letter-spacing: 0.09em; text-transform: uppercase; }
.rules ul { margin: 8px 0 0; padding-left: 19px; line-height: 1.5; }
.rules li + li { margin-top: 3px; }

.quota-card { position: relative; z-index: 4; padding: 18px; color: var(--ink); background: var(--paper); border-radius: 4px 15px 5px 11px; box-shadow: 7px 9px 0 rgba(6, 25, 51, 0.35); transform: rotate(-0.6deg); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.section-heading h2 { margin: 0; font: 800 1.1rem/1 "Fraunces", serif; }
.section-heading span { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.quota-list { display: grid; gap: 15px; padding: 16px 0 12px; }
.quota-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; }
.quota-name { display: flex; align-items: center; gap: 7px; font-weight: 800; }
.quota-name i { width: 11px; height: 11px; border-radius: 50%; }
.quota-track { height: 8px; overflow: hidden; border-radius: 10px; background: #ded9ce; }
.quota-fill { height: 100%; border-radius: inherit; transition: width 260ms ease; }
.quota-count { color: var(--muted); min-width: 33px; font-size: 0.8rem; font-weight: 700; text-align: right; }
.quota-row.anka .quota-name i, .quota-row.anka .quota-fill { background: var(--red); }
.quota-row.gabel .quota-name i, .quota-row.gabel .quota-fill { background: var(--blue); }
.quota-footnote { margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }

.calendar-panel { padding: clamp(28px, 4vw, 62px); background: var(--paper); }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.calendar-toolbar .eyebrow { color: var(--red); }
.calendar-toolbar h2 { margin: 0; font: 800 clamp(2rem, 4vw, 3.4rem)/1 "Fraunces", serif; letter-spacing: -0.035em; }
.month-controls { display: flex; align-items: center; gap: 8px; }
.icon-button, .today-button { height: 42px; border: 1px solid var(--line); background: var(--white); cursor: pointer; }
.icon-button { width: 42px; border-radius: 50%; display: grid; place-items: center; }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.today-button { border-radius: 22px; padding: 0 17px; font-weight: 700; }
.icon-button:hover, .today-button:hover { border-color: var(--blue); color: var(--blue); }

.legend { display: flex; justify-content: flex-end; gap: 20px; margin-bottom: 15px; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.anka { background: var(--red); }
.legend-dot.gabel { background: var(--blue); }
.legend-dot.free { border: 1px solid #aca797; background: transparent; }

.calendar { overflow: hidden; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; background: var(--line); gap: 1px; box-shadow: var(--shadow); }
.weekday { padding: 11px 6px; color: var(--muted); background: #f4efe5; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-align: center; text-transform: uppercase; }
.weekday.weekend { color: var(--red); }
.calendar-grid { display: contents; }

.day-cell {
  position: relative;
  min-height: clamp(84px, 8.5vw, 128px);
  border: 0;
  padding: 11px;
  color: var(--ink);
  background: rgba(255,255,255,0.9);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.day-cell:hover { z-index: 1; background: var(--white); box-shadow: inset 0 0 0 2px var(--blue); }
.day-cell.outside { color: #aaa69d; background: #f7f3eb; }
.day-cell.today::after { content: ""; position: absolute; top: 9px; left: 9px; width: 30px; height: 30px; border: 2px solid var(--red); border-radius: 50%; }
.day-number { position: relative; z-index: 1; display: block; font-weight: 800; }
.day-cell.booked { color: var(--white); }
.day-cell.booked.anka { background: var(--red); }
.day-cell.booked.gabel { background: var(--blue); }
.day-cell.booked:hover { box-shadow: inset 0 0 0 3px rgba(255,255,255,0.75); }
.day-cell.booked.today::after { border-color: var(--white); }
.booking-person { display: block; margin-top: 18px; font: 800 clamp(0.9rem, 1.3vw, 1.15rem)/1 "Fraunces", serif; }
.booking-note { display: -webkit-box; margin-top: 5px; overflow: hidden; opacity: 0.82; font-size: 0.72rem; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.booking-pin { position: absolute; right: 9px; top: 9px; width: 8px; height: 8px; border: 2px solid rgba(255,255,255,0.75); border-radius: 50%; }

.calendar-note { display: flex; gap: 10px; margin-top: 19px; color: var(--muted); font-size: 0.84rem; }
.calendar-note span { color: var(--red); font-size: 1.35rem; line-height: 0.7; }

.booking-dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 30px 90px rgba(11, 25, 47, 0.35); }
.booking-dialog::backdrop { background: rgba(8, 23, 43, 0.69); backdrop-filter: blur(4px); }
.booking-dialog form { position: relative; padding: clamp(24px, 5vw, 42px); }
.booking-dialog h2 { margin: 0; font: 800 2.2rem/1 "Fraunces", serif; }
.booking-dialog .eyebrow { color: var(--red); }
.dialog-date { margin: 9px 0 28px; color: var(--muted); }
.dialog-close { position: absolute; top: 15px; right: 16px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: #eee7da; font-size: 1.45rem; cursor: pointer; }
.booking-dialog fieldset { margin: 0 0 22px; padding: 0; border: 0; }
.booking-dialog legend, .text-field > span { display: block; margin-bottom: 9px; font-weight: 800; }
.text-field small { color: var(--muted); font-weight: 500; }
.person-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.person-option { position: relative; min-height: 78px; padding: 13px; display: flex; align-items: center; gap: 11px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.person-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.anka-option:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.person-option input { position: absolute; opacity: 0; pointer-events: none; }
.radio-art { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; color: var(--white); background: var(--blue); font: 800 1.15rem/1 "Fraunces", serif; }
.anka-option .radio-art { background: var(--red); }
.person-option strong, .person-option small { display: block; }
.person-option small { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.text-field input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 9px; padding: 0 13px; color: var(--ink); background: var(--white); }
.dialog-message { min-height: 21px; margin: 11px 0; color: #a72e1e; font-size: 0.82rem; font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.fine-print { margin: 18px 0 0; color: var(--muted); font-size: 0.7rem; text-align: center; }
.is-hidden { display: none !important; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; max-width: calc(100% - 28px); padding: 12px 18px; color: var(--white); background: var(--ink); border-radius: 30px; box-shadow: 0 14px 40px rgba(0,0,0,0.25); font-weight: 700; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .luca-panel { display: grid; grid-template-columns: minmax(220px, 0.7fr) 1fr; align-items: center; gap: 4px 32px; }
  .classification { position: absolute; top: 26px; left: 28px; }
  .portrait-wrap { grid-row: 1 / span 2; margin-top: 38px; }
  .luca-copy { align-self: end; }
  .quota-card { align-self: start; }
  .calendar-panel { padding-bottom: 50px; }
}

@media (max-width: 680px) {
  .topbar { align-items: flex-start; padding-block: 14px; }
  .brand small, .availability { display: none; }
  .button-light { width: 42px; padding: 0; }
  .button-light svg { margin: 0; }
  .button-light { font-size: 0; }
  .workspace { display: block; }
  .luca-panel { display: grid; grid-template-columns: 116px 1fr; gap: 0 15px; padding: 18px; }
  .classification { position: static; grid-column: 1 / -1; width: max-content; }
  .portrait-wrap { grid-row: auto; width: 130px; height: 155px; margin: 0 0 0 -8px; align-self: end; }
  .portrait-halo { inset: 27px 7px 10px; }
  .stamp { right: -2px; bottom: 14px; font-size: 0.62rem; border-width: 2px; padding: 5px; }
  .luca-copy { align-self: center; }
  .luca-copy h1 { font-size: 2rem; }
  .rules { margin: 11px 0 0; font-size: 0.75rem; }
  .rules ul { margin-top: 5px; padding-left: 16px; line-height: 1.35; }
  .luca-copy .eyebrow { font-size: 0.62rem; }
  .quota-card { grid-column: 1 / -1; margin-top: 14px; transform: none; }
  .calendar-panel { padding: 25px 12px 36px; }
  .calendar-toolbar { align-items: flex-end; }
  .calendar-toolbar h2 { font-size: 2rem; }
  .today-button { display: none; }
  .legend { justify-content: flex-start; padding-left: 3px; }
  .day-cell { min-height: 74px; padding: 7px; }
  .day-cell.today::after { top: 5px; left: 4px; width: 27px; height: 27px; }
  .booking-person { margin-top: 14px; font-size: 0.73rem; }
  .booking-note { font-size: 0.61rem; -webkit-line-clamp: 1; }
  .booking-pin { display: none; }
  .weekday { font-size: 0.62rem; }
  .person-options { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
