:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #334155;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --grey: #64748b;
  --grey-soft: #e2e8f0;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --accent: #38bdf8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1e3a8a 0, var(--bg) 36rem);
  color: var(--text);
}
a { color: #7dd3fc; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.88);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}
.eyebrow, .brand { color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 800; }
h1 { margin: .25rem 0 0; font-size: clamp(1.05rem, 4.5vw, 2rem); }
.user-card { text-align: right; display: grid; gap: .2rem; }
.user-card span { color: var(--muted); }
.legend-panel, .notes {
  margin: 1rem 1.5rem;
  padding: 1rem;
  background: rgba(17, 24, 39, .9);
  border: 1px solid var(--border);
  border-radius: 1rem;
}
.legend-panel { display: flex; flex-wrap: wrap; gap: 1rem; }
.legend { display: flex; align-items: center; gap: .5rem; color: var(--muted); }
.swatch { width: 1.1rem; height: 1.1rem; border-radius: .25rem; border: 1px solid var(--border); display: inline-block; }
.swatch.red { background: var(--red); }
.swatch.grey { background: var(--grey); }
.swatch.green { background: var(--green); }
.swatch.white { background: white; }
.table-shell {
  margin: 1rem 1.5rem 2rem;
  overflow: auto;
  max-height: 72vh;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: white;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.planning-table {
  border-collapse: separate;
  border-spacing: 0;
  color: #0f172a;
  min-width: 0;
  width: max-content;
}
th, td { border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1; }
.day-head {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  width: 78px;
  min-width: 78px;
  padding: .35rem .2rem;
  text-align: center;
  font-size: .75rem;
}
.day-head span { display: block; color: #64748b; }
.day-head strong { display: block; font-size: .8rem; }
.day-head.non-working { background: #cbd5e1; }
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #0f172a;
  color: white;
}
.room-col {
  width: max-content;
  min-width: max-content;
  max-width: max-content;
  padding: .35rem .4rem;
  text-align: left;
  font-size: .82rem;
  white-space: nowrap;
}
td.cell {
  height: 42px;
  width: 78px;
  min-width: 78px;
  text-align: center;
  padding: .2rem;
}
td.cell.red { background: var(--red); }
td.cell.green { background: var(--green); }
td.cell.grey { background: #94a3b8; color: #334155; }
.weekend-head, .weekend-cell { min-width: 96px; width: 96px; }
.closed { font-size: .7rem; font-weight: 700; opacity: .75; }
select {
  max-width: 72px;
  font-size: .68rem;
  border: 1px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.92);
  border-radius: .4rem;
  padding: .18rem;
}

@media (max-width: 600px) {
  body {
    background: #0f172a;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: .6rem;
    padding: .75rem;
    position: static;
  }
  .user-card {
    text-align: left;
    width: 100%;
  }
  .legend-panel, .notes {
    margin: .75rem;
    padding: .75rem;
    border-radius: .75rem;
  }
  .legend-panel {
    display: grid;
    gap: .45rem;
  }
  .legend {
    align-items: flex-start;
    font-size: .8rem;
  }
  .table-shell {
    margin: .75rem;
    max-height: calc(100vh - 11rem);
    border-radius: .75rem;
  }
  .planning-table {
    min-width: 0;
  }
  .day-head {
    width: 68px;
    min-width: 68px;
    font-size: .68rem;
    padding: .25rem .15rem;
  }
  .day-head strong {
    font-size: .72rem;
  }
  .room-col {
    padding: .3rem .32rem;
    font-size: .72rem;
  }
  td.cell {
    width: 72px;
    min-width: 72px;
    height: 44px;
    padding: .12rem;
  }
  .weekend-head, .weekend-cell {
    min-width: 74px;
    width: 74px;
  }
  select {
    width: 100%;
    max-width: 68px;
    min-height: 32px;
    font-size: .62rem;
    padding: .12rem;
  }
  .closed {
    font-size: .62rem;
  }
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card {
  width: min(580px, 100%);
  background: rgba(17, 24, 39, .94);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.muted { color: var(--muted); }
.error { color: #fecaca; background: rgba(220, 38, 38, .2); padding: .75rem; border-radius: .75rem; }
.login-form { display: grid; gap: .65rem; margin: 1.25rem 0; }
.login-form input, .login-form button {
  border-radius: .75rem;
  border: 1px solid var(--border);
  padding: .8rem 1rem;
  font: inherit;
}
.login-form button { background: var(--accent); color: #082f49; font-weight: 800; cursor: pointer; }
.demo-box { background: rgba(15,23,42,.9); padding: 1rem; border-radius: .85rem; color: var(--muted); }
code { color: #bae6fd; }
