/* ──────────────────────────────────────────────────────────────────────
 * Global page-container alignment.
 *
 * The sub-tabs strip lives inside Metronic's `.kt-container-fixed`
 * which defaults to a centred max-width of 1280px + 24-30px padding.
 * Page content below (overview-page, settings-page, etc.) uses its own
 * padding system. Left edges didn't line up — sub-tabs appeared
 * flush-left while page content was inset.
 *
 * Fix: force every `.kt-container-fixed` to be full-width with a
 * uniform 28px/32px padding-inline (the same value SnovaHR uses for
 * its hero band, settings pages, and the rest of the surfaces).
 * The header keeps its own override that already follows this rule.
 * ────────────────────────────────────────────────────────────────────── */
.kt-container-fixed {
  max-width: 100% !important;
  width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 28px !important;
}
@media (min-width: 80rem) {
  .kt-container-fixed {
    padding-inline: 32px !important;
  }
}
/* Override the per-page paddings on the Overview shell so the hero +
 * grid + feed-row all align with the sub-tabs above. */
.overview-page,
.settings-page,
.profile-layout,
.home-stub-page {
  padding-inline: 28px !important;
}
@media (min-width: 80rem) {
  .overview-page,
  .settings-page,
  .profile-layout,
  .home-stub-page {
    padding-inline: 32px !important;
  }
}


/* ──────────────────────────────────────────────────────────────────────
 * Typography base token.
 *
 * NOTE — superseded by /static/css/premium-theme.css ("Quiet Authority"),
 * which is loaded AFTER this file in base.html and re-sets --font-sans to
 * Geist-first. We keep this declaration for safety so any rendering path
 * that bypasses premium-theme.css still gets the Inter-fallback chain
 * rather than a generic system font.
 * ────────────────────────────────────────────────────────────────────── */
:root {
  --font-sans: 'Geist', 'Inter', 'Plus Jakarta Sans', 'Roboto',
               -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
html, body {
  font-family: 'Geist', 'Inter', 'Plus Jakarta Sans', 'Roboto',
               -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}


/* Snova.People — overlays on top of Metronic v9 Demo 1.
 *
 * The bulk of the styling comes from /static/metronic/css/core.bundle.css
 * + styles.css. This file holds:
 *   1. SnovaHR-specific brand mark in the sidebar (snova-brand.*)
 *   2. Profile dropdown panel (mirrors header.component.ts scoped styles).
 *   3. Legacy login / error / welcome styles preserved for /auth pages.
 *
 * Token names follow SnovaHR's source — colors taken verbatim from
 * snovahr-web/src/app/shared/components/layout/header/header.component.ts. */

/* ──────────────────────────────────────────────────────────────────────
 * 1. Sidebar brand mark (matches snovahr-web sidebar.component.ts:50-56).
 * ────────────────────────────────────────────────────────────────────── */
.snova-brand {
  color: #071437;
  text-decoration: none;
  height: 100%;
  /* Pixel-perfect vertical centering of the icon + wordmark.
   * line-height: 1 collapses the text line-box to its glyph height so
   * the flex centerline runs through the optical middle of both the
   * 28 px icon and the wordmark glyphs — without this, the wordmark
   * sits ~2 px low because of the inherited 1.5 line-height. */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}
.snova-brand:hover { text-decoration: none; }

.snova-brand__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1b84ff 0%, #0a5ec2 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(11, 33, 71, 0.08);
}
.snova-brand__icon-letter {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}
.snova-brand__text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #071437;
  white-space: nowrap;
  /* Give the wordmark a line-box the SAME height as the icon (28 px)
   * so the two children share a common vertical box. The wordmark's
   * glyph baseline then naturally sits where the icon's "S" baseline
   * sits — line-height: 1 on a smaller font, paired with align-items:
   * center, was placing the cap-line above the icon's cap-line. */
  line-height: 28px;
  display: inline-block;
}

/* Hide the wordmark when the sidebar is collapsed (Metronic's collapse
 * class is on body). Icon stays visible. */
body.kt-sidebar-collapse .snova-brand__text { display: none; }
body.snova-sidebar-collapsed .snova-brand__text { display: none; }


