@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --mech-navy: #0F3D3E;
  --mech-navy-soft: #14504C;
  --mech-blue: #1F6E63;
  --mech-blue-deep: #14504C;
  --mech-bg: #F3F3F5;
  --mech-sidebar-bg: #172A4D;
  --mech-sidebar-border: rgba(255, 255, 255, 0.12);
  --mech-sidebar-soft-bg: rgba(255, 255, 255, 0.07);
  --mech-sidebar-soft-border: rgba(255, 255, 255, 0.14);
  --mech-sidebar-hover-bg: rgba(255, 255, 255, 0.09);
  --mech-sidebar-active-bg: rgba(255, 255, 255, 0.16);
  --mech-sidebar-text: #C7D0E4;
  --mech-sidebar-text-muted: #8D97B5;
  --mech-sidebar-text-strong: #FFFFFF;
  --mech-border: #DFEAEA;
  --mech-muted: #6B7788;
  --mech-muted-dark: #4C5768;
  --mech-badge-blue-bg: #E6F4F2;
  --mech-badge-blue-fg: #1F6E63;
  --mech-badge-gray-bg: #EDF4F3;
  --mech-badge-gray-fg: #4C5768;
  --mech-badge-amber-bg: #FBEFE6;
  --mech-badge-amber-fg: #8A542A;
  --mech-mint: #BFE8E3;
  --mech-mint-fg: #0E4A44;
  --mech-soft-bg: #F4FAF9;
  --mech-soft-border: #E3EEED;
  --mech-radius: 20px;
  --mech-radius-sm: 12px;
  --mech-sidebar-w: 258px;
  --mech-sidebar-collapsed-w: 76px;
  --mech-topbar-h: 60px;
}

html {
  font-size: 15px;
}

body {
  background-color: var(--mech-bg);
  color: var(--mech-navy);
  font-family: 'Inter', -apple-system, Helvetica, Arial, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  letter-spacing: -0.01em;
}

/* ---------- Material Symbols icons ---------- */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.material-symbols-rounded.icon-fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

a {
  color: var(--mech-blue);
}
a:hover {
  color: var(--mech-blue-deep);
}

/* Installation progress charts (Plotly figures built in
   app/reports/charts.py; see app/templates/_progress_summary.html and
   static/js/plotly_charts.js for how they get mounted). */
.plotly-chart {
  line-height: 0;
}
.completion-ring-chart {
  margin: 0 auto;
}
.progress-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

/* Per-domain count captions under the admin equipment-progress bar chart -
   plain text so the exact numbers don't rely on hovering the chart. */
.domain-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.domain-summary-chip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 140px;
}

/* Compact per-area completion tiles (dashboard) */
.area-tiles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.area-tile {
  width: 148px;
  border: 1px solid var(--mech-border);
  border-radius: var(--mech-radius-sm);
  background: #fff;
}
.area-tile-trigger {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.85rem 0.5rem;
  text-align: center;
  border-radius: var(--mech-radius-sm);
}
.area-tile-trigger:hover,
.area-tile-trigger:focus-visible {
  background: var(--mech-bg);
  outline: none;
}
.area-tile-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mech-navy);
  line-height: 1.2;
  word-break: break-word;
}
.area-tile-caption {
  font-size: 0.7rem;
  color: var(--mech-muted-dark);
  line-height: 1.2;
}
/* Floating "area detail" panel: opened by JS on tile click, positioned out
   of document flow so it never reflows/skews the tile grid behind it. */
