:root {
  --paper: #F7F6F3;
  --surface: #FFFFFF;
  --border: #E5E3DD;
  --ink: #1C1D21;
  --ink-soft: #6B6A66;
  --amber: #C7860B;
  --amber-bg: #FBF0DA;
  --green: #2F7A4F;
  --green-bg: #E4F1E8;
  --red: #C4432E;
  --red-bg: #FBE6E1;
  --blue: #3B6EA5;
  --blue-bg: #E5EEF6;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(28,29,33,0.04), 0 8px 24px rgba(28,29,33,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

h1, h2 { font-family: 'Space Grotesk', 'Inter', sans-serif; margin: 0; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- Auth screens ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.auth-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 8px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
}

.auth-sub {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 24px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

input, select, textarea {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}

.auth-form button, .modal-actions .solid-btn {
  margin-top: 4px;
  background: var(--ink);
  color: var(--paper);
  padding: 11px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}

.auth-error {
  color: var(--red);
  font-size: 13px;
  min-height: 16px;
  margin: 0;
}

/* ---------- App shell ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--amber);
  letter-spacing: -2px;
  font-size: 14px;
}
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.who { display: flex; align-items: center; gap: 12px; }
.who-name { font-weight: 600; font-size: 14px; }
.who-role {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  text-transform: uppercase;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border) !important;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.ghost-btn:hover { background: var(--surface); }

.solid-btn {
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.solid-btn:hover { opacity: 0.85; }

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
}

.tabs-spacer { flex: 1; }

.tab {
  background: transparent;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.tab.active { background: var(--ink); color: var(--paper); }
.tab:not(.active):hover { background: var(--surface); }

/* ---------- Task list (the "ledger") ---------- */

.task-list {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: 4px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.tick { align-self: stretch; border-radius: 3px; }
.tick.status-not-started { background: var(--border); }
.tick.status-in-progress { background: var(--blue); }
.tick.status-blocked { background: var(--red); }
.tick.status-in-review { background: var(--amber); }
.tick.status-done { background: var(--green); }

.task-main .task-title { font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.task-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.task-meta .overdue { color: var(--red); font-weight: 500; }
.task-notes { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; }

.priority-pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.priority-low { background: var(--paper); color: var(--ink-soft); }
.priority-medium { background: var(--blue-bg); color: var(--blue); }
.priority-high { background: var(--amber-bg); color: var(--amber); }
.priority-urgent { background: var(--red-bg); color: var(--red); }

.status-select {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 6px 8px;
}

.assignee-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  margin: 60px auto;
}

.admin-only.hidden { display: none !important; }

/* ---------- Modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,29,33,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.hint { font-size: 12px; color: var(--ink-soft); margin: -6px 0 0; }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .topbar, .tabs { padding: 14px; flex-wrap: wrap; }
  .task-row { grid-template-columns: 4px 1fr; }
  .task-row > *:not(.tick):not(.task-main) { grid-column: 2; }
  .row-2 { grid-template-columns: 1fr; }
}
