html {
  font-size: 13.86px; /* 10% under 15.4px — scales rem-based type globally */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  height: 100%;
}

:root {
  /* HITS Solutions cascade — cyan / navy / lime / mist (from HITS.Jobs v4) */
  --hits-primary: #1aa6e0;
  --hits-primary-hover: #0f8fc4;
  --hits-primary-rgb: 26, 166, 224;
  --hits-primary-subtle: #eaf6fc;
  --hits-accent: #8cc63f;
  --hits-accent-hover: #7ab335;
  --hits-focus-ring: rgba(26, 166, 224, 0.25);
  --hits-navy: #0b3d6e;
  --hits-secondary: #e8eef3;

  --hits-canvas: #f2f4f7;
  --hits-surface: #ffffff;
  --hits-stroke: #d5dee6;
  --hits-text: #0a1c33;
  --hits-text-muted: #6b7a86;
  --hits-radius-sm: 8px;
  --hits-radius-md: 10px;
  --hits-btn-radius: 0.5rem;
  --hits-space-xs: 0.25rem;
  --hits-space-sm: 0.5rem;
  --hits-space-md: 0.75rem;
  --hits-space-lg: 1rem;
  --hits-space-xl: 1.5rem;

  --hits-success: #5aa312;
  --hits-success-subtle: #eef8e4;
  --hits-warning: #b8860b;
  --hits-warning-subtle: #fff8e0;
  --hits-danger: #a80000;
  --hits-danger-subtle: #fde7e9;

  --hits-shadow-sm: 0 1px 2px rgba(10, 28, 51, 0.08), 0 0 2px rgba(10, 28, 51, 0.05);
  --hits-shadow-md: 0 2px 6px rgba(10, 28, 51, 0.08), 0 0 2px rgba(10, 28, 51, 0.05);
  --hits-shadow-lg: 0 8px 20px rgba(10, 28, 51, 0.1), 0 0 2px rgba(10, 28, 51, 0.06);

  --hits-font-sans: "Figtree", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  --hits-font-display: "Sora", "Figtree", system-ui, sans-serif;
}

html[data-hits-density="compact"] {
  --hits-space-xs: 0.125rem;
  --hits-space-sm: 0.375rem;
  --hits-space-md: 0.5rem;
  --hits-space-lg: 0.75rem;
  --hits-space-xl: 1rem;
}

html[data-hits-density="comfortable"] {
  --hits-space-xs: 0.35rem;
  --hits-space-sm: 0.65rem;
  --hits-space-md: 1rem;
  --hits-space-lg: 1.25rem;
  --hits-space-xl: 1.75rem;
}

@media (min-width: 768px) {
  html {
    font-size: 15.84px; /* 10% under 17.6px */
  }
}

body {
  background: var(--hits-canvas);
  color: var(--hits-text);
  font-family: var(--hits-font-sans);
}

/* Match body / drill-table size (Bootstrap default is 0.875em). */
small,
.small {
  font-size: 1em;
}

html[lang="ar"] body {
  font-family: "Figtree", "Noto Sans Arabic", "Segoe UI", "Arabic UI Text", "Tahoma", var(--hits-font-sans);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--hits-font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--hits-text);
}

/* HITS is always uppercase in product wordmarks */
.hits-wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--hits-font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: inherit;
}
.hits-wordmark__hits {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hits-wordmark__product {
  color: var(--hits-primary);
  letter-spacing: 0;
  font-weight: 700;
  text-transform: none;
}
.hits-wordmark--ink {
  color: var(--hits-text);
}
.hits-wordmark--ink .hits-wordmark__product {
  color: var(--hits-primary);
}
.hits-mark {
  display: block;
  flex-shrink: 0;
}

.btn-accent {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--hits-accent);
  --bs-btn-border-color: var(--hits-accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--hits-accent-hover);
  --bs-btn-hover-border-color: var(--hits-accent-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--hits-accent-hover);
  --bs-btn-active-border-color: var(--hits-accent-hover);
  color: #fff;
  background: var(--hits-accent);
  border-color: var(--hits-accent);
}
.btn-accent:hover {
  color: #fff;
  background: var(--hits-accent-hover);
  border-color: var(--hits-accent-hover);
}

