:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1c2029;
  --ink: #e7ebf2;
  --ink-dim: #9aa3b2;
  --accent: #ffcf4a;
  --good: #58d68d;
  --warn: #ff6a6a;
  --soft: #334155;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2030 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:hover { opacity: .85; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
}
.brand {
  font-weight: 700;
  letter-spacing: .3px;
  text-decoration: none;
  color: var(--accent);
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.user img, .avatar-blank {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--soft); object-fit: cover;
}
.muted { color: var(--ink-dim); }
.muted:hover { color: var(--ink); }
.tiny { font-size: 12px; }

main {
  max-width: 760px;
  margin: 40px auto 80px;
  padding: 0 24px;
}

.hero h1 {
  font-size: 44px;
  margin: 10px 0 4px;
  letter-spacing: -0.5px;
}
.hero.newtab h1 {
  font-size: 56px;
  font-weight: 700;
}
.hero.newtab .date {
  font-size: 14px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.group {
  margin-top: 36px;
}
.group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 12px;
}
.group h2 .count {
  margin-left: auto;
  font-weight: 400;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--soft);
}
.dot.overdue { background: var(--warn); }
.dot.today   { background: var(--accent); }
.dot.upcoming{ background: #6aa7ff; }
.dot.nodate  { background: #6b7280; }

.items { list-style: none; padding: 0; margin: 0; }
.item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--panel);
  border: 1px solid #222631;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: background .12s;
}
.item:hover { background: var(--panel-2); }
.item .body { flex: 1; min-width: 0; }
.title {
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.summary {
  margin-top: 4px;
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.4;
}
.meta {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-dim);
}
.due {
  color: var(--accent);
}
.overdue .due { color: var(--warn); }
.src {
  padding: 2px 7px;
  background: #222631;
  border-radius: 10px;
  text-transform: lowercase;
}

.check-form, .snooze-form { margin: 0; }
.check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--soft);
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.check:hover { border-color: var(--good); color: var(--good); }
.mini {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.mini:hover { background: #222631; color: var(--ink); }

.empty {
  text-align: center;
  padding: 36px 0;
  color: var(--ink-dim);
}
.empty p { margin: 8px 0; }

/* ── Login ─────────────────────────────────────────────── */
.login-card {
  max-width: 440px;
  margin: 8vh auto;
  padding: 36px 32px;
  background: var(--panel);
  border: 1px solid #222631;
  border-radius: 20px;
  text-align: center;
}
.login-card h1 {
  font-size: 32px;
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}
.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #262a35;
  cursor: pointer;
}
.btn:hover { background: #222631; }
.btn.slack { background: #4a154b; border-color: #4a154b; color: white; }
.btn.google { background: white; color: #202124; border-color: white; }
.btn.disabled {
  opacity: .5;
  cursor: not-allowed;
  background: var(--panel-2);
}
.icon {
  display: inline-block;
  width: 20px; height: 20px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  text-align: center;
  line-height: 20px;
  font-size: 12px;
  font-weight: 700;
}
.btn.google .icon {
  background: #4285f4; color: white;
}
.error {
  background: #3a1d1d;
  color: #ffb4b4;
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 12px;
  font-size: 14px;
}

.foot {
  max-width: 760px;
  margin: 0 auto 40px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.prose {
  line-height: 1.6;
}
.prose h1 { font-size: 32px; margin-bottom: 8px; letter-spacing: -0.3px; }
.prose h3 { margin-top: 24px; }
.prose code {
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
}
.prose ol { padding-left: 20px; }
.prose li { margin: 6px 0; }

/* New-tab mode: tighter top padding, bigger hero */
body.newtab main { margin-top: 24px; }
body.newtab .top { padding: 14px 24px; }

/* ── Floating add button (FAB) ─────────────────────────── */
.fab-wrap {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 50;
}
.fab { position: relative; }
.fab summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #1b1200;
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.fab summary::-webkit-details-marker { display: none; }
.fab summary:hover { transform: translateY(-2px) scale(1.04); }
.fab[open] summary {
  transform: rotate(45deg);
  background: var(--panel-2);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.fab-form {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 48px));
  background: var(--panel);
  border: 1px solid #2a2f3b;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  animation: fab-pop .14s ease-out;
}
@keyframes fab-pop {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.fab-form-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}
.fab-form textarea {
  width: 100%;
  min-height: 72px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #262a35;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}
.fab-form textarea:focus { border-color: var(--accent); }
.fab-form textarea::placeholder { color: var(--ink-dim); }
.add-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.btn-primary {
  background: var(--accent);
  color: #1b1200;
  border: 0;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.add-flash {
  margin: 12px 0 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1f2a1f;
  color: #a8e6a8;
  font-size: 14px;
  border: 1px solid #294229;
}
.add-flash.error { background: #2a1f1f; color: #ffb4b4; border-color: #422929; }

@media (max-width: 480px) {
  .fab-wrap { right: 16px; bottom: 16px; }
  .fab summary { width: 52px; height: 52px; font-size: 28px; }
}

/* ── Tabs (Mine / Waiting on others) ──────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin: 24px 0 8px;
  border-bottom: 1px solid #222631;
}
.tabs a {
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink-dim);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tabs .tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: #222631;
  color: var(--ink-dim);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.tabs a.active .tab-count { background: var(--accent); color: #1b1200; }

/* ── Owner badge on waiting-on items ──────────────────── */
.owner {
  padding: 2px 7px;
  background: #1f2435;
  color: #a7b5e0;
  border-radius: 10px;
  font-size: 12px;
}
.owner b { color: var(--ink); font-weight: 600; }
.check.ghost {
  display: inline-block;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px dashed #2f3542;
  color: #3f4556;
  text-align: center;
  line-height: 20px;
  cursor: not-allowed;
  user-select: none;
}

/* ── Reschedule modal ─────────────────────────────────── */
.modal-root[hidden] { display: none; }
.modal-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid #2a2f3b;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: fab-pop .14s ease-out;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.modal-close {
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-title {
  color: var(--ink-dim);
  font-size: 14px;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.field input[type=date] {
  width: 100%;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #262a35;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  color-scheme: dark;
}
.field input[type=date]:focus { border-color: var(--accent); outline: none; }
.notify {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-dim);
  cursor: pointer;
  margin-bottom: 14px;
}
.notify[hidden] { display: none; }
.modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.modal-actions .mini:last-child { margin-left: auto; }
.mini.danger { color: #ff8585; }
.mini.danger:hover { background: #3a1d1d; color: #ffb4b4; }
.edit-date-trigger { font-weight: 500; }