.area-detail-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1040;
}
.area-detail-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--mech-border);
  border-radius: var(--mech-radius);
  box-shadow: 0 12px 32px rgba(18, 35, 61, 0.18);
  z-index: 1050;
}
.area-detail-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--mech-border);
  position: sticky;
  top: 0;
  background: #fff;
}
.area-detail-panel-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--mech-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}
.area-detail-panel-close:hover {
  color: var(--mech-navy);
}
.area-detail-panel-body {
  padding: 0.75rem 0.9rem 0.9rem;
}
.area-panel-subheading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mech-muted);
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
}
.area-tile-status-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  padding: 0.15rem 0;
}
.area-tile-status-label {
  flex: 1 1 auto;
  color: var(--mech-muted-dark);
}
.area-tile-status-pct {
  font-weight: 600;
  color: var(--mech-navy);
}
.area-tile-lines {
  font-size: 0.75rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--mech-border);
}
.area-tile-line-row {
  display: flex;
  justify-content: space-between;
  padding: 0.1rem 0;
  color: var(--mech-muted-dark);
}

/* "Genel İlerleme" / Overall Progress sub-card at the top of the
   dashboard's Installation Progress card, above the per-area tile grid.
   Its width tracks the number
   of area tiles below it (--overall-progress-tiles, set inline from
   area_count in the route) using the exact same width/gap math as
   .area-tiles-grid's fixed-width .area-tile children, so with N areas it
   spans exactly N tiles wide instead of the full card. */
.overall-progress-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--mech-soft-border);
  border-radius: var(--mech-radius-sm);
  background: var(--mech-soft-bg);
  width: calc(var(--overall-progress-tiles, 1) * 148px + (var(--overall-progress-tiles, 1) - 1) * 0.75rem);
  min-width: 320px;
  max-width: 100%;
}

/* Page-level overall-completion header - the dashboard's .overall-progress-panel
   above, and the equipment-progress page above its "Progress by domain" tiles. */
.eq-overall-progress-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mech-muted);
}
.eq-overall-progress-pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mech-navy);
  line-height: 1.25;
}
.eq-overall-progress-count {
  font-size: 0.78rem;
  color: var(--mech-muted-dark);
}
.eq-overall-status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}
.eq-overall-status-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  white-space: nowrap;
}
.eq-overall-status-chip-muted {
  background: var(--mech-badge-gray-bg);
  color: var(--mech-badge-gray-fg);
}

/* "Progress by domain" tiles on the equipment-progress page (main, not
   admin) - each tile carries its own accent via --eq-domain-color /
   --eq-domain-soft (see app/reports/progress.py::DOMAIN_ACCENT_PALETTE) so
   the ring border, selected-state background and percent chips all share
   one color per domain. */
.eq-domain-tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}
@media (max-width: 900px) {
  .eq-domain-tiles-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}
.eq-domain-tile {
  border-radius: var(--mech-radius-sm);
}
.eq-domain-tile-trigger {
  width: 100%;
  border: 1.5px solid var(--mech-border);
  background: #fff;
  border-radius: var(--mech-radius-sm);
  cursor: pointer;
  text-align: left;
  padding: 0.85rem;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.eq-domain-tile-trigger:hover,
.eq-domain-tile-trigger:focus-visible {
  border-color: var(--eq-domain-color, var(--mech-blue));
  outline: none;
}
.eq-domain-tile-selected .eq-domain-tile-trigger {
  border-color: var(--eq-domain-color, var(--mech-blue));
  background: var(--eq-domain-soft, var(--mech-soft-bg));
  box-shadow: 0 4px 14px rgba(20, 80, 76, 0.09);
}
.eq-domain-tile-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.eq-domain-tile-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.eq-domain-tile-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mech-navy);
  line-height: 1.3;
}
.eq-domain-tile-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--mech-muted);
  margin-top: 0.15rem;
}
.eq-domain-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.75rem;
}
.eq-domain-chip {
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--mech-muted-dark);
  border: 1px solid var(--mech-border);
  border-radius: 7px;
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Domain detail panel: inline (not floating like .area-detail-panel), shown
   below the tile grid for whichever domain is currently selected. */
