/* The app's whole stylesheet. Light mode only, the Fjord palette: a deep
   navy sidebar beside a cool blue-white page, a bright blue accent, green
   for Done and amber on the progress tile. Every colour is a variable
   here, so a change of palette touches only :root. */
:root {
  --bg: #f3f6fb;
  --text: #14213d;
  --muted: #5a6785;
  --faint: #97a1b8;
  --surface: #fff;
  --border: #dde4f0;
  --rule: #ebeff6;
  --head: #eef2f9;
  --stripe: #f8fafd;
  --hover: #e8effc;
  --track: #dbe3f0;
  --check: #a9b5cc;

  --accent: #1f4fd1;
  --on-accent: #fff;
  --accent-soft: #e3ebfd;
  --accent-ring: rgb(31 79 209 / 16%);
  --ok: #157a52;
  --ok-soft: #dcf3e8;
  --danger: #c0262d;
  --danger-soft: #f3c6c8;
  --warm: #e09b1a;
  --warm-soft: #fff7e6;
  --warm-border: #f6e2b8;

  --side: #1d2a57;
  --side-text: #c3cbe6;
  --side-strong: #fff;
  --side-muted: #8e99c2;
  --side-hover: #2b3a70;

  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { margin: 0 0 1rem; font-size: 1.4rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The shell: the sidebar beside the content column. */
.shell { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }
.column { min-width: 0; }
main { max-width: 72rem; padding: 1.5rem 2rem 4rem; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0.75rem;
  background: var(--side);
  color: var(--side-text);
}
.sidebar :focus-visible { outline-color: var(--side-strong); }
.brand { margin: 0 0.5rem; color: var(--side-strong); font-weight: 700; font-size: 1rem; text-decoration: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { padding: 0.35rem 0.6rem; border-radius: 6px; color: inherit; text-decoration: none; }
.sidebar nav a:hover { background: var(--side-hover); color: var(--side-strong); }
/* The Australian mode toggle sits at the foot, above the Session block. */
.sidebar-mode { margin: auto 0 0; padding: 0 0.6rem; }
.sidebar-mode button {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--side-hover);
  border-radius: 999px;
  background: none;
  color: var(--side-muted);
  font-size: 12px;
}
.sidebar-mode button:hover { background: var(--side-hover); color: var(--side-strong); }
.sidebar-session {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.6rem;
  align-items: center;
  padding: 0.6rem;
  border-top: 1px solid var(--side-hover);
}
.avatar {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-transform: uppercase;
}
.name { font-size: 12px; overflow-wrap: anywhere; }
.name strong { display: block; color: var(--side-strong); font-size: 14px; font-weight: 600; }
.sidebar-session button { justify-self: start; padding: 0; border: 0; background: none; color: var(--side-muted); }
.sidebar-session button:hover { color: var(--side-strong); }

@media (width < 700px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; }
  .sidebar-mode { margin: 0 0 0 auto; padding: 0; }
  .sidebar-session { padding: 0; border: 0; }
  .name { display: none; }
  .avatar { grid-row: auto; }
  main { padding: 1rem; }
}

/* The stat tiles over the list. */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.tile { padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.tile p { margin: 0; }
.tile-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.tile .tile-value { margin: 0.15rem 0 0.35rem; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-progress { border-color: var(--warm-border); background: var(--warm-soft); }
progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--track); overflow: hidden; appearance: none; }
progress::-webkit-progress-bar { background: var(--track); }
progress::-webkit-progress-value { background: var(--warm); }
progress::-moz-progress-bar { background: var(--warm); }
@media (width < 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* The add form: one input with its button inside the same box. */
.composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.composer input { flex: 1; min-width: 0; padding: 0.4rem 0.5rem; border: 0; background: none; outline: none; }
.composer button { padding: 0 0.9rem; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.error { margin: 0.5rem 0 0; color: var(--danger); }
.empty { color: var(--faint); font-style: italic; }

/* The list. */
#todos {
  width: 100%;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  table-layout: fixed;
}
#todos th {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--head);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#todos td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
#todos tbody tr:last-child td { border-bottom: 0; }
#todos tbody tr:nth-child(even) { background: var(--stripe); }
#todos tbody tr:hover { background: var(--hover); }
#todos form { margin: 0; }
.todo-check { width: 2.75rem; }
.todo-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-id { width: 4rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.todo-status { width: 8rem; }
.todo-actions { width: 6rem; text-align: right; }
@media (width < 900px) { .todo-id, .todo-status { display: none; } }

.check {
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 1.5px solid var(--check);
  border-radius: 4px;
  background: var(--surface);
}
.check:hover { border-color: var(--accent); }
.done .check { border-color: var(--accent); background: var(--accent); }
.done .check::after { content: "✓"; color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 1; }
.done .todo-title { color: var(--faint); text-decoration: line-through; }

.pill { white-space: nowrap; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.done .pill { background: var(--ok-soft); color: var(--ok); }

.delete { padding: 0.2rem 0.55rem; border: 1px solid var(--track); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; }
.delete:hover { border-color: var(--danger-soft); color: var(--danger); }

/* Sign in and Register: a form card. */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 24rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.card label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.card input { margin-bottom: 0.6rem; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.card input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.card button { align-self: start; padding: 0.45rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
[role="alert"]:not(.error) { max-width: 24rem; padding: 0.6rem 0.8rem; border: 1px solid var(--danger-soft); border-radius: 6px; background: #fdf0f0; color: var(--danger); }
