/* Shared colour tokens — aligned with marketing home/pricing. */
:root {
  --lime: #d0fb43;
  --ink: #141611;
  --muted: #656a61;
  --line: #dedfd8;
  --surface: #eff0ea;
  --bg: #fafbf8;
  --panel: #fff;
  --soft: #eff0ea;
  --sidebar: #111411;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f5e9;
  --muted: #a8b19f;
  --line: #374031;
  --surface: #22291f;
  --bg: #171b16;
  --panel: #22291f;
  --soft: #2c3427;
  --sidebar: #111411;
  --lime: #d0fb43;
  color: var(--ink);
  background: var(--bg);
}

html[data-theme="dark"] body {
  color: var(--ink);
  background: var(--bg);
}

html[data-theme="dark"] .workspace,
html[data-theme="dark"] .workspace:has(>.sidebar),
html[data-theme="dark"] .app:has(>#sidebar),
html[data-theme="dark"] body > .workspace {
  background: var(--sidebar);
  border: 0;
  border-radius: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  min-height: 100vh;
}

html[data-theme="dark"] .workspace-main,
html[data-theme="dark"] body > .app > main,
html[data-theme="dark"] .app > .workspace {
  background: var(--bg);
  border-radius: 0;
}

html[data-theme="dark"] .workspace-main:has(.ship-page),
html[data-theme="dark"] .workspace-main:has(.aset-root) {
  background: var(--bg) !important;
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] #sidebar {
  background: var(--sidebar) !important;
  color: #eef0e8 !important;
}

html[data-theme="dark"] .sidebar a:not(.active):not(.upgrade),
html[data-theme="dark"] #sidebar a:not(.active):not(.upgrade),
html[data-theme="dark"] #sidebar nav button {
  color: #bdc3b6;
}

html[data-theme="dark"] .sidebar .active,
html[data-theme="dark"] #sidebar nav .active,
html[data-theme="dark"] .nav a.active {
  background: var(--lime) !important;
  color: #1b210e !important;
}

html[data-theme="dark"] #sidebar nav .active svg,
html[data-theme="dark"] .nav a.active svg {
  color: #1b210e;
}

html[data-theme="dark"] .nav a:hover {
  background: #1c211c;
  color: #eef0e8;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .card,
html[data-theme="dark"] .automation-card,
html[data-theme="dark"] .subpanel,
html[data-theme="dark"] .form-step,
html[data-theme="dark"] .conversations,
html[data-theme="dark"] .conversation,
html[data-theme="dark"] .buyer-panel {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: inset 0 0 0 1px #ffffff05;
  color: var(--ink);
}

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

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--muted);
}

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

html[data-theme="dark"] :is(.btn, .button).lime,
html[data-theme="dark"] .upgrade,
html[data-theme="dark"] .upgrade h3,
html[data-theme="dark"] .upgrade p,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .admin-card p {
  color: #18200a !important;
}

html[data-theme="dark"] :is(.btn, .button).purple {
  background: #3a3148;
  color: #dbc6ff;
}

html[data-theme="dark"] :is(.icon-disc, .disc, .mini-icon, .hero-icon, .avatar) {
  color: #151723;
}

html[data-theme="dark"] :is(.icon-disc, .disc):not(.lime):not(.purple):not(.green):not(.red):not(.blue) {
  background: #374031;
  color: #edf0e7;
}

html[data-theme="dark"] .badge {
  color: #d3bdfb;
  background: #3a3148;
}

html[data-theme="dark"] .badge.green {
  background: #2a3a22;
  color: #c5f09a;
}

html[data-theme="dark"] .badge.red {
  background: #482a36;
  color: #ffa8bc;
}

html[data-theme="dark"] .badge.yellow {
  background: #493e27;
  color: #ffdb87;
}

html[data-theme="dark"] svg text {
  fill: var(--muted);
}

html[data-theme="dark"] svg line[stroke="#eceef1"],
html[data-theme="dark"] svg line[stroke="#f0f1f3"] {
  stroke: var(--line);
}

html[data-theme="dark"] .chart svg polygon {
  opacity: 0.7;
}

html[data-theme="dark"] dialog,
html[data-theme="dark"] .modal {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] dialog::backdrop {
  background: #0c100bb3;
}

html[data-theme="dark"] .chat p {
  color: var(--ink);
  background: var(--soft);
}

html[data-theme="dark"] #savebar {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border-color: var(--line);
}

