:root {
    --maega-red: #C8102E;
    --maega-blue: #1F3E8F;
    --lth-red: #CC0000;
    --light-gray: #F4F6FB;
    --border: #DDE3EF;
    --text-main: #1A1A2E;
    --text-sec: #6B7A99;
    --white: #FFFFFF;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--light-gray); color: var(--text-main); min-height: 100vh; }

  /* ── HEADER ── */
  .header {
    background: linear-gradient(135deg, #0D1B4B 0%, #1F3E8F 60%, #C8102E 100%);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  }
  .header-inner {
    max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 28px; flex-wrap: wrap; gap: 16px;
  }
  .logo-maega img { height: 52px; object-fit: contain; }
  .header-title {
    text-align: center; flex: 1;
  }
  .header-title h1 {
    color: #fff; font-size: 19px; font-weight: 700; letter-spacing: 0.5px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
  }
  .header-title p {
    color: rgba(255,255,255,0.75); font-size: 12px; margin-top: 4px;
  }
  .logo-lth img { height: 52px; object-fit: contain; }

  /* ── TABS ── */
  .tabs {
    max-width: 1400px; margin: 20px auto 0; padding: 0 20px;
    display: flex; gap: 6px;
  }
  .tab-btn {
    padding: 10px 28px; border: none; border-radius: 8px 8px 0 0;
    font-size: 14px; font-weight: 600; cursor: pointer;
    background: rgba(31,62,143,0.12); color: var(--maega-blue);
    transition: all 0.2s;
  }
  .tab-btn.active {
    background: var(--white); color: var(--maega-blue);
    box-shadow: 0 -2px 8px rgba(31,62,143,0.12);
    border-bottom: 2px solid var(--white);
  }
  .tab-btn:hover:not(.active) { background: rgba(31,62,143,0.2); }

  /* ── CARD ── */
  .card {
    max-width: 1400px; margin: 0 auto 0; padding: 0 20px 24px;
  }
  .card-inner {
    background: var(--white); border-radius: 0 12px 12px 12px;
    box-shadow: 0 4px 24px rgba(31,62,143,0.10); overflow: hidden;
  }
  .tab-pane { display: none; }
  .tab-pane.active { display: block; }

  /* ── FILTER BAR ── */
  .filter-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 18px; background: var(--light-gray);
    border-bottom: 1px solid var(--border);
  }
  .filter-bar label { font-size: 12px; color: var(--text-sec); font-weight: 600; white-space: nowrap; }
  .filter-bar select, .filter-bar input {
    font-size: 13px; padding: 6px 10px; border: 1px solid var(--border);
    border-radius: 6px; background: #fff; color: var(--text-main);
    height: 32px; outline: none;
  }
  .filter-bar select:focus, .filter-bar input:focus { border-color: var(--maega-blue); }
  .search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
  .search-wrap input { width: 100%; padding-left: 32px; }
  .search-icon {
    position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
    color: var(--text-sec); font-size: 14px; pointer-events: none;
  }
  .clear-btn {
    font-size: 12px; padding: 6px 14px; border: 1px solid var(--border);
    border-radius: 6px; background: #fff; cursor: pointer; color: var(--text-sec);
    height: 32px; white-space: nowrap;
  }
  .clear-btn:hover { background: #f0f0f0; }

  /* ── TABLE ── */
  .tbl-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  thead tr {
    background: linear-gradient(90deg, var(--maega-blue) 0%, #163580 100%);
    position: sticky; top: 0; z-index: 2;
  }
  th {
    padding: 11px 12px; text-align: left; font-weight: 600; font-size: 12px;
    color: #fff; cursor: pointer; user-select: none; white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.1);
  }
  th:last-child { border-right: none; }
  th:hover { background: rgba(255,255,255,0.1); }
  th .sort-arrow { margin-left: 4px; opacity: 0.5; }
  th.sorted .sort-arrow { opacity: 1; }
  td {
    padding: 9px 12px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }
  tr:last-child td { border-bottom: none; }
  tbody tr:nth-child(even) { background: #F8F9FD; }
  tbody tr:hover { background: #EEF2FF; }
  td.marca { font-weight: 600; color: var(--maega-blue); }

  /* ── BADGES ── */
  .badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
  }
  .b-gas  { background: #FFF3CD; color: #856404; }
  .b-die  { background: #E8E8E8; color: #3D3D3D; }
  .b-both { background: #D4EDDA; color: #155724; }
  .b-bat  { background: #EEEDFE; color: #3C3489; font-family: monospace; font-size: 11px; }
  .b-agm  { background: #D0E8FF; color: #0C447C; font-family: monospace; font-size: 11px; }
  .b-none { color: #bbb; font-size: 12px; }

  /* ── STATS ── */
  .stats-bar {
    padding: 10px 18px; display: flex; gap: 20px; flex-wrap: wrap;
    background: var(--light-gray); border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-sec);
  }
  .stats-bar span b { color: var(--text-main); }

  /* ── FOOTER ── */
  footer {
    text-align: center; padding: 18px;
    font-size: 11px; color: var(--text-sec);
    background: var(--white); border-top: 1px solid var(--border);
    margin-top: 28px;
  }

  footer strong { color: var(--maega-blue); }

  /* ── NO RESULTS ── */

  /* ── MOTO TABLE SPECIFICS ── */
  .b-conv  { background: #FFF3CD; color: #856404; font-family: monospace; font-size: 11px; font-weight: 600; }
  .b-agm2  { background: #D0E8FF; color: #0C447C; font-family: monospace; font-size: 11px; font-weight: 600; }
  .b-seg   { background: #E8F5E9; color: #2E7D32; font-size: 11px; border-radius: 12px; padding: 2px 7px; }
  td.moto-marca { font-weight: 700; color: var(--maega-blue); }
  .moto-search-bar { gap: 14px; }

  .no-res {
    text-align: center; padding: 40px; color: var(--text-sec); font-size: 14px;
    display: none;
  }

  /* ── NOTE BOXES ── */
  .note-box {
    margin: 16px 18px; padding: 12px 16px;
    background: #FFF8E7; border-left: 4px solid #F0A500;
    border-radius: 6px; font-size: 12px; color: #6B4C00;
    display: flex; gap: 8px; align-items: flex-start;
  }

  /* ── MOBILE / iPHONE COMPATIBILITY ── */
  @viewport { width: device-width; }
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-overflow-scrolling: touch; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }
  
  @media (max-width: 768px) {
    .header-inner { padding: 12px 14px; gap: 10px; }
    .logo-maega img { height: 38px; }
    .logo-lth img   { height: 38px; }
    .header-title h1 { font-size: 13px; }
    .header-title p  { font-size: 10px; }
    .tabs { padding: 0 10px; gap: 4px; flex-wrap: wrap; }
    .tab-btn { padding: 8px 12px; font-size: 12px; }
    .card { padding: 0 10px 16px; }
    .filter-bar { padding: 10px 12px; gap: 8px; }
    .filter-bar label { display: none; }
    .filter-bar select, .filter-bar input { font-size: 14px; height: 36px; }
    .search-wrap { min-width: 160px; max-width: 100%; flex: 1 1 100%; }
    th { font-size: 11px; padding: 8px 8px; }
    td { font-size: 12px; padding: 7px 8px; white-space: normal; }
    .badge { font-size: 10px; padding: 2px 6px; }
    .stats-bar { font-size: 11px; gap: 12px; padding: 8px 12px; flex-wrap: wrap; }
    footer { font-size: 10px; }
    .note-box { margin: 10px 12px; font-size: 11px; }
  }