/* Global loading bar (navigation / API / realtime) */
.global-loading-bar {
  position: fixed;
  top: 0;
  inset-inline: 0;
  height: 3px;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.06);
}

.global-loading-bar__inner {
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(var(--hits-primary-rgb), 0.9), rgba(255, 255, 255, 0));
  transform: translateX(-60%);
  animation: hits-loading 0.95s ease-in-out infinite;
}

@keyframes hits-loading {
  0% { transform: translateX(-60%); opacity: 0.35; }
  50% { opacity: 1; }
  100% { transform: translateX(260%); opacity: 0.35; }
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: 0.5rem;
  z-index: 2000;
  padding: 0.5rem 0.75rem;
  color: #fff;
  background: var(--hits-primary);
  border-radius: 0.375rem;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem var(--hits-focus-ring);
}

/* Global primary button theme (match login button) */
.btn {
  border-radius: var(--hits-btn-radius);
}

.btn-primary {
  background: var(--hits-primary);
  border-color: var(--hits-primary);
  border-radius: var(--hits-btn-radius);
  box-shadow: 0 0.75rem 1.5rem rgba(var(--hits-primary-rgb), 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--hits-primary-hover);
  border-color: var(--hits-primary-hover);
}

.btn-primary:active,
.btn-primary.active {
  background: var(--hits-primary-hover);
  border-color: var(--hits-primary-hover);
}

.btn-primary:disabled,
.btn-primary.disabled {
  background: var(--hits-primary);
  border-color: var(--hits-primary);
  opacity: 0.65;
  box-shadow: none;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--hits-canvas);
  overflow: hidden;
  overflow-x: clip;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
  padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
  background: var(--hits-surface);
  border-bottom: 1px solid var(--hits-stroke);
  box-shadow: var(--hits-shadow-sm);
}

.hits-topbar-filter-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  flex-shrink: 0;
}

.hits-topbar-filter-field .col-form-label {
  white-space: nowrap;
}

.hits-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.hits-nav-toggle .app-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.hits-mobile-toolbar {
  flex-shrink: 0;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.hits-mobile-toolbar-form .col-6 {
  min-width: 0;
}

.hits-mobile-toolbar .mission-select {
  max-width: 100%;
}

.app-sidebar.offcanvas-lg {
  --bs-offcanvas-width: min(22rem, calc(100vw - 1.25rem));
}

.brand-link,
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.user-pill {
  min-height: 2.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.brand-link small {
  display: block;
  color: var(--hits-text-muted);
  font-size: 0.75rem;
  line-height: 1;
  font-family: var(--hits-font-sans);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark .app-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.brand-mark,
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--hits-primary), var(--hits-navy));
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}

.mission-select {
  max-width: 12rem;
}

.search-box {
  flex: 1 1 auto;
  max-width: 28rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
}

.hits-ai-assistant-trigger,
.hits-quick-actions-trigger,
.hits-global-inbox-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding-inline: 0.5rem;
}

.hits-global-inbox-trigger .badge {
  font-size: 0.65rem;
  min-width: 1.1rem;
  padding: 0.15em 0.35em;
  transform: translate(-35%, -35%) !important;
}

.hits-global-inbox-menu {
  z-index: 1080;
}

