/* ── Design tokens ─────────────────────────────────────── */
:root {
  --bg:          #0f1117;
  --surface:     #181c27;
  --surface-2:   #1e2333;
  --surface-3:   #252a3a;
  --line:        rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.13);
  --text:        #e8eaf2;
  --text-2:      #8b92a8;
  --text-3:      #596070;
  --accent:      #5b8dee;
  --accent-2:    #3d6ed6;
  --accent-glow: rgba(91,141,238,0.18);
  --green:       #34c97d;
  --green-bg:    rgba(52,201,125,0.12);
  --amber:       #f5a623;
  --amber-bg:    rgba(245,166,35,0.12);
  --red:         #e05c5c;
  --red-bg:      rgba(224,92,92,0.12);
  --blue:        #5b8dee;
  --blue-bg:     rgba(91,141,238,0.12);
  --purple:      #a78bfa;
  --purple-bg:   rgba(167,139,250,0.12);
  --radius:      14px;
  --radius-lg:   20px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.6);
  --sidebar-w:   220px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Auth screen ────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(91,141,238,0.08), transparent),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(167,139,250,0.06), transparent),
    var(--bg);
}

.auth-wrap {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.auth-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  color: var(--text);
}

.auth-sub {
  color: var(--text-2);
  margin: 0 0 36px;
  font-size: 16px;
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.role-card {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: left;
  transition: border-color 180ms, box-shadow 180ms, transform 150ms;
  position: relative;
  overflow: hidden;
}

.role-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-glow);
  opacity: 0;
  transition: opacity 200ms;
  border-radius: inherit;
}

.role-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
  transform: translateY(-2px);
}

.role-card:hover::before { opacity: 1; }

.role-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-icon { background: var(--amber-bg); color: var(--amber); }
.dev-icon   { background: var(--blue-bg);  color: var(--blue);  }

.role-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.role-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.role-arrow {
  position: absolute;
  top: 24px;
  right: 20px;
  font-size: 18px;
  color: var(--text-3);
  transition: color 180ms, transform 180ms;
}

.role-card:hover .role-arrow { color: var(--accent); transform: translateX(3px); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 200ms ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.modal h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
}

.modal-sub {
  color: var(--text-2);
  margin: 0 0 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

/* ── App layout ─────────────────────────────────────────── */
#app-screen { height: 100vh; }

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 16px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms, color 150ms;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-info {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}

.session-role {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.session-stats {
  display: flex;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
}

.btn-logout {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-3);
  font-size: 13px;
  transition: background 150ms, color 150ms;
}

.btn-logout:hover { background: var(--red-bg); color: var(--red); }

/* ── Main area ──────────────────────────────────────────── */
.main-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background:
    radial-gradient(ellipse 40% 30% at 80% 10%, rgba(91,141,238,0.05), transparent),
    var(--bg);
}

.view { display: flex; flex-direction: column; gap: 20px; }
.view[hidden] { display: none; }

.view-head h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-head p { margin: 0; color: var(--text-2); }

/* ── Integration bar ────────────────────────────────────── */
.integration-bar {
  padding: 10px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12.5px;
}

.integration-bar[hidden] { display: none; }

/* ── Flash ──────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(52,201,125,0.2);
}

.flash[hidden]  { display: none; }
.flash.error    { background: var(--red-bg); color: var(--red); border-color: rgba(224,92,92,0.2); }
.flash.warning  { background: var(--amber-bg); color: var(--amber); border-color: rgba(245,166,35,0.2); }

/* ── Forms & inputs ─────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 14px; }

label { display: flex; flex-direction: column; gap: 6px; }
label span { font-size: 12.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }

input, textarea, select {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select option { background: var(--surface-2); }

textarea { resize: vertical; }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--accent);
}

.checkbox-row { flex-direction: row; align-items: center; gap: 10px; }
.checkbox-row span { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-2); }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }

.choice-pill { cursor: pointer; }
.choice-pill input { display: none; }
.choice-pill span {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: all 150ms;
  cursor: pointer;
}
.choice-pill input:checked + span { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────── */
button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: all 160ms;
}

button[type="submit"],
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(91,141,238,0.3);
  width: 100%;
  padding: 12px;
}

button[type="submit"]:hover,
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }

.btn-ghost {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  flex: 1;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ── Panels ─────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel-head { margin-bottom: 20px; }
.panel-head h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
.panel-head p { margin: 0; color: var(--text-2); font-size: 13px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.two-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Board ──────────────────────────────────────────────── */
.board { display: flex; flex-direction: column; gap: 24px; }

.project-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.project-header-left h3 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
}

.project-header-left .meta {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta a {
  color: var(--accent);
  text-decoration: none;
}

.meta a:hover { text-decoration: underline; }

.project-header-right { display: flex; align-items: center; gap: 8px; }

.count-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
}

/* Kanban columns */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 16px;
  gap: 12px;
}

.kanban-col {}

.col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.col-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.col-dot.todo        { background: var(--text-3); }
.col-dot.in_progress { background: var(--amber); }
.col-dot.pr_open     { background: var(--blue); }
.col-dot.merged      { background: var(--green); }

.col-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.empty-col {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 12px;
}

/* ── Task cards ─────────────────────────────────────────── */
.task-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 150ms;
}

.task-card:hover { border-color: var(--line-strong); }

.task-key {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

.task-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.task-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}

.task-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-meta-row {
  font-size: 11.5px;
  color: var(--text-3);
}

.task-meta-row a {
  color: var(--accent);
  text-decoration: none;
}

.task-meta-row a:hover { text-decoration: underline; }

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.btn-action {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 150ms;
  text-align: center;
  border: 1px solid transparent;
}

.btn-start   { background: var(--amber-bg); color: var(--amber); border-color: rgba(245,166,35,0.2); }
.btn-start:hover   { background: rgba(245,166,35,0.2); }

.btn-pr      { background: var(--blue-bg); color: var(--blue); border-color: rgba(91,141,238,0.2); }
.btn-pr:hover      { background: rgba(91,141,238,0.2); }

.btn-deploy  { background: var(--surface-3); color: var(--text-2); border-color: var(--line-strong); }
.btn-deploy:hover  { background: var(--surface-2); color: var(--text); }

.btn-review  { background: var(--purple-bg); color: var(--purple); border-color: rgba(167,139,250,0.2); }
.btn-review:hover  { background: rgba(167,139,250,0.2); }

.btn-merge   { background: var(--green-bg); color: var(--green); border-color: rgba(52,201,125,0.2); }
.btn-merge:hover   { background: rgba(52,201,125,0.2); }

/* status badges (for task) */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  align-self: flex-start;
}

.status-badge.todo        { background: rgba(89,96,112,0.2); color: var(--text-3); }
.status-badge.in_progress { background: var(--amber-bg); color: var(--amber); }
.status-badge.pr_open     { background: var(--blue-bg);  color: var(--blue); }
.status-badge.merged      { background: var(--green-bg); color: var(--green); }

/* ── Review console ─────────────────────────────────────── */
.review-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 200px;
  text-align: center;
}

.review-placeholder p { margin: 0; font-size: 14px; }

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.review-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.review-block h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
.review-block h4 { margin: 0 0 14px; font-size: 14px; color: var(--text-2); }

.review-block p   { margin: 0 0 8px; font-size: 13.5px; color: var(--text); }
.review-block .meta { font-size: 12.5px; color: var(--text-2); margin: 0 0 6px; }

.review-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.review-actions button {
  flex: 1;
  min-width: 100px;
  padding: 9px 16px;
  border-radius: 10px;
}

.btn-approve { background: var(--green-bg); color: var(--green); }
.btn-approve:hover { background: rgba(52,201,125,0.2); }
.btn-changes { background: var(--amber-bg); color: var(--amber); }
.btn-changes:hover { background: rgba(245,166,35,0.2); }
.btn-merge-review { background: var(--accent-glow); color: var(--accent); }
.btn-merge-review:hover { background: rgba(91,141,238,0.25); }

.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.file-row .filename { color: var(--text); font-family: "SF Mono", "Fira Code", monospace; }
.file-row .stats { white-space: nowrap; color: var(--text-3); }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px;
  color: var(--text-3);
  text-align: center;
  font-size: 14px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .role-grid   { grid-template-columns: 1fr; }
  .kanban      { grid-template-columns: 1fr 1fr; }
  .two-col     { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .sidebar     { width: 60px; padding: 16px 10px; }
  .sidebar-brand span,
  .nav-item span,
  .session-info,
  .btn-logout span { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .btn-logout { justify-content: center; }
  .main-area { padding: 20px 16px; }
}

@media (max-width: 600px) {
  .kanban { grid-template-columns: 1fr; }
  .two-field { grid-template-columns: 1fr; }
}
