/*
 * Theme tokens for the secure shell: sign-in, password change, administrator,
 * access-denied, and the Market Analysis account chrome.
 *
 * The light values are the site's existing colours, character for character, so
 * light mode renders exactly as it did before the toggle existed. Dark mode
 * reuses the same teal and green language on a deep teal-black ground rather
 * than introducing a new palette.
 *
 * The Market Analysis application's own interface is deliberately not themed
 * from here. Only the chrome wrapped around it responds.
 */

:root {
  color-scheme: light;

  --amc-bg: #F8F5EE;
  --amc-surface: #ffffff;
  --amc-surface-2: #faf8f3;
  --amc-border: #e5e0d6;
  --amc-border-soft: #f4f0e7;
  --amc-border-input: #ddd7ca;
  --amc-divider: #efeae0;
  --amc-head-rule: #ece7dc;

  --amc-text: #1a1a1a;
  --amc-text-soft: #3a3a3a;
  --amc-muted: #6b6b6b;
  --amc-faint: #8a8a8a;
  --amc-fainter: #9a9a9a;

  /* Teal is for headings, links and quiet accents. */
  --amc-accent: #046676;
  /* Filled buttons are tracked separately so each mode keeps legible contrast. */
  --amc-btn-bg: #046676;
  --amc-btn-bg-hover: #035565;
  --amc-btn-text: #ffffff;

  --amc-shadow: rgba(0, 0, 0, 0.10);

  --amc-ok-bg: #eef5e9;
  --amc-ok-border: #cfe0c2;
  --amc-ok-text: #3f6b28;
  --amc-err-bg: #fdf1f1;
  --amc-err-border: #f0cfcf;
  --amc-err-text: #a33a3a;
  --amc-warn-bg: #fdf6ec;
  --amc-warn-border: #e8cfa2;
  --amc-warn-text: #7a5320;
  --amc-warn-strong: #5c3d15;

  --amc-chip-yes-bg: #eef4ea;
  --amc-chip-yes-text: #4a7031;
  --amc-chip-no-bg: #f3f1ec;
  --amc-chip-no-text: #9a9a9a;
  --amc-chip-admin-bg: #e6f2f5;
  --amc-chip-admin-text: #046676;

  --amc-dot-idle: #9aa3a8;
  --amc-dot-ok: #659A45;
  --amc-dot-pending: #c8821a;
  --amc-dot-error: #c0392b;
}

[data-theme="dark"] {
  color-scheme: dark;

  --amc-bg: #0F1B1E;
  --amc-surface: #16262A;
  --amc-surface-2: #1C3035;
  --amc-border: #263C41;
  --amc-border-soft: #1F3338;
  --amc-border-input: #2E464C;
  --amc-divider: #22373C;
  --amc-head-rule: #24393E;

  --amc-text: #E9EEED;
  --amc-text-soft: #D2DCDB;
  --amc-muted: #A2B2B3;
  --amc-faint: #8FA1A3;
  --amc-fainter: #7E9092;

  --amc-accent: #56B9C9;
  --amc-btn-bg: #0B7F93;
  --amc-btn-bg-hover: #0E96AE;
  --amc-btn-text: #ffffff;

  --amc-shadow: rgba(0, 0, 0, 0.45);

  --amc-ok-bg: #16301C;
  --amc-ok-border: #2C5433;
  --amc-ok-text: #92CE72;
  --amc-err-bg: #351B1B;
  --amc-err-border: #5C2E2E;
  --amc-err-text: #EE9B95;
  --amc-warn-bg: #33260F;
  --amc-warn-border: #5B451C;
  --amc-warn-text: #E3B871;
  --amc-warn-strong: #F0D2A0;

  --amc-chip-yes-bg: #1D3A22;
  --amc-chip-yes-text: #8FC96F;
  --amc-chip-no-bg: #223438;
  --amc-chip-no-text: #8B9D9F;
  --amc-chip-admin-bg: #123C46;
  --amc-chip-admin-text: #6ECBDA;

  --amc-dot-idle: #7C8E90;
  --amc-dot-ok: #7FB861;
  --amc-dot-pending: #D9A040;
  --amc-dot-error: #E2685A;
}

/* ------------------------------------------------------------------ toggle */

/* Several host pages style bare `button`, including width:100%, so every
   property that would distort the control is pinned here rather than inherited. */
.amc-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  margin: 0;
  font: 600 12px/1 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--amc-accent);
  background: var(--amc-surface);
  border: 1px solid var(--amc-border-input);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.amc-theme-toggle:hover { border-color: var(--amc-accent); }
.amc-theme-toggle:focus-visible { outline: 2px solid var(--amc-accent); outline-offset: 2px; }
.amc-theme-toggle svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* For the screens that have no account area of their own. */
.amc-theme-floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  box-shadow: 0 1px 6px var(--amc-shadow);
}