.eq-domain-detail-panel {
  border-top: 1px solid var(--mech-border);
  padding-top: 1rem;
}
.eq-domain-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.eq-domain-detail-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mech-navy);
}
.eq-domain-detail-sub {
  font-size: 0.75rem;
  color: var(--mech-muted);
  margin-top: 0.15rem;
}
.eq-domain-detail-pct {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  white-space: nowrap;
}
.eq-domain-detail-subheading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mech-muted);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* Per-domain status-count boxes in the detail panel (mirrors the design's
   "eqStages" grid, but driven by real InstallationStatus rows/icons instead
   of a fixed 4-stage sequence). */
.eq-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}
.eq-status-box {
  border: 1px solid var(--mech-border);
  border-radius: var(--mech-radius-sm);
  padding: 0.75rem;
  background: #F8FBFB;
}
/* Completed status box: a soft-green tint + left accent stripe so it reads
   as the "good" state at a glance among the neutral in-progress ones -
   same green as STATUS_COLORS["completed"] / the completion rings. */
.eq-status-box-highlight {
  background: #DFF3DF;
  border-color: rgba(12, 163, 12, 0.35);
  box-shadow: inset 3px 0 0 #0ca30c;
}
.eq-status-box-highlight .eq-status-count {
  color: #006300;
}
.eq-status-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.eq-status-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.eq-status-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--mech-muted-dark);
  letter-spacing: 0.01em;
}
.eq-status-count {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.5rem;
}
.eq-status-bar-track {
  height: 5px;
  border-radius: 3px;
  background: #E7F1F0;
  overflow: hidden;
  margin-top: 0.4rem;
}
.eq-status-bar-fill {
  height: 100%;
  border-radius: 3px;
}

/* Expandable per-line list (mirrors the design's eqLines cards): click a
   line's header to reveal its individual equipment rows. Uses a delegated
   click listener (see static/js/equipment_domain_panel.js) rather than
   per-line ids, since this markup is re-cloned from a <template> on every
   domain switch. */
.eq-line-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.eq-line {
  border: 1px solid var(--mech-border);
  border-radius: var(--mech-radius-sm);
  background: #fff;
}
.eq-line-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  border-radius: var(--mech-radius-sm);
}
.eq-line-head:hover {
  background: #F7FBFA;
}
.eq-line-main {
  flex: 1 1 auto;
  min-width: 0;
}
.eq-line-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.eq-line-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--mech-navy);
}
.eq-line-meta {
  font-size: 0.68rem;
  color: var(--mech-muted);
  font-weight: 600;
  white-space: nowrap;
}
.eq-line-bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.45rem;
}
.eq-line-bar-track {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 4px;
  background: #E7F1F0;
  overflow: hidden;
}
.eq-line-bar-fill {
  height: 100%;
  border-radius: 4px;
}
.eq-line-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--mech-muted-dark);
  width: 2.4rem;
  text-align: right;
  flex: 0 0 auto;
}
.eq-line-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 7px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.eq-line-chevron {
  font-size: 1.1rem;
  color: var(--mech-muted);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}
