:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1115;
  color: #e6e6e6;
}
a { color: inherit; }

/* ---- Auth screen ---- */
.auth-wrap { max-width: 400px; margin: 10vh auto 0; padding: 0 20px; }
.auth-wrap h1 { font-size: 24px; margin-bottom: 4px; }
.auth-wrap .sub { color: #9aa0a6; margin-bottom: 24px; font-size: 14px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: #171a21; border-radius: 8px; padding: 4px; }
.tabs button {
  flex: 1; background: transparent; border: none; color: #9aa0a6;
  padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.tabs button.active { background: #262b35; color: #e6e6e6; }

/* ---- Shell layout ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: #12141a; border-right: 1px solid #1f232c;
  padding: 20px 14px; display: flex; flex-direction: column;
}
.sidebar .brand { font-weight: 700; font-size: 16px; padding: 0 8px 20px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav button {
  text-align: left; background: transparent; border: none; color: #9aa0a6;
  padding: 10px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.sidebar nav button.active { background: #1c2030; color: #e6e6e6; }
.sidebar nav button:hover { background: #171a21; }
.sidebar .whoami { font-size: 12px; color: #6b7280; padding: 0 8px 8px; }
.sidebar .signout {
  background: transparent; border: 1px solid #262b35; color: #9aa0a6;
  padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.main { flex: 1; padding: 28px 32px; max-width: 1040px; }
.main h1 { font-size: 20px; margin: 0 0 20px; }

/* ---- Cards / stats ---- */
.stat-row { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  background: #171a21; border: 1px solid #262b35; border-radius: 10px;
  padding: 16px 20px; min-width: 120px; flex: 1;
}
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .label { font-size: 12px; color: #9aa0a6; margin-top: 2px; }

.card { background: #171a21; border: 1px solid #262b35; border-radius: 10px; padding: 18px; }

/* ---- Forms ---- */
label { display: block; font-size: 13px; color: #9aa0a6; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: #0f1115; border: 1px solid #2a2f3a;
  border-radius: 8px; color: #e6e6e6; font-size: 14px; margin-bottom: 14px; font-family: inherit;
}
textarea { resize: vertical; min-height: 70px; }
button.primary {
  background: #5865f2; color: white; border: none; border-radius: 8px;
  padding: 10px 16px; font-size: 14px; cursor: pointer;
}
button.primary:hover { background: #4752c4; }
button.ghost {
  background: transparent; color: #9aa0a6; border: 1px solid #2a2f3a; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}
button.danger { background: #2a2f3a; color: #f04747; border: none; border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
button.danger:hover { background: #3a2a2a; }
button:disabled { opacity: 0.5; cursor: default; }
.error { color: #f04747; font-size: 13px; margin-bottom: 12px; }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #262b35; vertical-align: middle; }
th { color: #9aa0a6; font-weight: 500; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #262b35; color: #9aa0a6; display: inline-block; }
.pill.admin { background: #3a3350; color: #a78bfa; }
.pill.high { background: #3a2222; color: #f87171; }
.pill.medium { background: #3a3122; color: #fbbf24; }
.pill.low { background: #22303a; color: #9aa0a6; }
.pill.done { background: #1f3a2a; color: #4ade80; }
.pill.doing { background: #22303a; color: #60a5fa; }
.pill.todo { background: #262b35; color: #9aa0a6; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar .filters { display: flex; gap: 8px; }
.toolbar select { margin-bottom: 0; width: auto; }

.hidden { display: none; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #171a21; border: 1px solid #262b35; border-radius: 12px;
  padding: 24px; width: 420px; max-width: calc(100vw - 32px); max-height: 85vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }

.task-title-cell { display: flex; align-items: center; gap: 10px; }
.task-title-cell input[type="checkbox"] { margin: 0; width: auto; }
.task-title-cell .title.done { text-decoration: line-through; color: #6b7280; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 14px; }
  .sidebar nav { flex-direction: row; }
  .sidebar .whoami, .sidebar .brand { display: none; }
  .main { padding: 18px; }
  table { font-size: 13px; }
}
