:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e7eaef;
  --border-strong: #d8dde5;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --accent-hover: #4f46e5;
  --green: #10b981;
  --green-soft: #d1fae5;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --grey-soft: #f3f4f6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a { color: inherit; text-decoration: none; }

/* ============ Topbar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
}
.logo-text { font-weight: 600; font-size: 15px; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-item {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--grey-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, transform 0.05s;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }

.author-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}
.author-pill:hover { border-color: var(--accent); color: var(--accent); }
.author-pill img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ============ Page ============ */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 24px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-sub { margin: 0; color: var(--text-muted); font-size: 14px; }

.stats {
  display: flex;
  gap: 8px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 100px;
  box-shadow: var(--shadow-sm);
}
.stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.stat-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============ Board ============ */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.col {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 320px;
}

.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-grey { background: var(--text-soft); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--green); }

.col-count {
  margin-left: auto;
  background: var(--grey-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

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

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.task-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.task-card .tc-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  font-weight: 600;
}
.task-card .tc-title {
  font-weight: 600;
  font-size: 14px;
  margin: 4px 0 8px;
  line-height: 1.3;
}
.task-card .tc-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill-format { background: var(--accent-soft); color: var(--accent); text-transform: lowercase; }
.pill-score { background: var(--grey-soft); color: var(--text-muted); }
.pill-score.s-low { background: var(--red-soft); color: var(--red); }
.pill-score.s-mid { background: var(--amber-soft); color: #b45309; }
.pill-score.s-high { background: var(--green-soft); color: #047857; }

.tc-progress {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.tc-bar {
  height: 4px;
  background: var(--grey-soft);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.tc-bar-fill {
  height: 100%;
  background: var(--amber);
  transition: width 0.3s;
}

.col-empty {
  font-size: 12px;
  color: var(--text-soft);
  padding: 20px 0;
  text-align: center;
}

/* ============ Bottom row ============ */
.bottom-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}

.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-soft.wide { min-height: 240px; }

.card-head {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.ghost {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.ghost:hover { background: var(--grey-soft); color: var(--text); }

#last-audits .audit-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
#last-audits .audit-row:last-child { border-bottom: none; }
#last-audits .a-tag {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
}
#last-audits .a-text {
  color: var(--text-muted);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.donut-legend {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.donut-legend .item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.donut-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ============ Brief grid (list) ============ */
.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.bg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bg-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.bg-card .bg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.bg-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.bg-card .bg-meta { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

.bg-card .bg-progress { display: flex; gap: 8px; align-items: center; }
.bg-card .bg-track {
  flex: 1;
  height: 6px;
  background: var(--grey-soft);
  border-radius: 3px;
  overflow: hidden;
}
.bg-card .bg-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #8b5cf6 100%);
  transition: width 0.3s;
}
.bg-card .bg-pct { font-size: 11px; color: var(--text-muted); min-width: 36px; text-align: right; }

.bg-card .bg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bg-card .bg-stats > div {
  background: var(--grey-soft);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}
.bg-card .bg-stats strong { display: block; font-size: 16px; font-weight: 700; }
.bg-card .bg-stats span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ============ Brief detail (agents) ============ */
.bd-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.bd-head h2 { margin: 0 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.bd-head .ghost { margin-left: 0; }

/* ============ Pipeline layout (rows by task) ============ */
.bd-layout { display: flex; flex-direction: column; gap: 12px; }

.analyst-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.analyst-block:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.analyst-block .ab-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.analyst-block .ab-content { flex: 1; }
.analyst-block .ab-name { font-weight: 600; font-size: 14px; }
.analyst-block .ab-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.analyst-block .ab-btn {
  margin-left: 0;
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.pipeline-list { display: flex; flex-direction: column; gap: 8px; }

.pipeline-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) 4fr;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.pr-task {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pr-id {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--grey-soft);
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pr-info { min-width: 0; flex: 1; }
.pr-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.pr-head {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pr-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pr-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--grey-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  min-width: 0;
}
.pr-step:hover:not(.disabled) { border-color: var(--accent); background: var(--accent-soft); }
.pr-step:active:not(.disabled) { transform: translateY(1px); }
.pr-step.disabled { cursor: default; opacity: 0.6; }
.pr-step.s-low { border-color: rgba(239, 68, 68, 0.3); background: var(--red-soft); }
.pr-step.s-mid { border-color: rgba(245, 158, 11, 0.3); background: var(--amber-soft); }
.pr-step.s-high { border-color: rgba(16, 185, 129, 0.3); background: var(--green-soft); }

.prs-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.prs-info { min-width: 0; flex: 1; }
.prs-name { font-weight: 600; font-size: 12px; }
.prs-info-line { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .pipeline-row { grid-template-columns: 1fr; gap: 10px; }
  .pr-steps { grid-template-columns: repeat(2, 1fr); }
}

.agent-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.agent-col {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
}

.ac-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ac-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.ac-name { font-weight: 600; font-size: 13px; }
.ac-sub { font-size: 11px; color: var(--text-muted); }

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

.ac-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.ac-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.ac-card.empty {
  background: transparent;
  border-style: dashed;
  color: var(--text-soft);
  text-align: center;
  font-style: italic;
  cursor: default;
  box-shadow: none;
}
.ac-card.empty:hover { transform: none; box-shadow: none; }

.ac-card .ac-tid {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ac-card .ac-content {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.ac-card .ac-foot {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ac-card img {
  width: 100%;
  aspect-ratio: 1.6;
  object-fit: cover;
  border-radius: 6px;
  background: var(--grey-soft);
  margin-top: 4px;
}

.ac-rounds-strip {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.ac-rd {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--grey-soft);
}
.ac-rd.s-low { background: var(--red); }
.ac-rd.s-mid { background: var(--amber); }
.ac-rd.s-high { background: var(--green); }

.kv-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  padding: 14px 16px;
  background: var(--grey-soft);
  border-radius: 10px;
  font-size: 13px;
}
.kv-list dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding-top: 2px;
}
.kv-list dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}
.kv-list dd a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-soft); }
.kv-list dd code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.kv-chip {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 2px;
  color: var(--text);
}

.task-list {
  display: grid;
  gap: 8px;
}
.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}
.ti-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ti-id {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--text-soft);
  font-size: 12px;
  background: var(--grey-soft);
  padding: 2px 8px;
  border-radius: 6px;
}
.ti-title { color: var(--text-muted); font-size: 12px; }
.ti-headline { font-weight: 600; font-size: 14px; line-height: 1.3; color: var(--text); }
.ti-sub { font-size: 12px; color: var(--text-muted); }
.ti-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.ti-cta {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.ti-disc {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.qlist {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text);
}
.qlist li { margin-bottom: 4px; }

.agent-doc {
  background: var(--grey-soft);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow-y: auto;
}

.agent-doc-section h5 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.round-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}
.round-card .rc-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.round-card .rc-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .agent-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .agent-board { grid-template-columns: 1fr; }
  .brief-grid { grid-template-columns: 1fr; }
}

/* ============ Briefs tab ============ */
.briefs-list {
  display: grid;
  gap: 12px;
}

.brief-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}
.brief-card .b-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.brief-card h3 { margin: 0 0 4px; font-size: 16px; }
.brief-card .b-meta { color: var(--text-muted); font-size: 12px; }
.brief-card .b-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }
.brief-card .b-stats strong { color: var(--text); font-size: 16px; display: block; }
.brief-card .b-preview {
  background: var(--grey-soft);
  padding: 12px 14px;
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  margin: 14px 0 12px;
  max-height: 140px;
  overflow-y: auto;
}
.brief-card .b-tasks {
  display: grid;
  gap: 6px;
}
.brief-card .b-task-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--grey-soft);
  border-radius: 8px;
  font-size: 13px;
}

