/* ───────────────────────────────────────────────────────────────────────────
   Self-hosted Inter (latin) with metric overrides.

   Inter's native vertical metrics sit the glyph high in the em-box, so text
   reads "pulled to the top" inside tight single-line containers (buttons,
   badges/pills). Re-declaring the face with ascent/descent/line-gap overrides
   re-centres the glyph app-wide. The Google Fonts <link> now loads only
   Plus Jakarta Sans; Inter is served from /static/fonts so these overrides
   are authoritative. Latin subset only (English UI).

   Tuning: text HIGH in tight containers (buttons/badges) → raise ascent-override
   a few %; text LOW → lower it. Centered when ascent-override − descent-override
   ≈ Inter's cap-height (~0.727). Headings use Plus Jakarta, so this only affects
   Inter (body, buttons, inputs, badges).
   ──────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/inter-latin-400.woff2) format('woff2');
  ascent-override: 95%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/inter-latin-500.woff2) format('woff2');
  ascent-override: 95%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/inter-latin-600.woff2) format('woff2');
  ascent-override: 95%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/inter-latin-700.woff2) format('woff2');
  ascent-override: 95%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}

.container-xxl {
  max-width: 1600px;
}

/* ===========================================================================
   BackboneAI brand teal — sourced from Twin Tech Labs (twintechlabs.io)
     --ttl-teal        #1387b1   (primary)
     --ttl-teal-light  #18a5d6
     --ttl-teal-dark   #0f6d90
   =========================================================================== */

:root,
[data-coreui-theme=light] {
  --cui-body-font-size: 1.0625rem; /* 17px */
  --cui-body-font-family: 'Inter', system-ui, -apple-system, sans-serif;

  /* BackboneAI teal primary (Twin Tech Labs palette) */
  --cui-indigo: #1387b1;
  --cui-purple: #1387b1;
  --cui-primary: #1387b1;
  --cui-primary-rgb: 19, 135, 177;
  --cui-primary-text-emphasis: #0f6d90;
  --cui-primary-bg-subtle: #d6ecf4;
  --cui-primary-border-subtle: #8fcce0;
  --cui-link-color: #1387b1;
  --cui-link-color-rgb: 19, 135, 177;
  --cui-link-hover-color: #0f6d90;
  --cui-link-hover-color-rgb: 15, 109, 144;
  --cui-focus-ring-color: rgba(19, 135, 177, 0.25);
}

[data-coreui-theme=dark] {
  --cui-primary: #18a5d6;
  --cui-primary-rgb: 24, 165, 214;
  --cui-primary-text-emphasis: #9fd8ec;
  --cui-primary-bg-subtle: #0f3a4a;
  --cui-primary-border-subtle: #1f6b88;
  --cui-link-color: #18a5d6;
  --cui-link-color-rgb: 24, 165, 214;
  --cui-link-hover-color: #4fbde4;
  --cui-link-hover-color-rgb: 79, 189, 228;
  --cui-focus-ring-color: rgba(24, 165, 214, 0.25);
}

/* Override hardcoded button colors */
.btn-primary {
  --cui-btn-bg: #1387b1;
  --cui-btn-border-color: #1387b1;
  --cui-btn-hover-bg: #0f6d90;
  --cui-btn-hover-border-color: #0f6d90;
  --cui-btn-active-bg: #0d5f7e;
  --cui-btn-active-border-color: #0d5f7e;
  --cui-btn-disabled-bg: #1387b1;
  --cui-btn-disabled-border-color: #1387b1;
}

.btn-outline-primary {
  --cui-btn-color: #1387b1;
  --cui-btn-border-color: #1387b1;
  --cui-btn-hover-bg: #1387b1;
  --cui-btn-hover-border-color: #1387b1;
  --cui-btn-active-bg: #1387b1;
  --cui-btn-active-border-color: #1387b1;
  --cui-btn-disabled-color: #1387b1;
  --cui-btn-disabled-border-color: #1387b1;
}

