:root {
  /* Tokens from veracloud.eu */
  --wall: #e8eff7;
  --surface: #f7f9fc;
  --ink: #223449;
  --ink-soft: #5a6d84;
  --line: #d9e0e8;
  --blue: #1f6fa8;
  --free: #34dccc;
  --free-deep: #2bc4b6;
  --taken: #d9e0e8;
  --danger: #b93a3a;
  --ok: #17694a;
  --display: "Catamaran", system-ui, sans-serif;
  --body: "Catamaran", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  min-height: 100vh;
}

/* Navigation */
#nav {
  background: var(--ink);
  color: #fff;
  padding: 1.5rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.brand { padding: 0 0.75rem 1.5rem; }
.brand img { display: block; width: 100%; max-width: 9.5rem; height: auto; }
.brand span { display: block; margin-top: 0.35rem; font-size: 0.875rem; color: #acbaca; }
#nav a {
  color: #d9e0e8;
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-weight: 500;
}
#nav a:hover { background: #39577b; color: #fff; }
#nav a[aria-current="page"] { background: var(--free); color: var(--ink); font-weight: 700; }
.me {
  margin-top: auto;
  padding: 0.75rem;
  font-size: 0.875rem;
  color: #d9e0e8;
}
.me button {
  all: unset;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  display: block;
}
.me button:hover { text-decoration: underline; }

/* Page */
main {
  padding: 2.5rem clamp(1rem, 4vw, 3.5rem) 5rem;
  max-width: 68rem;
  width: 100%;
  outline: none;
}
h1 {
  font: 900 clamp(2.25rem, 6vw, 3.75rem)/1.05 var(--display);
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}
h2 {
  font: 700 1.3rem/1.2 var(--display);
  margin: 2.5rem 0 0.75rem;
}
h3 { font-size: 1rem; margin: 0; font-weight: 700; }
p { margin: 0 0 0.75rem; max-width: 65ch; }
.lede { font-size: 1.2rem; max-width: 50ch; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.875rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.between { justify-content: space-between; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); column-gap: 3rem; }

a { color: var(--blue); }

