/* Brand tokens for the HRS/3 prototype.
 *
 * Colours are APPROXIMATIONS of the corporate palette (blues from a
 * third-party brand-asset listing; green and neutrals suggested), good enough
 * for a prototype. The enterprise build must take official values from the
 * corporate brand guidelines. No company name or logo is used on purpose:
 * this is a personal prototype with fictional data.
 *
 * Status colours (Strong / Medium / Weak, workflow states) are deliberately
 * SEPARATE from the brand palette, so the brand green is never confused with
 * "Strong". Light blue is too pale for text on white (about 2:1 contrast):
 * use it for fills only.
 */
:root {
  --navy: #001A41;
  --blue: #155199;
  --pale-blue: #7EBFEC;
  --pale-blue-fill: #E6F2FB;   /* light blue at low strength, for fills */
  --green: #4A9D68;            /* brand accent: use sparingly */
  --text: #172B3A;
  --muted: #5B6B78;
  --surface: #F5F7F9;
  --border: #DCE3E8;
  --white: #FFFFFF;
  --font-sans: Arial, "Helvetica Neue", Helvetica, sans-serif;

  /* status palette: independent of brand */
  --strong: #E1F2E6;  --strong-ink: #1D6436;
  --medium: #FFF2D2;  --medium-ink: #7A5200;
  --weak:   #FBE1E1;  --weak-ink:   #9B2424;

  /* Bootstrap overrides */
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--surface);
  --bs-border-color: var(--border);
  --bs-link-color: var(--blue);
  --bs-link-color-rgb: 21, 81, 153;
  --bs-link-hover-color: var(--navy);
  --bs-link-hover-color-rgb: 0, 26, 65;
  --bs-primary: var(--blue);
  --bs-primary-rgb: 21, 81, 153;
  --bs-secondary-color: var(--muted);
}

body { background: var(--surface); color: var(--text); font-family: var(--font-sans); }
h1, h2, h3, h4, h5, h6 { color: var(--navy); font-weight: 700; }
h5 { font-weight: 600; }
.text-muted { color: var(--muted) !important; }

/* Buttons */
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--navy);
  --bs-btn-hover-border-color: var(--navy); --bs-btn-active-bg: var(--navy); --bs-btn-active-border-color: var(--navy);
  --bs-btn-disabled-bg: var(--blue); --bs-btn-disabled-border-color: var(--blue); font-weight: 600; }
.btn-outline-primary { --bs-btn-color: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue);
  --bs-btn-hover-border-color: var(--blue); --bs-btn-active-bg: var(--navy); font-weight: 600; }
.btn-outline-secondary { --bs-btn-color: var(--text); --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--surface);
  --bs-btn-hover-color: var(--navy); --bs-btn-hover-border-color: var(--blue); }
.form-select:focus, .form-control:focus { border-color: var(--pale-blue); box-shadow: 0 0 0 .2rem rgba(126, 191, 236, .35); }
.badge.bg-primary { background: var(--blue) !important; }
.badge.bg-secondary { background: var(--muted) !important; }

/* Header: white, simple, spacious */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); }
.site-header .brand { color: var(--navy); font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -.01em; }
.site-header .brand small { color: var(--blue); font-weight: 600; }
.site-header .nav-link { color: var(--navy); font-weight: 500; padding: .5rem .7rem; border-bottom: 3px solid transparent; }
.site-header .nav-link:hover { color: var(--blue); }
.site-header .nav-link.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.nav-section { color: var(--muted); font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  margin: 0 .2rem 0 1rem; }
.demo-note { font-size: .7rem; color: var(--muted); }

/* Cards: light borders, minimal shadow */
.card { border: 1px solid var(--border); box-shadow: none; border-radius: 6px; background: var(--white); }
.kpi .display-6 { font-weight: 700; color: var(--navy); }
.kpi .card { border-top: 3px solid var(--blue); }

