/**
 * Component Styles - Light Industrial Theme
 */

/* Buttons - Harmonized Design System Scale */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  background: #ffffff;
  color: var(--text-main);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  vertical-align: middle;
  text-decoration: none;
}
.btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--text-main);
  text-decoration: none;
}
.btn:active {
  transform: scale(0.99);
}
.btn:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

/* Sizing Tiers */
.btn-xs {
  height: 28px;
  min-height: 28px;
  padding: 0 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 0.3rem;
  border-radius: 5px;
}
.btn-sm {
  height: 34px;
  min-height: 34px;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  gap: 0.35rem;
  border-radius: var(--radius-sm);
}
.btn-lg {
  height: 44px;
  min-height: 44px;
  padding: 0 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  gap: 0.5rem;
  border-radius: var(--radius-md);
}

/* Square Icon Buttons */
.btn-icon {
  padding: 0;
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
}
.btn-icon.btn-xs {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 5px;
}
.btn-icon.btn-sm {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
}
.btn-icon.btn-lg {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
}

/* Icons Inside Buttons */
.btn .material-symbols-rounded {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
}
.btn-xs .material-symbols-rounded {
  font-size: 14px;
  line-height: 1;
}
.btn-sm .material-symbols-rounded {
  font-size: 16px;
  line-height: 1;
}
.btn-lg .material-symbols-rounded {
  font-size: 20px;
  line-height: 1;
}

/* Style Variants */
.btn-primary {
  background: var(--primary);
  border-color: #0369a1;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: #075985;
  color: #ffffff;
}
.btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text-main);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--text-main);
}
.btn-outline {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text-muted);
  box-shadow: none;
}
.btn-outline:hover {
  color: var(--text-main);
  background: #f8fafc;
  border-color: #94a3b8;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  box-shadow: none;
}
.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: transparent;
}
.btn-ghost.active {
  background: #e2e8f0;
  color: var(--text-main);
  font-weight: 700;
}
.btn-danger {
  background: #e11d48;
  border-color: #be123c;
  color: #ffffff;
}
.btn-danger:hover {
  background: #be123c;
  border-color: #9f1239;
  color: #ffffff;
}
.btn-success {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
}
.btn-success:hover {
  background: #047857;
  border-color: #065f46;
  color: #ffffff;
}
.btn-link {
  background: transparent;
  border: none;
  color: var(--primary);
  padding: 0;
  height: auto;
  min-height: 0;
  box-shadow: none;
  font-weight: 500;
}
.btn-link:hover {
  background: transparent;
  text-decoration: underline;
  border: none;
}

/* Button Groups */
.btn-group {
  display: inline-flex;
  align-items: center;
}
.btn-group > .btn:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}
.btn-group > .btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.btn-group > .btn:hover,
.btn-group > .btn:focus,
.btn-group > .btn.active {
  z-index: 1;
}

/* Interactive Meter Identifier Trigger */
.meter-code-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  padding: 0.15rem 0.35rem;
  margin: -0.15rem -0.35rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.92rem;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}
.meter-code-trigger:hover {
  background: #f1f5f9;
  color: var(--primary);
}
.meter-code-trigger .meter-trends-icon {
  font-size: 15px;
  color: #94a3b8;
  opacity: 0.7;
  transition: all 0.15s ease;
}
.meter-code-trigger:hover .meter-trends-icon {
  color: var(--primary);
  opacity: 1;
  transform: scale(1.1);
}

/* Badges - Industrial High-Contrast Light Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
}
.badge-electricity {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.badge-water_cold {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}
.badge-water_hot {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.badge-gas {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}
.badge-heat {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.badge-anomaly {
  background: #ffe4e6;
  color: #be123c;
  border: 1px solid #fecdd3;
  font-weight: 700;
}
.badge-active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.badge-admin {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}
.badge-night {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
.badge-night .material-symbols-rounded {
  font-size: 13px;
  line-height: 1;
}
.dual-icon-day {
  color: #b45309;
  font-size: 14px;
  vertical-align: middle;
  line-height: 1;
}
.dual-icon-night {
  color: #4338ca;
  font-size: 14px;
  vertical-align: middle;
  line-height: 1;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Form Controls & Streamlined Form System */
