:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #dbe3ef;
  --blue: #1f73d8;
  --blue-soft: #e9f2ff;
  --purple: #6b4bd8;
  --purple-soft: #efe9ff;
  --gold: #d99507;
  --gold-soft: #fff3d1;
  --green: #129866;
  --green-soft: #e8f8ef;
  --teal: #07938f;
  --teal-soft: #e7fbf8;
  --danger: #b42318;
  --radius: 8px;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #fbfcff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #0f172a;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand span,
.hint,
.eyebrow,
.muted {
  color: var(--muted);
}

.brand span {
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  background: transparent;
  color: #344054;
  text-align: left;
  font-weight: 750;
}

.nav-item:hover,
.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.role-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: grid;
  gap: 8px;
}

.role-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

select,
input {
  height: 40px;
  padding: 0 11px;
}

textarea {
  padding: 10px 11px;
  resize: vertical;
}

.app {
  min-width: 0;
  padding: 24px;
}

.topbar {
  min-height: 72px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(25px, 2vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 15px;
}

.top-actions,
.form-actions,
.card-actions,
.score-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.primary,
.ghost,
.danger {
  min-height: 39px;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 800;
}

.primary {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: #1f2937;
}

.danger {
  border: 1px solid #f6c4bd;
  background: #fff4f2;
  color: var(--danger);
}

.stage-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stage-card {
  min-height: 112px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--stage);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.stage-card strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.stage-card span {
  color: var(--muted);
  font-size: 12px;
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-number {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--stage);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
  gap: 16px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.7fr);
  gap: 16px;
  margin-bottom: 16px;
}

.overview-panel h2 {
  max-width: 920px;
  font-size: 22px;
  line-height: 1.3;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric-card,
.role-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-card {
  min-height: 76px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.metric-card strong {
  font-size: 24px;
  line-height: 1;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.role-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.role-summary {
  padding: 12px;
  display: grid;
  gap: 9px;
}

.role-summary p {
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.wide,
.panel.inspector,
.panel {
  padding: 17px;
}

.panel-head {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.hint {
  font-size: 13px;
}

.flow-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.flow-column {
  min-height: 500px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

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

.flow-column header strong {
  font-size: 13px;
}

.flow-column header .stage-number {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.column-body {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.work-card,
.data-card {
  border: 1px solid #e1e8f2;
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 9px;
}

.work-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 115, 216, 0.12);
}

.work-card h3,
.data-card h3 {
  line-height: 1.25;
}

.work-card p,
.data-card p,
.asset-body {
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
}

.pill {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.pill.gold {
  background: var(--gold-soft);
  color: var(--gold);
}

.pill.green {
  background: var(--green-soft);
  color: var(--green);
}

.pill.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill.red {
  background: #fff4f2;
  color: var(--danger);
}

.pill.slate {
  background: #eef2f7;
  color: #475467;
}

.asset-inspector {
  display: grid;
  gap: 12px;
}

.empty-state {
  min-height: 180px;
  border: 1px dashed #cfd8e6;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state.small {
  min-height: 96px;
  font-size: 13px;
}

.score {
  min-width: 74px;
  padding: 9px;
  border-radius: var(--radius);
  background: #f8fafc;
  text-align: center;
}

.score strong {
  display: block;
  color: var(--ink);
}

.score span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.campaign-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.editor-form,
.comment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

label.full,
.form-actions {
  grid-column: 1 / -1;
}

.stack {
  display: grid;
  gap: 10px;
}

.brief-grid,
.asset-table {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.data-card.compact {
  gap: 5px;
}

.export-box {
  min-height: 280px;
  max-height: 520px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  color: #f8fafc;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.18s ease;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .role-overview {
    grid-template-columns: 1fr;
  }

  .stage-strip,
  .brief-grid,
  .asset-table,
  .editor-form,
  .comment-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stage-strip,
  .brief-grid,
  .asset-table,
  .campaign-form,
  .editor-form,
  .comment-form {
    grid-template-columns: 1fr;
  }
}
