:root {
  --bg: #FAF5F0;          /* warm off-white — universal WorkConnect background */
  --text: #1F1A16;
  --muted: #A99E93;
  --faint: #ECE3DA;       /* hairline dividers */
  --accent: #FF4D1C;      /* WorkConnect orange — from the logo */
  --done: #C4BAAF;        /* completed task text */
  --maxw: 620px;
}

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

html { -webkit-text-size-adjust: 100%; }

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

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 28px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand img { height: 18px; width: auto; display: block; }
.brand b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

.nav { display: flex; gap: 20px; margin-left: 4px; }
.nav a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s ease;
}
.nav a.active { color: var(--text); }
.nav a:not(.active):hover { color: var(--text); }

.spacer { margin-left: auto; }
.date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Content ─────────────────────────────────────────────── */
main { max-width: var(--maxw); margin: 0 auto; padding: 20px 28px 80px; }

.preview-note {
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 77, 28, .06);
  border-radius: 8px;
  padding: 9px 13px;
  margin-bottom: 28px;
}

.page-title {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

/* ── Add row ─────────────────────────────────────────────── */
.add {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--faint);
}
.add .plus {
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1.6px solid var(--faint);
  color: var(--muted);
  display: grid; place-items: center;
  font-size: 14px; line-height: 1;
  flex: none;
  transition: border-color .15s ease, color .15s ease;
}
.add:focus-within .plus { border-color: var(--accent); color: var(--accent); }
.add input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15.5px;
  color: var(--text);
}
.add input::placeholder { color: var(--muted); }
.add input:focus { outline: none; }

/* ── Task list ───────────────────────────────────────────── */
.list { list-style: none; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--faint);
}

.dot {
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1.6px solid var(--muted);
  flex: none;
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.dot:hover { border-color: var(--accent); }
.row[data-status="in_progress"] .dot { border-color: var(--accent); }
.row[data-status="in_progress"] .dot::after {
  content: ""; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--accent);
}
.row[data-status="done"] .dot { background: var(--accent); border-color: var(--accent); }
.row[data-status="done"] .dot::after {
  content: ""; position: absolute; left: 6px; top: 2.5px;
  width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.title { flex: 1; font-size: 15.5px; }
.row[data-status="done"] .title { color: var(--done); text-decoration: line-through; }

.status {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: lowercase;
  min-width: 76px;
  text-align: right;
  cursor: pointer;
  user-select: none;
}

.del {
  border: none; background: none;
  color: var(--muted);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease;
}
.row:hover .del { opacity: .7; }
.del:hover { color: var(--accent); opacity: 1; }

.empty { color: var(--muted); font-size: 14.5px; padding: 26px 2px; }

/* ── Users page ──────────────────────────────────────────── */
.page-sub {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: -4px;
  margin-bottom: 22px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--faint);
}
.user-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.user-row[data-approved="1"] .user-status-dot { background: var(--accent); }

.user-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-id { font-size: 15.5px; font-weight: 500; }
.user-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.user-state {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: lowercase;
  min-width: 70px;
  text-align: right;
}
.user-row[data-approved="1"] .user-state { color: var(--accent); }

.user-action {
  border: 1px solid var(--faint);
  background: transparent;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s ease, border-color .15s ease;
}
.user-action:hover { background: var(--faint); }
.user-row[data-approved="1"] .user-action { color: var(--muted); }
.user-action:disabled { opacity: .5; cursor: default; }

/* ── Sign out (top bar) ──────────────────────────────────── */
.logout-form { display: inline; margin-left: 16px; }
.logout {
  border: none; background: none;
  color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 0;
  transition: color .15s ease;
}
.logout:hover { color: var(--accent); }

/* ── Login page ──────────────────────────────────────────── */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: 320px; max-width: 90vw; text-align: center; padding: 8px; }
.login-logo { width: 42px; height: 42px; margin-bottom: 14px; }
.login-logo-full { width: 200px; max-width: 70%; height: auto; margin-bottom: 18px; }
.login-card h1 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-error { color: var(--accent); font-size: 13px; margin-bottom: 12px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card input {
  padding: 11px 14px;
  border: 1px solid var(--faint);
  border-radius: 10px;
  font-size: 14.5px;
  background: #fff;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  padding: 11px;
  border: none; border-radius: 10px;
  background: var(--accent);
  color: #fff; font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  margin-top: 4px;
}

/* TOTP setup screen */
.totp-qr {
  width: 200px; height: 200px;
  margin: 12px auto 14px;
  display: block;
  border-radius: 12px;
}
.totp-key-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.totp-key {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--faint);
  padding: 8px 12px;
  border-radius: 8px;
  letter-spacing: .04em;
  margin-bottom: 18px;
  word-break: break-all;
}

/* ── Dark mode (follows the system setting) ──────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #21201F;        /* requested dark background */
    --text: #F4F1EC;      /* near-white text */
    --muted: #8C847B;     /* readable grey on dark */
    --faint: #353330;     /* hairline dividers */
    --done: #6B635B;      /* dimmed completed text */
    /* --accent stays WorkConnect orange — reads well on dark */
  }
  .login-card input {
    background: #2A2826;
    color: var(--text);
    border-color: var(--faint);
  }
  .preview-note { background: rgba(255, 77, 28, .12); }
}
