:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #121212;
  --panel-2: #1f1f1f;
  --panel-3: #171717;
  --line: #ffffff1a;
  --line-strong: #ffffff2b;
  --text: #fafafa;
  --muted: #c4c4c4;
  --soft: #ffffff80;
  --lime: #ebf701;
  --cyan: #0ef5ff;
  --danger: #ff5f57;
  --warn: #ffc857;
  --ok: #7cff9b;
  --shadow: 0 24px 80px #00000080;
  --footer-clearance: 68px;
  --select-arrow: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23fafafa' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --font-head: "Montserrat", Arial, Helvetica, sans-serif;
  --font-body: "Montserrat", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, #ffffff08 1px, transparent 1px),
    linear-gradient(#ffffff08 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, #0ef5ff26 0, transparent 28rem),
    radial-gradient(circle at 82% 2%, #ebf70124 0, transparent 24rem),
    #000;
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
  font-family: var(--font-body);
  letter-spacing: 0;
  overflow-x: hidden;
}

body.auth-loading .app-shell,
body.auth-locked .app-shell {
  display: none;
}

body:not(.auth-loading):not(.auth-locked) .login-screen {
  display: none;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 22px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #0ef5ff10, transparent 42%),
    linear-gradient(315deg, #ebf70112, transparent 58%),
    #101010f2;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 4px;
  font-family: var(--font-head);
  font-size: 24px;
  line-height: 1.1;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-grid;
  width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #ffffff10;
  color: var(--text);
  outline: none;
}

.login-card input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px #0ef5ff2b;
}

.login-card input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px #ff5f5726;
}

.login-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.login-submit {
  width: 100%;
}

