/*
 * Atlas themes. Built on Bootstrap 5.3 colour modes (data-bs-theme).
 * light = Bootstrap defaults; dark = Bootstrap dark; blue = navy chrome, light-blue accents, white surfaces.
 * All app colours below are variables so components stay consistent across themes.
 */
:root,
[data-bs-theme='light'],
[data-bs-theme='blue'] {
  --atlas-header-bg: #ffffff;
  --atlas-header-fg: #172b4d;
  --atlas-header-border: #dfe1e6;
  --atlas-sidebar-bg: #f7f8f9;
  --atlas-sidebar-fg: #344563;
  --atlas-sidebar-active-bg: #e9f2ff;
  --atlas-sidebar-active-fg: #0c66e4;
  --atlas-surface: #ffffff;
  --atlas-surface-2: #f7f8f9;
  --atlas-border: #dfe1e6;
  --atlas-muted: #5e6c84;
  --atlas-accent: #0c66e4;
  --atlas-focus: #2684ff;
  /* status categories (WCAG AA on their backgrounds) */
  --atlas-todo-bg: #dfe1e6;
  --atlas-todo-fg: #172b4d;
  --atlas-progress-bg: #cce0ff;
  --atlas-progress-fg: #09326c;
  --atlas-done-bg: #baf3db;
  --atlas-done-fg: #164b35;
  --atlas-archived-bg: #5e6c84;
  --atlas-archived-fg: #ffffff;
  --atlas-internal-bg: #fff7d6;
  --atlas-flow-bg: #eef1f4;
  --atlas-flow-border: #dcdfe4;
  --atlas-internal-border: #e2b203;
  --atlas-public-bg: #e9f2ff;
  --atlas-public-border: #579dff;
  --atlas-card-bg: #ffffff;
  --atlas-column-bg: #f1f2f4;
  --atlas-wip-over: #ffd5d2;
  --atlas-danger-fg: #ae2e24;
}

[data-bs-theme='blue'] {
  --bs-primary: #0c66e4;
  --bs-primary-rgb: 12, 102, 228;
  --bs-link-color: #0c66e4;
  --bs-link-color-rgb: 12, 102, 228;
  --bs-link-hover-color: #0055cc;
  --bs-body-bg: #f2f2f2; /* the user (2026-11-19): neutral grey instead of the mild blue */
  --bs-body-bg-rgb: 242, 242, 242;
  /* header and sidebar colours chosen by the user (2026-11-09); T-0204: the header blue 4% darker (#3478e3 -> #3273da) so the white
     brand name and header text pass WCAG AA (4.25:1 -> 4.56:1) */
  --atlas-header-bg: #3273da;
  --atlas-header-fg: #ffffff;
  --atlas-header-border: #3273da;
  --atlas-sidebar-bg: #1a2332;
  --atlas-sidebar-fg: #dbe8ff;
  --atlas-sidebar-active-bg: #1d4f9e;
  --atlas-sidebar-active-fg: #ffffff;
  --atlas-surface: #ffffff;
  --atlas-surface-2: #eef4fc;
  --atlas-border: #c9d8ee;
  --atlas-muted: #44546f;
  --atlas-accent: #0c66e4;
  --atlas-column-bg: #e6eefa;
}

[data-bs-theme='dark'] {
  --atlas-header-bg: #1d2125;
  --atlas-header-fg: #dee4ea;
  --atlas-header-border: #2c333a;
  --atlas-sidebar-bg: #161a1d;
  --atlas-sidebar-fg: #b6c2cf;
  --atlas-sidebar-active-bg: #1c2b41;
  --atlas-sidebar-active-fg: #85b8ff;
  --atlas-surface: #22272b;
  --atlas-surface-2: #1d2125;
  --atlas-border: #38414a;
  --atlas-muted: #9fadbc;
  --atlas-accent: #579dff;
  --atlas-focus: #85b8ff;
  --atlas-todo-bg: #454f59;
  --atlas-todo-fg: #f1f2f4;
  --atlas-progress-bg: #09326c;
  --atlas-progress-fg: #cce0ff;
  --atlas-done-bg: #164b35;
  --atlas-done-fg: #baf3db;
  --atlas-archived-bg: #8c9bab;
  --atlas-archived-fg: #161a1d;
  --atlas-internal-bg: #3d3110;
  --atlas-flow-bg: #2c333a;
  --atlas-flow-border: #3d454d;
  --atlas-internal-border: #cf9f02;
  --atlas-public-bg: #1c2b41;
  --atlas-public-border: #579dff;
  --atlas-card-bg: #2c333a;
  --atlas-column-bg: #1d2125;
  --atlas-wip-over: #5d1f1a;
  --atlas-danger-fg: #ff9c8f;
}

