/* ============================================================
   RAILMET Pixel-Perfect CSS — Matches desktop application exactly
   ============================================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", Arial, sans-serif;
  background: #F3F3F3;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* --- Top Dark Strip --- */
.rm-top-strip { height: 5px; background: #0B1A30; width: 100%; }

/* --- Header Bar --- */
.rm-header { display: flex; align-items: center; height: 44px; background: #0D4A8A; color: #fff; padding: 0 16px; width: 100%; }
.rm-header-brand { display: flex; align-items: baseline; gap: 8px; min-width: 220px; }
.rm-header-brand .rm-logo-railmet { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: 0.5px; }
.rm-header-brand .rm-logo-speed { font-size: 12px; font-style: italic; color: #FFD54F; font-weight: 500; letter-spacing: 0.3px; }
.rm-header-center { flex: 1; text-align: center; font-size: 14px; font-weight: 600; letter-spacing: 1.5px; color: #fff; }
.rm-header-date { background: #0B1A30; color: #fff; border-radius: 4px; padding: 4px 12px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 155px; text-align: center; }

/* --- App Body --- */
.rm-body { display: flex; height: calc(100vh - 49px); overflow: hidden; }

/* --- Sidebar --- */
.rm-sidebar { width: 200px; min-width: 200px; background: #fff; border-right: 1px solid #D6DCE5; display: flex; flex-direction: column; flex-shrink: 0; }
.rm-sidebar-logo { padding: 16px 16px 12px 16px; border-bottom: 1px solid #ECF0F5; }
.rm-sidebar-logo .rm-sb-railmet { font-size: 18px; font-weight: 800; color: #0D4A8A; }
.rm-sidebar-logo .rm-sb-speed { font-size: 10px; font-style: italic; color: #FFD54F; font-weight: 500; }
.rm-sidebar-nav { display: flex; flex-direction: column; padding: 8px 0; gap: 2px; }
.rm-sidebar-nav .rm-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 13px; font-weight: 600; color: #4A5568; cursor: pointer; border: none; background: none; text-decoration: none; transition: background .12s, color .12s; border-radius: 0; width: 100%; text-align: left; }
.rm-sidebar-nav .rm-nav-item:hover { background: #F0F4F8; color: #1a1a2e; }
.rm-sidebar-nav .rm-nav-item.active { background: #0D6EFD; color: #fff; }
.rm-sidebar-nav .rm-nav-item i { font-size: 15px; width: 18px; text-align: center; }

/* --- Main Content --- */
.rm-content { flex: 1; padding: 12px 16px 16px 16px; overflow: hidden; min-width: 0; display: flex; flex-direction: column; }

/* --- Summary Cards --- */
.rm-summary-row { display: flex; gap: 12px; margin-bottom: 12px; }
.rm-summary-card { flex: 1; background: #fff; border: 1px solid #D6DCE5; border-radius: 8px; padding: 12px 16px; min-width: 0; }
.rm-summary-card .rm-sc-label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: #718096; letter-spacing: 0.5px; margin-bottom: 2px; }
.rm-summary-card .rm-sc-value { font-size: 24px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-summary-card .rm-sc-value.blue   { color: #0D6EFD; }
.rm-summary-card .rm-sc-value.green  { color: #16A34A; }
.rm-summary-card .rm-sc-value.orange { color: #EA580C; }
.rm-summary-card .rm-sc-value.dark   { color: #1a1a2e; }

/* --- Section Title --- */
.rm-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; color: #0D4A8A; letter-spacing: 0.5px; margin-bottom: 8px; padding-left: 2px; }

/* --- Table Wrap --- */
.rm-table-wrap { background: #fff; border: 1px solid #D6DCE5; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.rm-table-scroll { overflow-x: auto; max-height: 340px; overflow-y: auto; }
.rm-table-wrap.wagon-grid-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rm-table-wrap.wagon-grid-wrap .rm-table-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.rm-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.rm-table thead th { background: #0D6EFD; color: #fff; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; padding: 8px 8px; text-align: left; border: none; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
.rm-table tbody td { padding: 6px 8px; border-bottom: 1px solid #ECF0F5; font-size: 12px; color: #2D3748; white-space: nowrap; }
.rm-table tbody tr:nth-child(even) { background: #F7FAFC; }
.rm-table tbody tr:hover { background: #EBF4FF; }
.rm-table .col-wagon { font-weight: 700; color: #1a1a2e; }

/* --- Wagon Table --- */
.rm-wagon-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.rm-wagon-table thead th { background: #0D6EFD; color: #fff; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; padding: 8px 8px; text-align: left; border: none; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
.rm-wagon-table tbody td { padding: 6px 8px; border-bottom: 1px solid #ECF0F5; font-size: 12px; color: #2D3748; white-space: nowrap; }
.rm-wagon-table tbody tr:nth-child(even) { background: #F7FAFC; }
.rm-wagon-table tbody tr:hover { background: #EBF4FF; }
.rm-wagon-table .col-wagon { font-weight: 700; color: #1a1a2e; }
.rm-wagon-table .col-gross { font-weight: 700; color: #1a1a2e; }
.rm-wagon-table .asym-pos { color: #16A34A; font-weight: 600; }
.rm-wagon-table .asym-neg { color: #DC2626; font-weight: 600; }
.rm-wagon-table .asym-zero { color: #718096; font-weight: 600; }

/* --- Bottom Grid --- */
.rm-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* --- Panels --- */
.rm-panel { background: #fff; border: 1px solid #D6DCE5; border-radius: 8px; overflow: hidden; }
.rm-panel-header { padding: 10px 14px; border-bottom: 1px solid #ECF0F5; }
.rm-panel-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: #0D4A8A; letter-spacing: 0.5px; }
.rm-panel-body { padding: 14px; }

/* --- Chart Area --- */
.rm-chart-area { width: 100%; height: 240px; display: flex; align-items: center; justify-content: center; color: #A0AEC0; font-size: 13px; border: 1px dashed #D6DCE5; border-radius: 6px; margin-bottom: 12px; }

/* --- Legend --- */
.rm-legend { display: flex; gap: 16px; margin-bottom: 10px; font-size: 11px; font-weight: 600; color: #4A5568; }
.rm-legend-item { display: flex; align-items: center; gap: 5px; }
.rm-legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.rm-legend-dot.green { background: #16A34A; }
.rm-legend-dot.blue  { background: #0D6EFD; }

/* --- Wagon Image --- */
.rm-wagon-img-wrap { text-align: center; padding: 10px 0; margin-bottom: 12px; }
.rm-wagon-img-wrap img { max-width: 320px; height: auto; opacity: 0.85; }

/* --- Axle Cards --- */
.rm-axle-row { display: flex; gap: 10px; margin-bottom: 12px; }
.rm-axle-card { flex: 1; background: #F7FAFC; border: 1px solid #D6DCE5; border-radius: 6px; padding: 8px 10px; text-align: center; }
.rm-axle-card .rm-ac-title { font-size: 12px; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.rm-axle-card .rm-ac-row { display: flex; justify-content: space-between; font-size: 11px; color: #4A5568; }
.rm-axle-card .rm-ac-val { font-weight: 700; color: #1a1a2e; }
.axle-lh { font-size: 14px; font-weight: 700; color: #0D6EFD; }
.axle-rh { font-size: 14px; font-weight: 700; color: #16A34A; }
.axle-label { font-size: 10px; font-weight: 600; color: #718096; text-transform: uppercase; margin-top: 2px; }

/* --- Axle Info --- */
.rm-axle-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; color: #4A5568; }
.rm-axle-info .rm-ai-label { font-weight: 600; }
.rm-axle-info .rm-ai-val { font-weight: 700; color: #1a1a2e; }
.rm-bottom-info { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 8px; font-size: 12px; color: #4A5568; }
.rm-bottom-info .rm-bi-label { font-weight: 600; }
.rm-bottom-info .rm-bi-val { font-weight: 700; color: #1a1a2e; }

/* --- Data Labels --- */
.rm-data-label { font-size: 11px; font-weight: 600; color: #718096; }
.rm-data-value { font-size: 14px; font-weight: 700; color: #1a1a2e; }
.rm-bogie-line { padding: 10px 0; border-top: 1px solid #ECF0F5; }

/* --- Buttons --- */
.rm-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rm-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; font-size: 12px; font-weight: 600; border: none; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: background .12s; }
.rm-btn-blue     { background: #0D6EFD; color: #fff; }
.rm-btn-blue:hover     { background: #0B5ED7; }
.rm-btn-red      { background: #DC2626; color: #fff; }
.rm-btn-red:hover      { background: #B91C1C; }
.rm-btn-gray     { background: #718096; color: #fff; }
.rm-btn-gray:hover     { background: #4A5568; }
.rm-btn-green    { background: #16A34A; color: #fff; }
.rm-btn-green:hover    { background: #15803D; }
.rm-btn-primary  { background: #0D6EFD; color: #fff; }
.rm-btn-primary:hover  { background: #0B5ED7; }
.rm-btn-success  { background: #16A34A; color: #fff; }
.rm-btn-success:hover  { background: #15803D; }
.rm-btn-danger   { background: #DC2626; color: #fff; }
.rm-btn-danger:hover   { background: #B91C1C; }
.rm-btn-secondary { background: #718096; color: #fff; }
.rm-btn-secondary:hover { background: #4A5568; }
.rm-btn-outline  { background: transparent; color: #0D6EFD; border: 1px solid #0D6EFD; }
.rm-btn-outline:hover  { background: #0D6EFD; color: #fff; }
.rm-btn:disabled { opacity: .5; cursor: not-allowed; }
.rm-btn-sm { padding: 4px 12px; font-size: 11px; }

/* --- Badges --- */
.rm-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: 10px; font-weight: 600; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.rm-badge-info    { background: #DBEAFE; color: #1D4ED8; }
.rm-badge-ok      { background: #DCFCE7; color: #16A34A; }
.rm-badge-overload { background: #FEE2E2; color: #DC2626; }
.rm-badge-warning  { background: #FEF3C7; color: #D97706; }

/* --- Select --- */
.rm-select { padding: 5px 28px 5px 10px; font-size: 12px; border: 1px solid #D6DCE5; border-radius: 4px; background: #fff; color: #1a1a2e; font-weight: 600; appearance: auto; }

/* --- Status Dot --- */
.rm-status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rm-status-dot.online  { background: #16A34A; }
.rm-status-dot.offline { background: #DC2626; }

/* --- Form Labels --- */
.rm-form-label { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; color: #718096; letter-spacing: 0.5px; margin-bottom: 4px; }

/* --- Filter Labels & Inputs --- */
.rm-filter-label { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; color: #718096; letter-spacing: 0.5px; margin-bottom: 4px; }
.rm-filter-select { width: 100%; padding: 7px 10px; font-size: 12px; border: 1px solid #D6DCE5; border-radius: 4px; background: #fff; color: #1a1a2e; font-family: inherit; outline: none; transition: border-color .12s; }
.rm-filter-select:focus { border-color: #0D6EFD; box-shadow: 0 0 0 2px rgba(13,110,253,.15); }

/* --- Report Type List --- */
.rm-rt-item { display: block; width: 100%; padding: 10px 14px; font-size: 12px; font-weight: 500; color: #4A5568; background: #fff; border: none; border-bottom: 1px solid #ECF0F5; text-align: left; cursor: pointer; transition: background .12s, color .12s; }
.rm-rt-item:last-child { border-bottom: none; }
.rm-rt-item:hover { background: #F0F4F8; color: #1a1a2e; }
.rm-rt-item.active { background: #0D6EFD; color: #fff; font-weight: 600; }

/* --- Empty State --- */
.rm-empty-state { text-align: center; color: #A0AEC0; }
.rm-empty-state i { font-size: 32px; display: block; margin-bottom: 8px; }
.rm-empty-title { font-size: 13px; font-weight: 600; color: #4A5568; margin-bottom: 4px; }
.rm-empty-desc { font-size: 12px; color: #A0AEC0; }

/* --- Tab Pills (Settings) --- */
.rm-tab-pills .nav-link { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12px; font-weight: 600; color: #4A5568; background: transparent; border: none; border-bottom: 1px solid #ECF0F5; text-align: left; cursor: pointer; transition: background .12s, color .12s; border-radius: 0; }
.rm-tab-pills .nav-link:last-child { border-bottom: none; }
.rm-tab-pills .nav-link:hover { background: #F0F4F8; color: #1a1a2e; }
.rm-tab-pills .nav-link.active { background: #0D6EFD; color: #fff; font-weight: 600; }

/* --- Modal --- */
.rm-modal { background: #fff; border: 1px solid #D6DCE5; border-radius: 8px; overflow: hidden; }
.rm-modal .modal-header { background: #0D4A8A; color: #fff; padding: 10px 14px; border-bottom: none; }
.rm-modal .modal-header h6 { margin: 0; font-size: 13px; font-weight: 700; color: #fff; }
.rm-modal .modal-body { padding: 14px; }
.rm-modal .modal-footer { padding: 10px 14px; border-top: 1px solid #ECF0F5; }

/* --- Scrollbar --- */
.rm-table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.rm-table-scroll::-webkit-scrollbar-track { background: transparent; }
.rm-table-scroll::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 3px; }

/* --- Responsive: sidebar offcanvas on small screens --- */
@media (max-width: 991.98px) {
  .rm-sidebar { display: none; }
  .rm-sidebar.offcanvas-show { display: flex; position: fixed; top: 49px; left: 0; bottom: 0; width: 200px; z-index: 1045; background: #fff; border-right: 1px solid #D6DCE5; box-shadow: 4px 0 12px rgba(0,0,0,.12); }
  .rm-sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1040; }
  .rm-sidebar-backdrop.show { display: block; }
}

/* --- Responsive: summary cards --- */
@media (max-width: 767.98px) {
  .rm-summary-row { flex-wrap: wrap; }
  .rm-summary-card { flex-basis: calc(50% - 6px); }
}
@media (max-width: 575.98px) {
  .rm-summary-card { flex-basis: 100%; }
  .rm-bottom-grid { grid-template-columns: 1fr; }
}

/* --- Print --- */
@media print {
  .rm-top-strip, .rm-header, .rm-sidebar { display: none !important; }
  .rm-content { padding: 0; }
}