.form-section {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-section:last-child {
  margin-bottom: 0;
}
.form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #f1f5f9;
}
.form-section-title .material-symbols-rounded {
  font-size: 15px;
  color: #94a3b8;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}
@media (max-width: 600px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}
.form-col-full {
  grid-column: 1 / -1;
}
.form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.35rem;
}
.form-label .required-star {
  color: #e11d48;
  margin-left: 2px;
}
.form-label .optional-pill {
  font-size: 0.68rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-control, .form-select {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: var(--transition);
  font-size: 0.85rem;
  box-sizing: border-box;
}
textarea.form-control {
  height: auto;
  min-height: 72px;
  padding: 0.5rem 0.75rem;
  line-height: 1.4;
  resize: vertical;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.form-hint {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 0.25rem;
  line-height: 1.35;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}

/* Glanceable Interactive Check / Toggle Cards */
.form-check-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  box-sizing: border-box;
}
.form-check-card:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.form-check-card:has(input:checked) {
  background: #f0f9ff;
  border-color: #0284c7;
}
.form-check-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.form-check-card-body {
  flex: 1;
  min-width: 0;
}
.form-check-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.form-check-card:has(input:checked) .form-check-card-title {
  color: #0369a1;
}
.form-check-card-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.35;
}

/* Glanceable Callout Banners */
.form-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.4;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  box-sizing: border-box;
}
.form-callout-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.form-callout-info {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}
.form-callout-info .form-callout-icon {
  color: #0284c7;
}
.form-callout-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.form-callout-warning .form-callout-icon {
  color: #d97706;
}
.form-callout-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.form-callout-success .form-callout-icon {
  color: #16a34a;
}

/* Modals - Clean White Industrial Dialogs */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.modal-dialog {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(10px);
  transition: transform 0.15s ease;
  display: flex;
  flex-direction: column;
}
.modal-dialog.modal-sm { max-width: 420px; }
.modal-dialog.modal-md { max-width: 560px; }
.modal-dialog.modal-lg { max-width: 680px; }
.modal-dialog.modal-xl { max-width: 840px; }
.modal-backdrop.open .modal-dialog {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  gap: 0.75rem;
}
.modal-header-title-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.modal-header-icon {
  font-size: 22px;
  color: var(--primary);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-close-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  box-sizing: border-box;
}
.modal-close-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
  background: #f1f5f9;
}
.modal-close-btn .material-symbols-rounded {
  font-size: 18px;
  line-height: 1;
}
.modal-body {
  padding: 1.25rem;
  max-height: 75vh;
  overflow-y: auto;
  background: #ffffff;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
}
.modal-footer .btn {
  height: 34px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Custom Accessible Dialogs (Confirm, Alert, Prompt) */
.custom-dialog-backdrop {
  z-index: 1100 !important;
  background: rgba(15, 23, 42, 0.55);
}
.custom-dialog-card {
  max-width: 440px;
  width: 92%;
  border-radius: 10px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
}
.custom-dialog-backdrop.open .custom-dialog-card {
  transform: translateY(0) scale(1);
}
.custom-dialog-header {
  padding: 0.85rem 1.2rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.custom-dialog-body {
  padding: 1.15rem 1.25rem;
}
.custom-dialog-footer {
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  gap: 0.5rem;
}
.custom-dialog-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.custom-dialog-icon.danger {
  background: #fee2e2;
  color: #dc2626;
}
.custom-dialog-icon.primary {
  background: #e0f2fe;
  color: #0284c7;
}
.custom-dialog-icon.warning {
  background: #fef3c7;
  color: #d97706;
}
.custom-dialog-msg {
  font-size: var(--font-size-base);
  color: var(--text-main);
  line-height: var(--leading-normal);
  font-weight: var(--font-weight-medium);
}
.custom-dialog-details {
  margin-top: var(--space-xs);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  pointer-events: auto;
  animation: slideIn 0.2s ease;
  font-size: 0.88rem;
  font-weight: 500;
}
.toast.toast-success {
  border-left: 4px solid var(--accent-green);
}
.toast.toast-error {
  border-left: 4px solid var(--accent-rose);
}
.toast.toast-info {
  border-left: 4px solid var(--accent-cyan);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Offline Sync Status Banner */
.offline-banner {
  background: var(--accent-amber);
  color: #000;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.pagination-info {
  color: var(--text-muted);
}
.pagination-info strong {
  color: var(--text-main);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Friendly Empty State Component */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 440px;
  margin: 0 auto;
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.empty-state-icon.success {
  background: #ecfdf5;
  color: #10b981;
}
.empty-state-icon.warning {
  background: #fffbeb;
  color: #f59e0b;
}
.empty-state-icon .material-symbols-rounded {
  font-size: 28px;
}
.empty-state-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.empty-state-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   Standard View Header & Layout System (Unified Design System)
   ========================================================================== */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.view-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}
.view-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.view-icon-box.accent-orange {
  background: #ffedd5;
  color: #ea580c;
}
.view-icon-box.accent-green {
  background: #ecfdf5;
  color: #10b981;
}
.view-icon-box.accent-purple {
  background: #f3e8ff;
  color: #8b5cf6;
}
.view-icon-box .material-symbols-rounded {
  font-size: 22px;
}
.view-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.view-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.view-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-main);
  margin: 0;
  line-height: var(--leading-tight);
}
.view-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-dim);
  margin-top: 2px;
  line-height: var(--leading-normal);
}
.view-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ==========================================================================
   Standardized View Filter Toolbar (.view-toolbar / .filter-toolbar)
   ========================================================================== */
