:root {
  color-scheme: light;
  --ink: #17372f;
  --text: #243a35;
  --muted: #66736d;
  --green-900: #17372f;
  --green-800: #245744;
  --green-700: #356e55;
  --sage-100: #f1f5ed;
  --sage-200: #e4ecdf;
  --sage-300: #ccd9c4;
  --gold: #b99a52;
  --cream: #f8f5ec;
  --paper: #fffdf8;
  --white: #ffffff;
  --line: rgba(23, 55, 47, 0.14);
  --line-strong: rgba(23, 55, 47, 0.24);
  --sidebar: #17372f;
  --sidebar-soft: #245744;
  --teal: #245744;
  --blue: #5f7f96;
  --coral: #9c5d45;
  --amber: #b99a52;
  --green: #356e55;
  --chart-1: #245744;
  --chart-2: #b99a52;
  --chart-3: #356e55;
  --chart-4: #5f7f96;
  --chart-5: #8f6b2c;
  --chart-6: #6f8b78;
  --chart-grid: rgba(23, 55, 47, 0.11);
  --chart-text: #66736d;
  --shadow: 0 20px 60px rgba(23, 55, 47, 0.1);
  --soft-shadow: 0 10px 32px rgba(23, 55, 47, 0.07);
  font-family:
    "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(228, 236, 223, 0.45) 0, rgba(248, 245, 236, 0) 420px),
    var(--cream);
  font-size: 16px;
  line-height: 1.5;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  cursor: pointer;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(185, 154, 82, 0.12), transparent 32rem),
    linear-gradient(180deg, rgba(228, 236, 223, 0.55) 0, rgba(248, 245, 236, 0) 460px),
    var(--cream);
  padding: 24px;
}

.login-shell {
  width: min(560px, calc(100vw - 32px));
}

.login-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 34px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--sidebar);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.brand-logo {
  width: min(238px, 100%);
}

.login-brand .brand-logo {
  width: min(357px, 100%);
}

.logo-dark {
  display: none;
}

.login-brand {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.login-brand span,
.brand-product {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-panel h1 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.08;
  margin: 22px auto 26px;
  max-width: none;
  text-align: center;
  white-space: nowrap;
}

.login-form {
  display: grid;
  gap: 18px;
}

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

input,
select,
textarea {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border-radius: 7px;
  padding: 10px 11px;
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(185, 154, 82, 0.75);
  outline-offset: 2px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.login-form button,
.primary-btn,
.secondary-btn,
.danger-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}

.login-form button,
.primary-btn {
  background: var(--green-800);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(36, 87, 68, 0.18);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.64);
  color: var(--green-900);
  border: 1px solid var(--line-strong);
}

.danger-btn {
  background: #fde8e1;
  color: #92391f;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #a33a24;
  font-weight: 650;
}

.dev-note {
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0 0;
}

.dashboard-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
  transition: grid-template-columns 0.18s ease;
}

.dashboard-body.sidebar-collapsed {
  grid-template-columns: 96px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(248, 245, 236, 0.94);
  color: var(--green-900);
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  overflow: hidden auto;
}

.sidebar-top {
  display: grid;
  gap: 18px;
  align-items: start;
}

.sidebar-menu-toggle,
.sidebar-logout,
.sidebar-theme-toggle {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--green-900);
}

.sidebar-menu-toggle,
.sidebar-logout,
.sidebar-theme-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}

.sidebar-menu-toggle {
  justify-self: end;
}

.sidebar-brand {
  display: grid;
  gap: 9px;
  align-items: start;
  color: var(--green-900);
  text-decoration: none;
  font-weight: 850;
  margin: 0 4px 2px;
}

.sidebar-brand .brand-logo {
  width: 218px;
}

.sidebar-brand .brand-icon {
  display: none;
  height: 49px;
  width: auto;
}

.sidebar-brand .brand-product {
  color: var(--gold);
  padding-left: 2px;
}

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

