:root {
  --bg: #f7f5ee;
  --surface: #fffdfa;
  --surface-2: #f0f6ff;
  --ink: #202124;
  --muted: #697077;
  --line: #d8d2c5;
  --line-strong: #262626;
  --gold: #ffc857;
  --green: #c9f27b;
  --blue: #cfe6ff;
  --red: #f1665c;
  --radius: 8px;
  --shadow: 0 12px 30px rgb(32 33 36 / 8%);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: grid;
  grid-template-columns: 264px 1fr;
}

button, input, select {
  font: inherit;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
button {
  cursor: pointer;
  font-weight: 700;
  padding: 0 14px;
  background: var(--gold);
  border-color: var(--line-strong);
}
button.secondary { background: #fff; }
textarea {
  width: 100%;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  resize: vertical;
}
button:hover { filter: brightness(0.98); }
input, select { padding: 0 12px; }
h1, h2, h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  letter-spacing: 0;
  margin: 0;
}
h1 { font-size: 34px; }
h2 { font-size: 24px; }
h3 { font-size: 17px; }
pre {
  margin: 10px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: var(--radius);
  background: #191919;
  color: #f8f4e8;
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #fffdfa;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand strong {
  display: block;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 22px;
}
.brand small, .sidebar-status small, .eyebrow, .sub {
  color: var(--muted);
  font-size: 13px;
}
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--line-strong);
  background: var(--gold);
  box-shadow: 3px 3px 0 var(--line-strong);
}
.nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  text-align: left;
  min-height: 42px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #424242;
}
.nav-item.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.sidebar-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38b66a;
}

.app {
  min-width: 0;
  padding: 26px 30px 46px;
}
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 4px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.view { display: none; }
.view.active { display: block; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric, .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.metric { padding: 18px; }
.metric .k {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.metric .v {
  margin-top: 7px;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 34px;
  font-weight: 800;
}
.panel { padding: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.overview-grid, .two-col, .agent-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}
.two-col.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 420px); }
.stack { display: grid; gap: 10px; }
.table { display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 110px 110px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  width: 100%;
}
.clickable {
  cursor: pointer;
  color: inherit;
  font-weight: inherit;
  box-shadow: none;
}
.clickable:hover, .clickable.selected {
  border-color: var(--line-strong);
  background: #fff9e8;
}
.row b, .mail b, .acct b, .creator b { overflow-wrap: anywhere; }
.status {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 800;
  text-transform: capitalize;
}
.status.active { background: var(--green); }
.status.paused { background: #ffe0dc; }
.status.draft { background: var(--blue); }
.filters {
  display: grid;
  grid-template-columns: 150px minmax(180px, 280px) auto;
  gap: 8px;
}
.finder-head { align-items: end; }
.creator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.creator, .mail, .acct, .summary-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}
.mail, .acct {
  width: 100%;
  text-align: left;
  display: block;
  min-height: auto;
}
.creator-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.platform {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0efe7;
  color: #343434;
  font-size: 12px;
  font-weight: 800;
}
.creator-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.mini {
  padding: 9px;
  border-radius: var(--radius);
  background: var(--bg);
}
.mini span { display: block; color: var(--muted); font-size: 12px; }
.mini b { font-size: 16px; }
.chatlog {
  min-height: 430px;
  max-height: 58vh;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
}
.bubble {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}
.bubble.user {
  justify-self: end;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.bubble.agent { justify-self: start; }
.bubble pre {
  max-height: 220px;
  white-space: pre-wrap;
}
.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.agent-side { display: grid; gap: 10px; }
.prompt {
  width: 100%;
  text-align: left;
  background: #fff;
  border-color: var(--line);
}
.doc { max-width: 980px; }
.lead {
  max-width: 72ch;
  color: #4e555c;
  line-height: 1.55;
}
.doc-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}
.doc-step {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.doc-step > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  border: 1px solid var(--line-strong);
  font-weight: 800;
}
.tools-box { margin-top: 20px; }
.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.tool-list span {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}
.detail-panel h2 { margin: 2px 0 12px; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.detail-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 700;
}
.breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}
.lower-detail { margin-top: 18px; }
.field-label {
  display: block;
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--green);
  font-weight: 800;
}

@media (max-width: 1120px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 14px;
  }
  .nav { display: flex; min-width: max-content; }
  .nav-item { width: auto; }
  .sidebar-status { margin-left: auto; margin-top: 0; min-width: 190px; }
  .app { padding: 20px; }
}

@media (max-width: 860px) {
  .metrics, .overview-grid, .two-col, .agent-shell, .creator-grid { grid-template-columns: 1fr; }
  .panel-head, .finder-head, .topbar { align-items: stretch; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .chat-form { grid-template-columns: 1fr; }
  .bubble { max-width: 100%; }
}
