:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #f59e0b;
  --accent-deep: #d97706;
  --blue: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --slate: #475569;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* The `hidden` attribute must beat the explicit display rules below
   (.modal/.login-view/.app-view), otherwise hidden views still render. */
[hidden] { display: none !important; }
body { margin: 0; background: #f1f5f9; color: var(--ink); }

/* ---------- Login ---------- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 70% -10%, #1e293b, #0f172a);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; box-shadow: 0 6px 16px rgba(217,119,6,.4);
}
.brand.small { gap: 8px; }
.brand.small .brand-mark { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--slate); }
input, select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }

button { cursor: pointer; font: inherit; border: none; border-radius: 9px; }
button.primary, #login-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-weight: 700; padding: 11px 16px;
}
button.primary:hover, #login-btn:hover { filter: brightness(1.05); }
button.ghost { background: #eef2f7; color: var(--slate); font-weight: 600; padding: 11px 16px; }
.hint { color: var(--muted); font-size: 12px; margin: 2px 0 0; text-align: center; }
.error { color: var(--red); font-size: 13px; margin: 0; }

/* ---------- App ---------- */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--bg); color: #fff;
  position: sticky; top: 0; z-index: 5;
}
.topbar strong { letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.stat { text-align: right; line-height: 1.1; }
.stat span { font-weight: 800; font-size: 16px; }
.stat label { display: block; color: #94a3b8; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: #ffffff14; padding: 6px 8px 6px 12px; border-radius: 999px;
}
.user-chip span { font-weight: 600; font-size: 13px; }
.user-chip small { color: #fbbf24; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.user-chip button { background: #ffffff22; color: #fff; width: 28px; height: 28px; border-radius: 50%; }

/* ---------- Board ---------- */
.board {
  flex: 1; display: flex; gap: 14px; padding: 18px;
  overflow-x: auto; align-items: flex-start;
}
.column {
  flex: 0 0 260px; background: #e9eef5; border-radius: 14px;
  padding: 10px; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 120px);
}
.column-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px; font-weight: 700; font-size: 13px;
}
.column-head .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.column-head .count {
  background: #cbd5e1; color: var(--slate); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 700;
}
.cards { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; padding: 2px; }
.card {
  background: var(--card); border-radius: 11px; padding: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 1px 3px rgba(15,23,42,.06);
  border-left: 3px solid var(--slate);
}
.card h4 { margin: 0 0 6px; font-size: 14px; letter-spacing: -.01em; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: var(--slate); font-weight: 600; }
.card .comm { font-weight: 800; font-size: 13px; color: var(--green); }
.card .comm.zero { color: var(--muted); }
.card .owner { color: var(--muted); font-size: 11px; margin-top: 6px; }
.card select {
  margin-top: 9px; width: 100%; font-size: 12px; padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--line); color: var(--slate); background: #f8fafc;
}
.empty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 6px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 16px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

@media (max-width: 640px) {
  .stat { display: none; }
  .column { flex-basis: 82vw; }
}
