/* ============================================================
   Page header
   ============================================================ */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--geist-space-4x);
  padding-bottom: var(--geist-space-4x);
  border-bottom: 1px solid var(--hairline);
}

/* When a tab bar follows the header, the tabs' own border is the single
   divider — the header's would stack a second line beneath it. */
.page-header:has(+ .content-tabs) {
  padding-bottom: 0;
  border-bottom: 0;
}

.page-header > div:not(.page-actions) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--geist-space-2x);
}

.page-title {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.96px;
}

/* The title and its info control share one line, so the screen keeps a single
   label. Only rendered when the page has an explanation to disclose. */
.page-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--geist-space-2x);
}

.page-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  gap: var(--geist-space-2x);
}

.eyebrow {
  display: block;
  margin-bottom: var(--geist-space-2x);
  color: var(--ink-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.text-muted {
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 18px;
}

/* ============================================================
   Info tooltip
   ============================================================ */

.info-tip {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.info-tip-trigger {
  position: relative;
  display: inline-flex;
  width: 24px;
  height: 24px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-subtle);
  cursor: pointer;
}

.info-tip-trigger:hover { color: var(--ink); }

.info-tip-trigger:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

.info-tip-icon {
  width: 16px;
  height: 16px;
}

/* Coarse pointers get the 44px target without widening the title line. */
@media (pointer: coarse) {
  .info-tip-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }

  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .production-run-form input,
  .production-run-form select,
  #press-run-form input,
  #press-run-form select {
    min-height: 44px;
    font-size: 16px;
  }

  .field input[type="checkbox"],
  .field input[type="radio"] {
    width: 24px;
    height: 24px;
  }
}

/* Floating layer: the panel is clipped by .visually-hidden while collapsed, so
   its copy stays available to a screen reader without being painted. */
.info-tip-panel {
  position: absolute;
  top: calc(100% + var(--geist-space));
  left: 0;
  z-index: var(--z-popover);
  width: max-content;
  max-width: min(280px, calc(100vw - var(--geist-space-8x)));
  padding: var(--geist-space-3x);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--ds-shadow-menu);
  animation: popover-in var(--ds-motion-popover-duration) var(--ds-motion-popover-timing);
}

.info-tip-text {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: var(--geist-space-2x);
  padding: 0 var(--geist-space-3x);
  border: 0;
  border-radius: var(--geist-radius);
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}

.btn:hover {
  background: var(--ds-gray-100);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
}

.btn:active {
  background: var(--ds-gray-200);
}

.btn:focus-visible,
.link-button:focus-visible {
  outline: none;
  box-shadow: var(--ds-shadow-border), var(--ds-focus-ring);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn[aria-busy="true"],
.btn.is-loading {
  opacity: 0.7;
  cursor: progress;
  pointer-events: none;
}

.btn[aria-busy="true"]::before,
.btn.is-loading::before {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  content: "";
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

.btn svg,
.btn .icon,
.btn-icon svg,
.btn-icon .nav-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--contrast);
  box-shadow: none;
  color: var(--on-contrast);
}

.btn-primary:hover {
  background: var(--contrast-hover);
  box-shadow: none;
  color: var(--on-contrast);
}

.btn-primary:active {
  background: var(--contrast-hover);
}

.btn-primary:focus-visible,
.btn-danger:focus-visible,
.btn-critical:focus-visible,
.btn-warning:focus-visible,
.btn-nominal:focus-visible,
.btn-ghost:focus-visible,
.link-button:focus-visible {
  box-shadow: var(--ds-focus-ring);
}

.btn-secondary,
.btn-outline {
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
}

.btn-secondary:hover,
.btn-outline:hover {
  background: var(--ds-gray-100);
  box-shadow: var(--ds-shadow-border);
}

.btn-ghost,
.link-button {
  background: transparent;
  box-shadow: none;
  color: var(--ink-muted);
}

.btn-ghost:hover,
.link-button:hover {
  background: var(--ds-gray-alpha-100);
  box-shadow: none;
  color: var(--ink);
}

.btn-danger,
.btn-critical {
  background: var(--ds-red-800);
  box-shadow: none;
  color: #ffffff;
}

.btn-danger:hover,
.btn-critical:hover {
  background: var(--ds-red-900);
  box-shadow: none;
  color: #ffffff;
}

.btn-nominal {
  background: var(--success);
  box-shadow: none;
  color: #ffffff;
}

