*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.10);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
  --text: #111;
  --muted: rgba(0,0,0,0.55);
  --accent: #2563eb;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --stale: #fee2e2;
  --stale-border: #fca5a5;
  --radius: 12px;
  --col-active: #dbeafe;
  --col-waiting: #fef9c3;
  --col-followup: #fce7f3;
  --col-closed: #f3f4f6;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Login overlay ── */
#login-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#login-overlay.visible { display: flex; }
.login-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 48px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
  min-width: 320px;
}
.login-box h1 { font-size: 22px; margin-bottom: 8px; }
.login-box p { color: var(--muted); margin-bottom: 28px; font-size: 13px; }
.login-box input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; margin-bottom: 12px;
}
.login-box button {
  width: 100%; padding: 10px; background: var(--accent);
  color: #fff; border: none; border-radius: 8px; font-size: 15px;
  font-weight: 600; cursor: pointer;
}
.login-box .error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
}
header h1 { font-size: 18px; font-weight: 700; flex: 1; }
.header-meta { font-size: 12px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--bg); box-shadow: var(--shadow); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* ── Board ── */
#board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 24px;
  min-height: calc(100vh - 60px);
  align-items: start;
}
@media (max-width: 900px) {
  #board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  #board { grid-template-columns: 1fr; }
}

.column {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.column-header {
  padding: 12px 16px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: space-between;
}
.col-active .column-header { background: var(--col-active); }
.col-waiting .column-header { background: var(--col-waiting); }
.col-followup .column-header { background: var(--col-followup); }
.col-closed .column-header { background: var(--col-closed); }

.col-count {
  background: rgba(0,0,0,0.12); border-radius: 12px;
  padding: 1px 8px; font-size: 11px;
}

.column-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.card.stale {
  background: var(--stale);
  border-color: var(--stale-border);
}
.card-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.card-company { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.card-role { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 20px;
  font-weight: 500; border: 1px solid var(--border);
}
.badge-stale { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.badge-days { background: var(--bg); color: var(--muted); }
.card-next { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ── Screenshot panel ── */
#screenshot-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: none;
}
#screenshot-panel.visible { display: block; }
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
}
.drop-zone.dragover { border-color: var(--accent); background: #eff6ff; }

/* ── Edit drawer ── */
#edit-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.3); z-index: 500;
  align-items: flex-start; justify-content: flex-end;
}
#edit-overlay.visible { display: flex; }
#edit-drawer {
  background: var(--surface);
  width: 420px; max-width: 95vw;
  height: 100vh; overflow-y: auto;
  padding: 24px;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  display: flex; flex-direction: column; gap: 16px;
}
#edit-drawer h2 { font-size: 18px; margin-bottom: 4px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-row input, .form-row select, .form-row textarea {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: var(--bg);
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  background: #111; color: #fff; border-radius: 10px;
  padding: 12px 20px; font-size: 13px;
  opacity: 0; transform: translateY(8px);
  transition: all 0.25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ── Spinner ── */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