body.is-light {
  color-scheme: light;
  --bg: #eef1ea;
  --panel: #f8faf5;
  --panel-2: #edf1e8;
  --panel-3: #ffffff;
  --line: #1c25101f;
  --line-strong: #1c25103d;
  --text: #151915;
  --muted: #4f584f;
  --soft: #717a70;
  --lime: #93af2d;
  --cyan: #2497a7;
  --danger: #d94f45;
  --warn: #b8831f;
  --ok: #348a57;
  --shadow: 0 18px 58px #18210f22;
  --select-arrow: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23151915' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color: var(--text);
  background:
    linear-gradient(90deg, #1c251008 1px, transparent 1px),
    linear-gradient(#1c251008 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, #2497a71a 0, transparent 27rem),
    radial-gradient(circle at 82% 2%, #93af2d1f 0, transparent 24rem),
    #eef1ea;
}

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

button {
  cursor: pointer;
}

button:focus {
  outline: none;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #0ef5ffb8;
  outline-offset: 2px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar,
  .app-footer {
    background: #050505f7;
  }

  .ai-panel {
    background: #050505;
  }
}

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

.app-shell.is-analytics-view {
  grid-template-columns: 268px minmax(0, 1fr);
}

.app-shell:not(.is-analytics-view) .ai-panel {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #000000d1;
  padding: 22px 16px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

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

.brand-title {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

.brand-subtitle,
.panel-head p,
#pageSubtitle,
.rule-description,
.log-cell-muted {
  color: var(--soft);
}

.brand-subtitle {
  margin-top: 5px;
  font-size: 12px;
}

.brand-subtitle,
#pageSubtitle,
.panel-head p,
.group-title > span,
.builder-head span,
.campaign-selector > div > span,
.analytics-shortcut > div > span,
.empty-rules-state span,
.decision-preview span,
.setup-card > div > span,
.tariff-card p,
.tariff-note span {
  display: none !important;
}

.summary-strip {
  display: none !important;
}

.level-nav {
  display: grid;
  gap: 8px;
}

.sidebar-account {
  display: grid;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.user-chip,
.logout-button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
  color: var(--muted);
  padding: 9px 10px;
  font-family: var(--font-head);
  font-size: 12px;
}

.user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip svg,
.logout-button svg,
.password-toggle svg {
  width: 17px;
  height: 17px;
}

.logout-button {
  width: 100%;
  background: transparent;
  text-align: left;
}

.logout-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.is-context-hidden {
  display: none !important;
}

.ai-launcher {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  border: 1px solid #0ef5ff40;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #0ef5ff18, #ebf70112 58%, #ffffff08),
    #101010;
  color: var(--text);
  padding: 10px;
  text-align: left;
  box-shadow: inset 0 1px 0 #ffffff12, 0 0 24px #0ef5ff10;
}

.ai-launcher::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: linear-gradient(180deg, var(--cyan), var(--lime));
}

.ai-launcher:hover {
  border-color: #ebf70170;
  transform: translateX(2px);
}

.ai-launcher.is-active {
  border-color: #0ef5ff70;
  background:
    linear-gradient(90deg, #0ef5ff1d, #ebf70113 72%),
    #101410;
}

.ai-launcher-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background:
    radial-gradient(circle at 72% 24%, #ffffffb8 0 2px, transparent 3px),
    linear-gradient(145deg, var(--lime), #b7ff00);
  color: #000;
  box-shadow: inset 0 1px 0 #ffffff80, 0 0 18px #ebf70135;
}

.ai-glyph {
  position: relative;
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  font-family: var(--font-head);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.ai-glyph::before,
.ai-glyph::after {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.ai-glyph::before {
  right: -3px;
  top: 2px;
}

.ai-glyph::after {
  bottom: 2px;
  left: -3px;
}

.ai-launcher-title,
.ai-launcher-subtitle {
  display: block;
  min-width: 0;
}

.ai-launcher-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
}

.ai-launcher-subtitle {
  margin-top: 3px;
  color: var(--soft);
  font-size: 10px;
}

.ai-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px #0ef5ffcc;
}

.nav-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: var(--line-strong);
  background: linear-gradient(90deg, #ffffff12, #ffffff08);
  color: var(--text);
}

.nav-button:hover {
  transform: translateX(2px);
}

.nav-button.is-active .nav-icon {
  background: var(--lime);
  color: #000;
}

.nav-icon,
.preview-icon,
.action-icon,
.ai-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff0d;
  color: var(--cyan);
}

.nav-icon svg,
.preview-icon svg,
.action-icon svg,
.ai-icon svg,
.icon-button svg,
.mode-btn svg,
.theme-toggle svg,
.primary-button svg,
.toggle-rule svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.nav-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-head);
  font-size: 13px;
}

.nav-count {
  min-width: 28px;
  border-radius: 999px;
  background: #ffffff12;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 20px #ebf701cc;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.workspace {
  min-width: 0;
  overflow-x: hidden;
  padding: 26px 30px 130px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

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

h1,
h2,
h3,
.metric-value,
.completion {
  font-family: var(--font-head);
}

h1 {
  font-size: 26px;
  line-height: 1.1;
}

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

.plan-badge {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  border: 1px solid #ebf70166;
  border-radius: 999px;
  background: #ebf70114;
  color: var(--lime);
  padding: 4px 9px;
  font-family: var(--font-head);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
}

#pageSubtitle {
  margin-top: 8px;
  max-width: 700px;
  font-size: 13px;
  line-height: 1.5;
}

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

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
}

.mode-btn,
.theme-toggle,
.primary-button,
.icon-button,
.toggle-rule {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.mode-btn {
  background: transparent;
  color: var(--soft);
  font-size: 12px;
}

.theme-toggle {
  width: 40px;
  min-width: 40px;
  min-height: 38px;
  padding: 0;
  border-color: var(--line);
  background: #ffffff06;
  color: var(--soft);
}

.theme-toggle[aria-pressed="true"] {
  border-color: var(--line);
  background: #ffffff08;
  color: var(--soft);
}

.mode-btn.is-active {
  background: var(--lime);
  color: #000;
}

.primary-button {
  background: var(--lime);
  color: #000;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
}

.save-button {
  min-height: 38px;
  border-color: #0ef5ff4f;
  background:
    linear-gradient(180deg, #30fbff, var(--cyan));
  color: #001012;
  padding: 9px 14px;
  box-shadow: 0 0 0 1px #0ef5ff24, 0 12px 34px #0ef5ff1c;
}

.save-button:hover {
  border-color: #0ef5ff99;
  background:
    linear-gradient(180deg, #66fdff, #10ecf5);
}

.icon-button {
  width: 38px;
  padding: 0;
  background: #ffffff12;
  color: var(--text);
}

.icon-button.ghost {
  background: transparent;
  border-color: var(--line);
}

.primary-button:hover,
.icon-button:hover,
.mode-btn:hover,
.theme-toggle:hover,
.toggle-rule:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.metric {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff10, transparent 46%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 15px;
  box-shadow: inset 0 1px 0 #ffffff12;
}

.metric-label {
  color: var(--soft);
  font-size: 12px;
}

.metric-value {
  margin-top: 7px;
  color: var(--text);
  font-size: 17px;
  line-height: 1;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.content-layout.is-single-column {
  grid-template-columns: minmax(0, 1fr);
}

.content-layout.is-single-column .scope-panel {
  display: none;
}

.scope-panel,
.rules-panel,
.empty-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121212eb;
  box-shadow: var(--shadow);
}

.scope-panel {
  padding: 18px;
  background:
    linear-gradient(180deg, #1f1f1ff2, #101010f2),
    #121212;
}

.rules-panel {
  overflow: hidden;
}

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

.panel-head.with-tabs {
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #1f1f1f;
  padding: 16px 18px;
}

.panel-head h2 {
  font-size: 13px;
  line-height: 1.2;
}

.panel-head p {
  margin-top: 5px;
  font-size: 12px;
}

.completion {
  min-width: 72px;
  border: 1px solid #ebf70166;
  border-radius: 8px;
  background: #ebf70112;
  padding: 8px 10px;
  color: var(--lime);
  font-size: 13px;
  text-align: center;
}

.scope-grid {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

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

.scope-grid label {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, #0ef5ff12, transparent 5px),
    #0000004f;
  padding: 10px 12px 10px 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 #ffffff0a;
}

.scope-grid select {
  min-height: 28px;
  border: 0;
  background: var(--select-arrow) no-repeat right 0 center / 18px 18px;
  background-color: transparent;
  padding: 0 28px 0 0;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
  text-transform: none;
}

select,
input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  padding: 8px 10px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background: #000 var(--select-arrow) no-repeat right 14px center / 18px 18px;
  padding-right: 44px;
}

input {
  background: #000;
}

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

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.decision-preview {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.decision-preview strong {
  display: block;
  font-family: var(--font-head);
  font-size: 13px;
}

.decision-preview span {
  display: block;
  margin-top: 5px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.ai-panel {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(180deg, #101010f2, #050505f5),
    #000;
  padding: 22px 16px 82px;
  box-shadow: -24px 0 80px #00000042;
}

.ai-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--cyan), var(--lime), transparent);
  opacity: 0.85;
}

.ai-panel.is-pulsed {
  box-shadow: -24px 0 80px #00000042, 0 0 0 1px #0ef5ff66, 0 0 34px #0ef5ff24;
}

.ai-panel-head {
  position: relative;
  display: flex;
  min-height: 86px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  border: 1px solid #0ef5ff30;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #0ef5ff14, transparent 42%),
    linear-gradient(315deg, #ebf70114, transparent 52%),
    #111;
  padding: 12px;
}

.ai-panel-head > div {
  min-width: 0;
}

.ai-kicker {
  display: block;
  color: var(--cyan);
  font-family: var(--font-head);
  font-size: 11px;
  text-transform: uppercase;
}

.ai-panel h2 {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.12;
  overflow-wrap: break-word;
}

.ai-status-pill {
  display: inline-flex;
  margin-top: 8px;
  border: 1px solid #ebf70155;
  border-radius: 999px;
  background: #ebf70112;
  color: var(--lime);
  padding: 5px 8px;
  font-size: 10px;
}

.ai-mark {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 10px;
  background:
    radial-gradient(circle at 70% 24%, #ffffff99 0 3px, transparent 7px),
    linear-gradient(145deg, var(--lime), var(--cyan));
  color: #000;
  box-shadow: 0 0 28px #0ef5ff30;
}

.ai-glyph-large {
  width: 30px;
  height: 30px;
  border-width: 2px;
  border-radius: 8px;
  font-size: 11px;
}

.ai-mark-spark {
  position: absolute;
  right: -6px;
  top: -6px;
  width: 20px;
  height: 20px;
  border: 1px solid #00000040;
  border-radius: 999px;
  background:
    radial-gradient(circle, #000 0 2px, transparent 3px),
    var(--lime);
  color: #000;
}

.ai-mark-spark::before,
.ai-mark-spark::after {
  position: absolute;
  background: #000;
  border-radius: 999px;
  content: "";
}

.ai-mark-spark::before {
  inset: 4px 8px;
}

.ai-mark-spark::after {
  inset: 8px 4px;
}

.ai-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ai-controls label {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
  padding: 9px;
  text-transform: uppercase;
}

.ai-controls select {
  min-height: 26px;
  border: 0;
  background: var(--select-arrow) no-repeat right 0 center / 16px 16px;
  padding: 0 22px 0 0;
  font-family: var(--font-head);
  font-size: 12px;
}

.ai-prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.ai-prompt-row input {
  min-height: 38px;
  border-color: #0ef5ff55;
  background:
    linear-gradient(90deg, #0ef5ff0d, transparent),
    #00000066;
  font-size: 12px;
  box-shadow: 0 0 0 1px #00000030, inset 0 1px 0 #ffffff0a;
}

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

.ai-chip-row button {
  border: 1px solid #ffffff14;
  border-radius: 999px;
  background: #ffffff0a;
  color: var(--soft);
  padding: 6px 8px;
  font-size: 10px;
}

.ai-chip-row button:hover {
  border-color: #0ef5ff55;
  color: var(--cyan);
}

.ai-export-button,
.ai-recommend-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
}

.ai-export-button {
  background:
    linear-gradient(90deg, #ffffff10, #0ef5ff0d),
    #101010;
  color: var(--text);
}

.ai-recommend-button {
  width: fit-content;
  min-width: min(100%, 250px);
  border-color: #ebf70175;
  background: var(--lime);
  color: #000;
  padding-inline: 16px;
}

.ai-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff0d, transparent 54%),
    #121212d9;
  padding: 12px;
}

.ai-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-section-title h3 {
  font-size: 13px;
}

.ai-section-title span {
  color: var(--soft);
  font-size: 11px;
}

.ai-stats-list {
  display: grid;
  gap: 8px;
}

.ai-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  gap: 14px;
  align-items: center;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #0ef5ff08, transparent 46%),
    #00000035;
  padding: 11px;
}

.ai-account-row strong,
.ai-output strong {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
}

.ai-account-row span,
.ai-output span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 10px;
  line-height: 1.35;
}

.ai-account-row span b {
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 700;
}

.ai-stat-value {
  justify-self: end;
  min-width: 112px;
  border: 1px solid #ffffff12;
  border-radius: 7px;
  background: #ffffff07;
  padding: 7px 8px;
  text-align: right;
}

.ai-stat-value strong {
  color: var(--text);
  font-size: 12px;
}

.ai-stat-value span {
  color: var(--soft);
  font-size: 9px;
  text-transform: none;
}

.ai-stat-recommend {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  border: 1px solid #ebf70140;
  border-radius: 999px;
  background: #ebf70110;
  color: var(--text);
  padding: 5px 7px;
  font-family: var(--font-head);
  font-size: 10px;
  line-height: 1.2;
}

.ai-stat-recommend small {
  color: var(--lime);
  font-size: 8px;
  text-transform: uppercase;
}

.ai-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  height: 112px;
  align-items: end;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background:
    linear-gradient(#ffffff08 1px, transparent 1px),
    #00000035;
  background-size: 100% 28px;
  padding: 10px;
}

.ai-chart span {
  min-height: 16px;
  height: var(--h);
  border-radius: 7px 7px 3px 3px;
  background:
    linear-gradient(180deg, var(--cyan), #0ef5ff35 52%, #ebf70180);
  box-shadow: 0 0 18px #0ef5ff24;
}

.ai-line-chart {
  height: 132px;
  overflow: hidden;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 18%, #0ef5ff14, transparent 30%),
    radial-gradient(circle at 88% 80%, #ebf70112, transparent 34%),
    linear-gradient(#ffffff08 1px, transparent 1px),
    #00000035;
  background-size: auto, auto, 100% 29px, auto;
  padding: 12px;
}

.ai-line-plot {
  position: relative;
  width: 100%;
  height: 100%;
}

.ai-line-chart svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.ai-line-dot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 7px;
  height: 7px;
  border: 1px solid #020202;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 1px #ffffff10;
  transform: translate(-50%, -50%);
}

.ai-line-dot b {
  position: absolute;
  bottom: 9px;
  left: 50%;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 10px;
  line-height: 1;
  text-shadow: 0 1px 8px #000000d9;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ai-map-list {
  display: grid;
  gap: 8px;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #0ef5ff0b, transparent 46%),
    #00000035;
  padding: 9px;
}

.ai-map-list article {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 44px;
  border: 1px solid #ffffff10;
  border-radius: 8px;
  background: #ffffff07;
  padding: 8px;
}

.ai-map-list svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.ai-map-list strong {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
}

.ai-map-list span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 10px;
  line-height: 1.35;
}

.ai-chart-legend {
  display: flex;
  gap: 12px;
  color: var(--soft);
  font-size: 11px;
}

.ai-check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.ai-check-list article {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #0ef5ff0b, transparent 42%),
    #00000035;
  padding: 10px;
}

.ai-check-list svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.ai-check-list span {
  display: grid;
  gap: 3px;
  font-size: 11px;
  line-height: 1.35;
}

.ai-check-list strong {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 11px;
}

.ai-check-list small {
  color: var(--soft);
  font-size: 10px;
  line-height: 1.35;
}

.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot.cyan {
  background: var(--cyan);
}

.legend-dot.lime {
  background: var(--lime);
}

.legend-dot.muted {
  background: #ffffff40;
}

.ai-output {
  display: none;
  gap: 8px;
}

.ai-output.is-visible {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.ai-output article {
  display: grid;
  gap: 9px;
  border: 1px solid #0ef5ff2e;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #0ef5ff13, transparent 52%),
    #101616;
  padding: 12px;
}

.ai-recommendation-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: start;
}

.ai-output article b {
  flex: 0 0 auto;
  max-width: 180px;
  border: 1px solid #ebf70155;
  border-radius: 999px;
  background: #ebf70110;
  color: var(--lime);
  padding: 6px 8px;
  font-family: var(--font-head);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.ai-recommendation-card p {
  margin: 0;
  color: var(--soft);
  font-size: 10px;
  line-height: 1.4;
}

.ai-recommendation-card p span {
  display: inline;
  margin: 0;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 10px;
}

.rules-list {
  display: grid;
}

.working-data-panel {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, #0ef5ff0e, transparent 52%),
    #111414;
  padding: 18px;
}

.working-data-head,
.working-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.working-data-head h3 {
  margin: 0;
  font-size: 13px;
}

.working-data-head span {
  display: block;
  margin-top: 5px;
  color: var(--soft);
  font-size: 11px;
}

.working-account-row label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.working-account-row select {
  width: min(520px, 100%);
}

.working-data-total {
  display: inline-grid;
  min-width: 116px;
  min-height: 54px;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000030;
  padding: 8px 14px;
}

.working-data-total strong {
  font-family: var(--font-head);
  font-size: 18px;
  line-height: 1;
}

.working-data-total span {
  margin-top: 4px;
  color: var(--soft);
  font-size: 10px;
}

.working-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06060655;
}

.working-data-table {
  min-width: 980px;
}

.working-data-table th:first-child {
  width: 20%;
}

.working-data-table th:last-child {
  width: 15%;
}

.working-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0000002f;
}

.analytics-empty-cell {
  padding: 22px 12px !important;
  color: var(--soft) !important;
  text-align: center !important;
  white-space: normal !important;
}

.rule-builder {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, #0ef5ff10, transparent 44%),
    linear-gradient(315deg, #ebf70110, transparent 58%),
    #151515;
  padding: 18px;
}

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

.builder-head h3 {
  font-size: 13px;
}

.builder-head span {
  display: block;
  margin-top: 5px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.4;
}

.builder-add {
  flex: 0 0 auto;
}

.builder-flow {
  display: grid;
  grid-template-columns: 68px minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.builder-keyword {
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border: 1px solid #ebf70150;
  border-radius: 8px;
  background: #ebf70110;
  color: var(--lime);
  padding: 0 12px;
  font-family: var(--font-head);
  font-size: 12px;
}

.builder-flow label {
  display: grid;
  min-height: 58px;
  align-content: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background: #00000038;
  padding: 9px;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.builder-if {
  grid-column: 1;
  grid-row: 1;
}

.builder-variable {
  grid-column: 2;
  grid-row: 1;
}

.builder-operator {
  grid-column: 3;
  grid-row: 1;
}

.builder-threshold {
  grid-column: 4;
  grid-row: 1;
}

.builder-then {
  grid-column: 1;
  grid-row: 2;
}

.builder-flow .builder-action {
  grid-column: 2 / 4;
  grid-row: 2;
}

.builder-bid {
  grid-column: 4;
  grid-row: 2;
}

.builder-flow select,
.builder-flow input {
  min-height: 32px;
  border: 0;
  background-color: transparent;
  padding-left: 0;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 12px;
  text-transform: none;
}

.builder-flow select {
  background-position: right 0 center;
  padding-right: 24px;
}

.builder-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.builder-value span {
  color: var(--soft);
  font-family: var(--font-head);
  font-size: 11px;
}

.empty-rules-state {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, #ffffff0c, transparent 50%),
    #101010d9;
  padding: 18px;
}

.empty-rules-state svg {
  width: 20px;
  height: 20px;
  color: var(--cyan);
}

.empty-rules-state strong {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
}

.empty-rules-state span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.4;
}

.rule-group {
  display: grid;
  gap: 13px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.rule-group:last-child {
  border-bottom: 0;
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 1px;
}

.group-title h3 {
  font-size: 13px;
}

.group-title span {
  color: var(--soft);
  font-size: 11px;
}

.rule-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, #ffffff12, #ffffff06 56%, #00000026),
    #151515;
  box-shadow: inset 0 1px 0 #ffffff12;
  overflow: hidden;
}

.rule-row::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--cyan);
}

.rule-stop::before {
  background: var(--danger);
}

.rule-down::before {
  background: var(--warn);
}

.rule-up::before {
  background: var(--lime);
}

.rule-watch::before {
  background: var(--cyan);
}

.rule-row.is-disabled {
  opacity: 0.48;
}

.toggle-rule {
  width: 30px;
  height: 30px;
  margin: 17px 0 0 12px;
  padding: 0;
  background: #ffffff0d;
  color: var(--muted);
}

.toggle-rule.is-on {
  background: linear-gradient(180deg, var(--cyan), #00dce6);
  color: #000;
  box-shadow: 0 0 0 1px #0ef5ff66, 0 0 22px #0ef5ff21;
}

.rule-title {
  font-family: var(--font-head);
  font-size: 13px;
  line-height: 1.3;
}

.rule-state {
  margin-bottom: 5px;
  color: var(--lime);
  font-family: var(--font-head);
  font-size: 9px;
  line-height: 1;
  text-transform: uppercase;
}

.rule-row.is-disabled .rule-state {
  color: var(--soft);
}

.rule-main {
  min-width: 0;
  padding: 15px 16px 16px 4px;
}

.rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  border-bottom: 1px solid #ffffff12;
  padding-bottom: 12px;
}

.rule-row.is-auto-mode .rule-header {
  justify-content: flex-start;
}

.rule-description {
  display: grid;
  gap: 12px;
  margin-top: 13px;
  border-radius: 8px;
  border: 1px solid #ffffff0c;
  background:
    linear-gradient(135deg, #ffffff08, transparent 38%),
    #00000035;
  padding: 13px;
  font-size: 12px;
  box-shadow: inset 0 1px 0 #ffffff08;
}

.rule-copy {
  max-width: 100%;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.rule-text {
  max-width: 100%;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.rule-token {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border: 1px solid #ebf7013d;
  border-radius: 999px;
  background: #ebf70110;
  color: #dce76a;
  font-family: var(--font-head);
  font-size: 10px;
  line-height: 1;
  margin: 0 3px;
  padding: 4px 7px;
  text-transform: uppercase;
  vertical-align: 1px;
  white-space: nowrap;
}

.rule-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  border-top: 1px solid #ffffff10;
  padding-top: 12px;
}

.rule-field {
  display: grid;
  min-width: 0;
  min-height: 48px;
  align-items: stretch;
  gap: 4px;
  border: 1px solid #ebf7014d;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ebf7011f, #ebf7010b),
    #131500;
  padding: 7px 9px;
  box-shadow: inset 0 1px 0 #ffffff12, 0 0 0 1px #00000030;
}

.rule-field-label {
  overflow: hidden;
  color: #ffffff8c;
  font-size: 9px;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.rule-field-entry {
  display: grid;
  grid-template-columns: minmax(52px, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.rule-field input {
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--lime);
  padding: 0;
  font-family: var(--font-head);
  font-size: 13px;
}

.rule-field input::placeholder {
  color: #ebf70145;
}

.unit {
  min-width: 18px;
  border-radius: 999px;
  background: #00000038;
  color: var(--soft);
  font-size: 11px;
  line-height: 1;
  padding: 4px 5px;
  text-align: center;
}

.rule-action {
  display: inline-flex;
  flex: 0 0 auto;
  max-width: 240px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff08, transparent),
    #00000048;
  padding: 6px 8px;
  box-shadow: inset 0 1px 0 #ffffff0a;
}

.action-icon.stop {
  background: #ff5f571f;
  color: var(--danger);
}

.action-icon.down {
  background: #ffc8571f;
  color: var(--warn);
}

.action-icon.up {
  background: #ebf7011f;
  color: var(--lime);
}

.action-icon.watch {
  background: #0ef5ff1f;
  color: var(--cyan);
}

.action-name {
  font-family: var(--font-head);
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.empty-panel {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: 36px;
  text-align: center;
}

.empty-panel h2 {
  font-size: 16px;
}

.empty-panel p {
  margin: 10px auto 0;
  max-width: 560px;
  color: var(--soft);
  line-height: 1.55;
}

.integration-grid {
  display: grid;
  gap: 12px;
  width: min(820px, 100%);
  margin-top: 0;
}

.setup-flow {
  display: grid;
  gap: 12px;
}

.setup-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(150px, auto);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
  padding: 14px;
}

.setup-card-wide {
  grid-template-columns: 34px minmax(180px, 0.36fr) minmax(0, 1fr);
}

.setup-connection-card {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
}

.setup-cabinet-card {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
}

.setup-card-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.setup-card.is-complete {
  border-color: #0ef5ff66;
  background: #0ef5ff0d;
}

.setup-step {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--lime);
  color: #000;
  font-family: var(--font-head);
  font-size: 13px;
}

.setup-card.is-complete .setup-step {
  background: var(--cyan);
}

.setup-card strong {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
}

.setup-card-note {
  margin: 5px 0 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.4;
}

.setup-card span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.setup-extension-area {
  display: grid;
  min-width: min(620px, 100%);
  gap: 10px;
}

.setup-connection-shell {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.setup-connection-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.setup-method-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000052;
  padding: 4px;
}

.setup-method-tab {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--soft);
  font-family: var(--font-head);
  font-size: 12px;
  padding: 0 12px;
}

.setup-method-tab.is-active {
  background: var(--lime);
  color: #050505;
}

.setup-method-tab svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.setup-connection-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 12px;
}

.setup-tool-panel,
.setup-instruction-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000024;
  padding: 14px;
}

.setup-tool-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.setup-tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.setup-status-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.setup-status-card {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000052;
  padding: 9px 10px;
}

.setup-status-card b,
.setup-status-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-status-card b {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 11px;
}

.setup-status-card em {
  color: var(--soft);
  font-size: 10px;
  font-style: normal;
}

.setup-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setup-live-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000030;
}

.setup-live-status div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 9px 10px;
}

.setup-live-status div:last-child {
  border-right: 0;
}

.setup-live-status b {
  color: var(--soft);
  font-size: 9px;
  text-transform: uppercase;
}

.setup-live-status span {
  overflow: hidden;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-live-status span.is-ok {
  color: var(--text);
}

.setup-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.setup-fields.has-profile {
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(210px, auto);
}

.setup-fields label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.setup-fields .setup-select,
.setup-fields .setup-text-input {
  width: 100%;
  min-width: 0;
}

.setup-profile-link {
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  align-self: end;
}

.setup-context-alert {
  grid-column: 1 / -1;
  border: 1px solid #efff0066;
  border-radius: 8px;
  background: #efff0012;
  color: var(--text);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
}

.setup-token-area {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, auto);
  gap: 10px;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.setup-token-field {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.setup-profile-name-field {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.setup-token-input,
.setup-profile-name-input,
.setup-text-input {
  min-height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  color: var(--text);
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
}

.setup-token-status {
  grid-column: 1 / -1;
  margin-top: 0;
  color: var(--cyan);
}

.setup-instruction-panel h3 {
  font-size: 13px;
}

.setup-instruction-panel ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.connected-profiles-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff06;
  padding: 14px;
}

.connected-profiles-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.connected-profiles-head h3 {
  margin: 0;
  font-size: 13px;
}

.connected-profile-grid {
  display: grid;
  gap: 10px;
}

.connected-profile-card,
.connected-empty {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000024;
  padding: 14px;
}

.connected-profile-card.is-online {
  border-color: #0ef5ff55;
}

.connected-profile-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
}

.connected-profile-top strong,
.connected-empty strong {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
}

.connected-profile-top span,
.connected-empty span,
.connected-profile-meta {
  color: var(--soft);
  font-size: 11px;
  line-height: 1.45;
}

.connected-profile-top mark {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff0a;
  color: var(--soft);
  padding: 4px 10px;
  font-family: var(--font-head);
  font-size: 10px;
}

.connected-profile-card.is-online mark {
  border-color: #0ef5ff66;
  color: var(--cyan);
}

.connected-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.profile-settings-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) repeat(4, minmax(110px, 0.7fr)) auto;
  gap: 10px;
  align-items: end;
}

.profile-settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.profile-settings-grid select,
.profile-settings-grid input {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  color: var(--text);
  padding: 0 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
}

.profile-save {
  min-height: 38px;
}

.setup-help-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 12px;
  margin-top: 12px;
}

.setup-help-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, #0ef5ff0a, transparent 54%),
    #ffffff06;
  padding: 14px;
}