/* Tables */
.table { --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.table > thead th, .table-light > * > th { color: var(--navy); font-weight: 600; }
.table-light { --bs-table-bg: var(--surface); }
.th-brand, .table-brand th, .table-brand > thead > tr > th { background: var(--navy) !important; color: var(--white) !important; font-weight: 600; }
.th-brand-2 { background: var(--pale-blue-fill) !important; color: var(--navy) !important; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--pale-blue-fill); }

/* Status: Strong / Medium / Weak */
.band-strong { background: var(--strong) !important; color: var(--strong-ink) !important; font-weight: 600; }
.band-medium { background: var(--medium) !important; color: var(--medium-ink) !important; font-weight: 600; }
.band-weak   { background: var(--weak) !important;   color: var(--weak-ink) !important;   font-weight: 600; }

/* Workflow status pills */
.status { font-size: .72rem; font-weight: 600; padding: .2em .55em; border-radius: .3em; }
.status-DRAFT     { background: #EAEEF1; color: #3E4C57; }
.status-SUBMITTED { background: var(--pale-blue-fill); color: var(--blue); }
.status-RETURNED  { background: var(--medium); color: var(--medium-ink); }
.status-APPROVED  { background: var(--strong); color: var(--strong-ink); }

/* Profile card (their template layout, brand colours) */
.profile-card .pc-label { background: var(--pale-blue-fill); color: var(--navy); font-weight: 600; white-space: nowrap; }
.profile-card td, .profile-card th { border-color: var(--border); }
.profile-card .current-role { color: var(--blue); font-weight: 700; }

.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.avatar-lg { width: 120px; height: 120px; border-radius: 8px; }
.table-sm td, .table-sm th { vertical-align: middle; }
pre.plain { white-space: pre-wrap; font-family: inherit; margin: 0; }
.alert-info { --bs-alert-bg: var(--pale-blue-fill); --bs-alert-color: var(--navy); --bs-alert-border-color: var(--pale-blue); }

/* ---- Layout: left sidebar + top bar ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex-shrink: 0; background: var(--white); border-right: 1px solid var(--border);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: block; color: var(--navy); font-weight: 700; font-size: 1.1rem; text-decoration: none; padding: 0 10px 16px;
  border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sidebar .brand small { display: block; color: var(--blue); font-size: .72rem; font-weight: 600; margin-top: 2px; }
.side-group { color: var(--green); font-size: 1rem; font-weight: 700; padding: 14px 10px 4px; }
.side-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--navy); font-weight: 500;
  text-decoration: none; padding: 7px 10px; border-radius: 5px; border-left: 3px solid transparent; }
.side-link:hover { background: var(--surface); color: var(--blue); }
.side-link.active { background: var(--pale-blue-fill); color: var(--blue); font-weight: 700; border-left-color: var(--blue); }
.main { flex: 1; min-width: 0; }
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex; }
.content { padding: 22px 24px 48px; }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .side-group { width: 100%; padding-top: 8px; }
}

/* ---- Tables: filter row, sortable headers ---- */
.filter-row th { background: var(--white) !important; padding: 4px !important; font-weight: 400; }
.filter-row .form-control, .filter-row .form-select { font-size: .78rem; min-width: 60px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: " ↕"; color: var(--muted); font-size: .75em; opacity: .5; }
th.sortable[aria-sort="ascending"]::after { content: " ▲"; opacity: 1; }
th.sortable[aria-sort="descending"]::after { content: " ▼"; opacity: 1; }
.table-brand th.sortable::after { color: var(--pale-blue); }
.table-pager { border-top: 1px solid var(--border); }
tr.row-vacant > * { background: #FFF8E6 !important; }

/* ---- Info tooltips, flags ---- */
.info { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--blue); color: var(--blue); font-size: .7rem; font-weight: 700; cursor: help; vertical-align: middle; margin-left: 4px; }
.flag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .15em .5em; border-radius: .3em; margin-right: 4px; }
.flag-risk { background: var(--weak); color: var(--weak-ink); }
.flag-warn { background: var(--medium); color: var(--medium-ink); }
.flag-info { background: var(--pale-blue-fill); color: var(--navy); }
.tag-level { border-bottom: 1px dotted var(--muted); cursor: help; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.2rem; line-height: 1; padding: 0 6px; user-select: none; }
.sortable-ghost { opacity: .4; }
.snapshot { border: 1px solid var(--pale-blue); background: var(--pale-blue-fill); border-radius: 6px; padding: 12px; }
.score-list div { display: flex; justify-content: space-between; gap: 12px; }

