:root {
  --bg: #08070d;
  --bg-soft: #0e0b17;
  --panel: #14111f;
  --panel-2: #1b1629;
  --ink: #f4f0e8;
  --muted: #a8a1b8;
  --line: rgba(216, 180, 91, 0.22);
  --soft-line: rgba(255, 255, 255, 0.08);
  --purple: #6d4fd3;
  --purple-2: #352157;
  --gold: #d8b45b;
  --gold-soft: rgba(216, 180, 91, 0.14);
  --green: #3dc786;
  --rose: #ff5f8f;
  --blue: #35a7ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.light {
  --bg: #f7f8fb;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f4f8;
  --ink: #1a2030;
  --muted: #6d7586;
  --line: #dde2ec;
  --soft-line: #edf0f5;
  --purple: #6d4fd3;
  --purple-2: #ebe7ff;
  --gold: #b58a2b;
  --gold-soft: #fff6dd;
  --shadow: 0 14px 34px rgba(35, 44, 70, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 0%, rgba(109, 79, 211, 0.20), transparent 30%),
    linear-gradient(135deg, #07060b 0%, #120d20 45%, #050408 100%);
}

body.light {
  background:
    linear-gradient(180deg, rgba(109, 79, 211, 0.08), transparent 360px),
    var(--bg);
}

body.auth-only .app-shell {
  grid-template-columns: 1fr;
}

body.auth-only .sidebar,
body.auth-only .topbar,
body.auth-only .page-head,
body.auth-only .sidebar-backdrop {
  display: none;
}

body.auth-only .view {
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 16px;
  background: linear-gradient(180deg, #0b0812, #100b1b 58%, #07060b);
  border-right: 1px solid var(--line);
  color: #f8f1df;
}

body.light .sidebar {
  background: #ffffff;
  color: #202636;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #0a0810;
  background: linear-gradient(135deg, var(--gold), #fff0a6);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(216, 180, 91, 0.36), 0 14px 28px rgba(216, 180, 91, 0.12);
}

.brand-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: inherit;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(216, 180, 91, 0.11);
}

body.light .nav-item:hover,
body.light .nav-item.active {
  background: #f1eefc;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--gold);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
}

.soon-dot {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 11px;
}

.manager-box {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

body.light .manager-box {
  background: #f8f9fc;
}

.manager-label,
.sidebar-footer,
.muted {
  color: var(--muted);
}

.manager-name {
  margin-top: 6px;
  font-weight: 600;
}

.manager-link {
  display: block;
  margin-top: 7px;
  color: var(--gold);
  font-size: 12px;
}

.sidebar-footer {
  margin-top: 26px;
  padding: 10px;
  font-size: 12px;
}

.sidebar-backdrop {
  display: none;
}

.workspace {
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 26px;
  background: rgba(8, 7, 13, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

body.light .topbar {
  background: rgba(255, 255, 255, 0.84);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu {
  display: none;
}

.primary-btn,
.purple-btn,
.ghost-btn,
.tool-btn,
.icon-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 500;
  white-space: nowrap;
}

.primary-btn {
  color: #0b0810;
  background: linear-gradient(135deg, var(--gold), #f3d77b);
}

.purple-btn {
  color: #ffffff;
  background: var(--purple);
}

.ghost-btn,
.tool-btn {
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.icon-btn {
  width: 38px;
  padding: 0;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.mobile-menu {
  display: none;
}

.balance-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: var(--radius);
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--line);
  font-weight: 600;
}

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.theme-switch button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.theme-switch button.active {
  color: #0b0810;
  background: var(--gold);
}

.profile-wrap {
  position: relative;
}

.profile-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #0b0810;
  background: var(--gold);
  font-size: 11px;
  font-weight: 600;
}

.avatar.big {
  width: 62px;
  height: 62px;
  font-size: 18px;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  z-index: 80;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-name {
  font-weight: 600;
}

.profile-email {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.profile-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.profile-menu button:hover {
  background: var(--panel-2);
}

.profile-warning {
  display: block;
  margin: 4px 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-style: normal;
}

.auth-panel {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 17, 31, 0.96), rgba(14, 11, 23, 0.98));
  box-shadow: var(--shadow);
}

body.light .auth-panel {
  background: #ffffff;
}

.auth-brand {
  margin-bottom: 26px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
}

.auth-panel p,
.auth-footnote,
.auth-status {
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-error {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 95, 143, 0.34);
  border-radius: var(--radius);
  color: #ffd4df;
  background: rgba(255, 95, 143, 0.10);
  font-size: 13px;
}

body.light .auth-error {
  color: #9e2145;
}

.auth-footnote {
  margin-top: 16px;
  font-size: 12px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 30px 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
}

.page-head p:not(.eyebrow) {
  max-width: 700px;
  margin: 8px 0 0;
  color: var(--muted);
  overflow-wrap: break-word;
}

.view {
  display: grid;
  gap: 18px;
  padding: 0 30px 36px;
}

.view > *,
.page-head > div,
.toolbar > * {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.segmented button {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: #0b0810;
  background: var(--gold);
}

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

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

.metric-card {
  min-height: 104px;
  display: grid;
  align-content: space-between;
  padding: 16px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.metric-card strong {
  font-size: 24px;
  font-weight: 500;
}

.metric-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric-card.gold {
  border-color: var(--line);
  background: linear-gradient(135deg, var(--panel), var(--gold-soft));
}

.metric-card.good em {
  color: var(--green);
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(20, 17, 31, 0.88);
  box-shadow: var(--shadow);
}

body.light .panel {
  background: var(--panel);
}

.compact-panel {
  margin-bottom: 14px;
}

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

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(170px, 1fr) minmax(230px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.inline-form label,
.inline-form input,
.inline-form select {
  min-width: 0;
}

.stack-cell {
  display: grid;
  gap: 4px;
}

.stack-cell small,
.danger-text {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.danger-text {
  color: #ff8daa;
}

.panel h2,
.modal h2,
.drawer h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.panel h3,
.modal h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.panel p,
.modal-copy,
.drawer p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-note {
  max-width: 270px;
  padding: 10px 12px;
  border: 1px solid rgba(53, 167, 255, 0.26);
  border-radius: var(--radius);
  color: #aee0ff;
  background: rgba(53, 167, 255, 0.10);
  font-size: 12px;
}

body.light .status-note {
  color: #146493;
}

.status-note.danger {
  max-width: none;
  color: #ffd4df;
  border-color: rgba(255, 95, 143, 0.34);
  background: rgba(255, 95, 143, 0.10);
}

body.light .status-note.danger {
  color: #9e2145;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--soft-line);
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 500;
}

body.light .data-table th {
  background: #f7f8fb;
}

.data-table tbody tr:hover {
  background: rgba(216, 180, 91, 0.06);
}

.row-title {
  color: var(--ink);
  font-weight: 500;
}

.graph-panel {
  background: linear-gradient(135deg, var(--panel), rgba(109, 79, 211, 0.13));
}

.bar-chart {
  display: grid;
  gap: 11px;
}

.bar-item {
  display: grid;
  grid-template-columns: 130px minmax(120px, 1fr) 90px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--gold));
}

.two-col {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.format-grid,
.check-grid,
.option-grid,
.method-grid,
.offer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-card,
.method-card,
.option-card,
.offer-card,
.preset-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel-2);
}

.check-card {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-card input,
.check-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--gold);
}

.full {
  width: 100%;
}

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

.ad-card {
  padding: 16px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.ad-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.ad-card h3 {
  margin: 14px 0 5px;
  font-size: 16px;
  font-weight: 500;
}

.ad-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--line);
  font-size: 12px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.row-actions .tool-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.staff-secret {
  margin-top: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.ad-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
}

.status.active,
.status.completed {
  color: var(--green);
  background: rgba(61, 199, 134, 0.12);
}

.status.review,
.status.in-progress,
.status.pending {
  color: var(--gold);
  background: var(--gold-soft);
}

.method-card {
  text-align: left;
}

.method-card.active,
.option-card.active {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.method-card span,
.method-card em,
.offer-card span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.api-panel {
  display: grid;
  gap: 18px;
}

.token-input {
  max-width: 520px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.api-block h3 {
  margin-bottom: 8px;
}

.code-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: #07060b;
}

body.light .code-line {
  background: #f6f7fb;
}

code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.doc-details {
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  padding: 14px;
}

.doc-details summary {
  cursor: pointer;
  color: var(--gold);
}

.doc-grid {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
}

.doc-grid span {
  color: var(--muted);
}

.soon-panel {
  min-height: 420px;
  display: grid;
  align-content: center;
  justify-items: start;
}

.soon-large {
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 600;
}

.ai-layout {
  grid-template-columns: 0.78fr 1.22fr;
}

.prompt-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.prompt-list button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel-2);
  text-align: left;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(300px, 1fr) auto;
  gap: 12px;
}

.chat-window {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 340px;
  max-height: 480px;
  overflow-y: auto;
}

.message {
  max-width: 82%;
  padding: 12px;
  border-radius: var(--radius);
  line-height: 1.45;
  font-size: 14px;
}

.message.assistant {
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--soft-line);
}

.message.user {
  justify-self: end;
  color: #0b0810;
  background: var(--gold);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

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

.referral-steps span {
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--panel-2);
  text-align: center;
}

.manager-card-large {
  display: flex;
  align-items: center;
  gap: 16px;
}

.manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.manager-rules {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--soft-line);
}

.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
}

.modal {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel-2);
}