.view-toolbar,
.filter-toolbar {
  padding: 0.65rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem;
  min-height: 52px;
  box-sizing: border-box;
  overflow-x: auto;
  scrollbar-width: thin;
}
.filter-group-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-group-left::-webkit-scrollbar {
  display: none;
}
.filter-group-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Standard Search Input Wrapper with Icon & Clear Button */
.search-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 220px;
  min-width: 170px;
  max-width: 260px;
  flex-shrink: 0;
}
.search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  font-size: 17px;
  color: #94a3b8;
  pointer-events: none;
}
.search-input-wrapper .search-input {
  width: 100%;
  height: 34px;
  padding-left: 2.15rem;
  padding-right: 2rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
  box-sizing: border-box;
}
.search-input-wrapper .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  outline: none;
}
.search-input-wrapper .search-clear-btn {
  position: absolute;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: var(--transition);
}
.search-input-wrapper .search-clear-btn:hover {
  background: #cbd5e1;
  color: var(--text-main);
}

/* Standardized Toolbar Selects */
.view-toolbar .form-select,
.filter-toolbar .form-select {
  height: 34px;
  font-size: var(--font-size-sm, 0.8125rem);
  padding: 0 1.8rem 0 0.65rem;
  border-radius: var(--radius-sm, 6px);
  width: auto;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Reset Filters Button */
.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 34px;
  padding: 0 var(--space-sm);
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-sizing: border-box;
}
.btn-reset-filters:hover {
  border-color: #94a3b8;
  color: var(--text-main);
  background: #f8fafc;
}
.btn-reset-filters.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Timeframe / Year Stepper Component */
.timeframe-stepper-group {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  height: 34px;
  padding: 1px;
  box-sizing: border-box;
}
.timeframe-stepper-btn {
  border: none;
  background: transparent;
  padding: 0 var(--space-xs);
  height: 100%;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.timeframe-stepper-btn:hover:not(:disabled) {
  color: var(--text-main);
  background: #e2e8f0;
}
.timeframe-stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.timeframe-stepper-select {
  border: none;
  background: transparent;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  color: var(--text-main);
  padding: 0 var(--space-xs);
  height: 100%;
  cursor: pointer;
  outline: none;
  text-align: center;
  min-width: 82px;
}

/* Inline Compact Date Range Picker */
.inline-date-range {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2px var(--space-xs);
  height: 34px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.inline-date-range input[type="date"] {
  border: none;
  background: transparent;
  font-size: var(--font-size-xs);
  padding: 2px 4px;
  color: var(--text-main);
  font-family: inherit;
  outline: none;
  cursor: pointer;
  width: 105px;
}
.inline-date-range .date-sep {
  color: var(--text-dim);
  font-size: var(--font-size-xs);
}
.inline-date-range .date-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.inline-date-range .date-clear-btn:hover {
  color: var(--accent-rose);
}

/* ==========================================================================
   Tab Groups & Segmented Controls (Unified Design System)
   Modeled after the Data Exporter format pill selector
   ========================================================================== */
.tab-group,
.filter-pill-group,
.export-format-pills {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm, 6px);
  padding: 2px;
  gap: 2px;
  height: 34px;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-group::-webkit-scrollbar,
.filter-pill-group::-webkit-scrollbar,
.export-format-pills::-webkit-scrollbar {
  display: none;
}

.tab-btn,
.filter-pill-btn,
.export-format-pill {
  height: 28px;
  padding: 0 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
  text-decoration: none;
}

.tab-btn:hover,
.filter-pill-btn:hover,
.export-format-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.tab-btn.active,
.filter-pill-btn.active,
.export-format-pill.active {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}

.tab-btn .material-symbols-rounded,
.filter-pill-btn .material-symbols-rounded,
.export-format-pill .material-symbols-rounded {
  font-size: 15px;
}

.page-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  height: 32px;
  min-width: 32px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}
.pagination-size select {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

/* ==========================================================
   Readings Log & Audit Trail - 15-Year Archive Filter Panel
   ========================================================== */
.readings-filter-panel {
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
}

/* Tier 1: Primary Operational Toolbar */
.readings-top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.readings-top-toolbar .filter-group-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
}

.search-box-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}
.search-box-wrapper .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
.search-box-wrapper .search-input {
  padding-left: 2.3rem;
  padding-right: 2rem;
  font-size: 0.85rem;
  height: 36px;
}
.search-box-wrapper .search-clear-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.85rem;
  line-height: 1;
}
.search-box-wrapper .search-clear-btn:hover {
  color: #0f172a;
}

