/* Roster Bot — Monospace Web redesign */
@import url("/css/tokens.css");

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--mono);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "calt" 1, "liga" 0;
}

::selection { background: var(--select-bg); color: var(--select-fg); }

a { color: var(--fg-0); text-decoration: underline; text-underline-offset: 3px; }
a:hover { background: var(--fg-0); color: var(--bg-0); text-decoration: none; }

/* page background — dotted blueprint plot */
.page {
  min-height: 100vh;
  background-image: radial-gradient(var(--line-3) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: 0 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px 96px;
}

.shell {
  width: 100%;
  max-width: 480px;
  background: var(--bg-0);
  border: 1px solid var(--line-1);
  box-shadow: var(--shadow-2);
}

/* ── HEADER ─────────────────────────────────────────────── */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-elev);
}
.hdr-logo {
  font-weight: var(--wt-bold);
  font-size: 15px;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.hdr-logo .glyph {
  display: inline-grid;
  grid-template-columns: 6px 6px;
  grid-template-rows: 6px 6px;
  gap: 2px;
  margin-right: 4px;
}
.hdr-logo .glyph span { background: var(--fg-0); display: block; }
.hdr-logo .glyph span:nth-child(3) { background: var(--bg-0); border: 1px solid var(--fg-0); }
.hdr-logo .sub {
  color: var(--fg-2);
  font-weight: var(--wt-reg);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  margin-left: 4px;
}
.hdr-logo .sep { color: var(--fg-3); }
.hdr-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-1);
}
.hdr-user .dot {
  width: 6px; height: 6px;
  background: var(--fg-0);
  display: inline-block;
}