.btn-warning {
  background: var(--ds-amber-800);
  box-shadow: none;
  color: var(--ds-black);
}

.btn-icon {
  width: 36px;
  min-width: 36px;
  padding: var(--geist-space-2x);
  background: transparent;
  box-shadow: none;
  color: var(--ink-muted);
}

.btn-icon:hover {
  background: var(--ds-gray-alpha-100);
  box-shadow: none;
  color: var(--ink);
}

.btn-sm {
  height: 32px;
  padding: 0 var(--geist-space-3x);
  gap: var(--geist-space);
  font-size: 14px;
  line-height: 20px;
}

.btn-xs {
  height: 32px;
  padding: 0 var(--geist-space-3x);
  gap: var(--geist-space);
  font-size: 14px;
  line-height: 20px;
}

.btn-lg {
  height: 40px;
  padding: 0 var(--geist-space-3x);
  font-size: 16px;
  line-height: 20px;
  border-radius: 8px;
}

.btn-icon.btn-sm { width: 32px; min-width: 32px; }
.btn-icon.btn-lg { width: 40px; min-width: 40px; }

.btn-block {
  display: flex;
  width: 100%;
}

form.button_to {
  display: inline-flex;
  margin: 0;
}

form.button_to .btn-block {
  width: 100%;
}

/* ============================================================
   Badges and status dots
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--geist-space-2x);
  min-height: 20px;
  padding: 2px var(--geist-space-3x);
  border: 0;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  white-space: nowrap;
}

.badge-neutral {
  background: var(--surface-muted);
  color: var(--ink-muted);
}

.badge-primary,
.badge.\61 ccent,
.badge-info {
  background: var(--info-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--info) 35%, transparent);
  color: var(--info);
}

.badge-nominal,
.badge-available,
.badge-success {
  background: var(--success-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning);
}

.badge-critical,
.badge-sold,
.badge-danger {
  background: var(--error-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--error) 35%, transparent);
  color: var(--error);
}

.badge-sm {
  min-height: 16px;
  padding: 1px 7px;
  font-size: 12px;
  line-height: 16px;
}

.badge-solid.badge-primary,
.badge-solid.badge-info { background: var(--ds-blue-700); box-shadow: none; color: #ffffff; }
.badge-solid.badge-nominal,
.badge-solid.badge-success { background: var(--ds-green-700); box-shadow: none; color: #ffffff; }
.badge-solid.badge-warning { background: var(--ds-amber-700); box-shadow: none; color: var(--ds-black); }
.badge-solid.badge-critical,
.badge-solid.badge-danger { background: var(--ds-red-700); box-shadow: none; color: #ffffff; }

.status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--ink-subtle);
}

.status-dot.is-ok,
.status-dot.signal-nominal { background: var(--success); }
.status-dot.is-warn,
.status-dot.signal-warning { background: var(--warning); }
.status-dot.is-error,
.status-dot.signal-critical { background: var(--error); }
.status-dot.is-running,
.status-dot.signal-info {
  background: var(--info);
  animation: pulse-dot 1.4s var(--ease) infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::before,
  .btn.is-loading::before,
  .autocomplete-results,
  .info-tip-panel,
  .status-dot.is-running,
  .status-dot.signal-info { animation: none; }
}

/* ============================================================
   Forms
   ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--geist-space-2x);
  margin-bottom: var(--geist-space-4x);
}

.field-error {
  color: var(--error);
  font-size: 13px;
  margin-top: var(--space-1);
}

.field input:not([type="checkbox"]):not([type="radio"])[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  box-shadow: 0 0 0 1px var(--ds-red-700);
}

[hidden] { display: none !important; }

.field label,
.form-label,
.field-static-label {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: var(--leading-snug);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.input,
.select,
.textarea,
.autocomplete-input,
.auth-form input,
.search-field input[type="text"],
.search-field input[type="search"] {
  width: 100%;
  max-width: 32rem;
  height: 36px;
  padding: 0 var(--geist-space-3x);
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 20px;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.field input::placeholder,
.field textarea::placeholder,
.input::placeholder,
.textarea::placeholder { color: var(--ds-gray-700); }

.field input:hover,
.field select:hover,
.field textarea:hover,
.input:hover,
.select:hover,
.textarea:hover,
.autocomplete-input:hover,
.auth-form input:hover { box-shadow: var(--ds-shadow-border); }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.autocomplete-input:focus-visible,
.auth-form input:focus-visible,
.filter-bar input:focus-visible,
.filter-bar select:focus-visible {
  outline: none;
  box-shadow: var(--ds-shadow-border), var(--ds-focus-ring);
}

.field textarea,
.textarea {
  min-height: 90px;
  height: auto;
  padding-block: 8px;
  resize: vertical;
}

.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
  max-width: none;
  align-self: flex-start;
}

.field_with_errors input,
.field_with_errors select,
.field_with_errors textarea {
  box-shadow: 0 0 0 1px var(--ds-red-700);
}

.field input:not([type="checkbox"]):not([type="radio"])[aria-invalid="true"]:focus,
.field input:not([type="checkbox"]):not([type="radio"])[aria-invalid="true"]:focus-visible,
.field select[aria-invalid="true"]:focus,
.field select[aria-invalid="true"]:focus-visible,
.field textarea[aria-invalid="true"]:focus,
.field textarea[aria-invalid="true"]:focus-visible,
.field_with_errors input:focus,
.field_with_errors input:focus-visible,
.field_with_errors select:focus,
.field_with_errors select:focus-visible,
.field_with_errors textarea:focus,
.field_with_errors textarea:focus-visible {
  box-shadow: 0 0 0 1px var(--ds-red-700), var(--ds-focus-ring);
}

.field_with_errors,
.field_with_errors + .field-error,
.field_with_errors + .help-text {
  color: var(--ds-red-900);
}

.compact-field { max-width: 220px; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--geist-space-3x);
  padding-top: var(--geist-space-4x);
}

.form-stack {
  display: grid;
  gap: var(--geist-space-4x);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--geist-space-4x);
}

/* Grid gap owns the spacing inside a form grid. */
.form-grid .field { margin-bottom: 0; }

