/* ================================================================
   Makenly — Theme & Design System
   Ruggedized Admin Panel for factory floor use
   ================================================================ */

/* ================================================================
   Inter font — vendored locally (CSP fontSrc:'self', offline-safe)
   Source: @fontsource/inter (OFL-1.1), Latin subset, weights 400/500/600/700
   ================================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/public/vendor/inter/inter-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/public/vendor/inter/inter-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/public/vendor/inter/inter-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/public/vendor/inter/inter-latin-700-normal.woff2') format('woff2');
}

:root {
  --mithra-bg: #f4f5f7;
  --mithra-surface: #ffffff;
  --mithra-border: #e6e8ec;
  --mithra-text: #1a1d21;
  --mithra-text-muted: #6b7280;
  --mithra-primary: #e2502e;
  --mithra-primary-hover: #c43e1e;
  --mithra-accent: #f2a93b;
  --mithra-success: #1f7a3a;
  --mithra-warning: #c46a12;
  --mithra-danger: #b21f1f;
  --mithra-info: #1b5e8c;
  --mithra-touch-min: 44px;
  --mithra-touch-primary: 48px;
  --mithra-radius: 10px;
  --mithra-radius-sm: 6px;
  --mithra-font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mithra-font-mono: "JetBrains Mono", "Consolas", "Courier New", monospace;

  --bs-primary: var(--mithra-primary);
  --bs-primary-rgb: 226, 80, 46;
  --bs-link-color: var(--mithra-primary);
  --bs-link-hover-color: var(--mithra-primary-hover);
}

@media (pointer: coarse), (max-width: 991.98px) {
  :root {
    --mithra-touch-min: 48px;
    --mithra-touch-primary: 56px;
  }
}

/* ================================================================
   Base
   ================================================================ */

body {
  background-color: var(--mithra-bg);
  font-family: var(--mithra-font);
  color: var(--mithra-text);
}

/* ================================================================
   Buttons & Touch Targets
   ================================================================ */

.btn {
  min-height: var(--mithra-touch-min);
  padding: .55rem 1rem;
  font-weight: 600;
  border-radius: var(--mithra-radius);
}

.btn-primary {
  background-color: var(--mithra-primary);
  border-color: var(--mithra-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--mithra-primary-hover);
  border-color: var(--mithra-primary-hover);
}

.btn-lg {
  min-height: var(--mithra-touch-primary);
}

.btn-sm {
  min-height: 36px;
}