/* ── STATUS STRIP ───────────────────────────────────────── */
.status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-1);
}
.status-cell {
  padding: 10px 12px;
  border-right: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.status-cell:last-child { border-right: 0; }
.status-cell .v {
  font-size: 22px;
  font-weight: var(--wt-bold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.status-cell .k {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}

/* ── SECTION ────────────────────────────────────────────── */
.section { padding: 18px 16px; border-bottom: 1px solid var(--line-2); }
.section:last-child { border-bottom: 0; }
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  white-space: nowrap;
}
.section-hdr .h {
  font-size: 11px;
  font-weight: var(--wt-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.section-hdr .h .num {
  color: var(--fg-3);
  font-weight: var(--wt-reg);
  margin-left: 6px;
}
.section-hdr .meta {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── CHORE LIST ─────────────────────────────────────────── */
.chore {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line-2);
  align-items: start;
}
.chore:first-child { border-top: 0; padding-top: 0; }
.chore .mark { color: var(--fg-2); line-height: 1.55; font-size: 12px; }
.chore .body { min-width: 0; }
.chore .body .desc { font-size: 13px; font-weight: var(--wt-med); line-height: 1.4; word-break: break-word; }
.chore .body .meta {
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 3px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chore .body .meta .dot-sep { color: var(--fg-3); }
.chore .body .meta .assignee { color: var(--fg-1); }
.chore .age {
  font-size: 11px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 2px;
}

.empty {
  font-size: 12px;
  color: var(--fg-2);
  font-style: italic;
  padding: 4px 0;
}

/* ── QUEUE TABLE ────────────────────────────────────────── */
.queue {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.queue-row {
  display: grid;
  grid-template-columns: 96px 1fr 72px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.queue-row .who {
  font-weight: var(--wt-med);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-row .who .pic {
  width: 14px; height: 14px;
  border: 1px solid var(--line-1);
  display: inline-grid;
  place-items: center;
  font-size: 9px;
  font-weight: var(--wt-bold);
  background: var(--bg-elev);
  flex-shrink: 0;
}
.queue-row .bar {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 12px;
}
.queue-row .bar .blk {
  width: 8px; height: 12px;
  background: var(--fg-0);
  display: inline-block;
}
.queue-row .bar .blk.a {
  background: var(--bg-elev);
  border: 1px solid var(--fg-0);
  width: 7px; height: 10px;
}
.queue-row .bar .pad {
  width: 8px; height: 12px;
  border-bottom: 1px dashed var(--line-2);
  display: inline-block;
  align-self: end;
}
.queue-row .tally {
  text-align: right;
  font-size: 11px;
  color: var(--fg-2);
  letter-spacing: 0.04em;
}
.queue-row .tally .v { color: var(--fg-0); font-weight: var(--wt-bold); }
.queue-row .tally .a { color: var(--fg-0); font-weight: var(--wt-bold); border-bottom: 1px dashed var(--fg-0); }
.queue-row .tally .sep { color: var(--fg-3); margin: 0 3px; }

/* ── CALENDAR ───────────────────────────────────────────── */
.cal { display: flex; flex-direction: column; }
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-nav .month {
  font-size: 14px;
  font-weight: var(--wt-bold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.cal-nav .month .yr { color: var(--fg-3); font-weight: var(--wt-reg); margin-left: 6px; }
.cal-nav .arrows { display: flex; gap: 4px; }
.cal-nav .arrows button {
  font-family: var(--mono);
  font-size: 12px;
  width: 26px; height: 26px;
  border: 1px solid var(--line-1);
  background: var(--bg-elev);
  color: var(--fg-0);
  cursor: pointer;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.cal-nav .arrows button:hover { background: var(--fg-0); color: var(--bg-0); }
.cal-nav .arrows button:active { transform: translate(1px, 1px); }
.cal-nav .arrows button.today {
  width: auto;
  padding: 0 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cal-grid {
  border: 1px solid var(--line-1);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--line-2);
  gap: 1px;
}
.cal-dow {
  background: var(--bg-1);
  padding: 6px 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: var(--wt-med);
}
.cal-day {
  background: var(--bg-0);
  min-height: 56px;
  padding: 4px 5px 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.cal-day:hover { background: var(--bg-1); }
.cal-day.other { background: var(--bg-1); color: var(--fg-3); cursor: default; }
.cal-day.other .num { color: var(--fg-3); }
.cal-day.weekend { background: color-mix(in oklab, var(--bg-0) 88%, var(--line-3)); }
.cal-day.today { outline: 2px solid var(--fg-0); outline-offset: -2px; z-index: 1; }
.cal-day.no-duty { cursor: default; }
.cal-day .num {
  font-size: 11px;
  font-weight: var(--wt-med);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-day .num .badge-q {
  font-size: 8px;
  color: var(--fg-3);
  font-weight: var(--wt-reg);
  letter-spacing: 0.04em;
}
.cal-day .pill-list {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: auto;
}
.cal-day .pill {
  font-size: 9px;
  line-height: 1.3;
  padding: 1px 3px;
  border: 1px solid var(--fg-0);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--wt-med);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.cal-day .pill.vol { background: var(--fg-0); color: var(--bg-0); border-color: var(--fg-0); }
.cal-day .pill.admin {
  background: var(--bg-elev);
  color: var(--fg-0);
  border-color: var(--fg-0);
}
.cal-day .pill.prog {
  background: transparent;
  color: var(--fg-2);
  border-color: var(--fg-3);
  border-style: dashed;
}
.cal-day .pill.more {
  border: 0;
  padding: 0 2px;
  color: var(--fg-2);
  font-size: 9px;
}

/* ── LEGEND ─────────────────────────────────────────────── */
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  font-size: 11px;
  color: var(--fg-1);
}
.legend > div { display: flex; align-items: center; gap: 6px; }
.legend .swatch {
  width: 14px; height: 10px;
  border: 1px solid var(--fg-0);
  display: inline-block;
  flex-shrink: 0;
}
.legend .swatch.vol { background: var(--fg-0); }
.legend .swatch.admin { background: var(--bg-elev); }
.legend .swatch.prog { background: transparent; border-style: dashed; border-color: var(--fg-3); }
.legend .swatch.today {
  background: var(--bg-0);
  outline: 2px solid var(--fg-0);
  outline-offset: -2px;
  border: 0;
}

/* ── FOOTER ─────────────────────────────────────────────── */
.foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line-1);
  background: var(--bg-elev);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.foot .blink {
  display: inline-block;
  width: 7px; height: 11px;
  background: var(--fg-0);
  vertical-align: -1px;
  margin-right: 6px;
  animation: cursor-blink 1s steps(2) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0; } }

/* ── MODAL ──────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0;
  background: color-mix(in oklab, var(--bg-0) 60%, transparent);
  backdrop-filter: blur(1px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
  animation: scrim-in 120ms var(--ease);
}
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--line-1);
  box-shadow: var(--shadow-2);
  animation: modal-in 160ms var(--ease);
}
@keyframes modal-in {
  from { transform: translate(-2px, -4px); opacity: 0; }
  to { transform: translate(0, 0); opacity: 1; }
}
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-0);
}
.modal-hdr .title {
  font-size: 11px;
  font-weight: var(--wt-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.modal-hdr .title .date {
  margin-left: 8px;
  color: var(--fg-2);
  font-weight: var(--wt-reg);
}
.modal-hdr .x {
  border: 1px solid var(--line-1);
  background: var(--bg-elev);
  font-family: var(--mono);
  width: 22px; height: 22px;
  font-size: 12px;
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  color: var(--fg-0);
}
.modal-hdr .x:hover { background: var(--fg-0); color: var(--bg-0); }
.modal-body { padding: 14px; }

.duty {
  border: 1px solid var(--fg-0);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
}
.duty.vol { background: var(--fg-0); color: var(--bg-0); }
.duty.vol .name { color: var(--bg-0); }
.duty.vol .kind { color: color-mix(in oklab, var(--bg-0) 70%, transparent); }
.duty.admin { background: var(--bg-elev); }
.duty.prog { border-style: dashed; border-color: var(--fg-3); background: var(--bg-1); }
.duty .name { font-weight: var(--wt-bold); font-size: 13px; line-height: 1.2; }
.duty .kind {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
  grid-column: 1 / -1;
}
.duty .qchip {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  align-self: start;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.modal-actions {
  display: flex; gap: 8px; margin-top: 10px;
}
.btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 14px;
  border: 1px solid var(--line-1);
  background: var(--bg-elev);
  color: var(--fg-0);
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform 80ms var(--ease), box-shadow 80ms var(--ease), background 80ms var(--ease), color 80ms var(--ease);
  font-weight: var(--wt-med);
  flex: 1;
}
.btn:hover { background: var(--fg-0); color: var(--bg-0); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--fg-0); color: var(--bg-0); }
.btn.primary:hover { background: var(--bg-0); color: var(--fg-0); }
.btn.ghost { box-shadow: none; }

.err {
  border: 1px solid var(--fg-0);
  border-left-width: 4px;
  background: var(--bg-1);
  padding: 8px 10px;
  font-size: 12px;
  margin-top: 10px;
  color: var(--fg-0);
}
.err .lbl {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: var(--wt-bold);
  margin-right: 4px;
}

.spinner {
  font-size: 11px;
  color: var(--fg-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 0;
  text-align: center;
}

/* utilities */
.tn { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-2); }

/* scrollbar */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); }
*::-webkit-scrollbar-track { background: transparent; }
