/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  --bg:             #0b0d10;
  --surface:        #13161b;
  --surface-2:      #181c22;
  --border:         #1f242b;
  --border-strong:  #2a3037;
  --text:           #e6e8eb;
  --muted:          #8a919a;
  --dim:            #5b636d;
  --brand:          #e5484d;
  --ok:             #22c55e;
  --warn:           #f59e0b;
  --crit:           #ef4444;
  --radius:         8px;
  --radius-lg:      12px;
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
a      { font: inherit; color: inherit; text-decoration: none; }
ul     { list-style: none; }

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px calc(80px + var(--safe-bottom));
}

/* ============================================================
   Topbar  (inventory page only — <header class="topbar">)
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  height: 52px;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}

.topbar-nav {
  display: none;
  gap: 4px;
  margin-left: 20px;
}

.topbar-link {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.topbar-link:hover       { color: var(--text); background: var(--surface-2); }
.topbar-link.active      { color: var(--text); background: var(--surface-2); }

.topbar-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* ============================================================
   Request Banner
   ============================================================ */
.request-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: rgba(229, 72, 77, 0.08);
  border-bottom: 1px solid rgba(229, 72, 77, 0.25);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.request-banner:active { background: rgba(229, 72, 77, 0.14); }
.request-banner svg { color: var(--brand); flex-shrink: 0; }
.request-banner-arrow { margin-left: auto; color: var(--brand); font-weight: 700; }

/* ============================================================
   Page Hero
   ============================================================ */
.page-hero {
  padding: 20px 0 14px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 5px;
}

.page-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.count-badge--warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.count-badge--ok {
  background: rgba(34, 197, 94, 0.10);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ============================================================
   Stats Rail
   ============================================================ */
.stats-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: 22px;
}
.stats-rail::-webkit-scrollbar { display: none; }