/* ──────────────────────────────────────────────────────────────────────
 * Collapsed-sidebar overrides — fixes Phase 5o.1 feedback:
 *   "the button doesn't close immediately on click, I have to hover out"
 *
 * Metronic Demo 1 ships a `:not(:hover)` rule that keeps labels visible
 * while the cursor is still over the sidebar — so clicking the
 * toggle (which is inside the sidebar) leaves labels half-visible
 * until the cursor moves away. We override to a flat "always hide
 * labels when collapsed" so the click feels instant.
 * ────────────────────────────────────────────────────────────────────── */
body.snova-sidebar-collapsed .kt-sidebar,
body.kt-sidebar-collapse .kt-sidebar {
  width: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  overflow: visible !important;
}

/* Collapsed: hide every text element regardless of hover. Icons stay. */
body.snova-sidebar-collapsed .kt-sidebar .kt-menu-title,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-title,
body.snova-sidebar-collapsed .kt-sidebar .kt-menu-arrow,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-arrow,
body.snova-sidebar-collapsed .kt-sidebar .kt-menu-heading,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-heading,
body.snova-sidebar-collapsed .kt-sidebar .kt-menu-accordion,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-accordion,
body.snova-sidebar-collapsed .kt-sidebar .kt-menu-badge,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-badge {
  display: none !important;
}

/* Collapsed: centre the icon inside the link so it looks pillared. */
body.snova-sidebar-collapsed .kt-sidebar .kt-menu-link,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-link {
  justify-content: center !important;
  padding-inline: 0 !important;
}

body.snova-sidebar-collapsed .kt-sidebar .kt-menu-icon,
body.kt-sidebar-collapse .kt-sidebar .kt-menu-icon {
  margin: 0 !important;
  width: auto !important;
}

/* Collapsed: keep the brand icon centred in the header. */
body.snova-sidebar-collapsed .kt-sidebar-header,
body.kt-sidebar-collapse .kt-sidebar-header {
  justify-content: center !important;
  padding-inline: 0 !important;
}

/* Shift the main content over by the new sidebar width so the page
 * doesn't leave an empty band where the expanded sidebar used to live.
 * (Metronic ships a similar rule under `.demo1.kt-sidebar-collapse`
 * but tied to its own width tokens — we lock it to 64 px here.) */
body.snova-sidebar-collapsed .kt-wrapper,
body.kt-sidebar-collapse .kt-wrapper {
  padding-inline-start: 64px;
}


/* ──────────────────────────────────────────────────────────────────────
 * 2. Header / topbar — page-title and container-fixed override.
 *    Verbatim from header.component.ts:176-186.
 * ────────────────────────────────────────────────────────────────────── */
#headerContainer.kt-container-fixed {
  max-width: 100% !important;
  width: 100% !important;
  padding-inline: 28px !important;
}
@media (min-width: 80rem) {
  #headerContainer.kt-container-fixed {
    padding-inline: 32px !important;
  }
}


/* ──────────────────────────────────────────────────────────────────────
 * 3. Profile dropdown — verbatim from header.component.ts:196-411.
 * ────────────────────────────────────────────────────────────────────── */
.profile-menu { position: relative; }

.profile-menu__trigger {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.profile-menu__trigger:focus-visible {
  outline: none;
  box-shadow: var(--qa-focus-ring);
}
.profile-menu__avatar {
  display: inline-flex;
  border-radius: 9999px;
  overflow: hidden;
}

.profile-menu__panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow:
    0 10px 24px -8px rgba(15, 23, 42, 0.18),
    0 4px 8px -2px rgba(15, 23, 42, 0.06);
  padding: 6px;
  z-index: 60;
  animation: profileMenuIn 0.14s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-menu__panel.is-closing {
  animation: profileMenuOut 0.14s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes profileMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes profileMenuOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-4px); }
}

