:root {
  /* Signature gradient: #3B82F6 -> #7DD3FC (replaces the old mint accent). */
  --blue: #3B82F6;
  --sky: #7DD3FC;
  --accent: var(--blue);       /* fills, borders, rings */
  --accent-2: var(--sky);      /* text and highlights on dark backgrounds */
  --grad: linear-gradient(135deg, #3B82F6 0%, #7DD3FC 100%);
  --on-accent: #03111f;        /* dark navy text on the gradient, ~5:1+ contrast */
  --accent-soft: rgba(59, 130, 246, 0.14);
  --ring: rgba(125, 211, 252, 0.45);
  --bg: #05070d;
  --ink: #e6f0ff;
  --muted: #94a3b8;
  --panel: rgba(15, 23, 42, 0.78);
  --field: rgba(2, 6, 17, 0.6);
  --line: rgba(125, 211, 252, 0.18);
  --red: #FF4D4D;
  --red-bg: #2a0a0d;
  --radius-panel: 20px;
  --radius-control: 14px;
  --bar-h: 76px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

/* Layered starfield, behind everything. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent 60%),
    radial-gradient(1px 1px at 33% 72%, #cfe, transparent 60%),
    radial-gradient(2px 2px at 58% 28%, #fff, transparent 60%),
    radial-gradient(1px 1px at 81% 61%, #bfe, transparent 60%),
    radial-gradient(1.5px 1.5px at 91% 11%, #fff, transparent 60%),
    radial-gradient(1px 1px at 7% 88%, #fff, transparent 60%),
    radial-gradient(1px 1px at 46% 93%, #cfe, transparent 60%),
    radial-gradient(60% 40% at 85% 8%, rgba(59, 130, 246, 0.2), transparent 70%),
    radial-gradient(70% 50% at 5% 95%, rgba(120, 80, 255, 0.14), transparent 70%),
    radial-gradient(50% 35% at 50% 55%, rgba(0, 150, 255, 0.07), transparent 70%),
    #000;
  background-size: 260px 260px, 340px 340px, 420px 420px, 300px 300px, 520px 520px,
    380px 380px, 460px 460px, auto, auto, auto, auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 4px;
  max-width: 760px;
  margin: 0 auto;
}
/* Gradient text: background is clipped to the glyphs. */
.brand {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-mark { font-size: 1.5rem; }

main, .foot { max-width: 760px; margin: 0 auto; padding: 0 16px; }

h2 { margin: 0 0 12px; font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }

/* One radius and one padding for every panel keeps the page calm and consistent. */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 20px;
  margin: 16px 0;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.panel-waiting {
  background: var(--red-bg);
  border: 2px solid var(--red);
  color: #fff;
}
.panel-waiting h2 { color: #ff8a8a; display: flex; align-items: center; gap: 8px; }
.panel-waiting .icon { font-size: 1.4rem; }

ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.muted { color: var(--muted); margin: 6px 0; }
.note {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--accent-soft);
}

.status {
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid var(--accent);
}
.status.error { background: var(--red-bg); border-color: var(--red); color: #ffd6d6; }

/* Forms */
label { display: block; font-weight: 600; margin: 10px 0 4px; }
.check { display: flex; align-items: center; gap: 10px; }
input[type="text"], input[type="url"], input[type="password"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  min-height: 46px;
}
input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--accent); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--ring);
}
.stack > * + .btn, .stack > .row { margin-top: 14px; }
.stack { display: block; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  min-height: 46px;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  background: var(--accent-soft);
  color: var(--accent-2);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: rgba(59, 130, 246, 0.26); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--grad);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.3);
}
.btn.primary:hover { filter: brightness(1.08); background: var(--grad); }
.btn.ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn.danger { border-color: var(--red); color: #fff; background: #5a1116; }
.btn.small { min-height: 40px; padding: 6px 14px; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  font: inherit;
  min-height: 44px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--grad); color: var(--on-accent); border-color: transparent; font-weight: 700; }

/* Tasks */
.task, .person, .noteitem, .waitingitem {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 17, 0.45);
}
.task { border-radius: var(--radius-control); }
.task.selected { border: 2px solid var(--accent-2); box-shadow: 0 0 0 4px var(--ring); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { display: block; font-weight: 700; margin: 0 0 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 1rem; margin: 0 0 8px; }
.badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--red-bg);
  border: 1px solid var(--red);
  color: #ffb3b3;
  font-weight: 700;
}
.status-pill { color: var(--accent-2); font-weight: 700; }
.select-btn {
  all: unset;
  display: block;
  cursor: pointer;
  width: 100%;
  border-radius: 12px;
}
.select-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.waitingitem {
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid var(--red);
  border-radius: var(--radius-control);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.waitingitem .t { font-weight: 700; }

/* People */
.person { border-radius: var(--radius-control); }
.person h3 { margin: 0; font-size: 1.1rem; color: var(--accent-2); }
.person .role { margin: 0 0 6px; color: var(--muted); }

/* Notes and files */
.noteitem { border-radius: var(--radius-control); }
.noteitem .by { color: var(--muted); font-size: 1rem; margin: 6px 0 0; }
.noteitem p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.filegroup h3 { margin: 14px 0 6px; font-size: 1.05rem; }
.filegroup ul { margin: 0; padding-left: 20px; }
.filegroup li { margin: 6px 0; overflow-wrap: anywhere; }
a { color: var(--accent-2); }

.foot { text-align: center; color: var(--muted); padding: 18px 16px 8px; }

/* Sheets */
.sheet {
  width: min(560px, calc(100vw - 24px));
  margin: auto auto 12px;
  padding: 20px;
  color: var(--ink);
  background: #0b1222;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.7); }
.sheet .btn { width: 100%; }
.sheet .row .btn { width: auto; flex: 1; }

/* Bottom action bar */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(5, 10, 22, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
}
.action-bar .btn { flex: 1; min-height: 52px; padding: 8px 6px; }