/* Shared entry forms keep sections in reading order while fields adapt within
   each section. Semantic span roles prevent supporting content from landing in
   a partial grid column. */
.entry-form {
  display: grid;
  width: 100%;
  max-width: 900px;
  gap: var(--geist-space-6x);
}

.entry-form-section,
.entry-form-fields {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--geist-space-4x);
}

.entry-form-section { margin: 0; }

.entry-form-section > legend,
.entry-form-section > .detail-list,
.entry-form-span,
.entry-form-errors,
.entry-form-note,
.entry-form-actions {
  grid-column: 1 / -1;
}

.entry-form .field {
  min-width: 0;
  margin-bottom: 0;
}

.entry-form-note { margin: 0; }

@media (max-width: 640px) {
  .entry-form-section,
  .entry-form-fields { grid-template-columns: minmax(0, 1fr); }

  .entry-form-section > legend,
  .entry-form-section > .detail-list,
  .entry-form-span,
  .entry-form-errors,
  .entry-form-note,
  .entry-form-actions { grid-column: auto; }
}

/* Inline checkbox row: the box sits beside its label with a real hit area,
   instead of a tiny control stranded under a stacked label. */
.field-check {
  flex-direction: row;
  align-items: center;
  gap: var(--geist-space-3x);
  min-height: 36px;
}

.field-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  align-self: center;
}

.field-check label {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

fieldset { margin-bottom: var(--geist-space-6x); }

legend {
  width: 100%;
  padding-bottom: var(--geist-space-2x);
  margin-bottom: var(--geist-space-3x);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 600;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--geist-space-2x);
}

.filter-bar input,
.filter-bar select {
  height: 36px;
  padding: 0 var(--geist-space-3x);
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--geist-space-3x);
  padding: var(--geist-space-3x) var(--geist-space-4x);
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-muted);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
  font-size: var(--text-sm);
}

.alert-content { flex: 1; }
.alert-title { margin-bottom: var(--geist-space); font-weight: 600; }
.alert-description { color: var(--ink-muted); }

.alert-critical {
  background: var(--error-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--error) 45%, transparent);
  color: var(--ds-red-900);
}

.alert-warning {
  background: var(--warning-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 45%, transparent);
  color: var(--ds-amber-900);
}

.alert-nominal {
  background: var(--success-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 45%, transparent);
  color: var(--ds-green-900);
}

.alert-info {
  background: var(--info-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--info) 45%, transparent);
  color: var(--ds-blue-900);
}

.alert-critical .alert-content,
.alert-warning .alert-content,
.alert-nominal .alert-content,
.alert-info .alert-content { color: var(--ink); }