.hits-culture-picker__code {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.topbar-actions .dropdown-menu {
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1080;
}

.hits-quick-actions-menu .dropdown-item .app-icon {
  margin-inline-end: 0.4rem;
}

@media (min-width: 992px) {
  .app-topbar {
    --hits-topbar-control-size: 2.25rem;
    gap: 0.75rem;
  }

  .topbar-actions .hits-topbar-control.btn {
    width: var(--hits-topbar-control-size);
    height: var(--hits-topbar-control-size);
    min-width: var(--hits-topbar-control-size);
    min-height: var(--hits-topbar-control-size);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .topbar-actions .hits-topbar-control.btn.dropdown-toggle::after {
    display: none;
  }

  .topbar-actions .hits-topbar-control.btn .app-icon {
    width: 1.125rem;
    height: 1.125rem;
  }

  .topbar-actions .user-pill.hits-topbar-control {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 2.5rem;
    padding: 0.25rem 0.5rem;
  }

  /* Base .offcanvas is visibility:hidden + fixed + off-screen; .offcanvas-lg lg rules do not undo that. */
  .app-sidebar.offcanvas-lg {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: static;
    visibility: visible;
    transform: none;
    height: auto;
    max-height: none;
  }
}

.app-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Density helpers used by registry / kanban tables */

.hits-table-dense.table > :not(caption) > * > * {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.hits-kanban-dense .hitsdo-kanban-card,
.hits-kanban-dense .border.rounded.p-3 {
  padding: 0.65rem !important;
}

.app-sidebar {
  width: 18rem;
  flex: 0 0 18rem;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border-inline-end: 1px solid #dee2e6;
}

.app-sidebar .offcanvas-header {
  flex-shrink: 0;
}

.app-sidebar .offcanvas-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.app-sidebar .offcanvas-body > nav {
  flex: 0 0 auto;
}

.app-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.125rem;
  padding: 0.5rem 0.75rem;
  color: var(--hits-text);
  border-radius: var(--hits-radius-sm);
  border-inline-start: 3px solid transparent;
  touch-action: manipulation;
}

.app-sidebar .nav-link span {
  flex: 1 1 auto;
}

.app-sidebar .nav-link .app-icon {
  color: var(--hits-text-muted);
}

.app-sidebar .nav-link:hover {
  background: var(--hits-secondary);
}

.app-sidebar .nav-link.active {
  color: var(--hits-navy);
  font-weight: 600;
  background: var(--hits-primary-subtle);
  border-inline-start-color: var(--hits-primary);
}

.app-sidebar .nav-link.active .app-icon {
  color: var(--hits-primary);
}

.nav-section {
  margin: 1rem 0 0.35rem;
  padding: 0 0.75rem;
  color: #6c757d;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section--toggle {
  cursor: pointer;
  user-select: none;
}

.nav-section--toggle::after {
  content: "▾";
  float: right;
  opacity: 0.65;
}

.nav-section--toggle[aria-expanded="false"]::after {
  content: "▸";
}

.nav-section-body {
  display: flex;
  flex-direction: column;
}

.app-content,
#main-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
  background-color: var(--hits-canvas);
}

.page-shell,
.auth-shell {
  min-height: 100%;
  padding: 1.5rem;
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  background-color: var(--hits-canvas);
}

.page-shell-wide {
  max-width: 1600px;
}

.hits-flat-surface,
.metric-card,
.surface-card {
  background: var(--hits-surface);
  border: 1px solid var(--hits-stroke);
  border-radius: var(--hits-radius-md);
  box-shadow: none;
}

.metric-card {
  padding: 1.25rem;
}

.metric-value {
  margin: 0.35rem 0;
  font-size: 2rem;
  font-weight: 700;
}

.gradient-blue,
.gradient-purple,
.gradient-auth {
  background: var(--hits-canvas);
  border: 1px solid var(--hits-stroke);
  border-radius: var(--hits-radius-md);
  box-shadow: none;
}

.code-panel {
  color: #fff;
  background: #111827;
  border-radius: 1rem;
}

.kanban-card {
  border-inline-start: 4px solid var(--hits-primary) !important;
}

.dashboard-home-skeleton .dashboard-skeleton-line,
.dashboard-home-skeleton .dashboard-skeleton-pill,
.dashboard-home-skeleton .dashboard-skeleton-badge {
  background: linear-gradient(90deg, #e9ecef 0%, #f8f9fa 40%, #e9ecef 80%);
  background-size: 200% 100%;
  animation: dashboard-skeleton-shimmer 1.2s ease-in-out infinite;
}

.dashboard-home-skeleton .dashboard-skeleton-badge {
  width: 5rem;
  height: 1.5rem;
}

.dashboard-home-skeleton .dashboard-skeleton-pill {
  width: 18rem;
  max-width: 100%;
  height: 2.25rem;
}

@keyframes dashboard-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

.my-tasks-kanban__lane {
  min-height: 14rem;
}

.white-space-preline {
  white-space: pre-line;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
  .app-topbar {
    --hits-topbar-control-size: 2.75rem;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    min-height: 3.25rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .app-topbar .hits-topbar-brand {
    width: auto;
    height: var(--hits-topbar-control-size);
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.25rem;
  }

  .app-topbar .hits-topbar-brand .hits-topbar-mark {
    width: 2rem;
    height: 2rem;
  }

  .app-topbar .hits-topbar-brand .hits-wordmark {
    font-size: 0.95rem;
  }

  .app-topbar .hits-topbar-control {
    width: var(--hits-topbar-control-size);
    height: var(--hits-topbar-control-size);
    min-width: var(--hits-topbar-control-size);
    min-height: var(--hits-topbar-control-size);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .app-topbar .hits-topbar-control.dropdown-toggle::after {
    display: none;
  }

  .app-topbar .hits-topbar-control .app-icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .app-topbar .user-pill.hits-topbar-control {
    border-radius: 50%;
    gap: 0;
    min-height: 0;
    padding: 0;
  }

  .app-topbar .user-pill.hits-topbar-control .avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-size: 0.8rem;
  }

  .app-topbar .topbar-actions {
    gap: 0.35rem;
  }

  /* Mobile drawer: full viewport height, scroll nav inside the panel (not the page). */
  #appNavDrawer.app-sidebar.offcanvas {
    height: 100%;
    max-height: 100dvh;
  }

  #appNavDrawer.app-sidebar .offcanvas-body {
    max-height: none;
    padding-top: 0.25rem;
  }

  .app-sidebar .nav-link {
    min-height: 2.75rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  /* iOS Safari: 16px+ on inputs avoids automatic zoom on focus. */
  .form-control:not(.form-control-sm):not(.form-control-lg),
  .form-select:not(.form-select-sm):not(.form-select-lg) {
    font-size: 16px;
  }
}

/* Bootstrap 5.3 color mode — HITS shell overrides */
[data-bs-theme="dark"] {
  color-scheme: dark;
  --hits-canvas: #0a1c33;
  --hits-surface: #12263d;
  --hits-stroke: #2a3f55;
  --hits-text: #f2f4f7;
  --hits-text-muted: #9aadc0;
  --hits-primary-subtle: rgba(26, 166, 224, 0.16);
  --hits-secondary: #16324a;
  --hits-navy: #eaf6fc;
  --hits-focus-ring: rgba(26, 166, 224, 0.45);
  --hits-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --hits-shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4);
  --hits-shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.45);
}

[data-bs-theme="dark"] .app-shell {
  background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .app-topbar {
  background: var(--bs-body-bg);
  border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .brand-link small {
  color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .page-shell,
[data-bs-theme="dark"] .auth-shell {
  background-color: var(--bs-body-bg);
}

[data-bs-theme="dark"] .hits-flat-surface,
[data-bs-theme="dark"] .surface-card,
[data-bs-theme="dark"] .metric-card {
  background: var(--hits-surface);
  border-color: var(--hits-stroke);
  box-shadow: none;
}

[data-bs-theme="dark"] .gradient-blue,
[data-bs-theme="dark"] .gradient-purple,
[data-bs-theme="dark"] .gradient-auth {
  background: var(--hits-surface);
  border-color: var(--hits-stroke);
}

[data-bs-theme="dark"] .dashboard-home-skeleton .dashboard-skeleton-line,
[data-bs-theme="dark"] .dashboard-home-skeleton .dashboard-skeleton-pill,
[data-bs-theme="dark"] .dashboard-home-skeleton .dashboard-skeleton-badge {
  background: linear-gradient(90deg, #2d3338 0%, #3d444a 40%, #2d3338 80%);
  background-size: 200% 100%;
}
