:root {
  --bg: #0d0916;
  --bg-2: #130d20;
  --surface: #1a1229;
  --surface-2: #221837;
  --surface-3: #2b1f45;
  --border: #33265250;
  --border-solid: #332652;
  --text: #ece6f8;
  --muted: #9a8fb5;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-glow: #8b5cf640;
  --danger: #f4577a;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #2a1656 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- controls ---------- */
.btn {
  border: 1px solid var(--border-solid); background: var(--surface-2); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #48357a; }
.btn.primary { background: linear-gradient(180deg, #9367f8, #7c3aed); border-color: #7c3aed; color: #fff; }
.btn.primary:hover { box-shadow: 0 0 0 3px var(--accent-glow); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #f4577a1c; border-color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=password], textarea, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border-solid);
  border-radius: 8px; padding: 8px 11px; outline: none; transition: .12s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { resize: vertical; min-height: 120px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .05em; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.login {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px #0008, 0 0 80px #7c3aed22;
}
.login h1 { margin: 14px 0 4px; font-size: 22px; }
.login p { margin: 0 0 8px; color: var(--muted); }
.login .btn { width: 100%; margin-top: 20px; padding: 10px; }
.err { color: var(--danger); min-height: 18px; margin-top: 12px; font-size: 13px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #a78bfa, #6d28d9);
  display: grid; place-items: center; box-shadow: 0 6px 20px #7c3aed55;
}
.logo svg { width: 20px; height: 20px; }

/* ---------- top bar ---------- */
header {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  border-bottom: 1px solid var(--border-solid); background: #130d20cc; backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
header .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; cursor: pointer; }
header .logo { width: 30px; height: 30px; border-radius: 8px; }
header .logo svg { width: 16px; height: 16px; }
header .spacer { flex: 1; }
header .who { color: var(--muted); font-size: 13px; margin-right: 4px; }
.badge {
  font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: var(--accent-glow);
  color: var(--accent-2); border: 1px solid #8b5cf655; text-transform: uppercase; letter-spacing: .05em; margin-left: 6px;
}
.badge.off { background: #f4577a1f; border-color: #f4577a55; color: var(--danger); }

/* ---------- board ---------- */
#board {
  display: flex; gap: 14px; padding: 20px; align-items: flex-start;
  overflow-x: auto; min-height: calc(100vh - 62px);
}
.col {
  flex: 0 0 290px; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 100px);
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 14px; }
.col-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .count { font-size: 12px; color: var(--muted); background: var(--bg-2); border-radius: 99px; padding: 1px 8px; }
.col-head .btn { padding: 2px 7px; }
.cards { padding: 4px 10px 6px; overflow-y: auto; min-height: 36px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cards.over { background: #8b5cf614; border-radius: 8px; }
.card {
  background: var(--surface-2); border: 1px solid var(--border-solid); border-radius: var(--radius);
  padding: 10px 12px; cursor: grab; transition: border-color .12s, transform .12s, box-shadow .12s;
}
.card:hover { border-color: #5b3fa8; box-shadow: 0 4px 18px #0005; }
.card.dragging { opacity: .35; }
.card .title { font-weight: 550; word-break: break-word; }
.card .desc { color: var(--muted); font-size: 12.5px; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.card .meta { display: flex; gap: 6px; margin-top: 9px; align-items: center; flex-wrap: wrap; }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border-solid); color: var(--muted); }
.pill.high { color: var(--danger); border-color: #f4577a55; background: #f4577a14; }
.pill.medium { color: var(--warn); border-color: #fbbf2444; background: #fbbf2410; }
.pill.low { color: var(--ok); border-color: #4ade8044; background: #4ade8010; }
.pill.who { color: var(--accent-2); border-color: #8b5cf655; background: #8b5cf61a; }
.drop-line { height: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: 0 0 3px; }
.add-card { padding: 6px 10px 10px; }
.add-card .btn { width: 100%; text-align: left; }
.add-card input { margin-bottom: 6px; }
.new-col {
  flex: 0 0 290px; border: 1px dashed #48357a; border-radius: 12px; padding: 10px; background: transparent;
}
.empty { color: var(--muted); text-align: center; padding: 50px 20px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: #05020bb3; backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 20; padding: 20px; overflow-y: auto; }
.modal {
  width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: 14px; padding: 22px; box-shadow: 0 30px 80px #000a, 0 0 60px #7c3aed22; max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal.wide { max-width: 640px; }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal .foot .left { margin-right: auto; }
.secret {
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px;
  word-break: break-all; margin: 8px 0; user-select: all;
}
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0; }
pre.snip { background: var(--bg-2); border: 1px solid var(--border-solid); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0; font-size: 12px; user-select: all; white-space: pre-wrap; word-break: break-all; }

/* ---------- tables / admin ---------- */
.page { max-width: 960px; margin: 0 auto; padding: 26px 20px 60px; }
.page h2 { margin: 0 0 4px; }
.panel { background: var(--surface); border: 1px solid var(--border-solid); border-radius: 12px; padding: 18px; margin-top: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .06em; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--border-solid); vertical-align: middle; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.form-grid { display: grid; grid-template-columns: 1.2fr 1.2fr 130px auto; gap: 10px; align-items: end; }
.form-grid label { margin-top: 0; }

#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--surface-3); border: 1px solid var(--border-solid); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 30px #000a; max-width: 340px; }
.toast.error { border-left-color: var(--danger); }

@media (max-width: 720px) {
  .col { flex-basis: 260px; }
  .form-grid { grid-template-columns: 1fr; }
  header .who { display: none; }
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  td.actions { text-align: left; }
}
a.btn { text-decoration: none; display: inline-block; }

.project-bar { display: flex; align-items: center; gap: 6px; margin-left: 10px; padding-left: 14px; border-left: 1px solid var(--border-solid); }
.project-select { width: auto; min-width: 170px; max-width: 280px; font-weight: 600; padding: 6px 10px; cursor: pointer; }
@media (max-width: 720px) { .project-bar { margin-left: 0; padding-left: 0; border-left: 0; } header { flex-wrap: wrap; } }