.inventory-readiness .alert-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inventory-results-summary {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

.inventory-attention-table td:first-child,
.inventory-attention-table td:last-child { font-weight: 600; }

.inventory-attention-table tr.is-selected td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.inventory-snapshot-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-block: 1px solid var(--hairline);
}

.inventory-snapshot-metric {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
  padding: var(--space-4);
  border-inline-start: 1px solid var(--hairline);
}

.inventory-snapshot-metric:first-child { border-inline-start: 0; }
.inventory-snapshot-label { grid-column: 1 / -1; color: var(--ink-muted); font-family: var(--font-mono); font-size: 12px; line-height: 16px; text-transform: uppercase; }
.inventory-snapshot-value { font-family: var(--font-mono); font-size: 24px; font-weight: 500; line-height: 32px; font-variant-numeric: tabular-nums; }
.inventory-snapshot-unit { align-self: end; padding-bottom: 4px; color: var(--ink-muted); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; }
.inventory-snapshot-context { grid-column: 1 / -1; color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.maintenance-attention-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.maintenance-attention-strip > a { color: inherit; text-decoration: none; }
.maintenance-attention-strip > a:hover .inventory-snapshot-label { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.inventory-coverage { margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--surface-muted); color: var(--ink-muted); }

.inventory-availability { display: grid; gap: var(--space-4); margin: 0; }
.inventory-availability-bar { display: flex; width: 100%; height: 24px; overflow: hidden; border-radius: var(--radius); background: var(--surface-muted); box-shadow: var(--ds-shadow-border); }
.inventory-availability-segment { width: var(--segment-width); min-width: 0; }
.inventory-availability-segment.is-available, .state-dot.is-available { background: var(--success); }
.inventory-availability-segment.is-allocated, .state-dot.is-allocated { background: var(--info); }
.inventory-availability-segment.is-pulled, .state-dot.is-pulled { background: var(--warning); }
.inventory-availability-values { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); margin: 0; }
.inventory-availability-values div { display: flex; align-items: center; gap: var(--space-2); }
.inventory-availability-values dt { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-muted); }
.inventory-availability-values dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.inventory-availability-values .state-dot { width: 8px; height: 8px; }
.inventory-activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.inventory-activity-section { min-width: 0; }

@media (max-width: 1000px) {
  .inventory-snapshot-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .maintenance-attention-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .maintenance-attention-strip .inventory-snapshot-metric:nth-child(3n + 1) { border-inline-start: 0; }
  .inventory-snapshot-metric, .inventory-snapshot-metric:first-child { border-block-start: 1px solid var(--hairline); }
  .inventory-activity-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .inventory-snapshot-strip { grid-template-columns: minmax(0, 1fr); }
  .maintenance-attention-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-snapshot-metric { border-inline-start: 0; }
  .maintenance-attention-strip .inventory-snapshot-metric:nth-child(even) { border-inline-start: 1px solid var(--hairline); }
  .inventory-availability-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); }
  .inventory-availability-values div { justify-content: space-between; }
}

.cockpit-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--geist-space-3x);
}

/* ============================================================
   Cards and panels
   ============================================================ */

.card,
.panel {
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
}

.card.is-raised,
.panel.is-raised {
  box-shadow: var(--ds-shadow-border-small);
}

.panel { padding: var(--geist-space-4x); }

.panel-heading,
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--geist-space-3x);
  padding: var(--geist-space-3x) var(--geist-space-4x);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  font-size: var(--text-caption);
  font-weight: 500;
}

.panel > .panel-heading {
  margin: calc(var(--geist-space-4x) * -1) calc(var(--geist-space-4x) * -1) var(--geist-space-4x);
}

.card-header-title {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  font-weight: 500;
}

.card-body { flex: 1; padding: var(--geist-space-4x); }

.card-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--geist-space-2x);
  padding: var(--geist-space-2x) var(--geist-space-4x);
  border-top: 1px solid var(--hairline);
}

.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  gap: var(--geist-space-2x) var(--geist-space-6x);
  margin: var(--geist-space-4x) 0;
}