.eq-line-open .eq-line-chevron {
  transform: rotate(180deg);
}
.eq-line-items {
  display: none;
  flex-direction: column;
  padding: 0 0.9rem 0.8rem 0.9rem;
  border-top: 1px dashed var(--mech-border);
  margin: 0 0.8rem;
}
.eq-line-open .eq-line-items {
  display: flex;
}
.eq-line-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--mech-border);
}
.eq-line-item-row:last-child {
  border-bottom: none;
}
.eq-line-item-name {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--mech-navy);
}
.eq-line-item-meta {
  font-size: 0.68rem;
  color: var(--mech-muted);
  margin-top: 0.1rem;
}
.eq-line-item-pill {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 7px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.eq-line-item-pill-muted {
  background: var(--mech-badge-gray-bg);
  color: var(--mech-badge-gray-fg);
}
.eq-line-item-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
/* "Aktif Satınalma" - an open procurement item linked to this equipment
   (specs/003-Satinalma.md section 12), independent of whether it's also a
   blocker. Turns the same red as a blocker tag once one of its linked
   items actually has an active blocker (see .eq-line-item-pill-blocked). */
.eq-line-item-pill-procurement {
  background: #E3EDFA;
  color: #2A4F82;
}
.eq-line-item-pill-blocked {
  background: #FCEEF3;
  color: #8A2A50;
}

.equipment-records-page,
.equipment-records-page h1 {
  font-family: "Segoe UI", Calibri, Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

/* Cards */
.card {
  background-color: #FFFFFF;
  border: 1px solid var(--mech-border);
  border-radius: var(--mech-radius);
  box-shadow: 0 1px 3px rgba(18, 35, 61, 0.06);
}

/* Buttons */
.btn {
  border-radius: var(--mech-radius-sm);
  font-weight: 600;
}
.btn-primary {
  --bs-btn-bg: var(--mech-blue);
  --bs-btn-border-color: var(--mech-blue);
  --bs-btn-hover-bg: var(--mech-blue-deep);
  --bs-btn-hover-border-color: var(--mech-blue-deep);
  --bs-btn-active-bg: var(--mech-blue-deep);
  --bs-btn-active-border-color: var(--mech-blue-deep);
  --bs-btn-focus-shadow-rgb: 31, 110, 99;
}
.btn-outline-primary {
  --bs-btn-color: var(--mech-blue);
  --bs-btn-border-color: var(--mech-blue);
  --bs-btn-hover-bg: var(--mech-blue);
  --bs-btn-hover-border-color: var(--mech-blue);
  --bs-btn-active-bg: var(--mech-blue);
  --bs-btn-active-border-color: var(--mech-blue);
}
.btn-pdf {
  --bs-btn-bg: #A0E86E;
  --bs-btn-border-color: #A0E86E;
  --bs-btn-color: var(--mech-navy);
  --bs-btn-hover-bg: #8FD65C;
  --bs-btn-hover-border-color: #8FD65C;
  --bs-btn-hover-color: var(--mech-navy);
  --bs-btn-active-bg: #7FC94C;
  --bs-btn-active-border-color: #7FC94C;
  --bs-btn-active-color: var(--mech-navy);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Badges / status pills */
.badge {
  border-radius: 9px;
  font-weight: 700;
  font-size: .75em;
  padding: .45em .7em;
}
.text-bg-secondary {
  background-color: var(--mech-badge-gray-bg) !important;
  color: var(--mech-badge-gray-fg) !important;
}
.text-bg-success {
  background-color: var(--mech-badge-blue-bg) !important;
  color: var(--mech-badge-blue-fg) !important;
}
.text-bg-danger {
  background-color: var(--mech-badge-amber-bg) !important;
  color: var(--mech-badge-amber-fg) !important;
}

/* Tables */
.table {
  --bs-table-border-color: var(--mech-border);
}
.table thead th {
  color: var(--mech-muted);
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom-width: 1px;
}

/* Forms */
.form-control,
.form-select {
  border-radius: var(--mech-radius-sm);
  border-color: var(--mech-border);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--mech-blue);
  box-shadow: 0 0 0 .2rem rgba(31, 110, 99, .15);
}

/* ---------- App shell: sidebar + main ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--mech-sidebar-w);
  flex-shrink: 0;
  background: var(--mech-sidebar-bg);
  color: var(--mech-sidebar-text);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width .2s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 8px;
  min-width: 0;
}
.sidebar-logo-img {
  display: block;
  height: 42px;
  width: auto;
}

.sidebar-icon-btn {
  background: var(--mech-sidebar-soft-bg);
  border: 1px solid var(--mech-sidebar-soft-border);
  color: var(--mech-sidebar-text);
  border-radius: 9px;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.sidebar-icon-btn:hover {
  background: var(--mech-sidebar-hover-bg);
  color: var(--mech-sidebar-text-strong);
}

/* the in-sidebar close button is mobile-only; the collapse toggle is desktop-only */
.sidebar-mobile-close {
  display: none;
}

.sidebar-user {
  background: var(--mech-sidebar-soft-bg);
  border: 1px solid var(--mech-sidebar-soft-border);
  border-radius: 14px;
  padding: 11px 13px;
  margin-bottom: 4px;
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--mech-mint);
  color: var(--mech-mint-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-circle.avatar-circle-round {
  border-radius: 50%;
  border: 1px solid #A7D3CE;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mech-sidebar-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 500;
  font-size: .92rem;
  margin-bottom: 4px;
}
.sidebar-nav .nav-link:hover {
  background: var(--mech-sidebar-hover-bg);
  color: var(--mech-sidebar-text-strong);
}
.sidebar-nav .nav-link.active {
  background: var(--mech-sidebar-active-bg);
  color: var(--mech-sidebar-text-strong);
  font-weight: 700;
}
.sidebar-nav .dropdown-menu {
  --bs-dropdown-min-width: 12rem;
}

/* Expandable "Reports" group with nested Daily/Weekly items */
.sidebar-nav .nav-group-toggle .sidebar-caret {
  font-size: 18px;
  color: var(--mech-sidebar-text-muted);
  transition: transform .15s ease;
}
.sidebar-nav .nav-group-toggle[aria-expanded="false"] .sidebar-caret {
  transform: rotate(-90deg);
}
.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 0 4px 14px;
  margin: 0 0 4px 14px;
  border-left: 1px solid var(--mech-sidebar-border);
}
.sidebar-subnav.is-collapsed {
  display: none;
}
.sidebar-subnav .nav-link {
  font-size: .85rem;
  padding: 8px 10px;
}
.sidebar-subnav .material-symbols-rounded {
  font-size: 19px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--mech-sidebar-border);
}
.sidebar-footer .btn-outline-light {
  --bs-btn-color: var(--mech-sidebar-text);
  --bs-btn-border-color: var(--mech-sidebar-soft-border);
  --bs-btn-hover-color: var(--mech-sidebar-text-strong);
  --bs-btn-hover-bg: var(--mech-sidebar-hover-bg);
  --bs-btn-hover-border-color: rgba(255, 255, 255, .3);
  --bs-btn-active-color: var(--mech-sidebar-text-strong);
  --bs-btn-active-bg: var(--mech-sidebar-active-bg);
  --bs-btn-active-border-color: rgba(255, 255, 255, .3);
  border-radius: var(--mech-radius-sm);
}

.lang-switch .btn {
  --bs-btn-padding-y: .2rem;
  --bs-btn-padding-x: .55rem;
  font-size: .72rem;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: .9rem;
}

.app-topbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 14px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--mech-border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-topbar-site-switch,
.app-topbar-site-fixed {
  display: flex;
  align-items: center;
}
.app-topbar-site-btn,
.app-topbar-site-fixed {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mech-soft-bg);
  border: 1px solid var(--mech-soft-border);
  border-radius: 24px;
  padding: 8px 14px;
  color: var(--mech-navy);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.app-topbar-site-btn:hover {
  background: #EDF6F5;
  border-color: #D3E7E4;
}
.app-topbar-site-btn .material-symbols-rounded,
.app-topbar-site-fixed .material-symbols-rounded {
  font-size: 19px;
  color: var(--mech-blue);
}
.app-topbar-site-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-topbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mech-muted-dark);
  position: relative;
  border: 1px solid var(--mech-soft-border);
  background: var(--mech-soft-bg);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.app-topbar-icon-btn .material-symbols-rounded {
  font-size: 21px;
}
.app-topbar-icon-btn:hover {
  background: var(--mech-badge-blue-bg);
  border-color: #CFE8E4;
  color: var(--mech-navy);
}
.app-topbar-icon-btn .notification-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mech-blue);
  border: 2px solid #FFFFFF;
}
.notification-menu {
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.35rem 0;
}
.notification-menu .dropdown-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mech-muted);
}
.notification-menu-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  white-space: normal;
  padding: 0.55rem 1rem;
}
.notification-menu-item-unread {
  background: var(--mech-badge-blue-bg);
}
.notification-menu-item-message {
  font-size: 0.82rem;
  color: var(--mech-navy);
  line-height: 1.35;
}
.notification-menu-item-time {
  font-size: 0.7rem;
  color: var(--mech-muted);
}
.notification-menu-empty {
  font-size: 0.82rem;
  color: var(--mech-muted);
  padding: 0.55rem 1rem;
}
.app-topbar-divider {
  width: 1px;
  height: 26px;
  background: var(--mech-border);
}