.nav-list button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: rgba(23, 55, 47, 0.78);
  padding: 11px 12px;
  border-radius: 8px;
  text-align: left;
  font-weight: 750;
}

.nav-list button:hover,
.sidebar-logout:hover,
.sidebar-theme-toggle:hover {
  background: var(--sage-200);
  color: var(--green-900);
}

.nav-list button.active {
  background: var(--green-800);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-list svg,
.toolbar svg,
.button-row svg,
.sidebar-menu-toggle svg,
.sidebar-logout svg,
.sidebar-theme-toggle svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-body.sidebar-collapsed .sidebar {
  padding-inline: 18px;
}

.dashboard-body.sidebar-collapsed .sidebar-brand {
  display: grid;
  justify-items: center;
  margin: 0 0 2px;
  width: 42px;
}

.dashboard-body.sidebar-collapsed .sidebar-top {
  justify-items: start;
}

.dashboard-body.sidebar-collapsed .sidebar-menu-toggle {
  justify-self: start;
}

.dashboard-body.sidebar-collapsed .sidebar-brand .brand-logo {
  display: none;
}

.dashboard-body.sidebar-collapsed .sidebar-brand .brand-icon {
  display: block;
}

.dashboard-body.sidebar-collapsed .nav-list button {
  justify-content: flex-start;
  padding: 11px 12px;
}

.dashboard-body.sidebar-collapsed .sidebar-footer {
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-end;
}

.dashboard-body.sidebar-collapsed .nav-list span {
  display: none;
}

.app-main {
  min-width: 0;
  padding: 28px clamp(22px, 3vw, 42px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar h1 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.08;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: start;
}

.dashboard-body.settings-view .toolbar {
  display: none;
}

.toolbar label {
  width: 142px;
  gap: 6px;
}

.toolbar label.wide-filter {
  width: 210px;
}

.toolbar input,
.toolbar select {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.82);
  color: var(--green-900);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 8px 18px rgba(23, 55, 47, 0.045);
  font-size: 14px;
  font-weight: 760;
  line-height: 1;
}

.toolbar input:hover,
.toolbar select:hover {
  border-color: rgba(23, 55, 47, 0.34);
  background-color: rgba(255, 255, 255, 0.94);
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(185, 154, 82, 0.2),
    0 10px 22px rgba(23, 55, 47, 0.07);
  outline: 0;
}

.toolbar input[type="date"] {
  color-scheme: light;
  padding: 0 12px 0 14px;
}

.toolbar input[type="date"]::-webkit-calendar-picker-indicator {
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.82;
  padding: 4px;
}

.toolbar input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: var(--sage-200);
  opacity: 1;
}

.toolbar select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2317372f' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 13px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  padding: 0 42px 0 14px;
}

.toolbar select option {
  background: var(--paper);
  color: var(--green-900);
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--green-900);
  text-decoration: none;
}

.icon-button:hover {
  background: var(--green-800);
  border-color: var(--green-800);
  color: var(--white);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--green-900);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 760;
  cursor: pointer;
}

.theme-toggle-track {
  width: 42px;
  height: 24px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(36, 87, 68, 0.18);
  border: 1px solid var(--line);
}

.theme-toggle-track span {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green-800);
  transform: translateX(0);
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.floating-theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
}

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

.metric-grid:empty {
  display: none;
}

.metric-card,
.panel,
.table-panel,
.connector-card,
.setting-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.metric-card {
  padding: 16px;
  min-height: 104px;
}

.metric-card .label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-card .value {
  margin: 0;
  font-size: 28px;
  font-weight: 850;
  line-height: 1.1;
}

.view-content {
  display: grid;
  gap: 16px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

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

.panel,
.table-panel,
.setting-block {
  padding: 16px;
  min-width: 0;
}

.panel h2,
.table-panel h2,
.setting-block h2,
.connector-card h3 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.18;
}

.chart-box {
  height: 320px;
  position: relative;
}