.btn-icon {
  padding: 0.35rem 0.5rem;
  min-height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Phones: 44x44 tap target for every per-row icon button (desktop keeps 36px). */
@media (max-width: 575.98px) {
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ================================================================
   Sidebar & Top Strip (Phase 2 — replaces top navbar chrome)
   ================================================================ */

/* Sidebar width CSS custom properties — toggled by JS state script */
:root {
  --sidebar-w: 220px;
  --sidebar-w-mini: 56px;
  --topstrip-h: 48px;
  /* Subscription banner height — 0px when no banner; JS sets to 32px when active (spec 014 / T23.9) */
  --mk-banner-h: 0px;
}

/* ================================================================
   Subscription Banner (spec 014 / T23.9 / ADR-057)
   A thin strip rendered by layout.js above the topstrip when the
   subscription is in a trial, grace, or locked state.
   On-prem (status:'none') → no banner, no CSS rendered (C1).
   textContent only — no innerHTML (XSS / CSP safety).
   prefers-reduced-motion: no animation (the strip simply appears).
   ================================================================ */

.mk-subscription-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  z-index: 1030; /* above topstrip (1029) */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0 1rem;
  /* No transition: prefers-reduced-motion-safe (strip just appears) */
}

.mk-banner--trial {
  background-color: #0dcaf0; /* Bootstrap info */
  color: #000f14;
}

.mk-banner--grace {
  background-color: #ffc107; /* Bootstrap warning */
  color: #3d2b00;
}

.mk-banner--locked {
  background-color: #dc3545; /* Bootstrap danger */
  color: #fff;
}

.mk-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mk-banner-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.mk-banner-message {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mk-banner-cta {
  flex-shrink: 0;
  font-weight: 700;
  text-decoration: underline;
  margin-left: 0.25rem;
}

.mk-banner--trial  .mk-banner-cta { color: #000f14; }
.mk-banner--grace  .mk-banner-cta { color: #3d2b00; }
.mk-banner--locked .mk-banner-cta { color: #fff; }

/* Demo environment banner — spec 015 / task #24 / ADR-061 */
.mk-banner--demo {
  background-color: #6f42c1; /* Bootstrap purple — distinct from subscription banners */
  color: #fff;
}

/* When banner is active, shift topstrip + sidebar + page content down */
body.has-subscription-banner #mk-topstrip {
  top: var(--mk-banner-h);
}

body.has-subscription-banner #mk-sidebar {
  top: var(--mk-banner-h);
}

body.has-subscription-banner .container {
  padding-top: calc(var(--topstrip-h) + var(--mk-banner-h) + 1.5rem) !important;
}

/* Mobile: banner spans full width (already done via left:0/right:0) */
@media (max-width: 575.98px) {
  .mk-subscription-banner {
    font-size: 0.72rem;
    height: 28px;
    --mk-banner-h: 28px;
  }
}

/* Print: hide the subscription banner */
@media print {
  .mk-subscription-banner { display: none !important; }
}

/* ---- Fixed left rail (desktop ≥ lg) ---- */
#mk-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background-color: var(--mithra-primary);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  overflow: hidden;
  transition: width 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  #mk-sidebar { transition: none; }
}

/* Hidden on mobile — Offcanvas handles it */
@media (max-width: 991.98px) {
  #mk-sidebar { display: none; }
}

/* Sidebar brand area */
.mk-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  min-height: var(--topstrip-h);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
}

.mk-sidebar-brand:hover { color: rgba(255,255,255,0.85); }

.mk-sidebar-brand-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  color: var(--mithra-accent);
}

.mk-sidebar-brand-text { transition: opacity 0.15s ease; }

/* ---- Sidebar nav list ---- */
.mk-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.mk-sidebar-nav::-webkit-scrollbar { width: 4px; }
.mk-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.mk-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Individual nav link */
.mk-nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.875rem;
  min-height: var(--mithra-touch-min);
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.mk-nav-link:hover {
  color: #fff;
  background-color: rgba(255,255,255,0.1);
}

.mk-nav-link.active {
  color: #fff;
  font-weight: 700;
  border-left-color: var(--mithra-accent);
  background-color: rgba(255,255,255,0.14);
}

.mk-nav-link .mk-nav-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

.mk-nav-label { transition: opacity 0.12s ease; }

/* ---- Admin collapsible sub-section ---- */
.mk-admin-toggle {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.875rem;
  min-height: var(--mithra-touch-min);
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
}

.mk-admin-toggle:hover { color: rgba(255,255,255,0.85); background-color: rgba(255,255,255,0.06); }

.mk-admin-toggle .mk-nav-icon { font-size: 1.1rem; flex-shrink: 0; width: 1.25rem; text-align: center; }

.mk-admin-caret {
  margin-left: auto;
  font-size: 0.75rem;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.mk-admin-toggle[aria-expanded="false"] .mk-admin-caret { transform: rotate(-90deg); }

@media (prefers-reduced-motion: reduce) {
  .mk-admin-caret { transition: none; }
}

.mk-admin-sub {
  padding-left: 0.5rem;
  overflow: hidden;
}

.mk-admin-sub .mk-nav-link {
  font-size: 0.875rem;
  padding-left: 1.25rem;
}

/* ---- Sidebar collapse toggle (bottom of rail) ---- */
.mk-sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.625rem 0.875rem;
  min-height: 40px;
  border-top: 1px solid rgba(255,255,255,0.12);
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  background: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: color 0.12s ease;
  width: 100%;
}

