:root {
  /* Core palette (from existing review dashboard) */
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --muted: #8b8d98;
  --accent: #6366f1;
  --green: #22c55e;
  --green-bg: #16291d;
  --red: #ef4444;
  --red-bg: #2d1618;
  --yellow: #eab308;
  --yellow-bg: #2a2510;
  --blue: #60a5fa;
  --blue-bg: #1a2a3d;

  /* Extended */
  --surface-hover: #222638;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --border-active: #6366f1;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  --nav-width: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, nav, .label, .filter-btn {
  font-family: 'Instrument Sans', -apple-system, sans-serif;
}

.mono, .id, .timestamp, code, kbd {
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Navigation ── */

nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.nav-brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.monogram {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 4px;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transition: var(--transition-fast);
}

.nav-links {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition-fast);
}
.nav-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.nav-links a.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}
.nav-links a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-links a kbd {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.5;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* ── Main Content ── */

main {
  margin-left: var(--nav-width);
  min-height: 100vh;
}

.view-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.view-header h1 {
  font-size: 20px;
  font-weight: 600;
}

.view-container {
  padding: 24px 32px;
}

/* View transitions */
.view-enter {
  animation: viewIn var(--transition-normal) ease;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Cards ── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  border-left: 4px solid var(--blue);
  transition: border-color var(--transition-fast),
              background var(--transition-fast),
              transform var(--transition-fast);
  animation: cardIn 300ms ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.card:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}
.card.focused {
  box-shadow: 0 0 0 2px var(--accent-glow);
  border-color: var(--border-active);
}

/* Status border colors */
.card[data-status="new"] { border-left-color: var(--blue); }
.card[data-status="assigned"] { border-left-color: var(--green); }
.card[data-status="discuss"] { border-left-color: var(--yellow); }
.card[data-status="dismissed"] { border-left-color: var(--red); opacity: 0.65; }

/* Action feedback */
.card.just-assigned { animation: pulseGreen 400ms ease; }
.card.just-dismissed { animation: pulseRed 400ms ease; }
.card.just-discuss { animation: pulseYellow 400ms ease; }
@keyframes pulseGreen { 50% { border-left-color: var(--green); box-shadow: 0 0 12px var(--green-bg); } }
@keyframes pulseRed { 50% { border-left-color: var(--red); box-shadow: 0 0 12px var(--red-bg); } }
@keyframes pulseYellow { 50% { border-left-color: var(--yellow); box-shadow: 0 0 12px var(--yellow-bg); } }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.card-author {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.card-author.tag { background: var(--accent); color: #fff; }
.card-author.fiona { background: var(--green); color: #000; }

.card-text {
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.card-timestamp {
  font-size: 11px;
  color: var(--muted);
}

.card-image {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  display: block;
  transition: transform var(--transition-fast);
}
.card-image:hover img {
  transform: scale(1.02);
}

/* ── Badges & Tags ── */

.badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.new { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue); }
.badge.assigned { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.badge.discuss { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }
.badge.dismissed { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.badge.urgent { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }

.tag-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Action Buttons ── */

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.card:hover .card-actions,
.card.focused .card-actions {
  opacity: 1;
}

.btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast);
  font-family: 'Instrument Sans', sans-serif;
}
.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-assign { background: var(--green); color: #000; }
.btn-discuss { background: var(--yellow); color: #000; }
.btn-dismiss { background: var(--red); color: #fff; }
.btn-undo {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-undo:hover { color: var(--text); border-color: var(--text); }

/* ── Filter Bar ── */

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 4px;
}
.filter-group + .filter-group { margin-left: 12px; }

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Capture Form ── */

.capture-container {
  max-width: 640px;
}

.capture-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--surface);
  border-radius: 20px;
  padding: 4px;
  width: fit-content;
}
.capture-tab {
  padding: 8px 20px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Instrument Sans', sans-serif;
}
.capture-tab.active {
  background: var(--accent);
  color: #fff;
}

.capture-form { display: none; }
.capture-form.active { display: block; }

.form-field {
  margin-bottom: 20px;
}
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Instrument Sans', sans-serif;
}

textarea.form-input,
input.form-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  resize: none;
  transition: border-color var(--transition-fast);
}
textarea.form-input:focus,
input.form-input:focus {
  outline: none;
  border-color: var(--accent);
}
textarea.form-input {
  min-height: 140px;
  field-sizing: content;
  max-height: 400px;
}
textarea.form-input::placeholder,
input.form-input::placeholder {
  color: var(--muted);
}

.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-toggle {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tag-toggle.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.priority-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 20px;
  padding: 4px;
  width: fit-content;
}
.priority-opt {
  padding: 5px 16px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.priority-opt.active {
  background: var(--bg);
  color: var(--text);
}
.priority-opt.active.urgent {
  background: var(--red-bg);
  color: var(--red);
}

.btn-submit {
  background: var(--accent);
  color: #fff;
  padding: 10px 28px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Instrument Sans', sans-serif;
}
.btn-submit:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

.submit-hint {
  font-size: 12px;
  color: var(--muted);
  margin-left: 12px;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
  color: var(--text);
}
.drop-zone svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  opacity: 0.6;
}
.drop-zone p {
  font-size: 14px;
}
.drop-zone .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.image-preview {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
  display: none;
}
.image-preview.show { display: block; }
.image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: var(--surface);
  display: block;
}

/* ── Placeholder View ── */

.placeholder {
  text-align: center;
  padding: 80px 20px;
}
.placeholder svg {
  width: 48px;
  height: 48px;
  color: var(--muted);
  opacity: 0.4;
  margin-bottom: 16px;
}
.placeholder h2 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}
.placeholder p {
  font-size: 14px;
  color: var(--muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
}
.empty-state svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  margin-bottom: 12px;
}

/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  animation: toastIn 300ms ease, toastOut 300ms ease 2.5s forwards;
}
.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ── Responsive ── */