.app-content {
  position: relative;
  flex: 1;
  padding: 28px 32px 48px;
  background: var(--mech-bg);
}
.app-content .h1, .app-content h1 { font-size: 1.75rem; }
.app-content .h2, .app-content h2 { font-size: 1.5rem; }
.app-content .h3, .app-content h3 { font-size: 1.3rem; }
.app-content .h4, .app-content h4 { font-size: 1.15rem; }
.app-content .h5, .app-content h5 { font-size: 1rem; }
.app-content .h6, .app-content h6 { font-size: .9rem; }

/* ---------- Mobile top bar (hamburger + brand) ---------- */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1040;
  min-height: var(--mech-topbar-h);
  padding: 0 12px;
  background: var(--mech-sidebar-bg);
  border-bottom: 1px solid var(--mech-sidebar-border);
}
.mobile-topbar .sidebar-brand {
  padding: 4px 0;
}
.mobile-topbar .sidebar-logo-img {
  height: 42px;
}

/* ---------- Backdrop for the mobile off-canvas drawer ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 17, 31, .55);
  z-index: 1045;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

/* ---------- Desktop: collapsible icon rail (>=992px) ---------- */
@media (min-width: 992px) {
  html.sidebar-collapsed .app-sidebar {
    width: var(--mech-sidebar-collapsed-w);
  }
  html.sidebar-collapsed .sidebar-label,
  html.sidebar-collapsed .sidebar-user-info {
    display: none;
  }
  /* .lang-switch also carries Bootstrap's .d-flex utility, which sets
     display:flex !important — an unqualified rule here would lose to it
     and the TR/EN buttons would keep their flex width, overflowing (and
     getting clipped by .app-sidebar's overflow-x:hidden) instead of
     actually hiding. */
  html.sidebar-collapsed .lang-switch {
    display: none !important;
  }
  html.sidebar-collapsed .sidebar-header {
    justify-content: center;
  }
  html.sidebar-collapsed .sidebar-header .sidebar-brand {
    display: none;
  }
  html.sidebar-collapsed .sidebar-user {
    justify-content: center;
    padding: 10px;
  }
  html.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 10px;
  }
  html.sidebar-collapsed .sidebar-nav .dropdown-toggle::after {
    display: none;
  }
  html.sidebar-collapsed .sidebar-nav .sidebar-caret,
  html.sidebar-collapsed .sidebar-subnav {
    display: none;
  }
}

