:root {
  --ink: #10150f;
  --muted: #5d6f64;
  --line: #dbe7de;
  --surface: #ffffff;
  --wash: #f7fbf5;
  --teal: #007a3d;
  --teal-2: #009b3a;
  --mint: #e5f6ea;
  --gold: #fed100;
  --black: #050505;
  --coral: #ef7357;
  --shadow: 0 18px 50px rgba(8, 21, 12, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(254, 209, 0, .2) 0 10px, transparent 10px 24px),
    linear-gradient(135deg, rgba(0, 155, 58, .1), transparent 34%),
    var(--wash);
}

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

button {
  cursor: pointer;
}

.loading-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 18px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, var(--black) 0 31%, var(--gold) 31% 43%, var(--teal-2) 43% 100%);
  color: white;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.app-shell {
  min-height: 100vh;
}

.dashboard {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, var(--black) 0 58%, #063f21 100%);
  color: white;
  padding: 26px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255,255,255,.06);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(254, 209, 0, .82);
  border-radius: 999px;
}

.sidebar h1 {
  font-size: 24px;
  line-height: 1.05;
  margin: 18px 0 8px;
}

.sidebar p {
  color: #c4d8d2;
  line-height: 1.5;
  margin: 0 0 22px;
}

.nav-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255,255,255,.13);
  background: transparent;
  color: #edf8f4;
  border-radius: 12px;
  padding: 11px 12px;
  text-align: left;
  margin-bottom: 8px;
  font-weight: 800;
}

.nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.05);
  color: #edf8f4;
  border-radius: 12px;
  padding: 11px 12px;
  margin-top: 10px;
  font-weight: 800;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255,255,255,.1);
}

.nav-button.active {
  background: var(--gold);
  color: var(--black);
}

.main {
  padding: 28px;
  min-width: 0;
}

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

.eyebrow {
  color: var(--teal);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 900;
}

h2 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  margin: 6px 0 8px;
  letter-spacing: 0;
}

.topbar p {
  color: var(--muted);
  max-width: 780px;
  margin: 0;
  line-height: 1.5;
}

.primary-button, .secondary-button, .ghost-button {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 900;
  background: white;
  color: var(--ink);
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.secondary-button {
  background: var(--gold);
  border-color: #e1ba00;
  color: var(--black);
}

.ghost-button {
  background: #f8fbf7;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric, .panel, .client-card, .drawer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid rgba(0, 122, 61, .72);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.automation-flow,
.sequence-grid,
.niche-list {
  display: grid;
  gap: 12px;
}

.automation-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}

.automation-step > span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #112827;
  font-weight: 900;
  font-size: 12px;
}

.automation-step strong,
.sequence-card strong,
.niche-list strong {
  display: block;
  margin-bottom: 4px;
}