@media (max-width: 1023px) {
  nav {
    transform: translateX(-100%);
  }
  nav.open {
    transform: translateX(0);
  }
  .nav-overlay.open {
    display: block;
  }
  main {
    margin-left: 0;
  }
  .hamburger {
    display: flex;
  }
  .view-header {
    padding: 16px 20px;
  }
  .view-container {
    padding: 16px 20px;
  }
  /* Show action buttons always on tablet */
  .card-actions { opacity: 1; }
}

@media (max-width: 767px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .filter-group + .filter-group {
    margin-left: 0;
  }
  .nav-links a kbd {
    display: none;
  }
}

/* Mobile nav trigger — show hamburger in header on mobile */
@media (max-width: 1023px) {
  .view-header::before {
    content: '';
    display: block;
    width: 0;
  }
  .mobile-hamburger {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-direction: column;
    gap: 4px;
    margin-right: 12px;
  }
  .mobile-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--muted);
    border-radius: 1px;
  }
}
@media (min-width: 1024px) {
  .mobile-hamburger { display: none; }
}

/* ── Review Dashboard ── */

/* Progress grid */
.progress-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.progress-card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.progress-card .counts { font-size: 13px; margin: 4px 0; }
.progress-card .counts .g { color: var(--green); }
.progress-card .counts .r { color: var(--red); }
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; display: flex; }
.seg-accepted { background: var(--green); }
.seg-discarded { background: var(--red); }

/* Session controls */
.session-picker { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; min-width: 220px; }
.session-picker option { background: var(--surface); color: var(--text); }
.lock-badge { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 10px; display: none; }
.lock-badge.show { display: inline-block; }
.type-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 10px; }
.type-badge.client { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue); }
.type-badge.core { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.btn-lock { background: var(--accent); color: #fff; border: none; padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; display: none; }
.btn-lock:hover { filter: brightness(1.15); }
.btn-lock.show { display: inline-block; }

/* Card fields */
.card-field { font-size: 13px; color: var(--muted); margin: 4px 0; }
.card-field b { color: var(--text); font-weight: 500; }

/* Accept/discard buttons */
.btn-accept { background: var(--green); color: #000; }
.btn-accept:hover { filter: brightness(1.15); }
.btn-discard { background: var(--red); color: #fff; }
.btn-discard:hover { filter: brightness(1.15); }

/* Note input */
.note-input { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 6px 10px; font-size: 13px; display: none; }
.note-input.show { display: block; }
.note-display { font-size: 12px; color: var(--muted); margin-top: 6px; font-style: italic; }
.btn-note { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 4px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-note:hover { color: var(--text); border-color: var(--text); }

/* Card status variants */
.card.review-accepted { border-left-color: var(--green); background: var(--green-bg); }
.card.review-discarded { border-left-color: var(--red); opacity: .65; background: var(--red-bg); }
.card.review-critical { border-left-color: var(--red); }

/* Status labels */
.status-label { font-size: 12px; font-weight: 600; margin-left: auto; }
.status-label.accepted-l { color: var(--green); }
.status-label.discarded-l { color: var(--red); }

/* Importance badges */
.badge.critical-b { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.badge.important-b { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }

/* Card ID */
.card-id { font-size: 11px; color: var(--accent); font-weight: 600; }