/* ---------- Mobile / tablet: off-canvas drawer (<992px) ---------- */
@media (max-width: 991.98px) {
  .app-shell {
    flex-direction: column;
  }
  .mobile-topbar {
    display: flex;
  }
  .sidebar-backdrop {
    display: block;
  }
  .app-shell.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(var(--mech-sidebar-w), 84vw);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1050;
    box-shadow: 0 0 32px rgba(0, 0, 0, .25);
  }
  .app-shell.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-header .sidebar-brand {
    display: flex;
  }
  .sidebar-collapse-toggle {
    display: none;
  }
  .sidebar-mobile-close {
    display: inline-flex;
  }

  .app-content {
    padding: 20px 16px 40px;
  }
  .app-topbar {
    padding: 10px 16px;
  }
  .app-topbar-site-label {
    display: none;
  }
}

body.sidebar-no-scroll {
  overflow: hidden;
}

/* ---------- Auth / login page ---------- */
.auth-panel-left {
  position: relative;
  /* z-index (with position: relative) forces this element to establish
     its own stacking context. Without it, the negative z-index ::before
     below doesn't nest inside this element's local paint order — it gets
     hoisted out to the nearest ancestor stacking context and can paint
     behind this element's own background instead of on top of it. */
  z-index: 0;
  /* Solid blue gradient — this is the panel's own background, fully
     opaque, painted first (see ::before below for the photo layer). */
  background: linear-gradient(160deg, #0E1F45 0%, #1D52A8 130%);
  color: #FFFFFF;
  padding: 44px 48px;
  overflow: hidden;
}

/* Photo on its own layer, painted above the gradient and below the
   in-flow content (z-index: -1, inside the stacking context the parent
   now establishes via its own z-index: 0 — see .auth-panel-left above).
   mix-blend-mode: luminosity blends this layer against the gradient
   sitting beneath it, taking hue/saturation from the gradient (blue)
   and only light/dark shape from the photo, so the photo's own colors
   never show — just a blue duotone silhouette. opacity then dials how
   strongly that silhouette shows through vs. the plain gradient. */
.auth-panel-left::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("../img/login-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: luminosity;
  opacity: .3;
}

.auth-brand {
  display: flex;
  align-items: center;
}
.auth-logo-img {
  display: block;
  height: 42px;
  width: auto;
}

.auth-eyebrow {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: #8FB0D8;
  margin-bottom: 14px;
  text-shadow: 0 2px 10px rgba(2, 6, 20, .65);
}

.auth-headline {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.12;
  color: #FFFFFF;
  max-width: 420px;
  text-shadow: 0 2px 12px rgba(2, 6, 20, .55);
}

.auth-subtext {
  font-size: .95rem;
  line-height: 1.6;
  color: #B9CCE4;
  margin-top: 16px;
  max-width: 420px;
  font-weight: 500;
  text-shadow: 0 2px 10px rgba(2, 6, 20, .6);
}

.auth-footnote {
  font-size: .78rem;
  font-weight: 600;
  color: #7C9AC1;
  text-shadow: 0 2px 10px rgba(2, 6, 20, .65);
}

.auth-panel-right {
  padding: 40px 24px;
}

.auth-form-wrap {
  width: 100%;
  max-width: 380px;
}

.auth-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--mech-radius-sm);
  background: #E1EAFA;
  color: #1D3E7C;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 1.3rem;
}