.setup-help-card h3 {
  font-size: 13px;
}

.setup-help-card ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.setup-token-fallback .setup-token-area {
  margin-top: 12px;
  min-width: 0;
}

.access-checks,
.data-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.access-checks span,
.data-map span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #00000024;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.access-checks svg {
  width: 14px;
  height: 14px;
  color: var(--cyan);
}

.campaign-selector,
.analytics-shortcut {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, #0ef5ff0e, transparent 54%),
    #101010d9;
  padding: 16px 18px;
}

.campaign-selector strong,
.analytics-shortcut strong {
  display: block;
  font-family: var(--font-head);
  font-size: 13px;
}

.campaign-selector span,
.analytics-shortcut span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.4;
}

.campaign-picker {
  position: relative;
}

.campaign-trigger {
  display: flex;
  min-height: 42px;
  min-width: 220px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #00000036;
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-head);
  font-size: 12px;
}

.campaign-trigger svg {
  width: 16px;
  height: 16px;
}

.campaign-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  display: none;
  width: min(280px, calc(100vw - 40px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101010f7;
  padding: 8px;
  box-shadow: var(--shadow);
}

.campaign-menu.is-open {
  display: grid;
  gap: 4px;
}

.campaign-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 7px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.campaign-menu label:hover {
  background: #ffffff0d;
}

.campaign-menu input {
  accent-color: var(--lime);
}

.campaign-apply {
  white-space: nowrap;
}

.analytics-board {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.analytics-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.analytics-filters label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.analytics-filter-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

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

.analytics-summary-card {
  display: grid;
  min-width: 0;
  min-height: 104px;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff0c, transparent 52%),
    #ffffff06;
  color: var(--text);
  padding: 14px;
  text-align: left;
}

.analytics-summary-card:hover,
.analytics-summary-card.is-active {
  border-color: #0ef5ff66;
  background:
    linear-gradient(135deg, #0ef5ff12, transparent 46%),
    linear-gradient(315deg, #ebf7010f, transparent 58%),
    #111;
}

.analytics-summary-card span {
  color: var(--soft);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.analytics-summary-card strong {
  overflow: hidden;
  font-family: var(--font-head);
  font-size: 22px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-summary-card em {
  overflow: hidden;
  color: var(--soft);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.analytics-summary-panel {
  display: grid;
  min-width: 0;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff0b, transparent 46%),
    #ffffff06;
  padding: 14px;
}

.analytics-summary-panel.is-attention {
  border-color: #ebf70133;
}

.dashboard-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.dashboard-card-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-head);
  font-size: 13px;
}

.dashboard-card-head h3::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 16px #0ef5ff80;
  content: "";
}

.analytics-table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.analytics-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.analytics-table th,
.analytics-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

.analytics-table th:first-child {
  width: 16%;
}

.analytics-table th:last-child {
  width: 18%;
}

.analytics-table th {
  color: var(--soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.analytics-table td {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.analytics-table .pill {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.analytics-table tr:last-child td {
  border-bottom: 0;
}

.analytics-name {
  width: 24%;
  white-space: normal !important;
}

.analytics-name strong,
.analytics-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-name strong {
  font-family: var(--font-head);
}

.analytics-name span {
  margin-top: 4px;
  color: var(--soft);
  font-size: 10px;
}

.analytics-issue-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.analytics-issue {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.analytics-issue:last-child {
  border-bottom: 0;
}

.analytics-issue strong,
.analytics-issue span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-issue strong {
  font-family: var(--font-head);
  font-size: 12px;
}

.analytics-issue span {
  margin-top: 4px;
  color: var(--soft);
  font-size: 11px;
}

.analytics-issue b {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #ebf70155;
  border-radius: 999px;
  color: var(--lime);
  padding: 6px 9px;
  font-family: var(--font-head);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.analytics-chart-card,
.analytics-result-list {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff06;
  padding: 14px;
}

.analytics-chart-card {
  min-width: 0;
  overflow: hidden;
  contain: paint;
  isolation: isolate;
}

.analytics-bars,
.analytics-line-chart {
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(#ffffff0b 1px, transparent 1px),
    linear-gradient(90deg, #0ef5ff08, #ebf70108),
    #0e0e0e;
  background-size: 100% 46px, auto, auto;
  padding: 18px;
}

.analytics-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  overflow: hidden;
}

.analytics-bars > span {
  position: relative;
  display: block;
  height: var(--h);
  min-height: 28px;
  overflow: hidden;
  border-radius: 7px 7px 3px 3px;
  background:
    linear-gradient(180deg, var(--cyan), #0ef5ff36 52%, #ebf70184);
  box-shadow: 0 0 18px #0ef5ff24;
}

.analytics-bars > span b {
  position: absolute;
  top: 7px;
  right: 4px;
  left: 4px;
  z-index: 2;
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 10px;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 8px #000000cc;
  white-space: nowrap;
}

.analytics-bars > span i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  height: var(--h2);
  background: linear-gradient(180deg, #ebf70100, #ebf701b8);
}

.analytics-line-chart .ai-line-plot {
  height: 100%;
}

.analytics-line-chart {
  position: relative;
  overflow: hidden;
  contain: paint;
}

.ai-line-plot {
  overflow: hidden;
  contain: paint;
}

.ai-line-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.analytics-donut {
  display: grid;
  min-height: 220px;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: center;
  justify-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 45%, #0ef5ff12, transparent 42%),
    #0e0e0e;
  padding: 18px;
}

.donut-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.donut {
  position: relative;
  display: grid;
  width: 132px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--donut));
  box-shadow: inset 0 0 0 1px #ffffff18, 0 0 28px #0ef5ff18;
}

.donut::after {
  position: absolute;
  inset: 22px;
  border-radius: inherit;
  background: #101010;
  content: "";
}

.donut strong,
.donut span {
  position: relative;
  z-index: 1;
}

.donut strong {
  align-self: center;
  font-family: var(--font-head);
  font-size: 18px;
}

.donut span {
  align-self: start;
  margin-top: 3px;
  color: var(--soft);
  font-size: 10px;
}

.donut-percent-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 11px;
}

.donut-percent-row span {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  border: 1px solid #ffffff16;
  border-radius: 999px;
  background: #ffffff08;
  padding: 5px 8px;
}

.donut-percent-row .cyan {
  color: var(--cyan);
}

.donut-percent-row .lime {
  color: var(--lime);
}

.donut-percent-row .muted {
  color: var(--soft);
}

.analytics-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.analytics-ai-box {
  display: grid;
  gap: 14px;
  border: 1px solid #0ef5ff33;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #0ef5ff0b, #ebf70108),
    #101010;
  padding: 14px;
}

.analytics-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analytics-ai-head h3 {
  font-size: 13px;
}

.analytics-ai-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: stretch;
}

.analytics-question {
  display: block;
  width: 100%;
  min-height: 118px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e0e0e;
  color: var(--text);
  padding: 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  resize: none;
}

.analytics-answer {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0ef5ff08;
  padding: 14px;
}

.analytics-answer strong {
  font-family: var(--font-head);
  font-size: 13px;
}

.analytics-answer span {
  color: #d4d4d4;
  font-size: 12px;
  line-height: 1.5;
}

.analytics-ask-button {
  min-width: 176px;
  padding-inline: 14px;
}

.analytics-result-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0ef5ff0a;
  padding: 12px;
}

.analytics-result-list strong {
  display: block;
  font-family: var(--font-head);
  font-size: 13px;
}

.analytics-result-list span {
  display: block;
  margin-top: 5px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.journal-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.journal-toolbar label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.journal-list {
  width: 100%;
}

.log-meta {
  display: grid;
  min-width: 0;
  justify-items: end;
  gap: 6px;
  color: var(--soft);
  font-size: 11px;
}

.tariff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 18px;
}

.tariff-simple {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 0.7fr);
  gap: 12px;
  padding: 18px;
}

.tariff-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff0c, transparent 48%),
    #101010;
  padding: 16px;
  box-shadow: inset 0 1px 0 #ffffff0b;
}

.tariff-card.is-active {
  border-color: #ebf70166;
  background:
    linear-gradient(135deg, #ebf70118, transparent 46%),
    #111;
}

.tariff-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tariff-card h3 {
  font-size: 17px;
}

.tariff-head strong {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 17px;
  white-space: nowrap;
}

.tariff-card p {
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.tariff-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tariff-card li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tariff-card li svg {
  width: 15px;
  height: 15px;
  color: var(--cyan);
  stroke-width: 2.2;
}

.tariff-secondary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 12px;
  padding: 0 14px;
  text-decoration: none;
}

.tariff-secondary svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.tariff-note {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(90deg, #0ef5ff0f, transparent 54%),
    #101010d9;
  padding: 18px;
}

.tariff-note svg {
  width: 20px;
  height: 20px;
  color: var(--cyan);
}

.tariff-note strong {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
}

.tariff-note span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.45;
}

.setup-select {
  width: min(260px, 100%);
  min-width: 220px;
  font-family: var(--font-head);
  font-size: 13px;
}

.setup-action {
  justify-self: end;
  white-space: nowrap;
}

.integration-row,
.log-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(118px, max-content);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
  padding: 14px;
  text-align: left;
}

.log-row {
  overflow: hidden;
}

.log-row > div {
  min-width: 0;
}

.log-row .nav-icon {
  align-self: start;
  margin-top: 1px;
}

.integration-row strong,
.log-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-head);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-row span,
.log-row span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.log-meta span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 900px) {
  .log-row {
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
  }

  .log-meta {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    justify-items: start;
    justify-content: flex-start;
    align-items: center;
  }

  .log-meta span {
    margin-top: 0;
  }
}