.modal-section {
  margin-top: 18px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
}

.filter-list,
.preset-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.preset-row {
  width: 100%;
  text-align: left;
}

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

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 18px;
}

.empty-state {
  margin-top: 16px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.drawer-backdrop {
  place-items: stretch end;
  padding: 0;
}

.drawer {
  position: relative;
  width: min(460px, 100%);
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.drawer-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  margin: 20px 0;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.drawer-meta span {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 264px;
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    background: rgba(0, 0, 0, 0.45);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .mobile-menu {
    display: inline-flex;
  }
}

@media (max-width: 880px) {
  .topbar,
  .page-head,
  .view {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .metric-grid,
  .metric-grid.compact,
  .two-col,
  .ad-card-list,
  .format-grid,
  .method-grid,
  .offer-grid,
  .referral-steps,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

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

  .topbar-left,
  .topbar-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .chat-form,
  .copy-field,
  .inline-form,
  .bar-item {
    grid-template-columns: 1fr;
  }

  .status-cluster {
    justify-content: flex-start;
  }
}

.brand strong {
  display: block;
  font-weight: 600;
}

.brand span,
.manager-mini span {
  color: var(--muted);
  font-size: 12px;
}

.soon-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 11px;
}

.manager-mini {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

body.light .manager-mini {
  background: #f8f9fc;
}

.terms-link {
  margin-top: 14px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.role-switch button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.role-switch button.active {
  color: #0b0810;
  background: var(--gold);
}

.profile-btn span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #0b0810;
  background: var(--gold);
  font-size: 11px;
  font-weight: 600;
}

.profile-menu > strong,
.profile-menu > span {
  display: block;
}

.profile-menu > span {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(53, 167, 255, 0.26);
  border-radius: var(--radius);
  color: #aee0ff;
  background: rgba(53, 167, 255, 0.10);
  font-size: 12px;
  white-space: nowrap;
}

body.light .info-pill {
  color: #146493;
}

.link-btn {
  padding: 0;
  color: var(--gold);
  background: transparent;
  text-align: left;
  font-weight: 500;
}

.link-btn:hover {
  text-decoration: underline;
}

.tool-btn.tiny,
.ghost-btn.tiny {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.good {
  color: var(--green);
}

.bad {
  color: var(--rose);
}

.metric-card.warn em {
  color: var(--gold);
}

.admin-toolbar {
  align-items: end;
}

.search-field {
  min-width: min(420px, 100%);
  flex: 0 1 420px;
}

.panel-head .info-pill {
  max-width: 280px;
  white-space: normal;
  text-align: left;
}

.admin-grid,
.ad-layout,
.api-layout,
.ai-layout,
.security-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
}

.request-form {
  display: grid;
  gap: 14px;
}

.route-list,
.crm-grid,
.endpoint-list,
.mini-list {
  display: grid;
  gap: 10px;
}

.route-card,
.crm-card,
.endpoint-list article,
.mini-list article,
.formula-card,
.copy-box {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.route-card span,
.route-card em,
.crm-card span,
.crm-card em,
.endpoint-list span,
.formula-card span,
.copy-box span,
.mini-list span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.route-card b,
.formula-card b {
  color: var(--gold);
  font-weight: 600;
}

.copy-box {
  margin-top: 14px;
}

.copy-box code {
  color: var(--ink);
  line-height: 1.45;
}

.formula-card {
  margin-top: 14px;
}

.single-soon {
  min-height: 300px;
  justify-items: start;
}

.single-soon p {
  color: var(--gold);
  font-size: 42px;
  line-height: 1;
}

.quick-prompts {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.quick-prompts button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel-2);
  text-align: left;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px minmax(160px, 1fr) 100px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-row > div {
  display: grid;
  gap: 4px;
  min-height: 10px;
}

.bar-row i {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), var(--gold));
}

.bar-row i.revenue {
  background: linear-gradient(90deg, #7258dd, #b9a7ff);
}

.bar-row i.money {
  background: linear-gradient(90deg, var(--gold), #ffe59a);
}

.bar-row i.profit {
  background: linear-gradient(90deg, var(--green), #9ef0c7);
}

.code-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: #07060b;
}

body.light .code-block {
  background: #f6f7fb;
}

.code-block pre {
  margin: 0;
  min-width: 0;
  overflow-x: auto;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.token-box {
  margin: 14px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--gold);
  background: var(--gold-soft);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

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

.wide-drawer {
  width: min(720px, 100%);
}

.mini-table {
  min-width: 480px;
}

.fraud-score {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(circle at center, var(--gold-soft), transparent 72%);
}

.fraud-score strong {
  color: var(--gold);
  font-size: 54px;
  font-weight: 500;
}

.fraud-score span {
  color: var(--muted);
}

.crm-card {
  border-left: 3px solid var(--gold);
}

.crm-card.high {
  border-left-color: var(--rose);
}

.crm-card.medium {
  border-left-color: var(--gold);
}

.crm-card.low {
  border-left-color: var(--green);
}

.crm-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crm-card strong {
  color: var(--gold);
  font-weight: 600;
}

.crm-card p {
  margin: 0;
}

@media (max-width: 1100px) {
  .admin-grid,
  .ad-layout,
  .api-layout,
  .ai-layout,
  .security-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .role-switch,
  .theme-switch {
    width: 100%;
  }

  .topbar-left {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    width: 100%;
  }

  .topbar-left > .primary-btn {
    min-width: 0;
    padding: 0 10px;
    font-size: 14px;
  }

  .topbar-left > .balance-pill {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }

  .topbar-right {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    width: 100%;
  }

  .role-switch,
  .theme-switch {
    grid-column: 1 / -1;
  }

  .profile-wrap,
  .profile-btn {
    min-width: 0;
  }

  .profile-btn {
    width: 100%;
    justify-content: flex-start;
  }

  .profile-btn strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .copy-row,
  .code-block,
  .settings-grid,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .ad-actions {
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: grid;
  }

  .drawer,
  .wide-drawer {
    width: 100%;
  }
}
