/* ===== Accountability — daily content pact =====
   Token-driven dark theme. Everything visual comes from the token layer below.
   The two people each get a colour that follows them through every view, so you
   never have to read a label to know whose column you are looking at. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces — each step is one level further from the page background */
  --bg: #0a0b10;
  --surface: #12141c;
  --surface-2: #191c26;
  --surface-hover: #212533;

  /* Text */
  --text: #f0f2f7;
  --text-dim: #a3abbf;
  --text-muted: #6b7386;

  --border: #232735;
  --border-bright: #363c4e;

  /* Accent */
  --accent: #8b5cf6;
  --accent-bright: #a78bfa;
  --accent-soft: rgba(139, 92, 246, 0.14);

  /* Semantic */
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.13);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);

  /* The three log types */
  --post: #38bdf8;
  --story: #fbbf24;
  --live: #f43f5e;

  /* Per-person identity colours */
  --person-a: #8b5cf6;
  --person-b: #2dd4bf;

  --radius: 14px;
  --radius-sm: 9px;
  --gap: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Each person's card picks up their colour via one attribute. */
[data-person="gabriele"] { --person: var(--person-a); }
[data-person="nick"]     { --person: var(--person-b); }

/* ===== Typography ===== */

.brand { font-size: 30px; font-weight: 900; letter-spacing: -0.03em; }
.brand-sm { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }

.muted { color: var(--text-dim); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--bad); font-size: 13px; margin-top: 10px; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin: 28px 0 12px;
}
.section-note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 6px;
}

.person-name { font-size: 16px; font-weight: 800; color: var(--person, var(--text)); }

/* ===== Screens ===== */

.screen { min-height: 100vh; }

#setup-screen, #login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-narrow { max-width: 420px; width: 100%; }

.login-mark, .topbar-mark { font-size: 34px; line-height: 1; }
.topbar-mark { font-size: 20px; }
#login-screen .brand { margin: 10px 0 4px; }
#login-screen .btn-google { margin-top: 22px; width: 100%; }

.setup-steps { margin: 16px 0 16px 20px; display: grid; gap: 10px; color: var(--text-dim); font-size: 14px; }
.setup-steps code, code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  transition: background .13s, border-color .13s, transform .08s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-bright); }
.btn:active { transform: translateY(1px); }

