/* Colour themes (Nov 4 2026) - the person picks one in the user menu
   (Appearance), or the company default from Settings > Features is used;
   MY_Controller::apply_theme() puts "nd-color-<key>" on <body>. Nidaam
   Purple is the default and has no class (mystyle.css as it was).
   Only the --db-* colour tokens change here, plus the few purple
   gradients mystyle.css draws itself. Paid / Overdue / Unpaid colours and
   the PDFs never change. Loaded after mystyle.css and mobile.css.
   Light: body.nd-color-x   Dark: body.nd-color-x.dark-mode (wins over
   mystyle's body.dark-mode). Every derived token (sidebar active ...) is
   set again here because :root works its values out once, at the top. */

/* ---- Aubergine & Gold ---- */
body.nd-color-aubergine {
    --db-primary: #4B1D6E;
    --db-primary-dark: #351450;
    --db-primary-rgb: 75, 29, 110;
    --db-link-rgb: 75, 29, 110;
    --db-accent: #7a5c00;
    --db-accent-bg: rgba(245, 211, 40, 0.22);
    --db-ink: #2A1508;
    --db-muted: #76604f;
    --db-border: #ece2c4;
    --db-sidebar-bg: #FFFCF1;
    --db-sidebar-border: #ece2c4;
    --db-sidebar-active-bg: #4B1D6E;
    --db-sidebar-active-ink: #F5D328;
    --db-sidebar-icon-muted: #a8957f;
    --db-topbar-bg: #ffffff;
    --db-page-bg: #FBF5E0;
    --db-card-bg: #ffffff;
    --db-input-bg: #ffffff;
    --db-highlight: #F5D328;
    --db-on-highlight: #2A1508;
    background-color: #FBF5E0;
}
body.nd-color-aubergine.dark-mode {
    --db-primary: #8a52bd;
    --db-primary-strong: #6f3d9c;
    --db-primary-dark: #dcc2f4;
    --db-link: #d3b2f2;
    --db-link-hover: #e8d6f8;
    --db-primary-rgb: 138, 82, 189;
    --db-link-rgb: 211, 178, 242;
    --db-accent: #F5D328;
    --db-accent-bg: rgba(245, 211, 40, 0.14);
    --db-ink: #FBF5E0;
    --db-muted: #c2ad94;
    --db-border: #3c2516;
    --db-line: #33200f;
    --db-sidebar-bg: #2A1508;
    --db-sidebar-border: #3c2516;
    --db-sidebar-active-bg: #F5D328;
    --db-sidebar-active-ink: #2A1508;
    --db-sidebar-icon-muted: #9a7f66;
    --db-topbar-bg: #2A1508;
    --db-page-bg: #170c05;
    --db-card-bg: #22120a;
    --db-raised-bg: #2e1a0e;
    --db-input-bg: #1a0d06;
    --db-highlight: #F5D328;
    --db-on-highlight: #2A1508;
    background: #170c05;
    color: #FBF5E0;
}
html:has(body.nd-color-aubergine.dark-mode) { background: #170c05; }
body.nd-color-aubergine.dark-mode .hero-card, body.nd-color-aubergine.dark-mode .user-menu .user-header { background: linear-gradient(135deg, #3a1a55 0%, #170c05 100%) !important; }
body.nd-color-aubergine.dark-mode.login-page { background-color: #170c05 !important; background-image: url('../img/circuit-pattern.svg'), linear-gradient(135deg, #3a1a55 0%, #170c05 100%) !important; background-size: 240px 240px, auto !important; }

/* ---- Ocean Blue ---- */
body.nd-color-ocean {
    --db-primary: #1d5fa8;
    --db-primary-dark: #164a84;
    --db-primary-rgb: 29, 95, 168;
    --db-link-rgb: 29, 95, 168;
    --db-accent: #0b7285;
    --db-accent-bg: rgba(11, 114, 133, 0.10);
    --db-ink: #16263a;
    --db-muted: #5f7189;
    --db-border: #e2e9f2;
    --db-sidebar-bg: #ffffff;
    --db-sidebar-border: #e2e9f2;
    --db-sidebar-active-bg: #e6f0fa;
    --db-sidebar-active-ink: #1d5fa8;
    --db-sidebar-icon-muted: #8496ad;
    --db-topbar-bg: #ffffff;
    --db-page-bg: #f3f7fb;
    --db-card-bg: #ffffff;
    --db-input-bg: #ffffff;
    background-color: #f3f7fb;
}
body.nd-color-ocean.dark-mode {
    --db-primary: #2f7bd0;
    --db-primary-strong: #2566b0;
    --db-primary-dark: #a9cdf5;
    --db-link: #86bdf5;
    --db-link-hover: #b9d8f8;
    --db-primary-rgb: 47, 123, 208;
    --db-link-rgb: 134, 189, 245;
    --db-accent: #4fc3e0;
    --db-accent-bg: rgba(79, 195, 224, 0.14);
    --db-ink: #e6eef8;
    --db-muted: #97a8be;
    --db-border: #243346;
    --db-line: #1d2a3a;
    --db-sidebar-bg: #0f1a28;
    --db-sidebar-border: #1d2a3a;
    --db-sidebar-active-bg: rgba(47, 123, 208, 0.22);
    --db-sidebar-active-ink: #a9cdf5;
    --db-sidebar-icon-muted: #6b7f98;
    --db-topbar-bg: #0f1a28;
    --db-page-bg: #0b121b;
    --db-card-bg: #142030;
    --db-raised-bg: #1a2a3d;
    --db-input-bg: #0e1824;
    background: #0b121b;
    color: #e6eef8;
}
html:has(body.nd-color-ocean.dark-mode) { background: #0b121b; }
body.nd-color-ocean.dark-mode .hero-card, body.nd-color-ocean.dark-mode .user-menu .user-header { background: linear-gradient(135deg, #163a66 0%, #0b121b 100%) !important; }
body.nd-color-ocean.dark-mode.login-page { background-color: #0b121b !important; background-image: url('../img/circuit-pattern.svg'), linear-gradient(135deg, #163a66 0%, #0b121b 100%) !important; background-size: 240px 240px, auto !important; }

/* ---- Forest Green ---- */
body.nd-color-forest {
    --db-primary: #1f6b45;
    --db-primary-dark: #175536;
    --db-primary-rgb: 31, 107, 69;
    --db-link-rgb: 31, 107, 69;
    --db-accent: #8a6a12;
    --db-accent-bg: rgba(201, 162, 39, 0.16);
    --db-ink: #17261e;
    --db-muted: #5e7266;
    --db-border: #e1ebe4;
    --db-sidebar-bg: #ffffff;
    --db-sidebar-border: #e1ebe4;
    --db-sidebar-active-bg: #e4f2ea;
    --db-sidebar-active-ink: #1f6b45;
    --db-sidebar-icon-muted: #869a8d;
    --db-topbar-bg: #ffffff;
    --db-page-bg: #f3f7f4;
    --db-card-bg: #ffffff;
    --db-input-bg: #ffffff;
    background-color: #f3f7f4;
}
body.nd-color-forest.dark-mode {
    --db-primary: #2e8a5c;
    --db-primary-strong: #24724b;
    --db-primary-dark: #a8e0c2;
    --db-link: #86d6ab;
    --db-link-hover: #b5e8cc;
    --db-primary-rgb: 46, 138, 92;
    --db-link-rgb: 134, 214, 171;
    --db-accent: #e0bf55;
    --db-accent-bg: rgba(224, 191, 85, 0.14);
    --db-ink: #e6f2ea;
    --db-muted: #9ab3a3;
    --db-border: #24362b;
    --db-line: #1d2c23;
    --db-sidebar-bg: #0f1914;
    --db-sidebar-border: #1d2c23;
    --db-sidebar-active-bg: rgba(46, 138, 92, 0.25);
    --db-sidebar-active-ink: #a8e0c2;
    --db-sidebar-icon-muted: #6d8577;
    --db-topbar-bg: #0f1914;
    --db-page-bg: #0b120e;
    --db-card-bg: #142019;
    --db-raised-bg: #1a2a21;
    --db-input-bg: #0e1712;
    background: #0b120e;
    color: #e6f2ea;
}
html:has(body.nd-color-forest.dark-mode) { background: #0b120e; }
body.nd-color-forest.dark-mode .hero-card, body.nd-color-forest.dark-mode .user-menu .user-header { background: linear-gradient(135deg, #174a31 0%, #0b120e 100%) !important; }
body.nd-color-forest.dark-mode.login-page { background-color: #0b120e !important; background-image: url('../img/circuit-pattern.svg'), linear-gradient(135deg, #174a31 0%, #0b120e 100%) !important; background-size: 240px 240px, auto !important; }

/* ---- Graphite ---- */
body.nd-color-graphite {
    --db-primary: #374151;
    --db-primary-dark: #1f2937;
    --db-primary-rgb: 55, 65, 81;
    --db-link-rgb: 55, 65, 81;
    --db-accent: #0f766e;
    --db-accent-bg: rgba(15, 118, 110, 0.10);
    --db-ink: #1f2328;
    --db-muted: #6b6f76;
    --db-border: #e7e5e4;
    --db-sidebar-bg: #fafaf9;
    --db-sidebar-border: #e7e5e4;
    --db-sidebar-active-bg: #e7e5e4;
    --db-sidebar-active-ink: #111827;
    --db-sidebar-icon-muted: #9a9ea5;
    --db-topbar-bg: #ffffff;
    --db-page-bg: #f5f5f4;
    --db-card-bg: #ffffff;
    --db-input-bg: #ffffff;
    background-color: #f5f5f4;
}
body.nd-color-graphite.dark-mode {
    --db-primary: #4b5563;
    --db-primary-strong: #374151;
    --db-primary-dark: #e5e7eb;
    --db-link: #cbd5e1;
    --db-link-hover: #f1f5f9;
    --db-primary-rgb: 75, 85, 99;
    --db-link-rgb: 203, 213, 225;
    --db-accent: #5eead4;
    --db-accent-bg: rgba(94, 234, 212, 0.12);
    --db-ink: #ececec;
    --db-muted: #a1a4a9;
    --db-border: #2e3033;
    --db-line: #26282b;
    --db-sidebar-bg: #161718;
    --db-sidebar-border: #26282b;
    --db-sidebar-active-bg: #2e3033;
    --db-sidebar-active-ink: #ffffff;
    --db-sidebar-icon-muted: #7d8187;
    --db-topbar-bg: #161718;
    --db-page-bg: #111213;
    --db-card-bg: #1c1d1f;
    --db-raised-bg: #242528;
    --db-input-bg: #151617;
    background: #111213;
    color: #ececec;
}
html:has(body.nd-color-graphite.dark-mode) { background: #111213; }
body.nd-color-graphite.dark-mode .hero-card, body.nd-color-graphite.dark-mode .user-menu .user-header { background: linear-gradient(135deg, #2b2f36 0%, #111213 100%) !important; }
body.nd-color-graphite.dark-mode.login-page { background-color: #111213 !important; background-image: url('../img/circuit-pattern.svg'), linear-gradient(135deg, #2b2f36 0%, #111213 100%) !important; background-size: 240px 240px, auto !important; }

/* ---- Terracotta ---- */
body.nd-color-terracotta {
    --db-primary: #b4532a;
    --db-primary-dark: #93421f;
    --db-primary-rgb: 180, 83, 42;
    --db-link-rgb: 180, 83, 42;
    --db-accent: #7c5a2e;
    --db-accent-bg: rgba(124, 90, 46, 0.10);
    --db-ink: #2b1d16;
    --db-muted: #7a675c;
    --db-border: #efe4dc;
    --db-sidebar-bg: #ffffff;
    --db-sidebar-border: #efe4dc;
    --db-sidebar-active-bg: #f8e6da;
    --db-sidebar-active-ink: #93421f;
    --db-sidebar-icon-muted: #a8968a;
    --db-topbar-bg: #ffffff;
    --db-page-bg: #fbf6f2;
    --db-card-bg: #ffffff;
    --db-input-bg: #ffffff;
    background-color: #fbf6f2;
}
body.nd-color-terracotta.dark-mode {
    --db-primary: #c2633a;
    --db-primary-strong: #a6522e;
    --db-primary-dark: #f5c2a8;
    --db-link: #f2ab88;
    --db-link-hover: #f8cdb6;
    --db-primary-rgb: 194, 99, 58;
    --db-link-rgb: 242, 171, 136;
    --db-accent: #e9b384;
    --db-accent-bg: rgba(233, 179, 132, 0.14);
    --db-ink: #f6ece6;
    --db-muted: #bba59a;
    --db-border: #3a2921;
    --db-line: #30221b;
    --db-sidebar-bg: #1a120e;
    --db-sidebar-border: #30221b;
    --db-sidebar-active-bg: rgba(194, 99, 58, 0.25);
    --db-sidebar-active-ink: #f5c2a8;
    --db-sidebar-icon-muted: #8f776b;
    --db-topbar-bg: #1a120e;
    --db-page-bg: #130c09;
    --db-card-bg: #201612;
    --db-raised-bg: #2a1d17;
    --db-input-bg: #18100c;
    background: #130c09;
    color: #f6ece6;
}
html:has(body.nd-color-terracotta.dark-mode) { background: #130c09; }
body.nd-color-terracotta.dark-mode .hero-card, body.nd-color-terracotta.dark-mode .user-menu .user-header { background: linear-gradient(135deg, #5a2a16 0%, #130c09 100%) !important; }
body.nd-color-terracotta.dark-mode.login-page { background-color: #130c09 !important; background-image: url('../img/circuit-pattern.svg'), linear-gradient(135deg, #5a2a16 0%, #130c09 100%) !important; background-size: 240px 240px, auto !important; }

/* ---- every theme other than Nidaam Purple ---- */
body[class*="nd-color-"].dark-mode .nd-newbtn,
body[class*="nd-color-"].dark-mode .login-card__aside,
body[class*="nd-color-"].dark-mode .small-box.bg-secondary,
body[class*="nd-color-"].dark-mode .form-actions .btn-save { background: linear-gradient(135deg, var(--db-primary) 0%, var(--db-primary-strong) 100%) !important; }
body[class*="nd-color-"].dark-mode .pv-avatar { background: linear-gradient(135deg, var(--db-primary) 0%, var(--db-primary-strong) 100%); }
body[class*="nd-color-"].dark-mode .pv-kpi--main { background: linear-gradient(135deg, var(--db-primary-strong) 0%, var(--db-primary-strong) 100%); }
/* the gold of Aubergine & Gold: the selected item in the menu keeps its icon in the same colour */
body.nd-color-aubergine .main-sidebar .nav-link.active i,
body.nd-color-aubergine .main-sidebar .nav-link.active .nav-icon { color: var(--db-sidebar-active-ink) !important; }

/* ---- more parts mystyle.css paints purple itself (every theme but Nidaam Purple) ---- */
body[class*="nd-color-"] .hero-card { background: var(--db-primary) !important; }
body[class*="nd-color-"].dark-mode .dash-seg button[aria-pressed="true"] { background: var(--db-primary); color: #fff; }
body[class*="nd-color-"] .nd-same-lines:not(.is-done) { background: rgba(var(--db-primary-rgb), 0.07); border-color: rgba(var(--db-primary-rgb), 0.25); color: var(--db-primary-dark); }
body[class*="nd-color-"] .nd-same-lines > .fas { color: var(--db-primary); }
body[class*="nd-color-"] .nd-same-lines__copy { background: var(--db-primary); }
body[class*="nd-color-"] .nd-same-lines__copy:hover { background: var(--db-primary-dark); }
body[class*="nd-color-"].dark-mode .nd-same-lines:not(.is-done) { background: rgba(var(--db-primary-rgb), 0.16); border-color: rgba(var(--db-primary-rgb), 0.4); color: var(--db-link); }
body[class*="nd-color-"].dark-mode .nd-same-lines__copy:hover { background: var(--db-primary-strong); }
body[class*="nd-color-"] .nd-bt__rec.is-on { border-color: rgba(var(--db-primary-rgb), 0.45); background: rgba(var(--db-primary-rgb), 0.06); }

/* ---- the "Colours" swatches in the user menu (navbar.php) ---- */
.nd-color-pick { padding: 4px 16px 10px; }
.nd-color-pick__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nd-color-pick__sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--db-card-bg, #fff); box-shadow: 0 0 0 1px var(--db-border, #e7ebf1); cursor: pointer; padding: 0; }
.nd-color-pick__sw:hover { box-shadow: 0 0 0 2px var(--db-muted, #6b7684); }
.nd-color-pick__sw.is-on { box-shadow: 0 0 0 2px var(--db-ink, #1c2733); }
.nd-color-pick__co { height: 28px; border-radius: 14px; border: 1px solid var(--db-border, #e7ebf1); background: transparent; color: var(--db-muted, #6b7684); font-size: .76rem; font-weight: 600; padding: 0 10px; cursor: pointer; }
.nd-color-pick__co.is-on { border-color: var(--db-ink, #1c2733); color: var(--db-ink, #1c2733); }
.nd-color-pick button:focus-visible { outline: 2px solid var(--db-primary, #534AB7); outline-offset: 2px; }