html[data-theme="dark"] .note {
  color: #d1c2e9;
  background: #2f2a3a;
  border-color: #4a405c;
}

html[data-theme="dark"] .tabs .selected,
html[data-theme="dark"] .tabs button.active {
  color: #1b210e;
  background: color-mix(in srgb, var(--lime) 72%, transparent);
}

html[data-theme="dark"] .tabs a,
html[data-theme="dark"] .tabs button {
  color: var(--muted);
}

html[data-theme="dark"] .switch:after,
html[data-theme="dark"] .toggle:after {
  background: #fff;
}

html[data-theme="dark"] .public-nav,
html[data-theme="dark"] .public-page,
html[data-theme="dark"] .landing,
html[data-theme="dark"] .auth-page {
  color: var(--ink);
}

html[data-theme="dark"] a:focus-visible,
html[data-theme="dark"] button:focus-visible {
  outline-color: var(--lime);
}

.theme-toggle {
  flex: 0 0 34px !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-size: 21px !important;
  line-height: 1;
  cursor: pointer;
  margin-left: 4px;
}

html[data-theme="dark"] .theme-toggle {
  background: var(--soft);
  color: var(--lime);
  border-color: var(--line);
}

html[data-theme="dark"] body:has(#settingsForm),
html[data-theme="dark"] body:has(.overview-grid) {
  background: var(--bg);
}

html[data-theme="dark"] body:has(#settingsForm) > .workspace,
html[data-theme="dark"] body:has(.overview-grid) > .workspace {
  background: var(--sidebar);
}

html[data-theme="dark"] #topbar,
html[data-theme="dark"] .topbar select,
html[data-theme="dark"] .search,
html[data-theme="dark"] .bridge {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

@media (max-width: 600px) {
  .theme-toggle {
    flex-basis: 30px !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    margin-left: 0;
  }
}

@media print {
  #theme-toggle {
    display: none !important;
  }
  html[data-theme="dark"] {
    color-scheme: light;
  }
  html[data-theme="dark"] .print-label {
    background: white !important;
    color: black !important;
  }
}

html[data-theme="dark"] :is(.btn, .button).lime {
  background: var(--lime) !important;
  border-color: var(--lime) !important;
  color: #141a08 !important;
}

html[data-theme="dark"] :is(.btn, .button).lime:hover {
  background: #c3ee29 !important;
}

html[data-theme="dark"] :is(.icon-disc, .disc).lime,
html[data-theme="dark"] .hero-icon {
  background: #d4fa72 !important;
  color: #1d2810 !important;
}

html[data-theme="dark"] :is(.icon-disc, .disc, .mini-icon).purple,
html[data-theme="dark"] .mini-icon,
html[data-theme="dark"] .avatar {
  background: #d6baff !important;
  color: #2a1c43 !important;
}

html[data-theme="dark"] .upgrade,
html[data-theme="dark"] .admin-card {
  background: linear-gradient(125deg, #e2ff68, #c7f338) !important;
}

html[data-theme="dark"] .gradient-text {
  background: linear-gradient(100deg, #d4fa6b, #a8e645);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

html[data-theme="dark"] input:checked + .switch,
html[data-theme="dark"] .toggle.on,
html[data-theme="dark"] .switch.on {
  background: var(--lime) !important;
}

html[data-theme="dark"] .preview-nav {
  background: var(--sidebar);
  color: #f4f5f7;
}

html[data-theme="dark"] .switch span {
  background: #f5f7fc !important;
}

html[data-theme="dark"] :is(.disc, .icon-disc).green {
  background: #bff1b4;
  color: #183415;
}

html[data-theme="dark"] .status.ready,
html[data-theme="dark"] .status.online {
  background: #263f2a;
  color: #aee98e;
}

html[data-theme="dark"] .status.printed {
  background: #423551;
  color: #d8bfff;
}

html[data-theme="dark"] .status.pending {
  background: #4b3c21;
  color: #fbd288;
}

html[data-theme="dark"] .status.error,
html[data-theme="dark"] .status.offline {
  background: #4a2d36;
  color: #ffb0c0;
}

.auth-form {
  position: relative;
}
.auth-theme-toggle {
  position: absolute;
  right: 0;
  top: -45px;
}

/* Light mode: no green frame, full-bleed shell */
body > .workspace,
.workspace:has(> .sidebar) {
  background: var(--sidebar);
  border: 0;
  border-radius: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  min-height: 100vh;
}

.workspace-main {
  border-radius: 0;
}