.mk-sidebar-collapse-btn:hover { color: #fff; }

/* ---- Mini (icon-only) state ----
   Scoped to desktop (≥992px): the fixed rail only renders there. Without this scope the
   `sidebar-mini` body class (a desktop preference, persisted in localStorage) would also blank
   the labels and hide the Admin sub-list inside the MOBILE offcanvas drawer, which reuses the
   same .mk-nav-label / .mk-admin-sub classes. Keeping these rules desktop-only fixes that leak. */
@media (min-width: 992px) {
  body.sidebar-mini #mk-sidebar { width: var(--sidebar-w-mini); }

  body.sidebar-mini .mk-sidebar-brand-text,
  body.sidebar-mini .mk-nav-label,
  body.sidebar-mini .mk-admin-caret { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }

  body.sidebar-mini .mk-admin-toggle .mk-nav-label { opacity: 0; width: 0; overflow: hidden; }

  body.sidebar-mini .mk-admin-sub { display: none; }

  /* Remove the caret from the rail ENTIRELY in mini (display:none, not width:0). A width:0 caret
     still claims a flex `gap` and keeps its `margin-left:auto`, which absorbed ~13px of free space
     and shoved the Admin gear icon ~10px left of every other nav icon. display:none drops it from
     layout so the gear centers identically to the rest. */
  body.sidebar-mini .mk-admin-caret { display: none; }

  body.sidebar-mini .mk-nav-link { justify-content: center; padding-left: 0; padding-right: 0; border-left: none; }

  body.sidebar-mini .mk-admin-toggle { justify-content: center; padding-left: 0; padding-right: 0; }

  body.sidebar-mini .mk-sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }

  body.sidebar-mini .mk-sidebar-collapse-btn { justify-content: center; }
}

/* ---- Desktop content shift ---- */
@media (min-width: 992px) {
  body.has-sidebar .container {
    margin-left: var(--sidebar-w);
    transition: margin-left 0.2s ease;
  }
  body.sidebar-mini .container {
    margin-left: var(--sidebar-w-mini) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.has-sidebar .container { transition: none; }
}

/* Prevent content from being too wide after shift */
@media (min-width: 992px) {
  body.has-sidebar .container {
    max-width: calc(100% - var(--sidebar-w));
  }
  body.sidebar-mini .container {
    max-width: calc(100% - var(--sidebar-w-mini)) !important;
  }
}

/* ---- Slim top strip (bell + user + logout) ---- */
#mk-topstrip {
  position: fixed;
  top: 0;
  right: 0;
  height: var(--topstrip-h);
  background-color: var(--mithra-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.875rem 0 0.75rem;
  z-index: 1029;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

/* Top strip left edge sits just to the right of the sidebar */
@media (min-width: 992px) {
  #mk-topstrip {
    left: var(--sidebar-w);
    transition: left 0.2s ease;
  }
  body.sidebar-mini #mk-topstrip {
    left: var(--sidebar-w-mini);
  }
}

@media (prefers-reduced-motion: reduce) {
  #mk-topstrip { transition: none; }
}

/* On mobile the topstrip spans full width; hamburger lives here */
@media (max-width: 991.98px) {
  #mk-topstrip { left: 0; }
}

/* Push page content below the top strip on ALL sizes.
   !important is REQUIRED: every view wraps content in `.container py-4` (NOT `.container-fluid` —
   that class skips the sidebar margin-left + max-width rules below and clips content under the
   sidebar/topstrip; see views/operators.html history). Bootstrap's .py-4 sets
   `padding-top: 1.5rem !important`, which would otherwise win and let the fixed 48px top strip clip
   the page header. Higher specificity + !important makes this rule win. */
body.has-sidebar .container {
  padding-top: calc(var(--topstrip-h) + 1.5rem) !important;
}