.utility-filter-select {
  max-width: 170px;
  height: 36px;
  font-size: 0.85rem;
  font-weight: 500;
}

.anomaly-filter-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0 0.85rem;
  white-space: nowrap;
}
.anomaly-filter-btn.active {
  background: #ffe4e6;
  border-color: #fecdd3;
  color: #be123c;
  box-shadow: 0 1px 2px rgba(190, 18, 60, 0.15);
}

.reset-filters-btn {
  height: 36px;
  padding: 0 0.75rem;
  font-size: 0.82rem;
  color: #64748b;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}
.reset-filters-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}
.reset-filters-btn.is-active {
  color: #0284c7;
  border-color: #bae6fd;
  background: #f0f9ff;
  font-weight: 600;
}

.filter-group-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tier 2: 15-Year Archive Timeline Ribbon */
.archive-timeline-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  flex-wrap: wrap;
}

.timeline-header-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.timeline-brand-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.timeline-stepper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.timeline-step-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  color: #334155;
  font-weight: 700;
  transition: var(--transition);
}
.timeline-step-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.timeline-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.timeline-ribbon-container {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
  position: relative;
  gap: 0.25rem;
}

.ribbon-scroll-arrow {
  width: 22px;
  height: 28px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  color: #64748b;
  flex-shrink: 0;
  transition: var(--transition);
}
.ribbon-scroll-arrow:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.timeline-chips-track {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.15rem 0.25rem;
  flex: 1;
}
.timeline-chips-track::-webkit-scrollbar {
  display: none;
}

.year-chip {
  height: 30px;
  padding: 0 0.75rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}
.year-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.year-chip.active {
  background: var(--primary);
  border-color: #0369a1;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.25);
}
.year-chip .chip-sub {
  font-size: 0.65rem;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  font-weight: 700;
}
.year-chip.active .chip-sub {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Custom Date Range Segment */
.timeline-custom-range {
  flex-shrink: 0;
}
.range-inputs-segment {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  height: 30px;
}
.range-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}
.range-date-input {
  border: none;
  background: transparent;
  font-size: 0.78rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  padding: 0.1rem 0.2rem;
  outline: none;
  width: 115px;
}
.range-date-input:focus {
  background: #f0f9ff;
  border-radius: 2px;
}
.range-separator {
  color: #94a3b8;
  font-size: 0.75rem;
}
.range-clear-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 0.25rem;
  font-size: 0.8rem;
  line-height: 1;
}
.range-clear-btn:hover {
  color: #e11d48;
}

/* Tier 3: Active Status & Audit Horizon Bar */
.timeline-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1.25rem;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.78rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.status-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.03em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}
.status-pill.filtered {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}
.status-pill.filter-anomaly {
  background: #ffe4e6;
  border-color: #fecdd3;
  color: #be123c;
}
.status-pill.filter-type {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}
.status-pill.filter-search {
  background: #f3e8ff;
  border-color: #e9d5ff;
  color: #6b21a8;
}

.status-right {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 500;
}
.total-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #0f172a;
}

/* Language Selector & Timezone Badges */
.lang-selector-wrapper {
  display: flex;
  align-items: center;
}
.lang-selector {
  background: #f8fafc;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.lang-selector:hover, .lang-selector:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.worker-lang-selector {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.time-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: #475569;
  font-weight: 600;
  user-select: none;
}

.reading-datetime-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.reading-date-main {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.88rem;
  white-space: nowrap;
}
.reading-time-sub {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

/* ==========================================================================
   Analytics Control & Filter Panel (Spacious & Ordered)
   ========================================================================== */

.analytics-filter-panel {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

/* Tier 1: Panel Header (Title & Active Scope Pill) */
.afp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fafafa;
  gap: 1rem;
  flex-wrap: wrap;
}

.afp-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.afp-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.afp-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.afp-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.afp-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(3, 105, 161, 0.08);
  transition: var(--transition);
}

