/* TrustNex — contemporary Mesopotamian identity.
   Shared product tokens; status colours remain semantic in theme-v2.css. */
:root {
  --primary: #16645e;
  --primary-dark: #104b46;
  --primary-light: #92c9bc;
  --primary-soft: #eaf4ef;
  --primary-border: #bcd8cc;
  --primary-strong: #13564e;
  --primary-gradient: linear-gradient(125deg, #153f3c, #237c6e);
  --navy: #183f3c;
  --brand-gold: #c49a58;
  --brand-brick: #a45e42;
  --body-bg: #f5f5f0;
  --bg-input: #fafbf8;
  --bg-hover: #eff3ee;
  --border-color: #dce3dc;
  --border-light: #edf0e9;
  --text-primary: #203b36;
  --text-secondary: #51665f;
  --text-muted: #667a71;
  --radius: .65rem;
  --radius-lg: 1rem;
  --radius-xl: 1.3rem;
  --sidebar-bg: #153c38;
  --sidebar-border: #2c5049;
  --sidebar-text: #e3ede6;
  --sidebar-text-muted: #a9c1b5;
  --sidebar-hover: #234e45;
  --sidebar-active-bg: #dceacb;
  --sidebar-active-text: #193e32;
  --sidebar-submenu-bg: #10332f;
  --shadow: 0 4px 20px -12px rgba(30, 62, 45, .16);
  --ring: 0 0 0 3px rgba(22, 100, 94, .16);
  --bs-primary: #16645e;
  --bs-primary-rgb: 22, 100, 94;
  --bs-link-color: #16645e;
  --bs-link-hover-color: #104b46;
}
[data-theme="dark"] {
  --primary: #86cdbb;
  --primary-dark: #65b4a0;
  --primary-soft: #203c34;
  --primary-border: #375c4d;
  --primary-strong: #b2e2d0;
  --body-bg: #101e1b;
  --card-bg: #182b25;
  --bg-card: #182b25;
  --bg-input: #12241e;
  --bg-hover: #213b31;
  --navbar-bg: #14251f;
  --border-color: #31483e;
  --border-light: #273d33;
  --text-primary: #e5eee5;
  --text-secondary: #c0d0c2;
  --text-muted: #a4b9ad;
  --sidebar-bg: #102c26;
  --sidebar-border: #2b483a;
  --sidebar-text: #e3ede6;
  --sidebar-text-muted: #a9c1b5;
  --sidebar-hover: #244839;
  --sidebar-active-bg: #dceacb;
  --sidebar-active-text: #193e32;
  --sidebar-submenu-bg: #0d241e;
}
body, [data-theme="dark"] body { background: var(--body-bg); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] .nav-section-label { letter-spacing: 0; }
.sidebar { background: var(--sidebar-bg); }
.sidebar-header { min-height: 86px; padding: 1.2rem 1.35rem; }
.sidebar-logo .logo-img { width: 176px; height: 44px; object-fit: contain; border-radius: 0; }
.sidebar-logo .logo-img[src$="wordmark.svg"] { filter: brightness(0) invert(1); }
.sidebar .nav-section-label { color: var(--sidebar-text-muted); font-size: .66rem; }
.sidebar .nav-link { color: var(--sidebar-text); min-height: 43px; border-radius: 7px; }
.sidebar .nav-link.active { color: var(--sidebar-active-text); background: var(--sidebar-active-bg); }
.sidebar .nav-link.active::before { background: var(--brand-gold); }
.sidebar .nav-link.active > i:first-child { color: var(--sidebar-active-text) !important; background: transparent; box-shadow: none; }
.sidebar .nav-core > .nav-link:not(.active) > i:first-child { color: #c3d8bb; background: #2b5045; }
.sidebar .nav-link:hover > i:first-child { border-color: transparent; }
.sidebar .submenu a { color: var(--sidebar-text-muted); }
.sidebar .submenu a:hover, .sidebar .submenu a.active { color: #fff; background: #2b5045; }
.sidebar .sidebar-toggle { color: #e3ede6; }
.top-navbar { box-shadow: none; border-bottom: 1px solid var(--border-color); }
.main-content { padding: 1.8rem; }
.card, .stat-card { border: 1px solid var(--border-color); box-shadow: var(--shadow); }
.card-header { padding: 1.1rem 1.25rem; background: transparent; border-bottom-color: var(--border-light); }
.card-header h5, .card-header h6 { font-weight: 700; }
.card-body { padding: 1.3rem; }
.stat-card:hover { transform: none; border-color: var(--primary-border); }
.btn { border-radius: .55rem; font-weight: 600; }
.btn-primary { --bs-btn-bg: #16645e; --bs-btn-border-color: #16645e; --bs-btn-hover-bg: #104b46; --bs-btn-hover-border-color: #104b46; --bs-btn-active-bg: #104b46; background: #16645e; border-color: #16645e; box-shadow: none; color: #fff; }
.btn-primary:hover, .btn-primary:focus-visible { background: #104b46; border-color: #104b46; }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: #16645e; --bs-btn-hover-border-color: #16645e; }
.form-control, .form-select { min-height: 43px; border-color: var(--border-color); border-radius: .55rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: var(--ring); }
.table { --bs-table-hover-bg: var(--bg-hover); }
.table thead th { color: var(--text-secondary); background: var(--bg-input); font-size: .76rem; padding-block: .9rem; }
.table tbody td { padding-block: 1rem; vertical-align: middle; }
.page-title { font-weight: 750; }
.welcome-section { position: relative; isolation: isolate; background: #173e36; border-radius: 1rem; box-shadow: none; padding: 2rem; overflow: visible; }
.welcome-section::before { content: ''; position: absolute; inset: 0; width: auto; height: auto; z-index: -1; border-radius: inherit; background: linear-gradient(90deg, rgba(15,49,40,.94), rgba(15,49,40,.79)), url('/assets/img/brand/baghdad.jpg') center 55% / cover; opacity: 1; }
.welcome-content::before { content: ''; display: block; width: 42px; height: 3px; background: var(--brand-gold); margin-bottom: 1rem; }
.welcome-greeting { color: #fff; line-height: 1.8; }
.welcome-date { color: #d3e3d4; opacity: 1; }
.workspace-intro { color: #d3e3d4; font-size: .83rem; margin: .35rem 0 .8rem; line-height: 1.9; }
.quick-actions-header { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.quick-actions-header .btn { margin: 0 !important; min-height: 36px; }
.quick-actions-header .btn-primary { background: #e4eccf; color: #183c31; border-color: #e4eccf; }
.quick-actions-header .dropdown-menu { z-index: 1030; }
.brand-eyebrow { display: block; color: var(--text-muted); font-size: .7rem; font-weight: 600; margin-bottom: .5rem; }
:focus-visible { outline: 3px solid var(--brand-gold); outline-offset: 3px; }
@media (max-width: 991px) { .main-content { padding: 1rem; } .quick-actions-header { justify-content: flex-start; } }
@media (max-width: 575px) { .welcome-section { padding: 1.3rem; } .welcome-greeting { font-size: 1.2rem; } .card-body { padding: 1rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* Sidebar has a dark surface in both themes. */
.sidebar { --nav-reg: #bdc6ff; --nav-isms: #aacfff; --nav-dpms: #dcc4fb; --nav-aml: #f0ce8d; --nav-coi: #f1b8c8; --nav-training: #9fdec6; }
[data-theme="dark"] .sidebar-logo .logo-img[src$="wordmark-light.svg"] { filter: none; }
[data-theme="dark"] .executive-kpi-value { color: var(--text-primary); }

/* Workspace masthead: page context, a dedicated search control, grouped tools. */
:root { --navbar-height: 94px; }
.top-navbar { height: var(--navbar-height); padding: 0 1.8rem; gap: 28px; background: var(--card-bg); border-bottom: 1px solid var(--border-color); }
.top-navbar .navbar-left { flex: 1; min-width: 0; gap: 24px; }
.header-context { display: flex; flex-direction: column; gap: 5px; min-width: 140px; max-width: 260px; }
.header-workspace { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-workspace i { font-size: .7rem; color: #967546; }
.header-page { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.6; }
.header-search { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; max-width: 440px; height: 46px; padding: 0 14px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--bg-input); color: var(--text-muted); text-align: start; transition: border-color .15s, background .15s; }
.header-search:hover { border-color: var(--primary); background: var(--bg-hover); }
.header-search > i { position: static; font-size: .88rem; color: var(--primary); flex: none; }
.header-search > span { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-search kbd { flex: none; margin-inline-start: auto; font: 10px system-ui, sans-serif; padding: 4px 6px; white-space: nowrap; }
.top-navbar .navbar-right { flex: none; gap: 18px; }
.header-tools { display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 10px; background: var(--bg-input); }
.header-tools .nav-item { margin: 0; }
.header-tools .nav-icon, .header-tools .theme-toggle, .header-tools .onboarding-help-btn { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 7px; color: var(--text-secondary); background: transparent; box-shadow: none; font-size: .9rem; }
.header-tools .nav-icon:hover, .header-tools .theme-toggle:hover, .header-tools .onboarding-help-btn:hover { color: var(--primary); background: var(--card-bg); box-shadow: 0 2px 8px #173f3808; transform: none; }
.header-tools .onboarding-help-btn::after { display: none; }
.header-tools .header-language { width: auto; min-width: 58px; gap: 7px; padding-inline: 8px; text-decoration: none; }
.header-language span { font-size: .73rem; font-weight: 600; }
.top-navbar .user-toggle { gap: 10px; padding: 5px 8px; border-radius: 9px; background: transparent; }
.top-navbar .user-avatar { width: 40px; height: 40px; border-radius: 11px; background: var(--primary-soft); color: var(--primary-strong); border: 1px solid var(--primary-border); box-shadow: none; flex: none; }
.top-navbar .user-info { min-width: 64px; max-width: 130px; }
.top-navbar .user-name { font-size: .83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.6; }
.top-navbar .user-role { color: var(--text-muted); font-size: .67rem; margin-top: 2px; }
.top-navbar .user-toggle > i { font-size: .65rem; color: var(--text-muted); }
.top-navbar .dropdown-menu { border-radius: 12px; border-color: var(--border-color); padding: 8px; box-shadow: var(--shadow-lg); }
.top-navbar .dropdown-item { border-radius: 6px; padding: .65rem .8rem; font-size: .83rem; }
.top-navbar .dropdown-header { padding: .7rem .8rem; }
.top-navbar .dropdown-header h6 { font-size: .86rem; margin: 0; }
@media (max-width: 1250px) {
  .top-navbar { padding-inline: 20px; gap: 16px; }
  .top-navbar .navbar-left { gap: 16px; }
  .top-navbar .navbar-right { gap: 8px; }
  .header-search { max-width: 260px; }
  .header-search > span { font-size: .74rem; }
  .header-context { min-width: 120px; max-width: 190px; }
  .top-navbar .user-info { display: none !important; }
}
@media (max-width: 1100px) and (min-width: 768px) {
  .header-search { max-width: 46px; flex: none; padding: 0; justify-content: center; }
  .header-search span, .header-search kbd { display: none; }
  .top-navbar .navbar-left { justify-content: space-between; }
}
@media (max-width: 767px) {
  :root { --navbar-height: 130px; }
  .top-navbar { height: auto; min-height: var(--navbar-height); padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .top-navbar .navbar-left { flex-basis: 100%; gap: 12px; }
  .header-context { flex: 1; max-width: none; min-width: 0; gap: 0; }
  .header-page { font-size: 1rem; }
  .header-workspace { font-size: .65rem; }
  .header-search { flex: none; width: 40px; height: 40px; padding: 0; justify-content: center; }
  .header-search span, .header-search kbd { display: none; }
  .top-navbar .sidebar-toggle { width: 36px; height: 40px; flex: none; padding: 0; background: var(--bg-hover); color: var(--text-primary); border-radius: 7px; }
  .top-navbar .navbar-right { width: 100%; justify-content: space-between; }
  .header-tools { padding: 3px; gap: 2px; }
  .header-tools .nav-icon, .header-tools .theme-toggle, .header-tools .onboarding-help-btn { width: 40px; height: 40px; }
  .header-tools .header-language { min-width: 40px; padding: 0; }
  .header-language span { display: none; }
  .top-navbar .user-toggle { padding: 0; }
  .top-navbar .user-avatar { width: 38px; height: 38px; }
  .top-navbar .dropdown-tasks, .top-navbar .dropdown-notifications { width: min(320px, calc(100vw - 32px)); }
}