.automation-step p,
.sequence-card p,
.niche-list small {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.automation-step small,
.sequence-card span,
.niche-list span {
  display: inline-block;
  margin-top: 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sequence-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sequence-card,
.niche-list article {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: white;
}

.hidden-copy-source {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.import-help {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--mint);
}

.import-help strong {
  display: block;
  margin-bottom: 6px;
}

.import-help p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.metric strong {
  font-size: 28px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

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

.panel h3 {
  margin: 0;
  font-size: 22px;
}

.sprint-update {
  border-top-color: var(--gold);
}

.sprint-update p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 16px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 5px 12px;
  background: #ffe3dc;
  color: #7d2c1c;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sprint-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr);
  gap: 16px;
}

.sprint-grid strong {
  display: block;
  margin-bottom: 10px;
}

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

.queue-grid span {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.queue-grid b {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.sprint-note {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: #fff7d8;
  color: #5c4700;
  font-weight: 800;
  line-height: 1.4;
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.source-row span {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stage-pill {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdfb;
}

.stage-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.client-list {
  display: grid;
  gap: 12px;
}

.client-card {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.client-card h4 {
  font-size: 20px;
  margin: 0 0 5px;
}

.client-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--mint);
  color: #0b4f4d;
  font-weight: 800;
  font-size: 12px;
}

.tag.gold { background: #fff1bd; color: #5c4700; }
.tag.coral { background: #ffe3dc; color: #7d2c1c; }

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

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

.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdfb;
  color: var(--ink);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 20, 19, .36);
  display: none;
  justify-content: flex-end;
  z-index: 20;
}

.drawer-backdrop.open {
  display: flex;
}

.drawer {
  width: min(980px, 100vw);
  height: 100vh;
  border-radius: 20px 0 0 20px;
  padding: 24px;
  overflow: auto;
}

.drawer-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.icon-button {
  border: 1px solid var(--line);
  background: #f8fbf7;
  border-radius: 12px;
  width: 46px;
  height: 46px;
  font-size: 26px;
  line-height: 1;
}

.drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.tab-button {
  border: 1px solid transparent;
  background: #eef5f1;
  border-radius: 12px;
  min-height: 42px;
  padding: 8px 13px;
  font-weight: 900;
  color: #143c3a;
}

.tab-button.active {
  background: var(--teal);
  color: white;
}

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

.info-card, .file-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fbfdfb;
}

.info-card-button {
  width: 100%;
  appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.info-card-button:hover,
.info-card-button:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 12px 28px rgba(13, 93, 92, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.info-card span, .file-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
}

.info-card strong {
  font-size: 20px;
}

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

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.file-card {
  min-height: 110px;
  text-decoration: none;
  color: inherit;
}

.file-card strong {
  display: block;
  margin-bottom: 6px;
}

.file-card em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}

.file-card button {
  align-self: end;
  margin-top: 8px;
}

.attach-library {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.attach-library h3 {
  margin: 0 0 12px;
}

.ai-output,
.prompt-details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfb;
  padding: 14px;
}

.ai-output span {
  display: block;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.ai-output pre,
.prompt-details pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: var(--ink);
  line-height: 1.48;
  font-family: inherit;
}

.prompt-details {
  margin-top: 12px;
}

.prompt-details summary {
  cursor: pointer;
  font-weight: 900;
  margin-bottom: 10px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.asset-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fbfdfb;
  display: grid;
  gap: 8px;
  min-height: 178px;
}

.asset-card span,
.asset-card small {
  color: var(--muted);
  font-size: 13px;
}

.asset-card strong {
  font-size: 20px;
}

.asset-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.billing-list {
  display: grid;
  gap: 12px;
}

.invoice-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfdfb;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.invoice-row strong,
.invoice-row span {
  display: block;
}

.invoice-row span {
  color: var(--muted);
  margin-top: 4px;
}

.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.link-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.compact-form {
  grid-template-columns: 1fr;
}

.empty-state {
  border: 1px dashed #b8c8c1;
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  background: #fbfdfb;
}

.ask-layout {
  display: grid;
  grid-template-columns: minmax(260px, .34fr) minmax(420px, 1fr);
  gap: 18px;
  align-items: start;
}

.ask-sidebar,
.ask-chat,
.ask-suggestions,
.ask-context,
.ask-thread {
  display: grid;
  gap: 12px;
}

.ask-suggestions button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  font-weight: 850;
  line-height: 1.35;
}

.ask-suggestions button:hover,
.ask-suggestions button:focus-visible {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--gold);
  outline: none;
}

.ask-thread {
  min-height: 430px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(254, 209, 0, .12), transparent 34%),
    #fbfdfb;
  padding: 14px;
}

.ask-message {
  max-width: 84%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: white;
}

.ask-message.user {
  justify-self: end;
  border-color: rgba(0, 122, 61, .32);
  background: var(--mint);
}

.ask-message span {
  display: block;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.ask-message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.ask-composer {
  display: grid;
  gap: 10px;
}

.ask-composer div {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.12fr) minmax(320px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.studio-builder,
.studio-preview,
.studio-library .panel {
  display: grid;
  gap: 14px;
}

.studio-output {
  min-height: 220px;
}

.studio-page-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(254, 209, 0, .18), transparent 34%),
    #fbfdfb;
}

.studio-page-card > span,
.studio-template-card span,
.studio-stack span {
  display: block;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.studio-page-card strong {
  display: block;
  font-size: 26px;
  line-height: 1.08;
}

.studio-page-card p {
  color: var(--muted);
  line-height: 1.5;
}

.studio-form-preview,
.studio-stack,
.studio-template-grid,
.studio-check-grid,
.studio-library {
  display: grid;
  gap: 12px;
}

.studio-form-preview small,
.studio-form-preview button,
.studio-stack div,
.studio-template-card,
.studio-check {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.studio-form-preview small,
.studio-form-preview button {
  min-height: 40px;
  display: grid;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.studio-form-preview button {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.studio-stack div,
.studio-template-card,
.studio-check {
  padding: 13px;
}

.studio-template-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.studio-template-card {
  min-height: 154px;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.studio-template-card:hover,
.studio-template-card:focus-visible,
.studio-template-card.active {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--gold);
  outline: none;
}

.studio-template-card.active {
  background: var(--mint);
}

.studio-template-card strong,
.studio-check strong,
.studio-stack strong {
  display: block;
}

.studio-template-card small,
.studio-template-card em,
.studio-selected-template {
  display: block;
  color: var(--muted);
  line-height: 1.42;
  margin-top: 7px;
}

.studio-template-card em,
.studio-selected-template {
  color: var(--teal);
  font-style: normal;
  font-weight: 900;
}

.studio-library {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
  margin-top: 18px;
}

.studio-check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.studio-check.done {
  color: var(--teal);
}

.left-align {
  justify-content: flex-start;
}

@media (max-width: 980px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .metric-grid, .grid, .drawer-grid, .form-grid, .sequence-grid, .ask-layout, .studio-layout, .studio-library, .sprint-grid, .queue-grid { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .sprint-update .panel-header { align-items: flex-start; flex-direction: column; }
  .action-grid { grid-template-columns: 1fr; }
  .invoice-row { grid-template-columns: 1fr; }
  .inline-actions { justify-content: flex-start; }
  .ask-message { max-width: 100%; }
}