/* ---- Wide tables scroll inside their card, never the page ---- */
.main, .content { min-width: 0; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll > table { margin-bottom: 0; }
.sticky-col { position: sticky; z-index: 2; background: var(--white) !important; }
thead .sticky-col { z-index: 3; }
.table-light .sticky-col, .table-light.sticky-col { background: var(--surface) !important; }
.table-brand .sticky-col { background: var(--navy) !important; }
.filter-row .sticky-col { background: var(--white) !important; }
tr.row-vacant > .sticky-col { background: #FFF8E6 !important; }
.table-active > .sticky-col { background: #EEF1F4 !important; }
.sticky-edge { box-shadow: 2px 0 0 var(--border); }
.nowrap { white-space: nowrap; }
.company-cell { white-space: nowrap; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; }

/* Tighter tables so most fit without scrolling on a laptop */
.table-sm > :not(caption) > * > * { padding: .3rem .4rem; }
.table { font-size: .875rem; }
.filter-row .form-control, .filter-row .form-select { font-size: .75rem; min-width: 3.2rem; width: 100%; padding: .15rem .35rem; }
.filter-row .form-select { padding-right: 1.4rem; background-position: right .3rem center; }

/* ---- Definitions in italics: explanatory lines under titles, and info tooltips ---- */
.content h3 + p.text-muted, .definition { font-style: italic; }
.tooltip-inner { font-style: italic; text-align: left; max-width: 340px; }

/* ---- Demo-mode strip (prototype only: stands in for Entra sign-in) ---- */
.demo-strip { background: #FFF2D2; border-bottom: 1px solid #F1D98A; color: #6B4A00; font-size: .8rem;
  padding: 4px 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-strip .form-select { width: auto; min-width: 16rem; font-size: .8rem; padding: .1rem 1.8rem .1rem .5rem; background-color: #fffaf0; }

/* 9-box: labels are links, but should not look underlined */
svg a text { text-decoration: none; }
svg a:hover text { text-decoration: underline; }

/* ---------------------------------------------------------------- Ask AI (templates/_ask_ai.html) */
.ask-log { display: flex; flex-direction: column; gap: .5rem; max-height: 22rem; overflow-y: auto; }
.ask-ai-full .ask-log { max-height: 60vh; min-height: 12rem; }
.ask-log:not(:empty) { margin-bottom: .75rem; }
.ask-msg { padding: .5rem .75rem; border-radius: .5rem; max-width: 92%; }
.ask-msg p { margin-bottom: .35rem; }
.ask-msg ul { margin-bottom: .35rem; padding-left: 1.2rem; }
.ask-q { align-self: flex-end; background: var(--pale-blue-fill); }
.ask-a { align-self: flex-start; background: var(--white); border: 1px solid var(--border); }
.ask-wait { color: var(--muted); }
.ask-error { color: var(--weak-ink); background: var(--weak); border-color: var(--weak); }
.ask-meta { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.ask-examples { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.ask-examples .btn { font-size: .8rem; text-align: left; }
.ask-disclaimer { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.ask-form textarea { resize: vertical; }

/* ---------------------------------------------------------------- Data upload */
.action-NEW { background: var(--strong); color: var(--strong-ink); }
.action-UPDATE { background: var(--pale-blue-fill); color: var(--navy); }
.action-LEAVER { background: var(--medium); color: var(--medium-ink); }
.action-REJECTED { background: var(--weak); color: var(--weak-ink); }
.action-UNCHANGED { color: var(--muted); }
.action-badge { display: inline-block; padding: .1rem .45rem; border-radius: .25rem; font-size: .75rem; font-weight: 600; }