.detail-list dt {
  color: var(--ink-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs,
.content-tabs {
  width: 100%;
  min-width: 0;
  display: flex;
  border-bottom: 1px solid var(--hairline);
}

.content-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.page-tab-head {
  display: flex;
  flex-direction: column;
  gap: var(--geist-space-4x);
}

.page-tab-head .page-title { margin: 0; }

.page-tab-head .page-header {
  padding-bottom: 0;
  border-bottom: 0;
}

.tab,
.local-navigation-area-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: var(--geist-space-2x);
  min-width: 48px;
  padding: var(--geist-space-3x) var(--geist-space-4x);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
  text-transform: none;
}

.tab:hover,
.local-navigation-area-link:hover { color: var(--ink); }

.tab:focus-visible,
.local-navigation-area-link:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

.tab.is-active,
.local-navigation-area-link.is-active {
  border-bottom-color: var(--ds-gray-1000);
  color: var(--ds-gray-1000);
}

.tab .badge,
.tab .pill-count {
  min-height: 16px;
  padding: 1px var(--geist-space-2x);
  font-size: 12px;
}

/* ============================================================
   Local area navigation
   ============================================================ */

.local-navigation {
  position: relative;
  z-index: var(--z-popover);
  display: flex;
  width: 100%;
  max-width: 100%;
  align-items: center;
  gap: var(--geist-space-3x);
  box-shadow: inset 0 -1px var(--hairline);
}

.local-navigation-primary {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* Keep the full underline inside the horizontally scrolling tab row. */
.local-navigation-area-link { margin-bottom: 0; }

.local-navigation-back {
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
}

.local-navigation-back:hover { color: var(--ink); }

.local-navigation-back:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

.local-navigation-menu {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.local-navigation-trigger {
  display: grid;
  height: 36px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--geist-space-2x);
  padding: 0 var(--geist-space-3x);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  list-style: none;
}

.local-navigation-trigger::-webkit-details-marker { display: none; }

.local-navigation-trigger:hover { background: var(--surface-hover); }

.local-navigation-trigger:focus-visible {
  outline: none;
  box-shadow: var(--ds-shadow-border), var(--ds-focus-ring);
}

.local-navigation-context {
  color: var(--ink-subtle);
  font-weight: 400;
}

.local-navigation-current {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-navigation-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--duration) var(--ease);
}

.local-navigation-menu[open] .local-navigation-chevron { transform: rotate(225deg) translate(-2px, -2px); }

.local-navigation-popover {
  position: absolute;
  top: calc(100% + var(--geist-space-2x));
  right: 0;
  width: 280px;
  max-width: calc(100vw - var(--geist-space-6x));
  z-index: var(--z-popover);
  max-height: min(420px, calc(100vh - 180px));
  padding: var(--geist-space);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--ds-shadow-menu);
  animation: popover-in var(--ds-motion-popover-duration) var(--ds-motion-popover-timing);
}

.local-navigation-link:not(.local-navigation-area-link) {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: var(--geist-space-3x);
  padding: var(--geist-space-2x) var(--geist-space-3x);
  border-radius: var(--radius);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}

.local-navigation-link:not(.local-navigation-area-link):hover { background: var(--surface-hover); color: var(--ink); }
.local-navigation-link:not(.local-navigation-area-link).is-active { background: var(--surface-active); color: var(--ink); font-weight: 500; }

.local-navigation-link:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

.orders-mobile-navigation { display: none; }

@media (min-width: 1728px) {
  .local-navigation-menu { display: none; }
}

@media (max-width: 672px) {
  .local-navigation {
    width: 100%;
    align-items: stretch;
  }
  .local-navigation-menu { min-width: 0; width: 100%; }
  .local-navigation-trigger,
  .local-navigation-link { min-height: 44px; }
}

@media (pointer: coarse) {
  .local-navigation-area-link,
  .local-navigation-trigger,
  .local-navigation-link { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .local-navigation-popover { animation: none; }
  .local-navigation-chevron { transition: none; }
}

/* ============================================================
   Pagination (Pagy)
   ============================================================ */

nav.pagy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--geist-space);
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: var(--geist-space-6x) auto 0;
  font-family: "Geist Sans", var(--font-sans);
  font-size: var(--text-sm);
}

nav.pagy a,
nav.pagy span {
  display: inline-flex;
  min-width: 2rem;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  padding: var(--geist-space-2x) var(--geist-space-2x);
  border-radius: 6px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  line-height: 1;
}

nav.pagy a[href]:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

nav.pagy a:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

nav.pagy .current,
nav.pagy a[aria-current="page"] {
  background: var(--surface-active);
  box-shadow: var(--ds-shadow-border);
  color: var(--ink);
  font-weight: 500;
}

nav.pagy .gap,
nav.pagy [aria-disabled]:not([aria-current]) {
  color: var(--ink-subtle);
}