.profile-menu__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 14px;
  border-bottom: 1px solid #f1f1f4;
}
.profile-menu__head-avatar { flex-shrink: 0; display: inline-flex; }
.profile-menu__head-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-menu__head-name {
  font-size: 13px;
  font-weight: 600;
  color: #071437;
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu__head-email {
  font-size: 12px;
  color: #4b5675;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu__head-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1b84ff;
  background: rgba(27, 132, 255, 0.10);
  padding: 3px 8px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.profile-menu__list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-menu__item,
.profile-menu__item:link,
.profile-menu__item:visited,
.profile-menu__item:active {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #252f4a !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.16s cubic-bezier(0.4, 0, 0.2, 1), color 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-menu__item-icon {
  font-size: 18px;
  color: #4b5675;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: color 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-menu__item-label { flex: 1; min-width: 0; color: inherit; }
.profile-menu__item:hover { background: #f8f9fb; color: #071437 !important; }
.profile-menu__item:hover .profile-menu__item-icon { color: #1b84ff; }
.profile-menu__item-pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  background: #f8285a;
  padding: 2px 7px;
  border-radius: 9999px;
  line-height: 1.4;
  min-width: 18px;
  text-align: center;
}

.profile-menu__foot {
  border-top: 1px solid #f1f1f4;
  padding: 8px 6px 6px;
  margin-top: 4px;
}
.profile-menu__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #252f4a !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.16s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.16s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-menu__logout-icon {
  font-size: 16px;
  color: #4b5675;
  transition: color 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-menu__logout:hover {
  background: rgba(248, 40, 90, 0.06);
  border-color: rgba(248, 40, 90, 0.30);
  color: #f8285a !important;
}
.profile-menu__logout:hover .profile-menu__logout-icon { color: #f8285a; }


/* ──────────────────────────────────────────────────────────────────────
 * 4. Legacy /auth pages (login, error). Kept as-is because they predate
 *    the Metronic skin and SnovaHR's own login uses an equivalent card.
 * ────────────────────────────────────────────────────────────────────── */
.login-page, .error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card, .error-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 2.5rem 3rem;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.login-card h1 { margin: 0 0 0.5rem 0; }
.login-card .subtitle { color: #6b7280; margin-bottom: 1.5rem; }
.dev-note { font-size: 0.85rem; color: #6b7280; margin-top: 1.5rem; }

/* ── Error / warning card (error.html — shared by 404 / 500 / 422) ── */
.error-card {
  padding: 2.25rem 2.5rem;
  max-width: 440px;
}
.error-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  color: #6b7280;
  background: #f3f4f6;
}
.error-card--warning .error-card__icon { color: #b45309; background: #fef3c7; }
.error-card__title {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
}
.error-card__message {
  margin: 0 0 1.75rem 0;
  font-size: 0.92rem;
  color: #6b7280;
  line-height: 1.6;
}
.error-card__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}
.error-card .btn { cursor: pointer; font-size: 0.9rem; }
.error-card .btn--primary { background: var(--qa-primary); color: var(--qa-primary-fg); }
.error-card .btn--primary:hover { text-decoration: none; opacity: 0.92; }
.error-card .btn--ghost {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}
.error-card .btn--ghost:hover { background: #f9fafb; }


/* ──────────────────────────────────────────────────────────────────────
 * Sidebar — soften the active-state weight.
 *
 * Vendored snova-sidebar.css ships:
 *   .kt-menu-accordion .kt-menu-item.active > .kt-menu-link .kt-menu-title
 *     { color: #1b84ff; font-weight: 600; }
 * Plus the parent branch (.is-branch-active) inherits a similarly heavy
 * weight from Metronic defaults, which makes the active row read 700ish
 * against the 400 idle rows — too much contrast.
 *
 * Drop both back to the idle weight; the blue color alone is enough to
 * mark selection, matching the look from earlier in the session.
 * ────────────────────────────────────────────────────────────────────── */
.kt-sidebar .kt-menu-accordion .kt-menu-item.active > .kt-menu-link .kt-menu-title,
.kt-sidebar .kt-menu > .kt-menu-item.is-branch-active > .kt-menu-link .kt-menu-title,
.kt-sidebar .kt-menu > .kt-menu-item.active > .kt-menu-link .kt-menu-title {
  font-weight: 500 !important;
}

/* Cancel the 45° rotation on the expanded-state arrow container.
 * Vendored snova-sidebar.css rotates `.kt-menu-arrow` to 45deg when
 * the parent has `.show` — that was designed for a single morphing
 * chevron. Our template renders TWO icons (plus when collapsed, minus
 * when expanded); rotating the minus 45° tilts it into a diagonal
 * dash. Keep the container upright so each icon reads as itself. */
.kt-sidebar .kt-menu-item.show > .kt-menu-link .kt-menu-arrow {
  transform: none !important;
}


/* ──────────────────────────────────────────────────────────────────────
 * Global thin scrollbar — a slim, quiet bar so users always know where
 * they can scroll, without the heavy default scroll furniture stealing
 * attention. Applied app-wide so every overflow container (cards, drawers,
 * modals, drop-downs, tables, search results, the document itself) gets
 * the same clean look without us hunting them down by class name.
 *
 *   • Firefox          → scrollbar-width: thin + scrollbar-color
 *   • WebKit / Blink   → 8px track, rounded translucent thumb, no arrows
 *
 * Thumb is transparent until the container (or page) is hovered, then it
 * fades in — so static screens stay pristine and the bar appears right
 * when the user reaches for it. Track stays transparent throughout.
 * ────────────────────────────────────────────────────────────────────── */
html,
body,
* {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(148, 158, 178, 0.45) transparent !important;
  -ms-overflow-style: auto !important;
}
*::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
  background: transparent !important;
}
*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: transparent !important;
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(148, 158, 178, 0.32) !important;
  border-radius: 999px !important;
  border: 1.5px solid transparent !important;   /* inset the thumb → thinner visual (~3px) */
  background-clip: content-box !important;
}
*:hover::-webkit-scrollbar-thumb {
  background-color: rgba(120, 130, 152, 0.55) !important;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(95, 105, 128, 0.75) !important;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  border: 1px solid transparent;
}
.btn-primary { background: #1b84ff; color: #ffffff; }
.btn-primary:hover { text-decoration: none; opacity: 0.92; }


/* ──────────────────────────────────────────────────────────────────────
 * 5. Global topbar separator.
 *
 * The Metronic header (.kt-header) only renders its bottom border once
 * the user scrolls (data-kt-sticky-class="border-b border-border"
 * swaps the class in on scroll). At the top of the page the header
 * floats borderless against the content, making the brand/profile bar
 * blend into the first row of page content.
 *
 * We want a permanent hairline between the global topbar and whatever
 * page renders below it, using the SAME color as the unified tab strip
 * baseline (tabs-unified.css → --tab-strip-line) so the two horizontal
 * rules read as one design language.
 * ────────────────────────────────────────────────────────────────────── */
.kt-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

/* The sidebar's brand header (.kt-sidebar-header — "Snova.People" logo
 * row) sits at the same vertical band as .kt-header but is a separate
 * column to the left of it. Give it the SAME bottom hairline so the
 * two lines join into one continuous rule across the full viewport. */
.kt-sidebar-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

/* …EXCEPT on screens that render the unified sub-tab strip (My Space,
 * Attendance → Team, Onboarding, and every other `_sub_tabs.html` page).
 * There, the tab strip already draws its own baseline JUST BELOW the tabs,
 * so the topbar hairline above them reads as a duplicate "extra" line.
 * Drop it on those pages only (Metronic-style: the rule sits below the tabs,
 * never above). Pages WITHOUT these tabs keep the separator untouched.
 * `:has()` scopes this per-page, the same way main#content:has(...) does above. */
body:has(.snova-subtabs) .kt-header,
body:has(.snova-subtabs) .kt-sidebar-header {
  border-bottom-color: transparent;
}

/* …and pull the tab strip up snug against the topbar. main#content carries a
 * default pt-5 (20px) gap that, with the separator line now gone, reads as
 * dead space above the tabs. Trim it to a hairline on sub-tab pages only —
 * the fixed-header clearance is provided separately, so this is safe. */
body:has(.snova-subtabs) main#content {
  padding-top: calc(var(--spacing) * 1);
}

/* ── Back-to-Operations arrow ─────────────────────────────────────────────
   Shared affordance at the top-left of every Operations service screen
   (Holidays, Leave Types, Custom Fields, Soft Labels, Org Structure, Approval
   Flows, Files, …), matching .ot-header__back on Onboarding / Offboarding.
   Defined here in the global app.css because those screens each ship their own
   stylesheet — this way one class covers all of them. Links to /operations. */
.ops-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex: 0 0 auto;
  color: #4b5675;
  background: #f1f5f9;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}
.ops-back:hover { background: #e2e8f0; color: #0f172a; }
.ops-back:focus-visible { outline: none; box-shadow: var(--qa-focus-ring); }
.ops-back .material-icons { font-size: 20px; line-height: 1; }