.afp-scope-badge .scope-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0284c7;
  animation: afp-pulse-dot 2s infinite;
}

@keyframes afp-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Tier 2: Timeline Horizon Bar (Macro + Stepper + Chips Track) */
.afp-timeline-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.afp-macro-btn {
  height: 34px;
  padding: 0 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}

.afp-macro-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.afp-macro-btn.active {
  background: var(--primary);
  border-color: #0369a1;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3);
}

.afp-divider {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.afp-stepper-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.afp-step-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  color: #475569;
  font-weight: 700;
  transition: var(--transition);
}

.afp-step-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.afp-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.afp-track-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 240px;
}

.afp-scroll-arrow {
  width: 26px;
  height: 32px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  color: #64748b;
  flex-shrink: 0;
  transition: var(--transition);
}

.afp-scroll-arrow:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.afp-chips-track {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.15rem 0.25rem;
  flex: 1;
}

.afp-chips-track::-webkit-scrollbar {
  display: none;
}

.afp-year-chip {
  height: 32px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}

.afp-year-chip:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.afp-year-chip.active {
  background: var(--primary);
  border-color: #0369a1;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.28);
}

.afp-year-chip .chip-sub {
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  font-weight: 700;
}

/* Tier 3: Utility Commodity & Focus Row */
.afp-commodity-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: #f8fafc;
  gap: 1rem;
  flex-wrap: wrap;
}

.afp-commodity-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.afp-commodity-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.afp-commodity-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.afp-util-btn {
  height: 28px;
  padding: 0 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.afp-util-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.afp-util-btn.active {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}

.afp-commodity-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.afp-jump-btn {
  height: 28px;
  padding: 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.afp-jump-btn:hover {
  background: #f1f5f9;
  color: var(--primary);
  border-color: #bae6fd;
}

@media (max-width: 900px) {
  .afp-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .afp-timeline-bar {
    gap: 0.6rem;
  }
  .afp-track-wrapper {
    min-width: 100%;
    order: 4;
  }
  .afp-commodity-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Custom Floating Action Dropdown Menu (.custom-action-menu)
   ========================================================================== */
.custom-action-menu {
  position: fixed;
  z-index: 1060;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: actionMenuFadeIn 0.12s ease-out;
  box-sizing: border-box;
}

@keyframes actionMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.custom-action-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: var(--font-size-sm, 0.82rem);
  font-weight: 500;
  color: var(--text-main, #0f172a);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease, color 0.1s ease;
  outline: none;
  box-sizing: border-box;
  text-decoration: none;
}

.custom-action-menu-item:hover,
.custom-action-menu-item:focus-visible {
  background: #f1f5f9;
  color: var(--primary, #0284c7);
}

.custom-action-menu-item .menu-item-icon {
  font-size: 17px;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
  transition: color 0.1s ease;
}

.custom-action-menu-item:hover .menu-item-icon {
  color: var(--primary, #0284c7);
}

.custom-action-menu-item.is-danger {
  color: var(--accent-rose, #e11d48);
}

.custom-action-menu-item.is-danger .menu-item-icon {
  color: var(--accent-rose, #e11d48);
}

.custom-action-menu-item.is-danger:hover,
.custom-action-menu-item.is-danger:focus-visible {
  background: #fff1f2;
  color: #be123c;
}

.custom-action-menu-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: transparent !important;
}

.custom-action-menu-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.25rem 0;
}

.action-menu-trigger-active {
  background-color: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

/* ==========================================================================
   Semantic Toolbar Clusters & Segmented Controls
   ========================================================================== */
.toolbar-cluster {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: #e2e8f0;
  margin: 0 0.25rem;
  flex-shrink: 0;
}

.toolbar-cluster-bordered {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm, 6px);
  padding: 2px;
  gap: 2px;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm, 6px);
  padding: 2px;
  gap: 2px;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

.segmented-btn:hover {
  color: var(--text-main, #0f172a);
}

.segmented-btn.active {
  background: #ffffff;
  color: var(--primary, #0284c7);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-group {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.btn-group > .btn {
  border-radius: 0;
  margin-left: -1px;
}

.btn-group > .btn:first-child {
  border-top-left-radius: var(--radius-sm, 6px);
  border-bottom-left-radius: var(--radius-sm, 6px);
  margin-left: 0;
}

.btn-group > .btn:last-child {
  border-top-right-radius: var(--radius-sm, 6px);
  border-bottom-right-radius: var(--radius-sm, 6px);
}