/* ============ Modals/Overlays ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  animation: fadein 0.15s;
}
.overlay.hidden { display: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.panel {
  background: var(--surface);
  width: 480px;
  max-width: 100vw;
  height: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slidein 0.2s;
}
.panel.wide-panel { width: 640px; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.panel-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.panel-eyebrow {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 4px;
}

.panel-body {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 22px;
  color: var(--text-muted);
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--grey-soft); color: var(--text); }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  background: var(--grey-soft);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone p { margin: 0; color: var(--text-muted); }
.dropzone code {
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.status { color: var(--text-muted); font-size: 12px; }
.status.ok { color: var(--green); }
.status.err { color: var(--red); }
.status.warn { color: var(--amber); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.field input[type="file"] {
  font-size: 12px;
  color: var(--text);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--grey-soft);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  padding: 8px;
  background: var(--grey-soft);
  border-radius: 8px;
  min-height: 88px;
  align-content: start;
}
.library-grid .small { padding: 8px; font-size: 11px; }

.lib-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: white;
  transition: border-color 0.1s, transform 0.05s;
}
.lib-thumb:hover { border-color: var(--border-strong); }
.lib-thumb.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.lib-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lib-thumb .check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.lib-thumb.selected .check { display: flex; }

.task-meta {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  display: grid;
  gap: 4px;
}
.task-meta .tm-key { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.section-block { display: flex; flex-direction: column; gap: 12px; }
.section-block h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}
.progress-grid > div {
  background: var(--grey-soft);
  border-radius: 8px;
  padding: 8px 10px;
}
.progress-grid .lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 2px; }
.progress-grid strong { font-size: 14px; font-weight: 700; }

.preview {
  background: var(--grey-soft);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 6px;
}

.audits-list {
  display: grid;
  gap: 6px;
}
.audits-list .round-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px 12px;
  background: var(--grey-soft);
  border-radius: 8px;
  font-size: 12px;
}
.audits-list .round-num { font-family: ui-monospace, monospace; font-weight: 700; color: var(--accent); }
.audits-list .round-summary { color: var(--text-muted); white-space: pre-wrap; line-height: 1.4; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.gallery .item {
  background: var(--grey-soft);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gallery .item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  background: white;
}
.gallery .item .name {
  font-size: 10px;
  word-break: break-all;
  color: var(--text-soft);
}
.gallery .item a { color: var(--accent); font-size: 11px; }

.muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
  .stats { width: 100%; flex-wrap: wrap; }
  .topbar { padding: 10px 14px; gap: 12px; }
  .nav { display: none; }
  .page { padding: 16px; }
  .page-head h1 { font-size: 22px; }
  .panel { width: 100%; }
  .panel.wide-panel { width: 100%; }
  .author-pill span { display: none; }
}
