:root {
  --paper: #e8eee9;
  --ink: #17211d;
  --mute: #5d6b65;
  --line: #c7d2cc;
  --plate: #1b2622;
  --enamel: #eef4f0;
  --occ: #b44522;
  --open: #1e6848;
  --hold: #9a6b24;
  --pad: 16px;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.35 "Geologica", "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
body[data-page="app"] .desk { min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.mark {
  font-weight: 800;
  font-size: 64px;
  line-height: .8;
  letter-spacing: -.06em;
  color: var(--plate);
}
.mark-sm {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.05em;
}
.place { color: var(--mute); font-size: 13px; margin: 6px 0 18px; }

.sheet {
  max-width: 420px;
  margin: 0 auto;
  padding: 28px var(--pad) 40px;
}
.stack { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

label.field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--mute);
}
input, textarea, select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
button.solid {
  background: var(--plate);
  color: var(--enamel);
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 600;
}
button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
}
button.tiny {
  padding: 6px 9px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
}
.err { color: var(--occ); font-size: 13px; }
.ok { color: var(--open); font-size: 13px; }

.desk-top, .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, white);
  position: sticky;
  top: 0;
  z-index: 4;
}
.who {
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 13px;
  color: var(--mute);
  max-width: 62vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse {
  padding: 10px var(--pad) 4px;
  font-size: 13px;
  color: var(--mute);
}
.pulse b { color: var(--ink); font-weight: 650; }
[data-state="free"] .pulse b { color: var(--open); }
[data-state="busy"] .pulse b { color: var(--occ); }

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 8px var(--pad) 12px;
}
.day {
  min-height: 72px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  font-size: 11px;
}
.day b { display: block; color: var(--mute); font-weight: 500; margin-bottom: 4px; }
.block {
  padding: 3px 4px;
  border-radius: 4px;
  margin-top: 3px;
  background: #f3d9cf;
  color: var(--occ);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.block.hold { background: #f0e4c8; color: var(--hold); }
.block.mine { background: #d5eadc; color: var(--open); }

.compose, .desk section { padding: 8px var(--pad) 16px; }
.compose h2, .desk h2 { font-size: 15px; font-weight: 650; margin-bottom: 8px; }
.grid-form { display: grid; gap: 8px; }
.combo { position: relative; }
.suggest {
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 6;
  max-height: 180px;
  overflow: auto;
  list-style: none;
}
.suggest li { padding: 8px 10px; cursor: pointer; font-size: 13px; }
.suggest li:hover, .suggest li.active { background: var(--enamel); }

.mine, .bookers, .accounts { list-style: none; display: grid; gap: 6px; }
.mine li, .accounts li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.mine menu { display: flex; gap: 6px; flex-wrap: wrap; }

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(23, 33, 29, .35);
  z-index: 10;
  display: grid;
  align-items: end;
}
.drawer:not([hidden]) { display: grid; }
.drawer .panel {
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  padding: 16px var(--pad) 28px;
  max-height: 88vh;
  overflow: auto;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}
.chip.on { background: var(--plate); color: var(--enamel); border-color: var(--plate); }
.dur { display: flex; gap: 6px; padding: 0 var(--pad) 8px; }
.weekbar {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 6px;
  align-items: center;
  padding: 0 var(--pad) 10px;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}
.cal-day {
  min-width: 0;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 2px;
  font-size: 11px;
}
.cal-day em { display: block; font-style: normal; color: var(--mute); font-size: 11px; }
.cal-day.on { background: var(--plate); color: var(--enamel); border-color: var(--plate); }
.cal-day.on em { color: #b7c4bd; }
.pane { padding-bottom: 12px; }
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 92%, white);
  border-top: 1px solid var(--line);
  z-index: 8;
}
.tabbar button {
  border: 0;
  background: transparent;
  padding: 10px 4px;
  font-weight: 650;
  color: var(--mute);
}
.tabbar button.on { color: var(--plate); }
.slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 var(--pad) 12px;
}
.slot {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 650;
}
.slot:disabled { opacity: .35; }
.ask {
  display: grid;
  gap: 8px;
  padding: 4px var(--pad) 16px;
}
.ask-when { font-weight: 650; }

body[data-page="house"], body[data-page="tv"] {
  background: var(--plate);
  color: var(--enamel);
  min-height: 100dvh;
}
body[data-page="house"] .top, body[data-page="tv"] .top {
  background: transparent;
  border-color: rgba(238,244,240,.12);
  color: var(--enamel);
}
.status {
  font-size: clamp(56px, 16vw, 120px);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: .85;
  padding: 10vh var(--pad) 0;
}
[data-state="free"] .status { color: #8fddb4; }
[data-state="busy"] .status { color: #f0a286; }
.host, .until, .next, .clock { padding: 8px var(--pad); color: #b7c4bd; }
.bill { list-style: none; padding: var(--pad); display: grid; gap: 14px; }
.bill li { border-top: 1px solid rgba(238,244,240,.12); padding-top: 10px; }

@media (max-width: 700px) {
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .week .day:nth-child(n+5) { min-height: 64px; }
}
@media (min-width: 900px) {
  .desk { max-width: 980px; margin: 0 auto; }
  .drawer { align-items: center; justify-items: center; }
  .drawer .panel { width: min(420px, 92vw); border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
