:root {
  --bg: #f3f6f5;
  --panel: #ffffff;
  --panel-2: #eef3f1;
  --ink: #17211f;
  --muted: #687572;
  --line: #dbe4e1;
  --line-strong: #b9c7c3;
  --brand: #0a9a72;
  --brand-strong: #087556;
  --growth: #63a83d;
  --orchid: #7458d9;
  --coral: #e86452;
  --amber: #d9901f;
  --sidebar: #101b22;
  --sidebar-2: #19262d;
  --admin: #3b1823;
  --shadow: 0 18px 50px rgba(20, 35, 31, 0.12);
  --shadow-soft: 0 4px 14px rgba(20, 35, 31, 0.05);
  --radius: 8px;
  --radius-sm: 6px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.foundation-workspace { max-width: 1160px; margin: 0 auto; min-width: 0; font-size: 14px; line-height: 1.6; letter-spacing: 0; }
.foundation-heading, .foundation-section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.foundation-heading h2 { font-size: 20px; margin: 0 0 6px; overflow-wrap: anywhere; }
.foundation-section-title { margin: 24px 0 12px; }
.foundation-workspace .foundation-section-title h2 { font-size: 20px; line-height: 1.5; font-weight: 600; margin: 0; }
.foundation-workspace .subtle { font-size: 13px; line-height: 1.6; color: #536963; }
.foundation-toolbar { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.foundation-toolbar select { width: min(100%,520px); min-width: 0; padding: 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; }
.foundation-toolbar label { flex-shrink: 0; font-size: 14px; }
.foundation-create { border-bottom: 1px solid var(--line); padding: 16px 0; }
.foundation-create summary { cursor: pointer; color: var(--brand-strong); font-size: 14px; }
.foundation-form { display: grid; grid-template-columns: minmax(160px,1fr) minmax(170px,1fr) minmax(145px,auto); gap: 16px; align-items: end; padding: 18px 0; }
.foundation-run-form { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(130px,.55fr) auto; gap: 12px; }
.foundation-form .field { min-width: 0; }
.foundation-workspace .foundation-form .field label { font-size: 13px; font-weight: 500; line-height: 1.5; margin-bottom: 6px; }
.foundation-workspace .foundation-form input, .foundation-workspace .foundation-form select { width: 100%; min-width: 0; height: 40px; font-size: 14px; padding: 8px 10px; }
.foundation-workspace .btn { font-size: 14px; line-height: 1.5; padding: 8px 12px; min-height: 40px; }
.foundation-currency-status { grid-column: 1 / -1; margin: 0; color: #865e1d; font-size: 13px; }
.foundation-health { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.foundation-error { color: #a62932; overflow-wrap: anywhere; }
.foundation-table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
.foundation-workspace .foundation-table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 14px; line-height: 1.6; min-width: 700px; background: white; }
.foundation-workspace .foundation-table th, .foundation-workspace .foundation-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: middle; }
.foundation-workspace .foundation-table th { color: #536963; font-size: 13px; font-weight: 500; background: #eef3f1; }
.foundation-table small { display: block; color: #536963; margin-top: 3px; font-size: 13px; line-height: 1.5; }
.foundation-workspace .foundation-table .foundation-number { text-align: right; font-variant-numeric: tabular-nums; }
.foundation-workspace .foundation-budgets { table-layout: auto; }
.foundation-budgets .foundation-number { white-space: nowrap; }
.foundation-workspace .tag { font-size: 12px; line-height: 1.5; padding: 3px 8px; border-radius: 4px; }
.foundation-runs time { font-size: 13px; font-variant-numeric: tabular-nums; }
.foundation-table-wrap:focus-visible { outline: 2px solid #25816d; outline-offset: 3px; }
.foundation-run-id { font-family: Consolas,monospace; }
.foundation-empty { text-align: center !important; height: 72px; color: var(--muted); }
.foundation-pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.foundation-pagination button:disabled { opacity: .4; cursor: default; }
.foundation-audit { list-style: none; padding: 0; margin: 0; }
.foundation-audit li { display: flex; gap: 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.foundation-audit time { color: #536963; white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 1200px) {
  .foundation-run-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .foundation-form { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .foundation-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .foundation-heading h2 { font-size: 20px; }
  .foundation-audit li { flex-direction: column; gap: 5px; }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  grid-template-columns: auto auto;
  gap: 18px;
  color: var(--ink);
}

.boot-screen h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.boot-screen p {
  margin: 0;
  color: var(--muted);
}

.boot-mark,
.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 25px rgba(0, 167, 165, 0.24);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(380px, 1.08fr);
}

.auth-story {
  padding: 54px;
  background:
    linear-gradient(135deg, rgba(20, 24, 31, 0.94), rgba(20, 24, 31, 0.85)),
    radial-gradient(circle at 30% 20%, rgba(0, 167, 165, 0.4), transparent 34%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-story h1 {
  margin: 54px 0 16px;
  max-width: 640px;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: 0;
}

.auth-story p {
  max-width: 580px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.75;
}

.loop-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(76px, 1fr));
  gap: 8px;
  margin-top: 30px;
}

.loop-step {
  min-height: 78px;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.loop-step span {
  display: block;
  width: 24px;
  height: 24px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  text-align: center;
  line-height: 24px;
  font-size: 12px;
  font-weight: 700;
}

.auth-panel {
  padding: 42px;
  display: grid;
  align-content: center;
}

.auth-card {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card h2,
.modal-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.subtle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #475161;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 167, 165, 0.14);
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: #fff;
  white-space: nowrap;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.secondary {
  border-color: var(--line);
  background: #fff;
}

.btn.dark {
  background: var(--ink);
  color: #fff;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.danger {
  background: rgba(232, 100, 82, 0.11);
  color: #b73d2c;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar);
  color: #fff;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 7px 14px;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand small {
  color: rgba(255, 255, 255, 0.58);
}

.nav-group-title {
  margin: 15px 9px 6px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-btn {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.tenant-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.tenant-card b {
  display: block;
  margin-bottom: 4px;
}

.tenant-card span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.tenant-user {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tenant-user button {
  border: 0;
  padding: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.tenant-user button:hover {
  color: #fff;
}

.admin-sidebar-footer {
  min-width: 0;
  line-height: 1.5;
  letter-spacing: 0;
}

.admin-sidebar-footer > b {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.admin-sidebar-footer > span {
  display: block;
  overflow-wrap: anywhere;
}

.admin-sidebar-footer .tenant-user {
  min-width: 0;
  margin-top: 10px;
  padding-top: 8px;
}

.admin-sidebar-footer .tenant-user > span {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-sidebar-footer .tenant-user button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 4px;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.top-title {
  min-width: 0;
}

.top-title h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.top-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ai-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0, 167, 165, 0.26);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(0, 167, 165, 0.08);
  color: #075b5a;
  font-size: 13px;
}

.role-badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.demo-account-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(0, 167, 165, 0.45);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 9px rgba(0, 167, 165, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 167, 165, 0);
  }
}

.content {
  padding: 18px 20px 36px;
}

.page {
  display: grid;
  gap: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.section-head h2,
.panel h2 {
  margin: 0;
  font-size: 20px;
}

.section-head p,
.panel > p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.metric-card,
.insight-card,
.account-card,
.task-card,
.report-card,
.wizard-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 18px;
}

.metric-card {
  padding: 16px;
  min-height: 118px;
  display: grid;
  gap: 12px;
}

.metric-card small {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  font-size: 28px;
}

.metric-card .delta {
  width: fit-content;
}

.delta {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  color: #316d15;
  background: rgba(127, 191, 63, 0.16);
}

.delta.warn {
  color: #965a0c;
  background: rgba(217, 144, 31, 0.16);
}

.delta.bad {
  color: #a83d2d;
  background: rgba(232, 100, 82, 0.15);
}

.hero-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.command-center {
  min-height: 278px;
  padding: 22px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(20, 24, 31, 0.98), rgba(31, 36, 43, 0.92)),
    var(--sidebar);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.command-center::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 110px;
  background: linear-gradient(180deg, transparent, rgba(0, 167, 165, 0.18));
  pointer-events: none;
}

.command-center h2 {
  margin: 0 0 10px;
  max-width: 650px;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

.command-center p {
  margin: 0;
  max-width: 700px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.65;
}

.results-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}

.results-summary,
.results-recommendation {
  border-radius: var(--radius);
  padding: 22px;
}

.results-summary {
  color: #fff;
  background: var(--sidebar);
}

.results-summary h2 {
  max-width: 760px;
  margin: 18px 0 10px;
  font-size: 29px;
  line-height: 1.25;
  letter-spacing: 0;
}

.results-summary > p {
  max-width: 780px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.65;
}

.result-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.result-chips > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
}

.result-chips span,
.result-chips b {
  display: block;
  overflow-wrap: anywhere;
}

.result-chips span {
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.results-recommendation {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.results-recommendation > small {
  color: var(--brand-strong);
  font-weight: 800;
}

.results-recommendation h3 {
  margin: 12px 0 8px;
  font-size: 19px;
}

.results-recommendation > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.impact-box {
  width: 100%;
  margin: 18px 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(127, 191, 63, 0.12);
}

.impact-box span,
.impact-box b {
  display: block;
}

.impact-box span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.results-recommendation .btn {
  margin-top: auto;
}

.compact-metrics .metric-card {
  min-height: 108px;
}

.result-chart {
  height: 190px;
}

.finding-list {
  display: grid;
  margin-top: 10px;
}

.finding-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.finding-row:last-child {
  border-bottom: 0;
}

.finding-row:hover {
  color: var(--brand-strong);
}

.finding-row b,
.finding-row small {
  display: block;
}

.finding-row small {
  margin-top: 5px;
  color: var(--muted);
}

.finding-level {
  width: 8px;
  height: 34px;
  border-radius: 4px;
  background: var(--brand);
}

.finding-level.high {
  background: var(--coral);
}

.finding-level.medium {
  background: var(--amber);
}

.completed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.completed-grid > div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}

.completed-grid span,
.completed-grid small {
  color: var(--muted);
}

.completed-grid span {
  font-size: 12px;
  font-weight: 800;
}

.agent-loop {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(6, minmax(86px, 1fr));
  gap: 10px;
}

.agent-step {
  min-height: 82px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.agent-step.active {
  border-color: rgba(0, 167, 165, 0.72);
  background: rgba(0, 167, 165, 0.18);
}

.agent-step b {
  display: block;
  margin-bottom: 8px;
}

.agent-step span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  line-height: 1.5;
}

.next-actions {
  display: grid;
  gap: 12px;
}

.action-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}

.action-item b {
  display: block;
  margin-bottom: 6px;
}

.action-item p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.chart-wrap {
  min-height: 220px;
}

.bar-chart {
  height: 168px;
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px 6px 4px;
}

.bar {
  min-height: 14px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--brand), var(--growth));
  position: relative;
}

.bar::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
}

.insight-card {
  padding: 16px;
  display: grid;
  gap: 12px;
  border-left: 4px solid var(--brand);
}

.insight-card.high {
  border-left-color: var(--coral);
}

.insight-card.medium {
  border-left-color: var(--amber);
}

.insight-card.low {
  border-left-color: var(--brand);
}

.insight-card h3,
.account-card h3,
.task-card h3 {
  margin: 0;
  font-size: 16px;
}

.insight-card p,
.task-card p,
.account-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-row,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  color: #475161;
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 800;
}

.tag.brand {
  color: #075b5a;
  background: rgba(0, 167, 165, 0.12);
}

.tag.purple {
  color: #533bb5;
  background: rgba(116, 88, 217, 0.13);
}

.tag.green {
  color: #316d15;
  background: rgba(127, 191, 63, 0.16);
}

.tag.red {
  color: #a83d2d;
  background: rgba(232, 100, 82, 0.15);
}

.tag.amber {
  color: #965a0c;
  background: rgba(217, 144, 31, 0.16);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.tab {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.account-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.account-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

.avatar.tiktok {
  background: #101418;
}

.avatar.facebook {
  background: #2565d0;
}

.avatar.instagram {
  background: #c74882;
}

.avatar.youtube {
  background: #d43a2f;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px;
  background: #fbfcfe;
}

.mini-stat small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}

.upload-zone {
  min-height: 178px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfe;
  text-align: center;
}

.upload-zone.dragging {
  border-color: var(--brand);
  background: rgba(0, 167, 165, 0.08);
}

.upload-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(0, 167, 165, 0.12);
  color: var(--brand-strong);
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fbfcfe;
  color: #475161;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.plan-output {
  min-height: 620px;
}

.ai-generating {
  min-height: 430px;
  display: grid;
  place-items: center;
  text-align: center;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(0, 167, 165, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.week-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: #fbfcfe;
  min-height: 146px;
}

.week-card b {
  display: block;
  margin-bottom: 6px;
}

.week-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.task-board {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(330px, 1.05fr);
  gap: 18px;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: #e7ecf2;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--growth));
}

.workflow {
  display: grid;
  gap: 9px;
}

.workflow-step {
  min-height: 54px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  text-align: left;
}

.workflow-step.active {
  border-color: var(--brand);
  background: rgba(0, 167, 165, 0.08);
}

.workflow-index {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: #475161;
  font-size: 12px;
  font-weight: 800;
}

.workflow-step.active .workflow-index {
  color: #fff;
  background: var(--brand);
}

.automation-banner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 167, 165, 0.28);
  border-radius: var(--radius);
  background: rgba(0, 167, 165, 0.07);
}

.automation-banner p,
.scope-savebar p,
.boundary-note p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.scope-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: start;
}

.scope-section {
  display: grid;
  gap: 14px;
  padding: 4px 0 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.scope-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.scope-heading > span {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: rgba(0, 167, 165, 0.11);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.scope-heading h3,
.queue-item h3 {
  margin: 0;
  font-size: 16px;
}

.scope-heading p,
.queue-item p,
.queue-item small {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.danger-scope .scope-heading > span {
  color: #a83d2d;
  background: rgba(232, 100, 82, 0.12);
}

.scope-tags {
  min-height: 28px;
}

.scope-controls {
  margin-bottom: 16px;
}

.scope-savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.scope-savebar p {
  margin: 0;
}

.scope-preview {
  position: sticky;
  top: 88px;
}

.queue-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.queue-item {
  display: grid;
  gap: 9px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.queue-item:last-child {
  border-bottom: 0;
}

.queue-item small {
  display: block;
}

.boundary-note {
  margin-top: 14px;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.ai-provider-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.provider-list {
  display: grid;
  gap: 10px;
}

.provider-option {
  min-height: 76px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.provider-option.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 167, 165, 0.1);
}

.provider-option b,
.provider-option small {
  display: block;
}

.provider-option small {
  margin-top: 4px;
  color: var(--muted);
}

.provider-logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

.provider-logo.gemini {
  background: #2565d0;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 4px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.switch-row b,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
}

.provider-status {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.provider-status p {
  margin: 3px 0 0;
  color: var(--muted);
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.success {
  background: var(--growth);
}

.status-dot.failed {
  background: var(--coral);
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.78fr);
  gap: 18px;
}

.report-card {
  padding: 18px;
}

.ceo-summary {
  border-left: 4px solid var(--orchid);
  background: rgba(116, 88, 217, 0.08);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.timeline-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.timeline-card b {
  display: block;
  margin-bottom: 4px;
}

.timeline-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-ribbon {
  border: 1px solid rgba(232, 100, 82, 0.28);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: rgba(232, 100, 82, 0.1);
  color: #7e2b20;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(20, 24, 31, 0.48);
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(720px, 92vh);
  overflow-y: auto;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 90px rgba(20, 24, 31, 0.26);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.modal-body {
  padding: 22px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.step-indicator {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step-indicator.active {
  border-color: var(--brand);
  background: rgba(0, 167, 165, 0.09);
  color: var(--brand-strong);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.choice {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 6px;
  background: #fff;
  text-align: left;
}

.choice.active {
  border-color: var(--brand);
  background: rgba(0, 167, 165, 0.08);
}

.choice b {
  font-size: 14px;
}

.choice span {
  color: var(--muted);
  font-size: 12px;
}

.split-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.toast b {
  display: block;
  margin-bottom: 3px;
}

.toast span {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  min-height: 260px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  background: #fbfcfe;
}

.empty h3 {
  margin: 0 0 8px;
}

.empty p {
  margin: 0 0 16px;
  color: var(--muted);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #e9eef4;
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.mobile-menu {
  display: none;
}

.desktop-only {
  display: inline-flex;
}

/* Reference-aligned desktop experience */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 40px;
  background: #edf1f0;
}

.login-shell {
  width: min(980px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid #d9e1df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 35, 31, 0.13);
}

.login-view .auth-story {
  position: relative;
  min-width: 0;
  padding: 38px 40px;
  overflow: hidden;
  background: #073934;
  color: #fff;
}

.auth-eyebrow {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  font-weight: 800;
}

.auth-eyebrow span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #37d3a0;
}

.auth-story-copy {
  position: relative;
  z-index: 2;
  margin: auto 0;
}

.login-view .auth-story-copy > p:first-child {
  margin: 0 0 12px;
  color: #7ee2bd;
  font-size: 13px;
  font-weight: 800;
}

.login-view .auth-story h1 {
  max-width: 390px;
  margin: 0 0 18px;
  font-size: 34px;
  line-height: 1.26;
}

.login-view .auth-story p {
  max-width: 380px;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.75;
}

.login-view .auth-story > small {
  position: relative;
  z-index: 2;
  color: rgba(255, 255, 255, 0.44);
}

.auth-wave,
.auth-wave::before,
.auth-wave::after {
  position: absolute;
  border: 1px solid rgba(68, 219, 174, 0.2);
  border-radius: 50%;
  content: "";
}

.auth-wave {
  right: -210px;
  bottom: -100px;
  width: 680px;
  height: 250px;
  transform: rotate(-13deg);
}

.auth-wave::before {
  inset: 22px -30px -22px 30px;
}

.auth-wave::after {
  inset: 48px -60px -48px 60px;
}

.login-view .auth-panel {
  padding: 52px 58px;
  background: #fff;
}

.login-view .auth-card {
  width: 100%;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.login-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  box-shadow: none;
}

.login-brand strong {
  font-size: 22px;
}

.auth-heading {
  margin-bottom: 22px;
  text-align: center;
}

.auth-heading h2 {
  margin: 0 0 7px;
  font-size: 22px;
}

.auth-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.login-fields {
  display: grid;
  gap: 14px;
}

.login-options {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.login-options label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.auth-primary {
  width: 100%;
  justify-content: center;
  min-height: 43px;
}

.auth-link {
  border: 0;
  padding: 0;
  color: var(--brand-strong);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.auth-divider {
  position: relative;
  margin: 22px 0 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.auth-divider span {
  position: relative;
  top: -9px;
  padding: 0 10px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
}

.demo-login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.demo-login-grid .btn {
  justify-content: center;
  padding-inline: 8px;
  font-size: 12px;
}

.register-link {
  width: 100%;
  margin-top: 20px;
  text-align: center;
}

.compact-register {
  margin: 0 0 18px;
}

.overview-page {
  gap: 0;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 14px;
  align-items: start;
}

.overview-main,
.overview-rail {
  display: grid;
  gap: 14px;
}

.core-insight {
  min-height: 104px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid #c7e7dc;
  border-radius: 6px;
  background: #eaf7f2;
}

.core-insight-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.core-insight-label {
  margin-bottom: 5px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.core-insight-label span {
  margin-left: 5px;
  color: var(--muted);
  font-weight: 600;
}

.core-insight h2 {
  margin: 0 0 5px;
  font-size: 16px;
  line-height: 1.35;
}

.core-insight p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.overview-metrics {
  gap: 10px;
}

.overview-metrics .metric-card {
  min-height: 92px;
  gap: 7px;
  padding: 12px 13px;
}

.overview-metrics .metric-card strong {
  font-size: 23px;
}

.overview-metrics .metric-card .delta {
  padding: 2px 6px;
  font-size: 10px;
}

.traffic-panel,
.recent-actions,
.overview-rail .panel {
  padding: 15px;
}

.traffic-panel .section-head,
.recent-actions .section-head {
  align-items: center;
}

.traffic-panel .section-head h2,
.recent-actions .section-head h2,
.overview-rail h2 {
  font-size: 15px;
}

.traffic-panel .section-head p,
.recent-actions .section-head p {
  margin-top: 3px;
  font-size: 11px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.traffic-dot,
.conversion-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.conversion-dot {
  margin-left: 5px;
  background: #d5a346;
}

.trend-chart {
  position: relative;
  height: 218px;
  margin-top: 12px;
  padding: 4px 0 22px;
}

.trend-grid {
  position: absolute;
  inset: 4px 0 22px;
  display: grid;
  grid-template-rows: repeat(5, 1fr);
}

.trend-grid span {
  border-top: 1px dashed #e5ebe9;
}

.trend-chart svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 180px;
  overflow: visible;
}

.trend-line {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.traffic-line {
  stroke: var(--brand);
}

.conversion-line {
  stroke: #d5a346;
}

.trend-axis {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.action-log-list {
  display: grid;
  margin-top: 8px;
}

.action-log-list > div {
  min-height: 56px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.action-log-list > div:last-child {
  border-bottom: 0;
}

.action-check {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

.action-log-list p,
.action-log-list b,
.action-log-list small {
  display: block;
  margin: 0;
}

.action-log-list b {
  font-size: 12px;
}

.action-log-list small,
.action-log-list time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.rail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.rail-title h2 {
  margin: 0;
}

.risk-alert {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  padding: 11px;
  border-radius: 6px;
  background: #fff4e7;
}

.risk-alert > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--amber);
  font-weight: 900;
}

.risk-alert b,
.risk-alert small {
  display: block;
}

.risk-alert b {
  font-size: 11px;
  line-height: 1.4;
}

.risk-alert small {
  margin-top: 3px;
  color: #8c6844;
  font-size: 10px;
}

.risk-center .btn {
  width: 100%;
  min-height: 34px;
  justify-content: center;
  margin-top: 10px;
  font-size: 11px;
}

.top-content-list {
  display: grid;
}

.top-content-row {
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.top-content-row:last-child {
  border-bottom: 0;
}

.content-rank {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--brand-strong);
  background: #e8f4ef;
  font-size: 11px;
  font-weight: 900;
}

.top-content-row b,
.top-content-row small {
  display: block;
}

.top-content-row b {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-content-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.boundary-summary > div:not(.rail-title):not(.progress) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.boundary-summary > div b {
  color: var(--ink);
}

.boundary-summary .progress {
  height: 7px;
  margin: 9px 0;
}

.boundary-summary > small {
  color: var(--muted);
  font-size: 10px;
}

.accounts-page .grid.cols-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.accounts-page .account-card {
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 1fr);
  align-items: center;
}

.accounts-page .account-card > .btn-row {
  grid-column: 1 / -1;
}

.scope-page {
  gap: 14px;
}

.scope-page > .section-head {
  align-items: center;
}

.scope-layout {
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.scope-form-panel,
.scope-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.scope-form-head,
.schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.scope-form-head b,
.schedule-head h2 {
  margin: 0;
  font-size: 15px;
}

.scope-form-head p,
.schedule-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.scope-form-head .btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

.scope-form-body {
  padding: 4px 16px;
}

.scope-form-body .scope-section {
  grid-template-columns: minmax(190px, 0.42fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px 20px;
  margin: 0;
  padding: 16px 0;
}

.scope-form-body .scope-section > :not(.scope-heading) {
  grid-column: 2;
}

.scope-form-body .scope-section:last-child {
  border-bottom: 0;
}

.scope-heading > span {
  width: 27px;
  height: 27px;
  border-radius: 5px;
}

.scope-heading h3 {
  font-size: 14px;
}

.scope-heading p {
  font-size: 11px;
}

.scope-form-body .field textarea {
  min-height: 68px;
}

.scope-controls.two-up {
  width: 100%;
  margin: 0;
}

.scope-preview {
  position: sticky;
  top: 72px;
  overflow: hidden;
}

.schedule-head {
  align-items: flex-start;
}

.schedule-platforms {
  padding: 4px 14px;
}

.schedule-platform {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.schedule-platform:last-child {
  border-bottom: 0;
}

.schedule-platform-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.schedule-platform-head .avatar {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  font-size: 10px;
}

.schedule-platform-head b,
.schedule-platform-head small {
  display: block;
}

.schedule-platform-head b {
  font-size: 12px;
}

.schedule-platform-head small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.schedule-slot {
  min-height: 44px;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding: 7px 8px;
  border-radius: 5px;
  background: #edf8f3;
}

.schedule-slot > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.schedule-slot b,
.schedule-slot small {
  display: block;
}

.schedule-slot b {
  font-size: 10px;
}

.schedule-slot small {
  max-width: 160px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-slot .tag {
  min-height: 21px;
  min-width: 48px;
  padding: 2px 6px;
  font-size: 9px;
  justify-content: center;
  white-space: nowrap;
}

.schedule-slot.empty-slot {
  background: #f4f6f5;
}

.schedule-slot.empty-slot > span {
  background: #aab5b2;
}

.scope-preview .boundary-note {
  margin: 0 14px 14px;
  background: #f5f7f6;
}

.binding-backdrop {
  backdrop-filter: blur(3px);
  background: rgba(16, 27, 34, 0.58);
}

.binding-modal {
  width: min(440px, 100%);
}

.binding-modal .modal-head {
  padding: 18px 20px;
}

.binding-modal .modal-head h2 {
  font-size: 19px;
}

.binding-modal .modal-body {
  padding: 18px 20px 20px;
}

.binding-platform {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9f8;
}

.binding-platform .avatar {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 11px;
}

.binding-platform small,
.binding-platform b {
  display: block;
}

.binding-platform small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.binding-steps {
  display: grid;
}

.binding-step {
  position: relative;
  min-height: 68px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
}

.binding-step:not(:last-child)::after {
  position: absolute;
  top: 30px;
  bottom: 4px;
  left: 14px;
  width: 1px;
  background: var(--line);
  content: "";
}

.binding-step > span {
  position: relative;
  z-index: 1;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 900;
}

.binding-step.active > span,
.binding-step.complete > span {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.binding-step b,
.binding-step p {
  display: block;
  margin: 0;
}

.binding-step b {
  padding-top: 2px;
  font-size: 13px;
}

.binding-step p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.binding-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 6px;
  background: #eaf7f2;
}

.binding-result p,
.binding-result b,
.binding-result small {
  display: block;
  margin: 0;
}

.binding-result b {
  font-size: 11px;
}

.binding-result small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1180px) {
  .grid.cols-4,
  .week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-dashboard,
  .results-hero,
  .task-board,
  .plan-layout,
  .report-layout,
  .scope-layout {
    grid-template-columns: 1fr;
  }

  .overview-layout {
    grid-template-columns: 1fr;
  }

  .overview-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scope-preview {
    position: static;
  }

  .ai-provider-layout {
    grid-template-columns: 1fr;
  }

  .agent-loop {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .auth-wrap {
    grid-template-columns: 1fr;
  }

  .auth-story {
    min-height: auto;
    padding: 30px 24px;
  }

  .auth-story h1 {
    margin-top: 30px;
    font-size: 34px;
  }

  .loop-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(290px, 86vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 12px 16px;
  }

  .content {
    padding: 18px 16px 38px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .split-row,
  .form-grid,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .result-chips,
  .completed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-only {
    display: none;
  }
}

@media (max-width: 560px) {
  .auth-panel {
    padding: 18px;
  }

  .auth-card {
    padding: 20px;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions .btn,
  .top-actions .ai-pill {
    flex: 1 1 auto;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .automation-banner,
  .scope-savebar {
    align-items: stretch;
    flex-direction: column;
  }

  .agent-loop {
    grid-template-columns: 1fr;
  }

  .result-chips,
  .completed-grid {
    grid-template-columns: 1fr;
  }

  .stepper {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
:root { --kb-border: #dde2e0; --kb-ink: #283430; }
.kb-workspace { padding: 24px; color: var(--kb-ink); letter-spacing: 0; min-width: 0; }
.kb-heading, .kb-actions, .kb-section-title, .kb-project-bar, .kb-pagination, .kb-version-actions { display: flex; align-items: center; gap: 10px; }
.kb-heading, .kb-section-title, .kb-pagination { justify-content: space-between; }
.kb-heading h2 { font-size: 23px; margin: 0 0 5px; }
.kb-heading .btn, .kb-dialog .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.kb-project-bar { padding: 18px 0; border-bottom: 1px solid var(--kb-border); flex-wrap: wrap; }
.kb-project-bar select { max-width: min(400px,100%); min-width: 0; }
.kb-layout { display: grid; grid-template-columns: 200px minmax(0,1fr); min-height: 450px; }
.kb-folders { padding: 16px 16px 16px 0; border-right: 1px solid var(--kb-border); min-width: 0; }
.kb-section-title { margin: 6px 0 12px; }
.kb-section-title h3 { font-size: 15px; margin: 0; }
.kb-folder { display: flex; align-items: center; gap: 8px; border: 0; width: 100%; padding: 10px 12px; text-align: left; background: transparent; border-radius: 4px; color: #56625c; min-width: 0; }
.kb-folder.active { background: #e5f3eb; color: #176b42; font-weight: 600; }
.kb-folder:hover { background: #edf1ef; }
.kb-folder span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-folder svg, .kb-file-link svg { flex-shrink: 0; }
.kb-main { padding: 16px 0 0 20px; min-width: 0; }
.kb-search { display: grid; grid-template-columns: minmax(100px,1fr) minmax(80px,150px) 36px auto; gap: 8px; margin-bottom: 16px; align-items: center; }
.kb-search input { min-width: 0; width: 100%; }
.kb-search input, .kb-project-bar select { border: 1px solid #d4ded8; border-radius: 4px; background: #fff; color: #344b3e; height: 36px; padding: 6px 10px; font: inherit; font-size: 13px; }
.kb-icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 4px; color: #52645b; cursor: pointer; }
.kb-icon-button:hover { border-color: #ced9d2; background: #edf3ef; }
.kb-icon-button:disabled { cursor: default; opacity: .35; }
.kb-icon-button:focus-visible, .kb-folder:focus-visible, .kb-file-link:focus-visible { outline: 2px solid #258152; outline-offset: 2px; }
.kb-table-wrap { overflow-x: auto; }
.kb-table { width: 100%; min-width: 680px; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.kb-table th { text-align: left; padding: 12px 8px; background: #f1f4f2; color: #68756e; font-size: 12px; font-weight: 500; }
.kb-table th:first-child { width: 27%; }.kb-table th:nth-child(2) { width: 20%; }.kb-table th:nth-child(3) { width: 22%; }.kb-table th:last-child { width: 52px; }
.kb-table td { border-bottom: 1px solid #e8ece9; padding: 14px 8px; vertical-align: top; overflow-wrap: anywhere; }
.kb-table small { display: block; margin-top: 4px; color: #7a837e; font-size: 11px; }
.kb-table .tag { white-space: normal; }
.kb-file-link { display: flex; align-items: flex-start; gap: 8px; background: none; border: 0; text-align: left; color: #243d2f; padding: 0; font-weight: 600; width: 100%; }
.kb-file-link span { min-width: 0; overflow-wrap: anywhere; }
.kb-file-link svg { margin-top: 2px; color: #4985a1; }
.kb-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.kb-tags span { color: #516875; background: #edf3f7; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.kb-table .kb-empty { text-align: center; padding: 85px 12px; color: #839087; }
.kb-pagination { margin-top: 10px; font-size: 12px; }
.kb-pagination>div { display: flex; }
.kb-overlay { position: fixed; inset: 0; z-index: 100; background: #17271e66; display: flex; align-items: center; justify-content: center; padding: 20px; }
.kb-dialog { background: #fff; width: 520px; max-width: 100%; max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #d5dfd9; border-radius: 8px; padding: 22px; box-shadow: 0 18px 60px #14291c22; min-width: 0; }
.kb-dialog.kb-detail { width: 740px; }
.kb-dialog>header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.kb-dialog h2 { font-size: 18px; line-height: 1.45; margin: 3px 0 0; min-width: 0; overflow-wrap: anywhere; }
.kb-dialog .field { margin-bottom: 14px; min-width: 0; }
.kb-dialog input, .kb-dialog select { max-width: 100%; min-width: 0; }
.kb-dialog input[type=file] { padding: 10px 0; border: 0; font-size: 13px; }
.kb-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 14px 0; line-height: 1.6; }
.kb-check input { flex-shrink: 0; width: auto; margin-top: 4px; }
.kb-two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kb-format-note { color: #7b8580; font-size: 11px; margin: 12px 0 20px; overflow-wrap: anywhere; }
.kb-detail-status { display: flex; gap: 12px; margin-bottom: 18px; overflow-wrap: anywhere; }
.kb-dialog #kb-metadata-form { border-bottom: 1px solid var(--kb-border); padding-bottom: 18px; margin-bottom: 20px; }
.kb-version { border-bottom: 1px solid #e6ece8; padding: 12px 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
.kb-version small { display: block; font-size: 12px; color: #7c8880; margin: 8px 0 4px; }
.kb-version code { font-size: 10px; color: #859189; word-break: break-all; }
.kb-version-actions { flex-wrap: wrap; justify-content: flex-end; align-content: center; }
.kb-version-actions .btn { padding: 7px 10px; font-size: 12px; min-height: 34px; }
.kb-preview { margin-top: 18px; border-top: 1px solid var(--kb-border); padding-top: 12px; }
.kb-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; background: #f5f7f6; padding: 14px; font: 13px/1.7 ui-monospace,monospace; }
.kb-preview img { display: block; max-width: 100%; max-height: 400px; object-fit: contain; margin: auto; }
.kb-preview dl>div { display: flex; gap: 30px; margin: 8px 0; font-size: 13px; }.kb-preview dt { width: 90px; color: #7b8980; }.kb-preview dd { margin: 0; }
.kb-dialog progress { width: 100%; accent-color: #268357; height: 8px; }
.kb-upload-results { list-style: none; padding: 0; }.kb-upload-results li { padding: 12px 0; border-bottom: 1px solid var(--kb-border); overflow-wrap: anywhere; }.kb-upload-results span { display: block; font-size: 12px; color: #7f887f; margin-top: 5px; }
.kb-wrap { overflow-wrap: anywhere; }
@media(max-width:600px) {
  .kb-table { min-width: 0; }
  .kb-table th:nth-child(2), .kb-table td:nth-child(2), .kb-table th:nth-child(4), .kb-table td:nth-child(4), .kb-table th:nth-child(5), .kb-table td:nth-child(5) { display: none; }
  .kb-table th:first-child { width: 53%; }.kb-table th:nth-child(3) { width: 34%; }.kb-table th:last-child { width: 13%; }
  .kb-table td, .kb-table th { padding-left: 4px; padding-right: 4px; }.kb-table .tag { font-size: 10px; padding: 3px 5px; }
}
.admin-layout .topbar { min-height: 72px; gap: 16px; padding: 14px 24px; }
.admin-layout .top-title { min-width: 0; }
.admin-layout .top-title h1 { font-size: 22px; line-height: 1.4; letter-spacing: 0; overflow-wrap: anywhere; }
.admin-layout .top-title p:empty { display: none; }
.admin-layout .top-actions { gap: 10px; flex-wrap: wrap; }
.admin-layout .top-actions .ai-pill, .admin-layout .top-actions .role-badge { font-size: 12px; padding: 7px 10px; border-radius: 4px; }
.admin-layout .top-actions .tag { font-size: 12px; }
.admin-layout .content { padding: 24px; }
.admin-layout .nav-btn { font-size: 14px; min-height: 42px; }
.admin-layout .admin-nav-status { margin-left: auto; flex: 0 0 auto; padding: 1px 4px; border: 1px solid #726341; border-radius: 4px; color: #d7bd7c; font-size: 11px; line-height: 1.5; letter-spacing: 0; }
.admin-layout .brand strong { font-size: 22px; }
.admin-layout .brand small { font-size: 12px; }
.admin-layout .nav-icon svg { width: 19px; height: 19px; }
.admin-layout .mobile-menu svg { width: 20px; height: 20px; }
.admin-layout .admin-nav-close, .admin-layout .admin-nav-scrim { display: none; }
@media(max-width:900px) {
  .admin-layout .admin-nav-close { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; margin-left: auto; padding: 6px; border: 0; border-radius: 4px; color: #d5e3df; background: transparent; }
  .admin-layout .admin-nav-close svg { width: 20px; height: 20px; }
  .admin-layout .admin-nav-scrim { display: block; position: fixed; inset: 0; z-index: 65; border: 0; border-radius: 0; background: #10232166; }
}
@media(max-width:700px) {
  .admin-layout .topbar { padding: 12px 16px; align-items: flex-start; flex-wrap: wrap; }
  .admin-layout .top-title h1 { font-size: 20px; }
  .admin-layout .top-actions { width: 100%; justify-content: flex-start; gap: 6px; }
  .admin-layout .top-actions .role-badge { display: none; }
  .admin-layout .content { padding: 18px 16px; }
}
@media(max-width:380px) {
  .admin-layout .top-actions .ai-pill { display: none; }
  .admin-layout .content { padding: 16px 12px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media(max-width:1000px) { .kb-layout { grid-template-columns: 155px minmax(0,1fr); }.kb-workspace { padding: 18px; }.kb-main { padding-left: 12px; } }
@media(max-width:600px) { .kb-workspace { padding: 14px; }.kb-heading h2 { font-size: 20px; }.kb-heading>div:first-child { min-width: 0; }.kb-heading .subtle { display: block; overflow-wrap: anywhere; }.kb-heading .btn { padding: 8px 10px; font-size: 12px; white-space: nowrap; }.kb-layout { grid-template-columns: minmax(0,1fr); }.kb-folders { display: flex; overflow-x: auto; gap: 5px; border-right: 0; border-bottom: 1px solid var(--kb-border); padding: 10px 0; }.kb-folders .kb-section-title { margin: 0; }.kb-folders h3 { display: none; }.kb-folder { width: auto; flex-shrink: 0; max-width: 180px; padding: 7px 10px !important; font-size: 12px; }.kb-main { padding: 12px 0 0; }.kb-overlay { padding: 10px; }.kb-dialog { padding: 16px; max-height: calc(100dvh - 20px); }.kb-two-fields { grid-template-columns: 1fr; gap: 0; }.kb-version { grid-template-columns: minmax(0,1fr); gap: 4px; }.kb-version-actions { justify-content: flex-start; }.kb-search { grid-template-columns: minmax(100px,1fr) minmax(80px,110px) 36px; }.kb-search>button:last-child:not([type=submit]) { grid-column: 3; }.kb-detail-status { flex-wrap: wrap; } }