.chart-box.compact {
  height: 250px;
}

.chart-box.hero {
  height: 440px;
}

.hero-panel {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 253, 248, 0.92)),
    var(--paper);
  border-left: 4px solid var(--gold);
}

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

.panel-title-row h2 {
  margin-bottom: 0;
}

.panel-title-row p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.overview-support {
  grid-template-columns: 1fr 1fr;
}

.kpi-panel {
  min-height: 316px;
}

.kpi-chart {
  display: grid;
  gap: 13px;
}

.kpi-row {
  display: grid;
  gap: 7px;
}

.kpi-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.kpi-meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpi-meta strong {
  font-size: 18px;
  line-height: 1;
}

.kpi-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sage-200);
}

.kpi-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--chart-1);
}

.kpi-fill.color-1 {
  background: var(--chart-2);
}

.kpi-fill.color-2 {
  background: var(--chart-3);
}

.kpi-fill.color-3 {
  background: var(--chart-4);
}

.kpi-fill.color-4 {
  background: var(--chart-5);
}

.kpi-fill.color-5 {
  background: var(--chart-6);
}

.funnel {
  display: grid;
  gap: 9px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 132px 1fr 88px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.funnel-track {
  height: 12px;
  background: var(--sage-200);
  border-radius: 99px;
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-800), var(--gold));
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-sort {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  text-transform: inherit;
  letter-spacing: inherit;
  font-size: inherit;
  font-weight: 850;
}

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

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-tabs button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--green-900);
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 750;
}

.admin-tabs button.active {
  background: var(--green-800);
  color: var(--white);
}

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

.setup-hero h2 {
  margin-bottom: 8px;
}

.setup-hero p,
.setup-copy {
  max-width: 760px;
  margin: 0 0 16px;
  color: var(--muted);
}

.setup-score {
  min-width: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sage-100);
  text-align: center;
}

.setup-score strong {
  display: block;
  color: var(--green-800);
  font-size: 34px;
  line-height: 1;
}

.setup-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.setup-step-grid,
.setup-help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.setup-step-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.setup-step-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green-800);
  color: var(--white);
  font-weight: 850;
}

.setup-step-card h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 18px;
}

.setup-step-card p,
.connector-purpose,
.connection-help p,
.privacy-note,
.field-help,
.setup-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.friendly-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}

.setup-note {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sage-100);
}

.setup-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.setup-note ol,
.setup-note ul,
.plain-checklist {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.setup-status-list {
  display: grid;
  gap: 10px;
}

.setup-status-list p {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.setup-status-list p:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.setup-status-list strong {
  color: var(--ink);
}

.setup-status-list span {
  color: var(--muted);
}

.field-help {
  display: block;
  margin-top: -2px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.copy-box {
  width: 100%;
  min-height: 84px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

.connector-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.connector-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.connection-help {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 8px;
  background: var(--sage-100);
}

.connector-form {
  display: grid;
  gap: 11px;
  margin-top: 12px;
}

.connection-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.32);
}

.connection-panel summary {
  color: var(--green-800);
  cursor: pointer;
  font-weight: 850;
}

.connector-fieldset {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.connector-fieldset h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.advanced-setup {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
}

.advanced-setup summary {
  color: var(--green-800);
  cursor: pointer;
  font-weight: 800;
}

.advanced-setup label,
.advanced-setup p {
  margin-top: 10px;
}

.connector-sync-line {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--sage-100);
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sage-200);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.good {
  background: rgba(53, 110, 85, 0.16);
  color: var(--green-800);
}

.badge.warn {
  background: rgba(185, 154, 82, 0.18);
  color: #7c5a16;
}

.badge.info {
  background: rgba(95, 127, 150, 0.16);
  color: var(--blue);
}

.muted {
  color: var(--muted);
}

.mini-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  min-height: 22px;
  color: var(--teal);
  font-weight: 750;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f1e8;
  --text: #dfe8df;
  --muted: #b6c6bc;
  --green-900: #071611;
  --green-800: #1e5a46;
  --green-700: #98c7aa;
  --sage-100: #10251e;
  --sage-200: #17342b;
  --sage-300: #335a4b;
  --gold: #d5b35d;
  --cream: #081612;
  --paper: #0e211b;
  --white: #ffffff;
  --line: rgba(244, 241, 232, 0.14);
  --line-strong: rgba(244, 241, 232, 0.28);
  --sidebar: #071611;
  --sidebar-soft: #17342b;
  --teal: #98c7aa;
  --blue: #8aa6b8;
  --coral: #d69a78;
  --amber: #d5b35d;
  --green: #98c7aa;
  --chart-1: #d5b35d;
  --chart-2: #98c7aa;
  --chart-3: #f3f1e8;
  --chart-4: #8aa6b8;
  --chart-5: #d69a78;
  --chart-6: #6aa080;
  --chart-grid: rgba(244, 241, 232, 0.14);
  --chart-text: #dfe8df;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.46);
  --soft-shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% 0%, rgba(53, 110, 85, 0.26), transparent 34rem),
    linear-gradient(180deg, rgba(8, 22, 18, 0.96), rgba(12, 27, 22, 0.98)),
    var(--cream);
}