.stat-tile {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-tile--link {
  cursor: pointer;
  border-style: dashed;
  border-color: var(--border-strong);
}
.stat-tile--link:active { background: var(--surface-2); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
}
.stat-value {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat-value--link {
  font-size: 15px;
  color: var(--muted);
}

/* ============================================================
   Section Headers
   ============================================================ */
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* ============================================================
   Item Cards  (low-inventory list on main page)
   ============================================================ */
.attention-section {
  margin-bottom: 24px;
}

.item-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}
.item-card--warn { border-left-color: var(--warn); }
.item-card--crit { border-left-color: var(--crit); }

.item-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.item-card-name {
  font-weight: 600;
  font-size: 15px;
}
.item-card-location {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.item-card-qty {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.item-card-current {
  font-size: 14px;
  font-weight: 500;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}
.item-card--crit .item-card-current { color: var(--crit); }
.item-card-par {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Action Bar
   ============================================================ */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.action-bar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:active { opacity: 0.85; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover { background: #d43b40; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-full { width: 100%; }

.btn-small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn-danger {
  background: var(--crit);
  color: #fff;
  border-color: var(--crit);
}
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--brand); color: var(--brand); background: rgba(229, 72, 77, 0.06); }
.btn-icon svg { display: block; }

/* ============================================================
   Activity Section
   ============================================================ */
.activity-section {
  margin-top: 4px;
}

.activity-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.activity-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.activity-item:last-child { border-bottom: none; }
.activity-item.clickable { cursor: pointer; transition: background 0.1s; }
.activity-item.clickable:active { background: var(--surface-2); }

.activity-note {
  color: var(--muted);
  font-style: italic;
}

.empty-state-inline {
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ============================================================
   Modals
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  z-index: 200;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal.active {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 22px;
  font-weight: 400;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.close:hover { color: var(--text); background: var(--surface-2); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-body form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ============================================================
   Forms  (shared with maintenance)
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.12);
}
.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  gap: 12px;
}
.form-actions-buttons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ============================================================
   Chemical list  (inside modals — shared)
   ============================================================ */
.chemical-list {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.chemical-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.chemical-item:last-child { margin-bottom: 0; }

.chemical-separator {
  height: 1px;
  background: var(--border-strong);
  margin: 12px 0;
}

.chemical-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.chemical-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.chemical-name-row .chemical-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  padding: 0;
  border: none;
  flex: 0 0 auto;
  max-width: calc(13ch + 10px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chemical-name-row .requested-qty {
  font-size: 13px;
  color: var(--brand);
  font-weight: 500;
  margin-left: 10px;
}

.chemical-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.chemical-inputs.single-input { grid-template-columns: 1fr; }
.chemical-inputs .form-group { margin-bottom: 0; }
.chemical-inputs .no-tracking {
  color: var(--dim);
  font-style: italic;
  font-size: 13px;
}

/* Shelf/Line tabs inside update modal */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 3px;
}
.tab-button {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-button:hover { color: var(--text); }
.tab-button.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* ============================================================
   Inventory Breakdown Table  (inside modal)
   ============================================================ */
.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.inventory-table th,
.inventory-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.inventory-table th {
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.inventory-table td { color: var(--text); }
.inventory-table tr:hover td { background: var(--surface-2); }
.inventory-table td strong { color: var(--brand); }
.inventory-table .separator-row { background: transparent; }
.inventory-table .separator-row:hover td { background: transparent; }
.inventory-table .table-separator { height: 1px; background: var(--border); margin: 4px 0; }
.inventory-updated {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ============================================================
   Low inventory section  (inside breakdown modal)
   ============================================================ */
.low-inventory-section {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}
.low-inventory-heading {
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}
.low-inventory-list { list-style: none; }
.low-inventory-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg);
  border-left: 3px solid var(--warn);
  border-radius: 4px;
}
.low-inventory-item:last-child { margin-bottom: 0; }
.low-item-name   { font-weight: 600; font-size: 14px; color: var(--text); }
.low-item-details { font-size: 12px; color: var(--muted); }

/* ============================================================
   Request note  (inside fulfill modal)
   ============================================================ */
.request-note-display {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(229, 72, 77, 0.06);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
}
.request-note-icon { flex-shrink: 0; color: var(--brand); margin-top: 2px; }
.request-note-content { flex: 1; }
.request-note-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.request-note-text { font-size: 14px; color: var(--text); line-height: 1.5; }

/* ============================================================
   Log Detail  (inside modal)
   ============================================================ */
.log-detail { padding: 8px 0; }
.log-detail p { margin: 10px 0; font-size: 14px; line-height: 1.8; }
.log-detail strong { color: var(--brand); margin-right: 8px; }

.request-batch-details {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.request-batch-details h4 { color: var(--brand); margin-bottom: 12px; font-size: 16px; }
.request-batch-details h5 { color: var(--text); margin-top: 14px; margin-bottom: 8px; font-size: 14px; }
.request-batch-details ul { list-style: none; }
.request-batch-details li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ============================================================
   Bottom Nav  (mobile only — inventory page)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: rgba(11, 13, 16, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  color: var(--dim);
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  transition: color 0.15s;
}
.bottom-nav-item:active { background: var(--surface-2); }
.bottom-nav-item.active { color: var(--text); }
.bottom-nav-item svg { width: 22px; height: 22px; }

/* ============================================================
   Legacy header  (maintenance.ejs uses plain <header>)
   ============================================================ */
header:not(.topbar) {
  margin-bottom: 24px;
  padding: 20px 0;
  border-bottom: 2px solid var(--brand);
  text-align: center;
  position: relative;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
  position: relative;
}
header:not(.topbar) h1 {
  font-size: 28px;
  color: var(--text);
  margin: 0;
}
header:not(.topbar) h2 {
  font-size: 18px;
  color: var(--brand);
  font-weight: normal;
}
.main-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.nav-tab {
  padding: 8px 20px;
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-tab:hover  { background: var(--surface-2); }
.nav-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ============================================================
   Maintenance  (phase 2 will restyle — keeping functional)
   ============================================================ */
.maintenance-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 3px;
}
.maintenance-tab {
  flex: 1;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.maintenance-tab:hover { color: var(--text); }
.maintenance-tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.maintenance-content { display: none; }
.maintenance-content.active { display: block; }

.maintenance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.maintenance-header h3 { font-size: 20px; color: var(--text); margin: 0; }

.maintenance-list { display: flex; flex-direction: column; gap: 12px; }

.maintenance-item {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  transition: border-color 0.15s;
}
.maintenance-item:hover               { border-color: var(--muted); }
.maintenance-item.completed           { opacity: 0.5; }
.maintenance-item.urgent              { border-color: var(--crit); background: rgba(239, 68, 68, 0.04); }
.maintenance-item.clickable           { cursor: pointer; }
.maintenance-item.clickable:hover     { border-color: var(--brand); background: var(--surface-2); }
.maintenance-item.clickable:active    { opacity: 0.85; }

.maintenance-item-content       { flex: 1; }
.maintenance-item-description   { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.maintenance-item-note          { font-size: 13px; color: var(--muted); margin-top: 6px; font-style: italic; }
.maintenance-item-meta          { font-size: 13px; color: var(--dim); margin-top: 6px; }
.maintenance-item-actions       { display: flex; gap: 8px; flex-shrink: 0; }

.urgent-badge {
  display: inline-block;
  background: var(--crit);
  color: #fff;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
  text-transform: uppercase;
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.detail-group { margin-bottom: 16px; }
.detail-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}
.detail-value {
  font-size: 15px;
  color: var(--text);
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-height: 40px;
}

@media (max-width: 768px) {
  .maintenance-tabs { flex-wrap: wrap; }
  .maintenance-tab  { flex: 1; min-width: 80px; }
  .maintenance-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .maintenance-item { flex-direction: column; }
  .maintenance-item-actions { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   Desktop  (≥ 640px)
   ============================================================ */
@media (min-width: 640px) {
  .page-main { padding-bottom: 40px; }

  .topbar-nav { display: flex; }
  .bottom-nav { display: none; }

  .page-title { font-size: 28px; }

  .stats-rail { flex-wrap: wrap; overflow: visible; }
  .stat-tile  { min-width: 110px; }

  .action-bar { flex-direction: row; }
  .btn-full   { width: auto; flex: 1; }
  .action-bar-row { display: contents; }

  .modal.active    { align-items: center; }
  .modal-content   { border-radius: var(--radius-lg); max-width: 560px; max-height: 85vh; }

  .item-cards      { grid-template-columns: repeat(2, 1fr); display: grid; }

  .chemical-inputs { grid-template-columns: 1fr 1fr; gap: 12px; }
  .chemical-inputs.single-input { grid-template-columns: 1fr; }

  .page-main       { padding: 0 20px 40px; }
}

@media (min-width: 1024px) {
  .page-main { max-width: 900px; }
}