/* Controls */
button, .button {
  font: 600 0.95rem/1.2 var(--body);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: #d9e0e8; }
button.primary, .button.primary { background: var(--ink); color: #fff; }
button.primary:hover, .button.primary:hover { background: #39577b; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.quiet { border-color: transparent; padding: 0.25rem 0.4rem; color: var(--ink-soft); font-weight: 500; text-decoration: underline; }
button:disabled { opacity: 0.55; cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
#nav :focus-visible { outline-color: var(--free); }

form.stack { display: grid; gap: 0.75rem; max-width: 30rem; }
form.inline { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
label { display: grid; gap: 0.2rem; font-size: 0.875rem; font-weight: 600; }
input, select, textarea {
  font: 400 1rem/1.3 var(--body);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid #8fa3ba;
  border-radius: 7px;
  padding: 0.45rem 0.6rem;
  width: 100%;
}
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
textarea { min-height: 5rem; resize: vertical; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--line); }
.list > li { padding: 0.7rem 0; border-bottom: 1.5px solid var(--line); }
.empty { color: var(--ink-soft); padding: 0.5rem 0; }
.people { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0; }
.people li { background: var(--surface); border-radius: 6px; padding: 0.2rem 0.55rem; font-size: 0.95rem; }
.people b { font-weight: 700; margin-right: 0.3rem; }
.badge { font-size: 0.8rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 5px; background: var(--taken); white-space: nowrap; }
.badge.go { background: var(--free); }
.badge.ok { background: #cfe9dd; color: var(--ok); }

/* Today */
.hero-date { margin-bottom: 1rem; }
.today-desk { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.plate {
  font: 800 2rem/1 var(--display);
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

/* Desk date strip */
.days {
  display: grid;
  grid-template-columns: repeat(10, minmax(4.25rem, 1fr));
  gap: 0.35rem;
  overflow-x: auto;
  padding: 3px;
  margin: 1rem -3px;
}
.day {
  border: 0;
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem 0.4rem 0.45rem;
  text-align: left;
  display: grid;
  gap: 0.1rem;
}
.day:hover { background: #fff; }
.day[aria-pressed="true"] { background: var(--ink); color: #fff; }
.day .dow { font-size: 0.8rem; font-weight: 600; }
.day .dnum { font: 700 1.3rem/1.1 var(--display); }
.day .free { font-size: 0.78rem; white-space: nowrap; }
.day .meter { height: 4px; border-radius: 2px; background: var(--taken); overflow: hidden; margin-top: 0.15rem; }
.day .meter i { display: block; height: 100%; background: var(--blue); }
.day[aria-pressed="true"] .meter { background: #39577b; }
.day[aria-pressed="true"] .meter i { background: var(--free); }

/* Floor plan: the desks are the interface */
.plan-wrap { overflow-x: auto; padding: 3px; margin: 0 -3px; }
.plan {
  display: grid;
  gap: 0.5rem;
  grid-auto-rows: 5.5rem;
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 1rem;
  width: max-content;
  min-width: 100%;
}
.zone {
  background: var(--wall);
  border-radius: 10px;
  margin: -0.25rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.desk {
  align-self: end;
  height: 4.25rem;
  width: 100%;
  min-width: 5rem;
  z-index: 1;
  border-radius: 10px;
  border: 0;
  padding: 0.3rem 0.4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: transform 0.12s ease;
}
.desk .tag { font: 800 1.05rem/1.1 var(--display); }
.desk .who { font-size: 0.75rem; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk.free { background: var(--free); color: var(--ink); }
.desk.free:hover { background: var(--free-deep); transform: translateY(-2px); }
.desk.taken { background: var(--taken); color: var(--ink); cursor: default; }
.desk.taken.can-cancel { cursor: pointer; }
.desk.mine { background: var(--blue); color: #fff; }
.desk.mine:hover { background: #1d61a4; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.875rem; margin: 0.75rem 0 0; color: var(--ink-soft); }
.legend span::before {
  content: "";
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
  background: var(--c);
}

/* Coffee */
.run { border-top: 2.5px solid var(--ink); padding-top: 1rem; margin-top: 2rem; }
.run h2 { margin: 0; }
.tally { list-style: none; padding: 0; margin: 0 0 1rem; }
.tally li { display: grid; grid-template-columns: 2.5rem 1fr; padding: 0.3rem 0; align-items: baseline; }
.tally .count { font: 800 1.5rem/1 var(--display); }

/* Rooms */
.timeline { position: relative; height: 3rem; background: var(--surface); border-radius: 8px; overflow: hidden; margin: 0.4rem 0 0.2rem; }
.timeline .hour { position: absolute; top: 0; bottom: 0; border-left: 1px solid #e8eff7; }
.timeline .slot {
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  background: var(--taken);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  font-size: 0.78rem;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
}
.timeline .slot.mine { background: var(--blue); color: #fff; }
.hours { position: relative; height: 1.2rem; font-size: 0.75rem; color: var(--ink-soft); }
.hours span { position: absolute; transform: translateX(-50%); }
.room-block { margin-bottom: 1.25rem; }

/* Admin */
.table-wrap { overflow-x: auto; }
table.edit { border-collapse: collapse; width: 100%; }
table.edit th { text-align: left; font-size: 0.8rem; padding: 0.25rem 0.5rem 0.25rem 0; }
table.edit td { padding: 0.25rem 0.5rem 0.25rem 0; }
table.edit input { min-width: 4rem; }
table.edit input[type="number"] { width: 5rem; }

/* Sign-in */
body.signed-out { display: block; background: var(--ink); }
body.signed-out #nav { display: none; }
body.signed-out main { max-width: none; padding: clamp(1rem, 10vh, 6rem) 1rem; }
.gate {
  background: var(--surface);
  border-radius: 14px;
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem;
}
.gate-logo { display: block; height: 2rem; width: auto; margin-bottom: 1.5rem; }
.gate h1 { font-size: 2.25rem; }

/* One-time password panel */
.notice { background: var(--surface); border-left: 5px solid var(--free); border-radius: 8px; padding: 0.9rem 1.1rem; margin-bottom: 1.5rem; }
.secret { font: 700 1.25rem/1.3 var(--body); margin: 0.3rem 0; overflow-wrap: anywhere; user-select: all; }

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 2rem);
  width: max-content;
}
.toast-body {
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.toast-body.bad { background: var(--danger); }
.toast-body button { border-color: #fff; color: #fff; padding: 0.25rem 0.6rem; }
.toast-body button:hover { background: rgba(255, 255, 255, 0.15); }

@media (max-width: 760px) {
  body { display: block; padding-bottom: 4rem; }
  main { padding-top: 1.5rem; }
  #nav {
    position: fixed;
    inset: auto 0 0 0;
    height: auto;
    z-index: 10;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.4rem 0.5rem;
  }
  #nav a { white-space: nowrap; padding: 0.5rem 0.65rem; }
  .brand, .me { display: none; }
  #toast { bottom: 4.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