html[data-theme="dark"] .logo-light {
  display: none;
}

html[data-theme="dark"] .logo-dark {
  display: block;
}

html[data-theme="dark"] .sidebar {
  background:
    linear-gradient(180deg, rgba(7, 22, 17, 0.98), rgba(12, 27, 22, 0.98)),
    var(--sidebar);
  border-right-color: rgba(213, 179, 93, 0.18);
}

html[data-theme="dark"] .sidebar-brand {
  color: var(--white);
}

html[data-theme="dark"] .sidebar-menu-toggle,
html[data-theme="dark"] .sidebar-logout,
html[data-theme="dark"] .sidebar-theme-toggle {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
  color: var(--ink);
}

html[data-theme="dark"] .nav-list button,
html[data-theme="dark"] .sidebar-logout,
html[data-theme="dark"] .sidebar-theme-toggle {
  color: rgba(255, 255, 255, 0.78);
}

html[data-theme="dark"] .nav-list button:hover,
html[data-theme="dark"] .sidebar-logout:hover,
html[data-theme="dark"] .sidebar-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

html[data-theme="dark"] .nav-list button.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--gold);
}

html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .connector-card,
html[data-theme="dark"] .setting-block {
  background: rgba(16, 37, 30, 0.94);
  border-color: var(--line);
  box-shadow: var(--soft-shadow);
}

html[data-theme="dark"] .hero-panel {
  background:
    linear-gradient(180deg, rgba(16, 37, 30, 0.96), rgba(14, 33, 27, 0.94)),
    var(--paper);
  border-left-color: var(--gold);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #091914;
  color: var(--ink);
  border-color: var(--line-strong);
}