/* Scoped to the login form so the rest of the app keeps its teal
   btn-primary — only the login button picks up the panel's blue. */
.auth-form-wrap .btn-primary {
  --bs-btn-bg: #1D52A8;
  --bs-btn-border-color: #1D52A8;
  --bs-btn-hover-bg: #163E82;
  --bs-btn-hover-border-color: #163E82;
  --bs-btn-active-bg: #163E82;
  --bs-btn-active-border-color: #163E82;
  --bs-btn-focus-shadow-rgb: 29, 82, 168;
}

.auth-field {
  position: relative;
}
.auth-field .form-control {
  padding-right: 40px;
}
.auth-field-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #A2AAB6;
  pointer-events: none;
}
/* Show/hide password button (see static/js/password_toggle.js) */
.auth-field-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #A2AAB6;
  cursor: pointer;
}
.auth-field-toggle:hover,
.auth-field-toggle:focus-visible {
  color: #12233D;
}

/* Click-to-enlarge photo viewer (see static/js/photo_lightbox.js) */
[data-lightbox] {
  cursor: zoom-in;
}
.photo-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 2rem;
}
.photo-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Page navigation / button loading feedback (see static/js/page_loading.js) */
.page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3000;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease-out;
}
.page-loading-bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -35%;
  width: 35%;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, var(--mech-blue), var(--mech-mint));
}
.page-loading-bar.is-active {
  opacity: 1;
}
.page-loading-bar.is-active::before {
  animation: mech-page-loading-slide 1.1s cubic-bezier(.4, 0, .2, 1) infinite;
}
@keyframes mech-page-loading-slide {
  0% { left: -35%; width: 35%; }
  60% { left: 100%; width: 60%; }
  100% { left: 100%; width: 60%; }
}

