/* Mission Control - dark theme, mobile-friendly. Vanilla CSS. */
:root {
  --bg: #0e131a;
  --panel: #161d27;
  --panel2: #1c2431;
  --line: #2a3546;
  --text: #e8edf3;
  --muted: #8b98a9;
  --accent: #4da3ff;
  --accent-dim: #2b6cb0;
  --danger: #e5534b;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; }
.brand .back { margin-right: 8px; }
.topbar nav a { margin-left: 16px; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.wrap.narrow { max-width: 520px; }
h2 { margin: 28px 0 12px; font-size: 20px; }
h3 { margin: 20px 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
code { background: var(--panel2); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; color: var(--text);
}
a.card:hover { text-decoration: none; border-color: var(--accent-dim); }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 6px 0; }
.card.ops { margin-bottom: 8px; border-left: 4px solid var(--accent); }
.card.empty { border-style: dashed; }
.open { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 600; }

.counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.count { background: var(--panel2); border: 1px solid var(--line); border-radius: 20px;
  padding: 3px 10px; font-size: 13px; color: var(--muted); }
.count b { color: var(--text); }
.count.done b { color: #7ee2a8; }
.count.waiting b { color: #ffcf6b; }
.count.inprogress b { color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
}
.row .muted { font-size: 14px; margin-top: 2px; }
.pill { flex: none; font-size: 12px; padding: 2px 10px; border-radius: 12px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.pill.on { color: #7ee2a8; border-color: #2c5f43; }
.pill.off { color: var(--muted); }
.snapline { margin: -4px 0 12px; font-size: 14px; }

/* Kanban board */
.board-wrap { max-width: 1400px; }
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 20px; align-items: flex-start; }
.col { flex: 1 0 260px; min-width: 260px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.col-head { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line); }
.col-head h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.addbtn { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; width: 28px; height: 28px; font-size: 18px; line-height: 1; cursor: pointer; }
.addbtn:hover { border-color: var(--accent); }
.col-body { padding: 10px; overflow-y: auto; min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.col-body.dragover { background: var(--panel2); outline: 2px dashed var(--accent-dim); outline-offset: -2px; }
.kcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; cursor: grab; }
.kcard:hover { border-color: var(--accent-dim); }
.kcard.dragging { opacity: 0.4; }
.ktitle { font-weight: 600; font-size: 14px; }
.knote { font-size: 13px; color: var(--muted); margin-top: 4px; }
.klinks { font-size: 12px; color: var(--accent); margin-top: 4px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.sheet h3 { margin-top: 0; }
.sheet label { display: block; margin: 12px 0; font-size: 14px; }
.sheet input, .sheet textarea, .sheet select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text);
  font: inherit; font-size: 15px;
}
.sheet textarea { resize: vertical; }
.m-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.m-actions .sp { flex: 1; }
button { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 9px 16px; font: inherit; font-size: 15px; cursor: pointer; }
button:hover { border-color: var(--accent-dim); }
button.primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; font-weight: 600; }
button.ask { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; font-weight: 600; }
button.ask:hover { border-color: var(--accent); }
button.hand { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; font-weight: 600; }
button.hand:hover { border-color: var(--accent); }
button.hand:disabled { opacity: .55; cursor: default; }
.hand-status {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--radius);
  background: rgba(77,163,255,0.12); border: 1px solid var(--accent-dim);
  color: var(--text); font-size: 14px; text-align: center;
}
.hand-status[hidden] { display: none; }
.ask-confirm {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--radius);
  background: rgba(77,163,255,0.12); border: 1px solid var(--accent-dim);
  color: var(--text); font-size: 14px; text-align: center;
}
.ask-confirm[hidden] { display: none; }
button.danger { color: var(--danger); border-color: #5a2b28; }
.err { color: var(--danger); background: rgba(229,83,75,0.1); border: 1px solid #5a2b28;
  border-radius: 6px; padding: 8px 12px; }

.auth h2 { margin-top: 0; }
.auth form label { display: block; margin: 12px 0; }
.auth input { display: block; width: 100%; margin-top: 4px; padding: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); font: inherit; }

@media (max-width: 640px) {
  .wrap { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .col { flex-basis: 78vw; min-width: 78vw; }
  .row { flex-direction: column; }
  .pill { align-self: flex-start; }
}
