/*
 * Essential edition — colour scheme and branding styles (loaded after app.css / themes.css, and on the login page).
 *
 *   Midnight Navy   #14243A  headers, menus, primary buttons
 *   Pure White      #FFFFFF  text on dark areas, document backgrounds
 *   Soft Background #F5F7FB  screen backgrounds, panels
 *   Slate           #334155  body text, borders, secondary elements
 *
 * Applies to the Light theme (the edition default) and Semi-dark; Dark stays available for users who pick it.
 */
:root,
html[data-theme="light"],
html[data-theme="semidark"] {
  --brand-navy: #14243A;
  --brand-navy-2: #1E3350;      /* hover / borders on navy */
  --brand-navy-3: #0D1828;      /* pressed */
  --brand-white: #FFFFFF;
  --brand-soft: #F5F7FB;
  --brand-slate: #334155;

  --surface: #FFFFFF;
  --surface-2: #F5F7FB;
  --surface-3: #EBEFF5;
  --border: #D6DCE5;
  --text: #334155;
  --text-muted: #64748B;
  --shadow-sm: 0 1px 3px rgba(20,36,58,.08);
  --shadow-md: 0 4px 20px rgba(20,36,58,.10);
  --shadow-header: 0 1px 0 rgba(0,0,0,.25), 0 2px 10px rgba(20,36,58,.18);
  --strong-bg: #14243A;
  --strong-text: #FFFFFF;
  --overlay: rgba(20,36,58,.5);
  --on-primary: #FFFFFF;
  --bs-body-color: #334155;
  --bs-body-bg: #F5F7FB;
  --bs-border-color: #D6DCE5;
  --bs-heading-color: #14243A;

  /* header + sidebar in Midnight Navy with white text */
  --header-bg: #14243A; --header-text: #FFFFFF; --header-muted: rgba(255,255,255,.68);
  --sidebar-bg: #14243A; --sidebar-text: #FFFFFF; --sidebar-muted: rgba(255,255,255,.62);
  --sidebar-hover: rgba(255,255,255,.08); --sidebar-active-bg: rgba(255,255,255,.14); --sidebar-active-text: #FFFFFF;
  --sidebar-border: #1E3350;
}

/* components that sit inside the navy header / sidebar use dark-surface tokens */
html:not([data-theme="dark"]) #main-header,
html:not([data-theme="dark"]) #sidebar {
  --surface: #14243A;
  --surface-2: #1E3350;
  --surface-3: #25395A;
  --border: #2A4062;
  --text: #FFFFFF;
  --text-muted: rgba(255,255,255,.68);
  color: #FFFFFF;
}
html:not([data-theme="dark"]) #sidebar .nav-item-btn.active { background: rgba(255,255,255,.14); color: #FFFFFF; }
html:not([data-theme="dark"]) #sidebar .sub-menu .nav-item-btn.active::before { background: #FFFFFF; border-color: #FFFFFF; }
html:not([data-theme="dark"]) #sidebar .nav-item-btn:hover { background: rgba(255,255,255,.08); color: #FFFFFF; }
html:not([data-theme="dark"]) #main-header .btn-close { filter: invert(1); }
html:not([data-theme="dark"]) #main-header .dropdown-menu,
html:not([data-theme="dark"]) #main-header .dropdown-menu * { --surface: #FFFFFF; --surface-2: #F5F7FB; --border: #D6DCE5; --text: #334155; --text-muted: #64748B; }
html:not([data-theme="dark"]) #main-header .dropdown-menu { color: #334155; }
html:not([data-theme="dark"]) .app-version a { color: #FFFFFF; }

/* Midnight Navy accent: primary buttons, links, selected items */
html[data-accent="navy"], html:not([data-accent]) {
  --primary: #14243A;
  --primary-dark: #0D1828;
  --primary-light: #E6EAF1;
  --primary-mid: #BCC6D6;
  --bs-primary: #14243A;
  --bs-primary-rgb: 20, 36, 58;
  --bs-link-color: #1E3A5F;
  --bs-link-color-rgb: 30, 58, 95;
  --bs-link-hover-color: #14243A;
  --bs-link-hover-color-rgb: 20, 36, 58;
  --bs-primary-text-emphasis: #14243A;
  --bs-primary-bg-subtle: #E6EAF1;
  --bs-primary-border-subtle: #BCC6D6;
}
html[data-theme="dark"][data-accent="navy"] { --primary: #8FA6C8; --primary-dark: #B4C4DC; --primary-light: #1E2A3B; --primary-mid: #33465F; }
/* sidebar selection stays readable on navy whatever the accent */
html:not([data-theme="dark"]) #sidebar { --primary: #FFFFFF; --primary-light: rgba(255,255,255,.14); }

/* secondary buttons in Slate */
.btn-outline-secondary { --bs-btn-color: #334155; --bs-btn-border-color: #94A3B8; --bs-btn-hover-bg: #334155;
  --bs-btn-hover-border-color: #334155; --bs-btn-hover-color: #FFFFFF; --bs-btn-active-bg: #1F2937; }

/* ── branding: logo / product name in the header ─────────────────── */
.logo-mark .brand-name { color: #FFFFFF; font-weight: 800; font-size: 1.05rem; letter-spacing: -.2px; white-space: nowrap; }
html[data-theme="dark"] .logo-mark .brand-name { color: var(--text); }
.logo-mark .brand-logo-chip { background: #FFFFFF; border-radius: 6px; padding: 3px 6px; display: inline-flex; align-items: center; }
.logo-mark .brand-logo-chip .logo-img { height: 24px; }
.logo-mark .brand-logo-dark { height: 30px; width: auto; display: block; }
.logo-mark .logo-version { background: #FFFFFF; color: #14243A; }

/* ── login page ───────────────────────────────────────────────────── */
.login-logo .login-product { font-weight: 800; font-size: 1.35rem; color: #14243A; letter-spacing: -.3px; }
.login-logo .login-logo-img { max-height: 46px; width: auto; }
.login-logo .login-version { background: #14243A; color: #FFFFFF; font-size: .66rem; font-weight: 700; border-radius: 5px; padding: 3px 6px; }
.btn-primary-custom { background: #14243A; }
.btn-primary-custom:hover { background: #0D1828; box-shadow: 0 4px 16px rgba(20,36,58,.3); }
#login-screen { background: #F5F7FB; }
.login-brand { color: #334155; }
.login-brand a { color: #14243A; font-weight: 600; }

/* ── branding settings screen ─────────────────────────────────────── */
.brand-preview { border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand-preview.on-navy { background: #14243A; color: #FFFFFF; }
.brand-preview.on-white { background: #FFFFFF; border: 1px solid var(--border); }
.brand-preview img { max-height: 40px; width: auto; }