/* And below topstrip on desktop (overrides padding-top from above where needed) */
@media (min-width: 992px) {
  body.has-sidebar .container {
    /* padding-top already set above; margin-left set separately */
  }
}

.mk-topstrip-hamburger {
  background: none;
  border: none;
  color: rgba(255,255,255,0.9);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.375rem;
  display: flex;
  align-items: center;
}

@media (min-width: 992px) {
  .mk-topstrip-hamburger { display: none; }
}

.mk-topstrip-spacer { flex: 1; }

/* User + role in top strip */
#navUserWrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#navUser {
  color: rgba(255,255,255,0.9);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

@media (max-width: 575.98px) {
  #navUser { max-width: 90px; }
}

/* ---- Offcanvas mobile drawer ---- */
#mk-offcanvas {
  width: min(260px, 85vw) !important;
  background-color: var(--mithra-primary);
  color: #fff;
}

#mk-offcanvas .offcanvas-header {
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding: 0.75rem 0.875rem;
}

#mk-offcanvas .offcanvas-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

#mk-offcanvas .btn-close {
  filter: invert(1) brightness(2);
  opacity: 0.7;
}

#mk-offcanvas .offcanvas-body {
  padding: 0.5rem 0;
  overflow-y: auto;
}

/* role-badge colors updated for non-ember backgrounds */
.role-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge.owner {
  background-color: var(--mithra-accent);
  color: #fff;
}

.role-badge.supervisor {
  background-color: rgba(255,255,255,0.25);
  color: #fff;
}