html[data-theme="dark"] .toolbar input,
html[data-theme="dark"] .toolbar select {
  background-color: rgba(9, 25, 20, 0.92);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 22px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .toolbar input:hover,
html[data-theme="dark"] .toolbar select:hover {
  background-color: rgba(14, 33, 27, 0.98);
  border-color: rgba(244, 241, 232, 0.38);
}

html[data-theme="dark"] .toolbar input:focus,
html[data-theme="dark"] .toolbar select:focus {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(213, 179, 93, 0.18),
    0 12px 26px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .toolbar input[type="date"] {
  color-scheme: dark;
}

html[data-theme="dark"] .toolbar input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: rgba(213, 179, 93, 0.16);
}

html[data-theme="dark"] .toolbar select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f3f1e8' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 13px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}

html[data-theme="dark"] .toolbar select option {
  background: #091914;
  color: var(--ink);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: rgba(223, 232, 223, 0.58);
}

html[data-theme="dark"] .login-form button,
html[data-theme="dark"] .primary-btn,
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .admin-tabs button.active {
  background: var(--gold);
  color: #071611;
  border-color: var(--gold);
  box-shadow: 0 12px 26px rgba(213, 179, 93, 0.18);
}

html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .admin-tabs button,
html[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
  color: var(--ink);
}

html[data-theme="dark"] .theme-toggle-track {
  background: rgba(213, 179, 93, 0.18);
}

html[data-theme="dark"] .theme-toggle-track span {
  transform: translateX(18px);
  background: var(--gold);
}

html[data-theme="dark"] .badge.good {
  background: rgba(152, 199, 170, 0.16);
  color: var(--green-700);
}

html[data-theme="dark"] .badge.warn {
  background: rgba(213, 179, 93, 0.18);
  color: var(--gold);
}

html[data-theme="dark"] .badge.info {
  background: rgba(138, 166, 184, 0.16);
  color: var(--blue);
}

html[data-theme="dark"] .setup-score,
html[data-theme="dark"] .setup-note,
html[data-theme="dark"] .connection-help,
html[data-theme="dark"] code {
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .advanced-setup {
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .connection-panel {
  background: rgba(255, 255, 255, 0.045);
}

@media (max-width: 520px) {
  .login-body {
    padding: 16px;
  }

  .login-panel {
    padding: 26px 22px;
  }

  .login-brand .brand-logo {
    width: min(320px, 100%);
  }

  .login-panel h1 {
    font-size: 25px;
  }
}

@media (max-width: 360px) {
  .login-panel {
    padding: 22px 16px;
  }

  .login-panel h1 {
    font-size: 22px;
  }
}

@media (max-width: 1100px) {
  .dashboard-body {
    grid-template-columns: 88px 1fr;
  }

  .dashboard-body.sidebar-collapsed {
    grid-template-columns: 96px 1fr;
  }

  .sidebar-brand .brand-product,
  .nav-list span {
    display: none;
  }

  .sidebar-brand .brand-logo {
    display: none;
  }

  .sidebar-brand .brand-icon {
    display: block;
  }

  .metric-grid,
  .three-grid,
  .connector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .chart-box.hero {
    height: 360px;
  }
}

@media (max-width: 720px) {
  .dashboard-body {
    display: block;
  }

  .dashboard-body.sidebar-collapsed {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .dashboard-body.sidebar-collapsed .sidebar {
    padding: 22px 18px;
  }

  .dashboard-body.sidebar-collapsed .sidebar-brand {
    display: grid;
    justify-items: start;
    margin: 0 4px 2px;
    width: auto;
  }

  .sidebar-brand .brand-logo {
    display: block;
    width: 218px;
  }

  .dashboard-body.sidebar-collapsed .sidebar-brand .brand-logo {
    display: block;
  }

  .sidebar-brand .brand-icon,
  .dashboard-body.sidebar-collapsed .sidebar-brand .brand-icon {
    display: none;
  }

  html[data-theme="dark"] .sidebar-brand .logo-light,
  html[data-theme="dark"] .dashboard-body.sidebar-collapsed .sidebar-brand .logo-light {
    display: none;
  }

  html[data-theme="dark"] .sidebar-brand .logo-dark,
  html[data-theme="dark"] .dashboard-body.sidebar-collapsed .sidebar-brand .logo-dark {
    display: block;
  }

  .sidebar-brand .brand-product {
    display: block;
  }

  .dashboard-body.sidebar-collapsed .sidebar-footer {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

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

  .dashboard-body.sidebar-collapsed .nav-list span {
    display: none;
  }

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

  .toolbar {
    justify-content: start;
  }

  .panel-title-row {
    display: grid;
  }

  .setup-hero {
    display: grid;
  }

  .setup-step-grid,
  .setup-help-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .three-grid,
  .connector-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .funnel-row {
    grid-template-columns: 96px 1fr 64px;
  }
}
