:root {
  --bg: #151515;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --border: #333;
  --text: #e9e9e9;
  --muted: #8c8c8c;
  --in-progress: #fdab3d;
  --open: #579bfc;
  --done: #00c875;
  --critical: #df2f4a;
  --medium: #fdab3d;
  --low: #00c875;
  --completed: #9d50dd;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

/* Sign in */

.signin-card {
  max-width: 340px;
  margin: 18vh auto;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}

.signin-card h1 { margin: 0 0 4px; font-size: 22px; }

.subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.btn-primary {
  display: block;
  margin-top: 20px;
  padding: 10px;
  background: var(--open);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.error { margin-top: 14px; color: var(--critical); font-size: 13px; }

/* Top bar */

/* black-translucent puts the iOS status bar over the page, so the bar needs to
   clear the notch. env() resolves to 0 everywhere else, so this is a no-op on
   desktop and Android. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) 10px calc(18px + env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; }
.brand span { margin-left: 6px; color: var(--muted); font-size: 10px; letter-spacing: .09em; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.whoami { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }

.badge {
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text);
}

.btn-ghost {
  padding: 6px 12px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:hover { background: #2f2f2f; }

/* Page */

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px calc(18px + env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-header h1 { margin: 0 0 2px; font-size: 21px; }

.btn-inline { display: inline-block; margin: 0; padding: 8px 14px; white-space: nowrap; }

/* Status cards */

.status-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}

.status-card[data-status="In Progress"] { border-color: var(--in-progress); }
.status-card[data-status="Open"] { border-color: var(--open); }
.status-card[data-status="Done"] { border-color: var(--done); }

.status-card b { font-size: 15px; }

/* Filters */

/* Flex-wrap, not a grid: equal-width columns clipped the longer labels
   ("All priorities" → "All prioritie"). Letting each control size to its own
   content and wrap keeps every label readable at any width. */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.filters input,
.filters select {
  padding: 7px 9px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
}

.filters input { flex: 1 1 190px; min-width: 160px; }
.filters select { flex: 0 1 auto; }

.showing-count { margin: 10px 2px 0; text-align: right; color: var(--muted); font-size: 12px; }

/* Sections */

.section { margin-top: 22px; border-top: 2px solid var(--border); padding-top: 12px; }
.section[data-status="In Progress"] { border-top-color: var(--in-progress); }
.section[data-status="Open"] { border-top-color: var(--open); }
.section[data-status="Done"] { border-top-color: var(--done); }

.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.section-head h2 { margin: 0; font-size: 15px; }

.count-pill {
  padding: 1px 7px;
  background: var(--surface-2);
  border-radius: 9px;
  font-size: 11px;
  color: var(--muted);
}

/* Task rows */

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid #262626;
}

.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 13.5px; }
.task-meta { margin-top: 3px; color: var(--muted); font-size: 12px; }

.task.is-done .task-title { color: var(--muted); font-weight: 500; }

.priority { font-weight: 600; }
.priority-Critical { color: var(--critical); }
.priority-Medium { color: var(--medium); }
.priority-Low { color: var(--low); }
.completed-tag { color: var(--completed); font-weight: 600; }

.scope-tag {
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
}

.meeting-tag,
.ongoing-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.meeting-tag {
  background: rgba(87, 155, 252, .12);
  border: 1px solid rgba(87, 155, 252, .35);
  color: var(--open);
}

/* Deliberately quieter than a meeting tag — it's a valid origin, not an alert. */
.ongoing-tag {
  background: rgba(253, 171, 61, .1);
  border: 1px solid rgba(253, 171, 61, .3);
  color: var(--in-progress);
}

/* Dialog */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .6);
}

.dialog {
  width: 100%;
  max-width: 380px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.dialog h2 { margin: 0 0 4px; font-size: 17px; }
.dialog-note { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; }

.dialog label { display: block; margin-top: 12px; color: var(--muted); font-size: 12.5px; }

.dialog input,
.dialog select {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13.5px;
}

.dialog > input { margin-top: 0; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-actions button { font-size: 13px; }

.link-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 0;
  background: none;
  color: var(--muted);
  border: 0;
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover { color: var(--text); }

.task select {
  padding: 5px 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
}

.task select:disabled { opacity: .5; cursor: progress; }

.show-older {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.show-older:hover { background: var(--surface-2); }

.empty-state { margin-top: 30px; text-align: center; color: var(--muted); }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}

.toast.is-error { border-color: var(--critical); }

@media (max-width: 680px) {
  .status-cards { grid-template-columns: repeat(3, 1fr); }
  .status-card { flex-direction: column; align-items: flex-start; gap: 2px; }
  .filters select { flex: 1 1 calc(50% - 4px); }
  .task { flex-wrap: wrap; }
}