/* Tag palette — background/foreground pairs reach AA in every theme */
.tag-blue { --tag-bg: #cce0ff; --tag-fg: #09326c; }
.tag-green { --tag-bg: #baf3db; --tag-fg: #164b35; }
.tag-red { --tag-bg: #ffd5d2; --tag-fg: #5d1f1a; }
.tag-yellow { --tag-bg: #f8e6a0; --tag-fg: #533f04; }
.tag-purple { --tag-bg: #dfd8fd; --tag-fg: #352c63; }
.tag-teal { --tag-bg: #c6edfb; --tag-fg: #164555; }
.tag-orange { --tag-bg: #fedec8; --tag-fg: #702e00; }
.tag-grey { --tag-bg: #dcdfe4; --tag-fg: #172b4d; }
[data-bs-theme='dark'] .tag-blue { --tag-bg: #09326c; --tag-fg: #cce0ff; }
[data-bs-theme='dark'] .tag-green { --tag-bg: #164b35; --tag-fg: #baf3db; }
[data-bs-theme='dark'] .tag-red { --tag-bg: #5d1f1a; --tag-fg: #ffd5d2; }
[data-bs-theme='dark'] .tag-yellow { --tag-bg: #533f04; --tag-fg: #f8e6a0; }
[data-bs-theme='dark'] .tag-purple { --tag-bg: #352c63; --tag-fg: #dfd8fd; }
[data-bs-theme='dark'] .tag-teal { --tag-bg: #164555; --tag-fg: #c6edfb; }
[data-bs-theme='dark'] .tag-orange { --tag-bg: #702e00; --tag-fg: #fedec8; }
[data-bs-theme='dark'] .tag-grey { --tag-bg: #454f59; --tag-fg: #f1f2f4; }

/* Avatar palette */
.avatar-c0 { background: #3b5bdb; }
.avatar-c1 { background: #0b7285; }
.avatar-c2 { background: #237a34; }
.avatar-c3 { background: #c2255c; }
.avatar-c4 { background: #862e9c; }
.avatar-c5 { background: #c4410c; }
.avatar-c6 { background: #4c7a0b; }
.avatar-c7 { background: #1864ab; }

/* ── WCAG AA adjustments to Bootstrap defaults (verified with axe) ── */
[data-bs-theme='light'],
[data-bs-theme='blue'] {
  --bs-code-color: #a52863;
}
[data-bs-theme='dark'] {
  --bs-code-color: #f08cbd;
}
/* Bootstrap's yellow outline text is too light on white (WCAG AA): darker amber on the light themes */
:root:not([data-bs-theme='dark']) .btn-outline-warning {
  --bs-btn-color: #855d00;
  --bs-btn-border-color: #b88600;
  --bs-btn-hover-color: #000;
}
[data-bs-theme='dark'] .btn-outline-primary {
  --bs-btn-color: #6ea8fe;
  --bs-btn-border-color: #6ea8fe;
}
[data-bs-theme='blue'] .btn-outline-secondary {
  --bs-btn-color: #545b62;
  --bs-btn-border-color: #545b62;
}
[data-bs-theme='blue'] .btn-outline-primary {
  --bs-btn-color: #0a58ca;
  --bs-btn-border-color: #0a58ca;
}
[data-bs-theme='blue'] .btn-outline-danger {
  --bs-btn-color: #b02a37;
  --bs-btn-border-color: #b02a37;
}
[data-bs-theme='dark'] .btn-outline-danger {
  --bs-btn-color: #ea868f;
  --bs-btn-border-color: #ea868f;
}
[data-bs-theme='blue'] .btn-outline-success {
  --bs-btn-color: #146c43;
  --bs-btn-border-color: #146c43;
}
[data-bs-theme='dark'] .btn-outline-secondary {
  --bs-btn-color: #adb5bd;
  --bs-btn-border-color: #8c959f;
}
[data-bs-theme='dark'] .btn-outline-success {
  --bs-btn-color: #75b798;
  --bs-btn-border-color: #75b798;
}

/* T-0201 (DESIGN-T0201 6.6): database schema diagram. Text tokens reach 4.5:1 on --dbs-node-bg (dimmed text too, so a dimmed
   node never fails contrast); the 16 group colours are a stripe and a frame only (non-text, 3:1 on the node and frame
   background). The group name is always written next to the colour. */
:root,
[data-bs-theme='light'],
[data-bs-theme='blue'] {
  --dbs-bg: #f7f8f9;
  --dbs-frame-bg: rgba(255, 255, 255, 0.6);
  --dbs-node-bg: #ffffff;
  --dbs-node-border: #b3b9c4;
  --dbs-node-fg: #172b4d;
  --dbs-muted: #44546f;
  --dbs-dim-fg: #5e6c84;
  --dbs-dim-border: #dcdfe4;
  --dbs-edge: #8590a2;
  --dbs-edge-hot: #0c66e4;
  --dbs-select: #0c66e4;
  --dbs-match-bg: #fff7d6;
  --dbs-match-border: #b38600;
  --dbs-link: #0055cc; /* 4.5:1 also on --dbs-match-bg */
  --dbs-g0: #758195;
  --dbs-g1: #0c66e4;
  --dbs-g2: #1f845a;
  --dbs-g3: #6e5dc6;
  --dbs-g4: #c9372c;
  --dbs-g5: #b65c02;
  --dbs-g6: #227d9b;
  --dbs-g7: #943d73;
  --dbs-g8: #7f5f01;
  --dbs-g9: #5e4db2;
  --dbs-g10: #216e4e;
  --dbs-g11: #ae2e24;
  --dbs-g12: #0055cc;
  --dbs-g13: #626f86;
  --dbs-g14: #a54800;
  --dbs-g15: #206a83;
}
[data-bs-theme='blue'] {
  --dbs-bg: #eef4fc;
  --dbs-node-border: #a9bcd8;
}
[data-bs-theme='dark'] {
  --dbs-bg: #161a1d;
  --dbs-frame-bg: rgba(34, 39, 43, 0.6);
  --dbs-node-bg: #22272b;
  --dbs-node-border: #596773;
  --dbs-node-fg: #dee4ea;
  --dbs-muted: #b6c2cf;
  --dbs-dim-fg: #9fadbc;
  --dbs-dim-border: #38414a;
  --dbs-edge: #738496;
  --dbs-edge-hot: #579dff;
  --dbs-select: #85b8ff;
  --dbs-match-bg: #3d3110;
  --dbs-match-border: #cf9f02;
  --dbs-link: #85b8ff;
  --dbs-g0: #8c9bab;
  --dbs-g1: #579dff;
  --dbs-g2: #4bce97;
  --dbs-g3: #9f8fef;
  --dbs-g4: #f87168;
  --dbs-g5: #fea362;
  --dbs-g6: #6cc3e0;
  --dbs-g7: #e774bb;
  --dbs-g8: #e2b203;
  --dbs-g9: #b8acf6;
  --dbs-g10: #7ee2b8;
  --dbs-g11: #fd9891;
  --dbs-g12: #85b8ff;
  --dbs-g13: #9fadbc;
  --dbs-g14: #fec195;
  --dbs-g15: #9dd9ee;
}