.pill.ready {
  border-color: #ebf70166;
  color: var(--lime);
}

.pill.next {
  border-color: #0ef5ff66;
  color: var(--cyan);
}

body.is-light .sidebar {
  background: #f7f9f2e8;
  box-shadow: inset -1px 0 0 #ffffffb8;
}

body.is-light .workspace {
  background: transparent;
}

body.is-light .ai-panel {
  background:
    linear-gradient(180deg, #f7f9f2f0, #edf1e8f5),
    #eef1ea;
  box-shadow: -24px 0 70px #18210f14;
}

body.is-light .nav-button:hover,
body.is-light .nav-button.is-active,
body.is-light .icon-button,
body.is-light .mode-switch,
body.is-light .theme-toggle,
body.is-light .ai-controls label,
body.is-light .ai-chip-row button {
  background: #ffffffa8;
}

body.is-light .nav-button.is-active {
  box-shadow: inset 0 1px 0 #ffffffd8, 0 8px 22px #1c25100f;
}

body.is-light .theme-toggle {
  border-color: #1c251024;
  background: #f8faf5cc;
  color: var(--muted);
  box-shadow: none;
}

body.is-light .nav-count,
body.is-light .nav-icon,
body.is-light .preview-icon,
body.is-light .action-icon,
body.is-light .toggle-rule,
body.is-light .unit {
  background: #1c25100d;
}

body.is-light .ai-launcher,
body.is-light .ai-panel-head {
  border-color: #2497a733;
  background:
    linear-gradient(135deg, #2497a715, #93af2d17 58%, #ffffffa6),
    #f8faf5;
  box-shadow: inset 0 1px 0 #ffffffd8, 0 14px 34px #18210f12;
}

body.is-light .metric,
body.is-light .scope-panel,
body.is-light .rules-panel,
body.is-light .ai-section,
body.is-light .analytics-ai-box,
body.is-light .analytics-summary-card,
body.is-light .analytics-summary-panel,
body.is-light .empty-panel {
  background:
    linear-gradient(180deg, #ffffffd6, #f2f5ee),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 #ffffffd8;
}

body.is-light .panel-head.with-tabs {
  background: #edf1e8;
  box-shadow: inset 0 1px 0 #ffffffd8;
}

body.is-light .scope-grid label,
body.is-light .builder-flow label,
body.is-light .ai-map-list,
body.is-light .ai-map-list article,
body.is-light .ai-check-list article,
body.is-light .ai-account-row,
body.is-light .ai-output article,
body.is-light .setup-card,
body.is-light .setup-help-card,
body.is-light .setup-tool-panel,
body.is-light .setup-instruction-panel,
body.is-light .setup-status-card,
body.is-light .connected-profiles-panel,
body.is-light .connected-profile-card,
body.is-light .connected-empty,
body.is-light .working-data-panel,
body.is-light .working-table-wrap,
body.is-light .working-empty,
body.is-light .working-data-total,
body.is-light .campaign-selector,
body.is-light .analytics-shortcut,
body.is-light .analytics-chart-card,
body.is-light .analytics-result-list,
body.is-light .analytics-result-list article,
body.is-light .analytics-issue,
body.is-light .integration-row,
body.is-light .log-row {
  background:
    linear-gradient(90deg, #2497a70c, transparent 46%),
    #ffffff9c;
  box-shadow: inset 0 1px 0 #ffffffd8;
}

body.is-light .analytics-summary-card:hover,
body.is-light .analytics-summary-card.is-active {
  border-color: #2497a766;
  background:
    linear-gradient(135deg, #2497a714, transparent 46%),
    linear-gradient(315deg, #93af2d18, transparent 58%),
    #ffffffd6;
}

body.is-light .rule-builder {
  background:
    linear-gradient(135deg, #2497a711, transparent 44%),
    linear-gradient(315deg, #93af2d14, transparent 58%),
    #edf1e8;
}

body.is-light .empty-rules-state {
  background:
    linear-gradient(90deg, #2497a70e, transparent 50%),
    #f8faf5;
}

body.is-light .rule-row {
  background:
    linear-gradient(120deg, #ffffffd8, #edf1e8 56%, #ffffff90),
    #f8faf5;
  box-shadow: inset 0 1px 0 #ffffffd8, 0 10px 26px #18210f0c;
}

body.is-light .rule-description {
  background:
    linear-gradient(135deg, #ffffffb8, transparent 38%),
    #edf1e8a8;
}

body.is-light select,
body.is-light input,
body.is-light textarea {
  background-color: #ffffffc7;
  color: var(--text);
}

body.is-light select {
  background-image: var(--select-arrow);
}

body.is-light .scope-grid select,
body.is-light .ai-controls select,
body.is-light .builder-flow select,
body.is-light .builder-flow input,
body.is-light .rule-field input,
body.is-light .setup-token-input,
body.is-light .setup-profile-name-input,
body.is-light .setup-text-input,
body.is-light .setup-fields select,
body.is-light .profile-settings-grid select,
body.is-light .profile-settings-grid input {
  background-color: transparent;
}

body.is-light .ai-prompt-row input,
body.is-light .analytics-question,
body.is-light .analytics-answer,
body.is-light .ai-export-button,
body.is-light .rule-action,
body.is-light .campaign-trigger,
body.is-light .campaign-menu,
body.is-light .access-checks span,
body.is-light .data-map span {
  background:
    linear-gradient(90deg, #ffffffb8, #2497a70d),
    #f7f9f2;
}

body.is-light .analytics-answer span {
  color: #374036;
}

body.is-light .mode-btn.is-active,
body.is-light .primary-button,
body.is-light .ai-recommend-button,
body.is-light .setup-step {
  background: var(--lime);
  color: #101216;
  box-shadow: 0 0 0 1px #93af2d33, 0 12px 28px #93af2d1f;
}

body.is-light .save-button {
  border-color: #2497a74a;
  background:
    linear-gradient(180deg, #41d2df, var(--cyan));
  color: #f8faf5;
  box-shadow: 0 0 0 1px #2497a726, 0 12px 30px #2497a71f;
}

body.is-light .completion,
body.is-light .builder-keyword,
body.is-light .rule-token,
body.is-light .ai-stat-recommend,
body.is-light .ai-output article b,
body.is-light .ai-status-pill {
  border-color: #93af2d4a;
  background: #93af2d17;
  color: #5f7910;
}

body.is-light .rule-field {
  border-color: #93af2d4a;
  background:
    linear-gradient(180deg, #93af2d1e, #ffffff78),
    #f3f7ea;
}

body.is-light .rule-field-label {
  color: #5f684f;
}

body.is-light .rule-field input {
  color: #5f7910;
}

body.is-light .ai-chart,
body.is-light .ai-line-chart,
body.is-light .analytics-bars,
body.is-light .analytics-donut,
body.is-light .analytics-line-chart {
  border-color: #1c251014;
  background:
    linear-gradient(#1c25100b 1px, transparent 1px),
    #f8faf5;
}

body.is-light .ai-line-chart {
  background:
    radial-gradient(circle at 18% 18%, #2497a714, transparent 30%),
    radial-gradient(circle at 88% 80%, #93af2d15, transparent 34%),
    linear-gradient(#1c25100b 1px, transparent 1px),
    #f8faf5;
}

body.is-light .analytics-donut .donut::after {
  background: #f8faf5;
}

body.is-light .legend-dot.muted {
  background: #1c25103d;
}

body.is-light .action-icon.stop {
  background: #d94f4519;
}

body.is-light .action-icon.down {
  background: #b8831f1a;
}

body.is-light .action-icon.up {
  background: #93af2d1f;
}

body.is-light .action-icon.watch {
  background: #2497a71f;
}

.app-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, 236px) minmax(300px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 0;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, #050505d9, #050505f5),
    #050505;
  padding: 10px 16px;
  color: var(--soft);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 -16px 46px #00000038;
}

.footer-status {
  min-width: 0;
}

.footer-status.status-line {
  color: var(--text);
  font-size: 12px;
}

.footer-left,
.footer-links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.footer-links {
  justify-content: flex-end;
  margin-left: auto;
}

.app-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease;
}

.app-footer a:hover {
  color: var(--text);
}

.footer-brand {
  color: var(--soft);
}

.footer-divider {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
}

.footer-icon-link {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
}

.footer-icon-link svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

body.is-light .plan-badge {
  border-color: #93af2d55;
  background: #93af2d18;
  color: #6f8525;
}

body.is-light .tariff-card,
body.is-light .tariff-note,
body.is-light .tariff-secondary {
  background:
    linear-gradient(90deg, #2497a70c, transparent 46%),
    #ffffffb8;
  box-shadow: inset 0 1px 0 #ffffffd8;
}

body.is-light .tariff-card.is-active {
  border-color: #93af2d66;
  background:
    linear-gradient(135deg, #93af2d1a, transparent 48%),
    #ffffffc4;
}

body.is-light .app-footer {
  background:
    linear-gradient(180deg, #eef1ead9, #eef1eaf5),
    #eef1ea;
  box-shadow: 0 -16px 46px #18210f14;
}

body.is-light .toast {
  background: #f8faf5;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: calc(var(--footer-clearance) + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  max-width: min(360px, calc(100vw - 40px));
  transform: translateY(20px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #1f1f1f;
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1380px) {
  .app-shell {
    grid-template-columns: 268px minmax(0, 1fr);
  }

  .app-shell.is-analytics-view {
    grid-template-columns: 268px minmax(0, 1fr);
  }

  .app-footer {
    right: 0;
  }

  .ai-panel {
    position: relative;
    grid-column: 2;
    height: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .analytics-chart-grid {
    grid-template-columns: 1fr 1fr;
  }

  .analytics-chart-card:last-child {
    grid-column: 1 / -1;
  }

  .analytics-donut {
    grid-template-columns: 1fr;
    min-height: 180px;
  }
}

@media (max-width: 1680px) {
  .app-shell.is-analytics-view .analytics-chart-grid {
    grid-template-columns: 1fr 1fr;
  }

  .app-shell.is-analytics-view .analytics-chart-card:last-child {
    grid-column: 1 / -1;
  }

  .app-shell.is-analytics-view .analytics-donut {
    grid-template-columns: 1fr;
    min-height: 180px;
  }
}

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

  .app-shell.is-analytics-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-width: 100vw;
    overflow-x: hidden;
  }

  .level-nav {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-button {
    flex: 0 0 160px;
  }

  .sidebar-footer {
    display: none;
  }

  .app-footer {
    left: 0;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .setup-connection-grid {
    grid-template-columns: 1fr;
  }

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

  .profile-save {
    grid-column: 1 / -1;
  }

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

  .tariff-simple,
  .analytics-dashboard-grid,
  .analytics-chart-grid,
  .analytics-filters {
    grid-template-columns: 1fr;
  }

  .analytics-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-issue-list {
    grid-template-columns: 1fr;
  }

  .analytics-filter-actions,
  .analytics-ai-grid {
    grid-template-columns: 1fr;
  }

  .analytics-filter-actions {
    display: grid;
  }

  .app-shell.is-analytics-view .analytics-chart-grid {
    grid-template-columns: 1fr;
  }

  .analytics-chart-card:last-child {
    grid-column: auto;
  }

  .analytics-donut {
    grid-template-columns: 1fr;
  }

  .app-shell.is-analytics-view .analytics-chart-card:last-child {
    grid-column: auto;
  }

  .app-shell.is-analytics-view .analytics-donut {
    grid-template-columns: 1fr;
  }

  .working-data-head,
  .working-account-row,
  .campaign-selector,
  .analytics-shortcut {
    grid-template-columns: 1fr;
  }

  .working-account-row select,
  .working-data-head .tariff-secondary {
    width: 100%;
  }

  .ai-panel {
    grid-column: 1;
    max-width: 100vw;
  }
}

@media (max-width: 780px) {
  :root {
    --footer-clearance: 132px;
  }

  .workspace {
    padding: 20px 14px 130px;
  }

  h1 {
    font-size: 22px;
  }

  .topbar {
    display: grid;
    min-width: 0;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .app-footer {
    align-items: flex-start;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 14px;
  }

  .footer-status,
  .footer-left,
  .footer-links {
    width: 100%;
    flex-wrap: wrap;
  }

  .footer-links {
    justify-content: flex-start;
    margin-left: 0;
  }

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

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

  .rule-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .rule-header {
    display: grid;
    gap: 10px;
    align-items: start;
  }

  .rule-action {
    width: fit-content;
    max-width: 100%;
  }

  .builder-head {
    display: grid;
  }

  .builder-add {
    width: 100%;
  }

  .builder-flow {
    grid-template-columns: 1fr;
  }

  .builder-flow > * {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .builder-keyword {
    justify-content: flex-start;
  }

  .setup-card {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .setup-connection-head {
    align-items: stretch;
  }

  .setup-method-switch {
    width: 100%;
  }

  .setup-method-tab {
    flex: 1 1 150px;
  }

  .setup-action,
  .setup-select,
  .setup-text-input,
  .setup-extension-area,
  .setup-actions-row,
  .setup-token-area,
  .setup-fields {
    grid-column: 1 / -1;
    justify-self: stretch;
    min-width: 0;
    width: 100%;
  }

  .setup-status-grid {
    grid-template-columns: 1fr;
  }

  .setup-actions-row .primary-button,
  .setup-actions-row .tariff-secondary,
  .setup-profile-link {
    width: 100%;
  }

  .setup-help-grid,
  .setup-token-area,
  .setup-fields,
  .profile-settings-grid,
  .journal-toolbar {
    grid-template-columns: 1fr;
  }

  .campaign-trigger,
  .campaign-apply,
  .analytics-filter-actions .primary-button,
  .analytics-filter-actions .tariff-secondary,
  .analytics-ask-button,
  .analytics-actions .primary-button,
  .analytics-actions .tariff-secondary {
    width: 100%;
  }

  .analytics-result-list article {
    grid-template-columns: 1fr;
  }

  .log-meta {
    justify-items: start;
  }

  .ai-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  :root {
    --footer-clearance: 154px;
  }

  .sidebar {
    max-width: 100vw;
    overflow-x: hidden;
    padding: 16px 12px;
  }

  .level-nav {
    max-width: calc(100vw - 24px);
  }

  .workspace {
    width: 100vw;
    max-width: 100vw;
  }

  .topbar,
  .summary-strip,
  .content-layout {
    width: 100%;
    max-width: 100%;
  }

  .topbar > div:first-child,
  #pageSubtitle,
  .top-actions,
  .mode-switch,
  .scope-panel,
  .rules-panel {
    max-width: calc(100vw - 28px);
  }

  #pageSubtitle {
    overflow-wrap: break-word;
  }

  .mode-switch {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .analytics-summary-grid {
    grid-template-columns: 1fr;
  }

  .analytics-table {
    min-width: 680px;
  }

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

  .rule-field {
    grid-template-columns: 1fr;
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .rule-field-label {
    white-space: normal;
  }
}