.btn-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: .75;
  animation: mech-btn-spin .6s linear infinite;
}
@keyframes mech-btn-spin {
  to { transform: rotate(360deg); }
}
.btn.is-loading {
  cursor: progress;
}
html.is-page-loading,
html.is-page-loading a,
html.is-page-loading button {
  cursor: progress;
}

/* htmx-boosted in-app navigation (see base.html): the sidebar/topbar swap
   only #appContent via AJAX, so the shell never reloads. #contentSkeleton
   is a hidden-by-default htmx indicator - htmx toggles the .htmx-request
   class on it for the duration of the request. */
.htmx-indicator {
  opacity: 0;
}
.content-skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--mech-bg);
  pointer-events: none;
  transition: opacity 160ms ease-in;
}
.content-skeleton.htmx-request {
  opacity: 1;
}
#contentSkeleton.htmx-request ~ * {
  opacity: .35;
  filter: saturate(60%);
  pointer-events: none;
  transition: opacity 160ms ease;
}
.skeleton-block {
  border-radius: 10px;
  background: linear-gradient(90deg, #E4EAEC 25%, #EEF2F3 37%, #E4EAEC 63%);
  background-size: 400% 100%;
  animation: mech-skeleton-shimmer 1.4s ease infinite;
}
.skeleton-title { height: 28px; width: 40%; }
.skeleton-line { height: 16px; width: 65%; }
.skeleton-card { height: 110px; width: 100%; }
@keyframes mech-skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
/* Procurement: request/item wizard step indicator (steps 5-6) */
.procurement-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  max-width: 460px;
}
.procurement-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.procurement-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .95rem;
  background: var(--mech-bg);
  border: 2px solid var(--mech-border);
  color: var(--mech-muted);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.procurement-step-circle .material-symbols-rounded {
  font-size: 20px;
}
.procurement-step.is-active .procurement-step-circle {
  background: var(--mech-blue);
  border-color: var(--mech-blue);
  color: #fff;
}
.procurement-step.is-complete .procurement-step-circle {
  background: var(--mech-mint);
  border-color: var(--mech-mint);
  color: var(--mech-mint-fg);
}
.procurement-step-label {
  font-size: .8rem;
  color: var(--mech-muted);
  text-align: center;
  max-width: 110px;
}
.procurement-step.is-active .procurement-step-label {
  color: var(--mech-navy);
  font-weight: 600;
}
.procurement-step-connector {
  flex: 1 1 auto;
  height: 2px;
  background: var(--mech-border);
  margin: 17px 8px 0;
  min-width: 32px;
}
.procurement-step-connector.is-complete {
  background: var(--mech-mint);
}

/* Procurement: Line(s)/Equipment(s) checklist + selection preview (step 7/11) */
.procurement-checklist {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--mech-border);
  border-radius: var(--mech-radius-sm);
  padding: 10px 12px;
  background: #fff;
}
.procurement-checklist .form-check {
  padding-left: 1.6em;
}
.procurement-checklist .form-check + .form-check {
  margin-top: 2px;
}
.procurement-selection-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.procurement-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  padding: .35em .6em;
}
.procurement-chip .btn-close {
  width: .55em;
  height: .55em;
  font-size: .65em;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-block {
    animation: none;
  }
}