[data-coreui-theme=dark] .btn-primary {
  --cui-btn-bg: #18a5d6;
  --cui-btn-border-color: #18a5d6;
  --cui-btn-hover-bg: #1387b1;
  --cui-btn-hover-border-color: #1387b1;
  --cui-btn-active-bg: #0f6d90;
  --cui-btn-active-border-color: #0f6d90;
  --cui-btn-disabled-bg: #18a5d6;
  --cui-btn-disabled-border-color: #18a5d6;
}

body {
  font-size: var(--cui-body-font-size);
  font-family: var(--cui-body-font-family);
}

/* ─── Softer, rounder surfaces (clean-SaaS pass) ─────────────────────────── */
:root {
  --cui-border-radius:      0.625rem;   /* 10px — buttons, inputs, badges */
  --cui-border-radius-sm:   0.45rem;
  --cui-border-radius-lg:   0.875rem;   /* 14px */
  --cui-border-radius-xl:   1.25rem;
  --cui-card-border-radius: 1rem;       /* 16px — rounder cards */
  --cui-card-inner-border-radius: calc(1rem - 1px);
}

.card {
  border-radius: var(--cui-card-border-radius);
  border-color: rgba(15, 23, 42, 0.07);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
              0 10px 28px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Gentle lift on cards that opt into a shadow (plan cards, dashboards, tiles). */
.card.shadow-sm:hover,
.card.shadow:hover {
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06),
              0 18px 44px rgba(15, 23, 42, 0.11);
  transform: translateY(-2px);
}

.btn,
.form-control,
.form-select,
.input-group-text { border-radius: var(--cui-border-radius); }
/* keep input-group seams flush when inner controls are rounded */
.input-group > :not(:last-child):not(.dropdown-menu):not(.form-floating) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.invalid-tooltip) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* ─── Brand teal palette (used by login, welcome, client list/detail) ──── */
:root {
  --brand-teal-deep:   #0f6d90;   /* gradient start, hover-text-active */
  --brand-teal-mid:    #1387b1;   /* primary teal */
  --brand-teal-bright: #18a5d6;   /* gradient end, active accents */
  --brand-teal-glow:   #5cc6e8;   /* highlight on dark surfaces */
}

/* ─── Sequential band ramp — "position, not value" ───────────────────────
   For non-evaluative trait / interest scales (Big-Five facets like Presence &
   Influence, RIASEC interests) where Lower/Mid/Higher describe where you sit,
   not good vs bad. A single-hue teal ramp signals position without implying one
   end is better — unlike the green↔red severity colours. Selected by a band's
   `tone` (seq-1/2/3) through the severity_class macro; -subtle = client portal. */