.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-icon { padding: 6px 12px; font-size: 19px; line-height: 1; }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn-google { background: #fff; color: #1f2330; border-color: #fff; font-weight: 700; }
.btn-google:hover { background: #e9ecf3; border-color: #e9ecf3; }

.btn-link {
  background: none; border: none; font: inherit; font-size: 12px;
  color: var(--text-muted); cursor: pointer; padding: 0;
}
.btn-link:hover { color: var(--bad); }

/* ===== Top bar ===== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px 20px;
  background: rgba(10, 11, 16, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 9px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.whoami { font-size: 13px; font-weight: 600; color: var(--text-dim); }

.tabs { display: flex; gap: 4px; margin-left: 10px; }
.tab {
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  background: transparent; border: none;
  padding: 7px 13px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { color: var(--text); background: var(--accent-soft); }

.content { max-width: 1040px; margin: 0 auto; padding: 4px 20px 64px; }

/* ===== Quote ===== */

.quote-card {
  margin-top: 24px;
  padding: 26px 28px;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.quote-text { font-size: 20px; font-weight: 700; line-height: 1.38; letter-spacing: -0.015em; }
.quote-author { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* ===== Today ===== */

.today-grid, .scoreboard, .stats-grid, .calendars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

.today-card { border-top: 3px solid var(--person); display: grid; gap: 14px; align-content: start; }
.today-card.is-done { background: linear-gradient(180deg, var(--good-soft), transparent 60%), var(--surface); }
.today-head { display: flex; align-items: center; gap: 8px; }
.today-state { margin-left: auto; font-size: 12px; font-weight: 700; }
.today-state.ok { color: var(--good); }
.today-state.pending { color: var(--text-muted); }
.today-note {
  font-size: 13px; color: var(--text-dim);
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 11px;
}
.today-open { justify-self: start; }

.pill {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 2px 7px; border-radius: 99px;
}
.pill-you { background: var(--accent-soft); color: var(--accent-bright); }

/* ===== The three type toggles ===== */

.type-row { display: flex; gap: 8px; flex-wrap: wrap; }

.type-btn {
  font: inherit; font-size: 12px; font-weight: 800;
  letter-spacing: 0.06em;
  padding: 9px 15px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: default;
  transition: background .13s, color .13s, border-color .13s;
}
button.type-btn { cursor: pointer; }
button.type-btn:hover { border-color: var(--border-bright); color: var(--text); }

.type-btn.type-post.on  { background: var(--post);  border-color: var(--post);  color: #04121c; }
.type-btn.type-story.on { background: var(--story); border-color: var(--story); color: #211703; }
.type-btn.type-live.on  { background: var(--live);  border-color: var(--live);  color: #fff; }
.type-btn.on { cursor: pointer; }

/* ===== Scoreboard ===== */

.score-card { border-top: 3px solid var(--person); }
.score-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.streak-badge {
  margin-left: auto; font-size: 12px; font-weight: 800;
  padding: 3px 10px; border-radius: 99px;
}
.streak-badge.hot { background: var(--good-soft); color: var(--good); }
.streak-badge.cold { background: var(--bad-soft); color: var(--bad); }

.score-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.figure {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  display: grid; gap: 2px;
}
.figure-value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.figure-label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.figure-bad .figure-value { color: var(--bad); }
.figure-good .figure-value { color: var(--good); }

/* ===== Calendars ===== */

.month-nav { display: flex; align-items: center; gap: 10px; margin: 24px 0 14px; }
.month-label { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; min-width: 190px; text-align: center; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }

.dot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; }
.dot-post { background: var(--post); }
.dot-story { background: var(--story); }
.dot-live { background: var(--live); }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.swatch-missed { background: var(--bad-soft); border: 1px solid var(--bad); }

.cal-card { border-top: 3px solid var(--person); padding: 16px; }
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-summary { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-muted); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekday {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); text-align: center; padding-bottom: 4px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: inherit;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.cal-cell:hover { background: var(--surface-hover); border-color: var(--border-bright); }
.cal-blank { background: transparent; cursor: default; }
.cal-daynum { font-size: 12px; font-weight: 700; }

.cal-cell.is-done { background: var(--good-soft); border-color: rgba(52, 211, 153, 0.4); color: var(--text); }
.cal-cell.is-missed { background: var(--bad-soft); border-color: rgba(248, 113, 113, 0.35); color: var(--bad); }
.cal-cell.is-future { opacity: 0.4; }
.cal-cell.is-today { outline: 2px solid var(--accent); outline-offset: 1px; }

.dot-row { display: flex; gap: 3px; min-height: 7px; }
.cal-flag { position: absolute; top: 2px; right: 3px; font-size: 8px; opacity: 0.75; font-style: normal; }
.cal-flag-comment { top: auto; bottom: 2px; }

/* ===== Stats ===== */

.stats-card { border-top: 3px solid var(--person); display: grid; gap: 14px; align-content: start; }
.stats-list { display: grid; gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.stats-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); padding: 9px 12px; font-size: 13px;
}
.stats-row dt { color: var(--text-dim); }
.stats-row dd { font-weight: 800; }
.stats-row-bad dd { color: var(--bad); }
.stats-row-good dd { color: var(--good); }

.stats-subtitle {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}

.type-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-total {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 11px; text-align: center; display: grid; gap: 2px;
  border-top: 2px solid var(--border);
}
.type-total.type-post { border-top-color: var(--post); }
.type-total.type-story { border-top-color: var(--story); }
.type-total.type-live { border-top-color: var(--live); }
.type-total-value { font-size: 20px; font-weight: 800; }
.type-total-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-muted); }

.missed-block { display: grid; gap: 9px; }
.missed-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.missed-chip {
  font: inherit; font-size: 12px; font-weight: 600;
  background: var(--bad-soft); color: var(--bad);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 99px; padding: 4px 10px; cursor: pointer;
}
.missed-chip:hover { background: rgba(248, 113, 113, 0.22); }

.notice {
  font-size: 13px; color: var(--text-dim);
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 9px 12px;
}
.notice-locked { color: var(--text-muted); }
.notice-good { background: var(--good-soft); color: var(--good); }

/* ===== Day modal ===== */

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 5, 9, 0.75); backdrop-filter: blur(3px); }
.modal-card {
  position: relative;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 20px;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal-head .btn-icon { margin-left: auto; }
.modal-title { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.modal-body { display: grid; gap: 16px; }

.note-editor { display: grid; gap: 9px; justify-items: start; }
.note-input, .comment-input {
  width: 100%; font: inherit; font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  resize: vertical;
}
.note-input:focus, .comment-input:focus { outline: none; border-color: var(--accent); }
.note-readonly { font-size: 13px; color: var(--text-dim); background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 11px; }

.comments { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; }
.comments-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.comment-list { display: grid; gap: 8px; }
.comment {
  background: var(--surface-2);
  border-left: 2px solid var(--person, var(--border-bright));
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment-author { font-size: 12px; font-weight: 800; color: var(--person, var(--text)); }
.comment-head .btn-link { margin-left: auto; }
.comment-text { font-size: 13px; color: var(--text-dim); white-space: pre-wrap; }
.comment-compose { display: flex; gap: 8px; }
.comment-compose .btn { flex-shrink: 0; }

/* ===== Toast ===== */

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 60;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.toast-error { border-color: var(--bad); color: var(--bad); }

/* ===== Narrow screens =====
   The two people stack instead of shrinking: a calendar cell below ~40px stops
   being tappable, which matters because this gets logged from a phone. */

@media (max-width: 780px) {
  .today-grid, .scoreboard, .stats-grid, .calendars { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .tab { flex: 1; }
  .topbar-right { margin-left: auto; }
  .content { padding-left: 14px; padding-right: 14px; }
  .quote-text { font-size: 17px; }
  .month-label { min-width: 0; flex: 1; }
}