nav.pagy a[aria-label="Previous"],
nav.pagy a[aria-label="Next"] {
  gap: var(--geist-space-2x);
  padding-inline: var(--geist-space-3x);
  box-shadow: var(--ds-shadow-border);
  background: var(--surface);
}

nav.pagy a[aria-disabled]:not([aria-current]):not(.gap) {
  background: var(--surface-hover);
}

nav.pagy svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pagination-chevron-back {
  transform: rotate(180deg);
}

nav.pagy a[aria-label][href]:hover {
  background: var(--surface-hover);
}

nav.pagy a[aria-label]:focus-visible {
  box-shadow: var(--ds-focus-ring);
}

@media (pointer: coarse) {
  nav.pagy a { min-height: 2.75rem; }
}

/* ============================================================
   Sortable table headers
   ============================================================ */

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: var(--geist-space);
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  text-transform: inherit;
  white-space: nowrap;
}

.sort-link:hover,
.sort-link.is-sorted { color: var(--ink); }
.sort-link.is-sorted { font-weight: 600; }

.sort-link:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

.sort-indicator {
  color: var(--ink-subtle);
  font-size: var(--text-xs);
}

/* ============================================================
   Autocomplete picker
   ============================================================ */

.autocomplete { position: relative; }
.autocomplete-input { width: 100%; }

.autocomplete-results {
  position: absolute;
  top: calc(100% + var(--geist-space));
  right: 0;
  left: 0;
  z-index: var(--z-popover);
  max-height: 16rem;
  padding: var(--geist-space);
  margin: 0;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--ds-shadow-menu);
  list-style: none;
  transform-origin: top;
  animation: popover-in var(--ds-motion-popover-duration) var(--ds-motion-popover-timing);
}

@keyframes popover-in {
  from { opacity: 0; transform: scale(var(--ds-motion-overlay-scale)); }
  to { opacity: 1; transform: scale(1); }
}

.autocomplete-option,
.autocomplete-empty {
  padding: var(--geist-space-2x) var(--geist-space-3x);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: var(--text-sm);
}

.autocomplete-option { cursor: pointer; }
.autocomplete-option:hover { background: var(--surface-hover); }
.autocomplete-option.is-active { background: var(--surface-active); }
.autocomplete-empty { color: var(--ink-muted); }

.autocomplete-option:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

/* ============================================================
   Empty states and dividers
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--geist-space-10x) var(--geist-space-6x);
  color: var(--ink-muted);
  text-align: center;
}

.empty-state-icon {
  margin-bottom: var(--geist-space-4x);
  color: var(--ink-subtle);
}

.empty-state-title {
  margin-bottom: var(--geist-space-2x);
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
}

.empty-state-description {
  max-width: 360px;
  margin-bottom: var(--geist-space-6x);
  color: var(--ink-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.empty-state-bordered {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ds-shadow-border);
}

.divider {
  display: flex;
  width: 100%;
  height: 1px;
  align-items: center;
  margin: var(--geist-space-4x) 0;
  background: var(--hairline);
}

/* ============================================================
   Utilities
   ============================================================ */

.skip-link {
  position: absolute;
  top: var(--geist-space-2x);
  left: var(--geist-space-2x);
  z-index: 10000;
  padding: var(--geist-space-2x) var(--geist-space-3x);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--canvas);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

@media (max-width: 720px) {
  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .field textarea,
  .input,
  .select,
  .textarea,
  .autocomplete-input,
  .auth-form input,
  .search-field input,
  .filter-bar input,
  .filter-bar select,
  .ai-chat-input {
    font-size: 16px;
  }

  .btn,
  .btn-icon,
  .icon-link,
  .ai-chat-icon-btn,
  .nav-item {
    min-height: 44px;
  }

  .btn-icon,
  .icon-link,
  .ai-chat-icon-btn {
    min-width: 44px;
  }
}

.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border-width: 0;
}

.no-print {
  /* Hidden by the shared print stylesheet. */
}

@media (max-width: 672px) {
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .detail-list { grid-template-columns: 1fr; }
}
/* Printable equipment label; the SVG is generated locally and links only to
   an authenticated maintenance-request route. */
.qr-label {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  width: min(100%, 28rem);
  margin-inline: auto;
  padding: var(--space-6);
  text-align: center;
  border: 2px solid var(--hairline-mid);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.qr-label h1,
.qr-label p { margin: 0; }

.qr-label svg {
  display: block;
  width: min(100%, 20rem);
  height: auto;
  background: #ffffff;
}
.directional-label-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}