/* Shortcuts hint in top strip */
.nav-shortcuts-hint {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

/* Legacy .navbar rule — kept so any stray .navbar reference doesn't break */
.navbar {
  background-color: var(--mithra-primary) !important;
  min-height: var(--mithra-touch-primary);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-link {
  font-weight: 500;
  min-height: var(--mithra-touch-min);
  display: inline-flex;
  align-items: center;
}

.nav-link.active {
  font-weight: 700;
  border-bottom: 2px solid rgba(255,255,255,0.8);
}

/* Admin dropdown in navbar — Bootstrap compiles its own active bg, re-point it at the brand token */
.navbar .dropdown-menu {
  --bs-dropdown-link-active-bg: var(--mithra-primary);
}

.navbar .dropdown-item {
  min-height: var(--mithra-touch-min);
  display: flex;
  align-items: center;
}

/* ================================================================
   Tables
   ================================================================ */

.table {
  --bs-table-bg: var(--mithra-surface);
}

.table thead th {
  font-size: .8125rem;
  background: #f3f4f6;
  color: #2a2f36;
  border-bottom: 1px solid #d1d5db;
  padding: .65rem .75rem;
  font-weight: 600;
}

.table tbody td {
  padding: .55rem .75rem;
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background-color: #f1f3f5;
}

/* ================================================================
   Numeric Formatting
   ================================================================ */

.num {
  font-variant-numeric: tabular-nums;
  font-family: var(--mithra-font-mono);
}

.unit {
  color: var(--mithra-text-muted);
  font-size: 0.875em;
  font-weight: 500;
}

/* ================================================================
   Status Badges
   ================================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4em 0.7em;
  border-radius: var(--mithra-radius);
  white-space: nowrap;
}

.status-badge::before {
  font-family: "bootstrap-icons";
  font-size: 0.9em;
  line-height: 1;
}

.status-badge.draft {
  background-color: #e9ecef;
  color: #495057;
}
.status-badge.draft::before { content: "\F38B"; } /* bi-file-earmark */

.status-badge.approved {
  background-color: rgba(226, 80, 46, 0.12);
  color: var(--mithra-primary);
}
.status-badge.approved::before { content: "\F26B"; } /* bi-check-circle */

.status-badge.in_progress {
  background-color: rgba(196, 106, 18, 0.12);
  color: var(--mithra-warning);
}
.status-badge.in_progress::before { content: "\F3E5"; } /* bi-gear-fill */

.status-badge.completed {
  background-color: rgba(31, 122, 58, 0.12);
  color: var(--mithra-success);
}
.status-badge.completed::before { content: "\F26F"; } /* bi-check2-all */

.status-badge.cancelled {
  background-color: rgba(178, 31, 31, 0.10);
  color: var(--mithra-danger);
}
.status-badge.cancelled::before { content: "\F623"; } /* bi-x-circle */

/* Rotation animation for in_progress gear */
@keyframes spin-gear {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.status-badge.in_progress::before {
  animation: spin-gear 2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .status-badge.in_progress::before {
    animation: none;
  }
}

/* Active/Inactive pills */
.status-pill.active {
  background-color: rgba(31, 122, 58, 0.12);
  color: var(--mithra-success);
}
.status-pill.active::before { content: "\F26B"; } /* bi-check-circle */

.status-pill.inactive {
  background-color: #e9ecef;
  color: #6c757d;
}
.status-pill.inactive::before { content: "\F622"; } /* bi-circle */

/* Low stock warning */
.low-stock-icon {
  color: var(--mithra-warning);
  margin-right: 0.25em;
}

/* ================================================================
   Cards & Surfaces
   ================================================================ */

.card {
  background-color: var(--mithra-surface);
  border: 1px solid var(--mithra-border);
  border-radius: var(--mithra-radius);
  box-shadow: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
}

.page-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--mithra-border);
}

/* Summary cards */
.summary-card {
  border-left: 4px solid var(--mithra-primary);
}

.summary-card.warning {
  border-left-color: var(--mithra-warning);
}

.summary-card.danger {
  border-left-color: var(--mithra-danger);
}

.summary-card.success {
  border-left-color: var(--mithra-success);
}

.summary-card.info {
  border-left-color: var(--mithra-info);
}

.summary-card.clickable {
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.summary-card.clickable:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* KPI cards on dashboard */
.kpi-value {
  font-family: var(--mithra-font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ================================================================
   Forms
   ================================================================ */

.form-control:focus,
.form-select:focus {
  border-color: var(--mithra-primary);
  box-shadow: 0 0 0 .2rem rgba(226,80,46,.18);
}

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.modal-body .form-control,
.modal-body .form-select {
  font-size: 1rem; /* prevent iOS zoom */
}

/* Qty stepper */
.qty-stepper {
  display: flex;
  align-items: stretch;
}

.qty-stepper .btn-step {
  min-width: var(--mithra-touch-min);
  font-weight: 700;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qty-stepper .form-control {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   Modals
   ================================================================ */

.modal-content {
  border: 1px solid var(--mithra-border);
  border-radius: var(--mithra-radius);
}

.modal-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--mithra-border);
}

.modal-footer {
  border-top: 1px solid var(--mithra-border);
}

@media (max-width: 991.98px) {
  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  .modal-footer .btn {
    width: 100%;
    margin: 0 !important;
  }
}

/* ================================================================
   Empty States
   ================================================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--mithra-text-muted);
}

.empty-state i {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
  color: #adb5bd;
}

.empty-state .empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--mithra-text);
  margin-bottom: 0.5rem;
}

.empty-state .empty-subtitle {
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

/* ================================================================
   Skeleton Loading
   ================================================================ */

@keyframes skeleton-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton-bar {
  height: 1rem;
  border-radius: 4px;
  background: linear-gradient(90deg, #e9ecef 25%, #f1f3f5 50%, #e9ecef 75%);
  background-size: 200px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-row td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid #f1f3f5;
}

/* ================================================================
   Code Format
   ================================================================ */

.code-format {
  font-family: var(--mithra-font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--mithra-primary);
}

/* ================================================================
   Focus Visible
   ================================================================ */

*:focus-visible {
  outline: 3px solid var(--mithra-accent);
  outline-offset: 2px;
}

/* ================================================================
   Footer / Shortcuts hint
   ================================================================ */

.nav-shortcuts-hint {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

/* ================================================================
   Responsive Layout
   ================================================================ */

@media (min-width: 1200px) {
  .container {
    max-width: 1320px;
  }
}

@media (max-width: 991.98px) {
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .table-responsive {
    font-size: 1rem;
  }
}

/* ================================================================
   BOM Table responsive stacking below 768px
   ================================================================ */

@media (max-width: 767.98px) {
  .bom-table-responsive tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--mithra-border);
  }
  .bom-table-responsive tbody tr td {
    border: none;
    padding: 0.25rem 0;
  }
  .bom-table-responsive tbody tr td:first-child {
    grid-column: 1 / -1;
  }
}

/* ================================================================
   Print Styles
   ================================================================ */

@media print {
  /* Hide ALL navigation chrome in print (navbar legacy + new sidebar/topstrip) */
  .navbar,
  #mk-sidebar,
  #mk-topstrip,
  #mk-offcanvas,
  #notifPanel,
  .page-header .btn,
  .filters-card,
  .no-print,
  .modal-backdrop,
  .nav-shortcuts-hint,
  .btn-group .btn,
  .empty-state .btn,
  .card .btn {
    display: none !important;
  }

  /* Zero the desktop content shift so reports print full-width */
  body.has-sidebar .container,
  body.sidebar-mini .container {
    margin-left: 0 !important;
    max-width: 100% !important;
    padding-top: 0 !important;
  }

  body {
    background: #fff !important;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .table {
    font-size: 0.875rem;
  }

  .table thead th {
    background: #f1f3f5 !important;
    color: #000 !important;
  }

  tr {
    page-break-inside: avoid;
  }

  .modal {
    position: static !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .modal-dialog {
    max-width: 100% !important;
    margin: 0 !important;
  }

  .modal-content {
    border: none !important;
    box-shadow: none !important;
  }

  .modal-header,
  .modal-footer {
    display: none !important;
  }

  .modal-body {
    padding: 0 !important;
  }

  /* Print header for reports */
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #333;
  }

  .print-header h3 {
    margin: 0;
    font-size: 1.25rem;
  }

  .print-header p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: #555;
  }

  /* Signature line */
  .signature-line {
    display: block !important;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #ccc;
  }

  .signature-line p {
    margin: 0;
    font-size: 0.875rem;
  }
}

.print-header,
.signature-line {
  display: none;
}

/* ================================================================
   Mobile Table Cards
   ================================================================ */

@media (max-width: 575.98px) {
  /* Hide table head; tbody rows become cards */
  .table-responsive .table thead {
    display: none;
  }
  .table-responsive .table tbody tr {
    display: block;
    background: var(--mithra-surface);
    border: 1px solid var(--mithra-border);
    border-radius: var(--mithra-radius);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
  }
  .table-responsive .table tbody tr td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right !important;
    padding: 0.4rem 0;
    border: none;
    border-bottom: 1px solid #f0f1f3;
    min-height: 36px;
    word-break: break-word;
  }
  .table-responsive .table tbody tr td:last-child {
    border-bottom: none;
  }
  .table-responsive .table tbody tr td::before {
    content: attr(data-label);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--mithra-text-muted);
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }
  /* Action button rows: stack horizontally, full width */
  .table-responsive .table tbody tr td.actions-cell,
  .table-responsive .table tbody tr td[data-label="Actions"],
  .table-responsive .table tbody tr td[data-label="Action"] {
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  .table-responsive .table tbody tr td.actions-cell::before,
  .table-responsive .table tbody tr td[data-label="Actions"]::before,
  .table-responsive .table tbody tr td[data-label="Action"]::before {
    content: '';
    margin-right: 0;
  }
  /* Hide print stylesheet from the no-print column header anchors */
  .table-responsive .table tbody tr td.no-print {
    /* still hidden during print, but visible on phone */
  }
  /* Status column gets no label prefix (the badge speaks for itself if labelled) */
  .table-responsive .table tbody tr td[data-label="Status"] {
    justify-content: space-between;
  }
}