.bg-seq-1 { background-color: #dbeef6 !important; color: #0f6d90 !important; }
.bg-seq-2 { background-color: #6fb9d8 !important; color: #06303f !important; }
.bg-seq-3 { background-color: #0f6d90 !important; color: #ffffff !important; }
.bg-seq-1-subtle { background-color: #eef7fb !important; color: #0f6d90 !important; }
.bg-seq-2-subtle { background-color: #cfe9f3 !important; color: #0f6d90 !important; }
.bg-seq-3-subtle { background-color: #a9d6e8 !important; color: #0b5474 !important; }

/* ─── Client portal polish ───────────────────────────────────────────── */
.portal {
  background:
    radial-gradient(900px 340px at 100% -8%, rgba(24,165,214,.10), transparent 60%),
    #f4f7fa;
  min-height: 100vh;
}
.portal-topbar {
  background: linear-gradient(90deg, var(--brand-teal-deep), var(--brand-teal-bright));
  box-shadow: 0 2px 14px rgba(19,135,177,.28);
}
.portal-brand-mark {
  width: 2rem; height: 2rem; flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.20));
}
.portal-brand { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; line-height: 1; }
.portal-brand .pb-light { font-weight: 300; opacity: .88; }
.portal-brand-link:hover .portal-brand { text-decoration: none; opacity: .92; }

/* Login wordmark — teal gradient text (solid-teal fallback) + brand mark */
.portal-login-mark { width: 3rem; height: 3rem; filter: drop-shadow(0 4px 10px rgba(19,135,177,.30)); }
.portal-wordmark {
  color: var(--brand-teal-mid);
  background: linear-gradient(120deg, var(--brand-teal-deep), var(--brand-teal-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.portal-hero {
  background:
    radial-gradient(600px 220px at 108% -50%, rgba(255,255,255,.20), transparent 70%),
    linear-gradient(120deg, var(--brand-teal-deep), var(--brand-teal-bright));
  box-shadow: 0 8px 24px rgba(19,135,177,.26);
  border-radius: .8rem;
}

/* Clickable tiles feel alive */
.portal .card { border-radius: .7rem; }
.portal a .card { transition: transform .15s ease, box-shadow .15s ease; }
.portal a:hover .card { transform: translateY(-3px); box-shadow: 0 .6rem 1.4rem rgba(19,135,177,.18); }

/* ─── Light sidebar: white surface, slate nav text, soft teal accent pill ──
   App runs light-only. CoreUI's stock sidebar ships dark, so set the light
   tokens explicitly here (don't rely on the absence of .sidebar-dark). */
.sidebar {
  --cui-sidebar-width: 16.5rem;          /* a touch wider than CoreUI's 16rem default */
  --cui-sidebar-bg: #ffffff;
  --cui-sidebar-border-color: var(--bb-slate-200);
  --cui-sidebar-color: var(--bb-slate-700);

  --cui-sidebar-nav-title-color: var(--bb-slate-500);
  --cui-sidebar-nav-link-color: var(--bb-slate-600);
  --cui-sidebar-nav-link-icon-color: var(--bb-slate-400);

  --cui-sidebar-nav-link-hover-bg: rgba(19, 135, 177, 0.08);
  --cui-sidebar-nav-link-hover-color: var(--brand-teal-deep);
  --cui-sidebar-nav-link-hover-icon-color: var(--brand-teal-mid);

  --cui-sidebar-nav-link-active-bg: rgba(19, 135, 177, 0.12);
  --cui-sidebar-nav-link-active-color: var(--brand-teal-deep);
  --cui-sidebar-nav-link-active-icon-color: var(--brand-teal-mid);

  --cui-sidebar-nav-group-toggle-show-color: var(--brand-teal-deep);
}

/* Inset, rounded nav links so hover/active reads as a soft teal "pill". */
.sidebar-nav .nav-link {
  border-radius: .5rem;
  margin: 1px .4rem 1px .35rem;          /* tighter left inset, reclaim width for labels */
  padding-left: .85rem;                  /* a little less on the left ... */
  padding-right: 1.15rem;                /* ... and a little more on the right */
}
.sidebar-nav .nav-link.active { font-weight: 600; }
.sidebar-nav .nav-group-items .nav-link { margin-block: 0; }

/* Scroll the nav natively (SimpleBar removed — it cached the expanded-group height and left a
   long, mostly-empty scroll runway). Flex column + the mt-auto "Documentation" item keep that
   link pinned to the bottom, and the bar only appears when the nav truly overflows. */
.sidebar-nav {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar scrollbar — only show when the nav actually overflows, and keep it thin.
   Covers both the SimpleBar overlay and the native scrollbar on the scroll wrapper. */
.sidebar-nav,
.sidebar-nav .simplebar-content-wrapper {
  scrollbar-width: thin;                 /* Firefox: thin track */
  scrollbar-color: var(--bb-slate-300) transparent;
}
.sidebar-nav::-webkit-scrollbar,
.sidebar-nav .simplebar-content-wrapper::-webkit-scrollbar {
  width: 3px;                            /* WebKit/Blink: thinner track */
}
.sidebar-nav::-webkit-scrollbar-thumb,
.sidebar-nav .simplebar-content-wrapper::-webkit-scrollbar-thumb {
  background: var(--bb-slate-300);
  border-radius: 6px;
}
.sidebar-nav::-webkit-scrollbar-track,
.sidebar-nav .simplebar-content-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
/* SimpleBar overlay track: make the thumb narrower (default is 11px). */
.sidebar-nav .simplebar-track.simplebar-vertical { width: 4px; }
.sidebar-nav .simplebar-scrollbar::before { background: var(--bb-slate-300); }

/* Sidebar header (BackboneAI brand) — white, hairline rule below to anchor it. */
.sidebar .sidebar-header {
  background: #ffffff !important;
  border-bottom-color: var(--bb-slate-200) !important;
}

.sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0;
  color: #ffffff;
}
.sidebar .sidebar-brand .brand-mark {
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(24, 165, 214, 0.30));
  transition: transform 0.2s ease;
}
.sidebar .sidebar-brand:hover .brand-mark {
  transform: rotate(-4deg) scale(1.04);
}
.sidebar .sidebar-brand .brand-text {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  /* Teal wordmark gradient — reads cleanly on the white sidebar */
  background: linear-gradient(120deg, #0f6d90 0%, #1387b1 58%, #18a5d6 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ─── Top header bar: clean white with a hairline rule + teal hovers ─────── */
.header {
  --cui-header-bg: #ffffff;
  --cui-header-color: var(--bb-slate-600);
  --cui-header-border-color: var(--bb-slate-200);
  --cui-header-hover-color: var(--brand-teal-deep);
  --cui-header-active-color: var(--brand-teal-deep);
}

/* ─── Soft teal-glow page background — authenticated shell + auth/public pages ── */
body.app-shell,
body.auth-bg {
  background:
    radial-gradient(900px 340px at 100% -8%, rgba(24,165,214,.10), transparent 60%),
    #f4f7fa;
}

/* Brand mark used on the login / register / signup headers (teal square, white B) */
.auth-mark { width: 3rem; height: 3rem; filter: drop-shadow(0 4px 10px rgba(19,135,177,.30)); }

/* Shared hero banner (portal dashboard + main-app dashboard) */
.bb-hero {
  background:
    radial-gradient(600px 220px at 108% -50%, rgba(255,255,255,.20), transparent 70%),
    linear-gradient(120deg, var(--brand-teal-deep), var(--brand-teal-bright));
  box-shadow: 0 8px 24px rgba(19,135,177,.26);
  border-radius: .8rem;
}

/* ─── Brand wordmark (auth / landing): two-tone teal gradient, brighter "AI" ─── */
.brand-wordmark {
  font-weight: 800;
  letter-spacing: -1.2px;
  filter: drop-shadow(0 3px 14px rgba(19, 135, 177, 0.18));
}
.brand-wordmark .bw-main {
  background: linear-gradient(120deg, #0f6d90 0%, #1387b1 58%, #18a5d6 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-wordmark .bw-ai {
  background: linear-gradient(120deg, #18a5d6 0%, #36c5ec 55%, #5cc6e8 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-left: 0.5px;
}

/* ════════════════════════════════════════════════════════════════════════
   BEAUTIFICATION — clean-SaaS design layer (cascades app-wide via tokens)
   Tier 1: tokens, type, borders, shadows, buttons, inputs
   Tier 2: tables, badges, transitions, empty states
   Tier 3: stat cards, depth scale, page headers
   ════════════════════════════════════════════════════════════════════════ */

/* ── Tier 1 · tokens — neutral slate scale, softer borders, depth scale ──── */
:root,
[data-coreui-theme=light] {
  --bb-slate-50:  #f8fafc;  --bb-slate-100: #f1f5f9;  --bb-slate-200: #e2e8f0;
  --bb-slate-300: #cbd5e1;  --bb-slate-400: #94a3b8;  --bb-slate-500: #64748b;  --bb-slate-600: #475569;
  --bb-slate-700: #334155;  --bb-slate-900: #0f172a;

  --cui-border-color: var(--bb-slate-200);            /* hairline borders */
  --cui-secondary-color: var(--bb-slate-500);         /* muted text */
  --cui-tertiary-color:  var(--bb-slate-500);

  --bb-shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 2px 6px rgba(15,23,42,.05);
  --bb-shadow-md: 0 1px 2px rgba(15,23,42,.04), 0 10px 28px rgba(15,23,42,.06);
  --bb-shadow-lg: 0 2px 6px rgba(15,23,42,.06), 0 24px 56px rgba(15,23,42,.12);
}

/* ── Tier 1 · type — Plus Jakarta headings, calmer rhythm ───────────────── */
h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 {
  font-family: 'Plus Jakarta Sans','Inter',system-ui,sans-serif;
  letter-spacing: -0.015em;
  font-weight: 700;
  line-height: 1.2;
}
body { line-height: 1.55; }
.page-title    { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.15rem; }
.page-subtitle { color: var(--bb-slate-500); margin-bottom: 1.5rem; }

/* ── Tier 1 · buttons — softer weight, smooth states, ghost variant ─────── */
.btn {
  font-weight: 500;
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary        { box-shadow: 0 1px 2px rgba(19,135,177,.25); }
.btn-primary:hover  { box-shadow: 0 4px 12px rgba(19,135,177,.30); }
.btn-ghost {
  --cui-btn-color: var(--bb-slate-600);
  --cui-btn-hover-bg: var(--bb-slate-100);
  --cui-btn-hover-color: var(--bb-slate-900);
  --cui-btn-active-bg: var(--bb-slate-200);
  border-color: transparent;
}

/* ── Tier 1 · inputs — labels + soft teal focus ring ────────────────────── */
.form-label   { font-weight: 500; margin-bottom: 0.35rem; }
.form-control, .form-select { border-color: var(--bb-slate-200); transition: border-color .15s ease, box-shadow .15s ease; }
.form-control:focus, .form-select:focus {
  border-color: var(--cui-primary);
  box-shadow: 0 0 0 0.2rem rgba(19,135,177,.16);
}
.form-text { color: var(--bb-slate-500); }
/* Checkbox / radio / switch outlines — keep the unchecked control clearly visible
   (the default hairline is too faint on a small box). Checked stays primary teal. */
.form-check-input { border-color: var(--bb-slate-400); }
.form-check-input:checked { border-color: var(--cui-primary); }

/* ── Tier 2 · tables — airy rows, hairline dividers, muted headers ──────── */
.table { --cui-table-border-color: var(--bb-slate-200); --cui-table-hover-bg: var(--bb-slate-50); vertical-align: middle; }
.table > thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 600; color: var(--bb-slate-500); border-bottom: 1px solid var(--bb-slate-200);
}
.table > :not(caption) > * > * { padding-top: .7rem; padding-bottom: .7rem; }
.table-hover > tbody > tr { transition: background-color .12s ease; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ── Tier 2 · badges — soft, rounded, tinted ────────────────────────────── */
.badge { font-weight: 600; border-radius: 999px; padding: .35em .7em; }
.badge.text-bg-primary   { background: var(--cui-primary-bg-subtle) !important; color: var(--cui-primary-text-emphasis) !important; }
.badge.text-bg-success   { background:#dcfce7 !important; color:#166534 !important; }
.badge.text-bg-warning   { background:#fef3c7 !important; color:#92400e !important; }
.badge.text-bg-danger    { background:#fee2e2 !important; color:#991b1b !important; }
.badge.text-bg-info      { background:#cffafe !important; color:#155e75 !important; }
.badge.text-bg-secondary { background: var(--bb-slate-100) !important; color: var(--bb-slate-600) !important; }

/* ── Tier 2 · interactive transitions + empty states ────────────────────── */
.nav-link, .dropdown-item, .list-group-item-action { transition: background-color .12s ease, color .12s ease; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--bb-slate-500); }
.empty-state .empty-icon { width: 2.5rem; height: 2.5rem; opacity: .5; margin-bottom: .75rem; }

/* ── Tier 3 · dashboard stat cards + consistent depth scale ─────────────── */
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bb-slate-500); font-weight: 600; }
.stat-card .stat-trend.up   { color:#16a34a; }
.stat-card .stat-trend.down { color:#dc2626; }
.shadow-sm { box-shadow: var(--bb-shadow-sm) !important; }
.shadow    { box-shadow: var(--bb-shadow-md) !important; }
.shadow-lg { box-shadow: var(--bb-shadow-lg) !important; }

/* ── Dashboard: the "current" (in-progress / imminent) appointment ────────── */
tr.appt-current {
  background: rgba(19, 135, 177, 0.08) !important;
  box-shadow: inset 3px 0 0 0 var(--cui-primary, #1387b1);
}
tr.appt-current > td { font-weight: 500; }
.badge-now {
  background: var(--cui-primary, #1387b1);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  animation: nowPulse 2s ease-in-out infinite;
}
@keyframes nowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(19, 135, 177, 0.45); }
  50%      { box-shadow: 0 0 0 4px rgba(19, 135, 177, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-now { animation: none; }
}
