  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #f4f6fb; --card: #ffffff;
    --border: #e8ecf4; --text: #1a1d2e; --text-secondary: #6b7280;
    --text-muted: #9ca3af; --blue: #2563eb; --blue-light: #eff6ff;
    --blue-mid: #bfdbfe; --green: #10b981; --green-light: #d1fae5;
    --orange: #f59e0b; --orange-light: #fef3c7;
    --red: #ef4444; --red-light: #fee2e2;
    --purple: #8b5cf6; --purple-light: #ede9fe;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
  }

  /* TOP BAR */
  .topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
  }
  .topbar-left  { display: flex; align-items: center; gap: 12px; }
  .topbar-icon  { width: 38px; height: 38px; background: var(--orange-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
  .topbar-title h1 { font-size: 20px; font-weight: 700; }
  .topbar-title p  { font-size: 12.5px; color: var(--text-secondary); margin-top: 1px; }
  .topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    font-family: inherit; border: 1px solid var(--border);
    background: var(--card); color: var(--text);
    transition: background .15s; white-space: nowrap;
    touch-action: manipulation;
  }
  .btn:hover { background: var(--bg); }
  .btn-arrow  { padding: 7px 10px; font-size: 16px; font-weight: 700; }

  /* BODY LAYOUT */
  .body-wrap { display: flex; min-height: 0; flex: 1; }
  .center-col { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
  .right-col  { width: 280px; border-left: 1px solid var(--border); background: var(--card); overflow-y: auto; flex-shrink: 0; }

  /* CONTENT AREA */
  .content { flex: 1; padding: 20px 24px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }

  /* LOADING / ERROR */
  .loading-overlay { display: flex; align-items: center; justify-content: center; padding: 80px; color: var(--text-muted); font-size: 15px; gap: 12px; }
  .spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
  .error-box { background: var(--red-light); border: 1px solid #fca5a5; border-radius: var(--radius); padding: 16px 20px; color: var(--red); font-size: 13.5px; }

  /* STAT CARDS */
  .stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; flex-shrink: 0; }
  .stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; transition: box-shadow .2s, transform .2s; animation: fadeUp .3s ease both; }
  .stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
  .stat-icon  { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
  .stat-label { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; margin-bottom: 3px; }
  .stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
  .stat-sub   { font-size: 11.5px; margin-top: 3px; }

  /* FILTER BAR */
  .filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-shrink: 0; flex-wrap: wrap; }

  /* TAB BAR — scrollable, no visible scrollbar */
  .tab-underline {
    display: flex;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge */
  }
  .tab-underline::-webkit-scrollbar { display: none; } /* Chrome/Safari */
  .tab-underline .tab {
    border-radius: 0; border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 10px 16px; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); cursor: pointer;
    white-space: nowrap; transition: all .15s;
    touch-action: manipulation; flex-shrink: 0;
  }
  .tab-underline .tab:hover { color: var(--text); }
  .tab-underline .tab.active { border-bottom-color: var(--blue); color: var(--blue); font-weight: 600; background: none; }

  .search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; min-width: 220px; max-width: 100%; }
  .search-box input { border: none; background: transparent; font-family: inherit; font-size: 13px; color: var(--text); outline: none; flex: 1; min-width: 0; }
  .search-box input::placeholder { color: var(--text-muted); }

  /* TABLE CARD */
  .table-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: visible; display: flex; flex-direction: column; flex: 1; min-height: 0; }

  /* TABLE SCROLL WRAPPER — horizontal scroll on all sizes */
  .table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }
  .table-scroll table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* prevents columns from crushing on mobile */
  }
  .table-scroll thead th {
    padding: 10px 14px; text-align: left;
    font-size: 11px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .05em;
    background: var(--bg); border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky; top: 0; z-index: 5;
  }
  tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: #fafbff; }
  td { padding: 14px; vertical-align: top; }

  /* TABLE CELLS */
  .auction-cell  { display: flex; align-items: flex-start; gap: 10px; }
  .auction-thumb { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
  .auction-name     { font-weight: 700; font-size: 13.5px; margin-bottom: 1px; }
  .auction-provider { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
  .auction-date     { font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px; font-family: 'DM Mono', monospace; }
  .auction-tag      { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: var(--green-light); color: var(--green); }
  .winner-name  { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
  .winner-email { font-size: 12px; color: var(--text-secondary); }
  .winner-phone { font-size: 12px; color: var(--text-muted); font-family: 'DM Mono', monospace; margin-top: 1px; }
  .winning-badge { display: inline-block; background: var(--green-light); color: var(--green); font-size: 10px; font-weight: 700; border-radius: 5px; padding: 2px 7px; margin-top: 5px; }
  .bid-big   { font-size: 18px; font-weight: 700; color: var(--blue); margin-bottom: 2px; }
  .bid-label { font-size: 11.5px; color: var(--text-muted); }
  .slot-badge  { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 6px; margin-bottom: 5px; }
  .slot-green  { background: var(--green-light); color: var(--green); }
  .slot-orange { background: var(--orange-light); color: var(--orange); }
  .slot-date   { font-size: 12px; color: var(--text-secondary); margin-bottom: 1px; }
  .slot-time   { font-size: 12px; color: var(--text-muted); font-family: 'DM Mono', monospace; }
  .remind-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--blue); cursor: pointer; margin-top: 5px; font-weight: 500; }
  .remind-link:hover { text-decoration: underline; }
  .remind-sent { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); margin-top: 5px; font-weight: 500; cursor: not-allowed; }
  .pay-badge     { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; margin-bottom: 5px; }
  .pay-paid      { background: var(--green-light); color: var(--green); }
  .pay-pending   { background: var(--orange-light); color: var(--orange); }
  .pay-cancelled { background: #f3f4f6; color: var(--text-muted); }
  .pay-detail    { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 1px; }
  .pay-txn       { font-size: 11px; color: var(--text-muted); font-family: 'DM Mono', monospace; margin-top: 2px; }
  .pay-link      { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--blue); cursor: pointer; margin-top: 4px; font-weight: 500; }
  .booking-badge  { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; margin-bottom: 5px; }
  .book-completed { background: var(--green-light); color: var(--green); }
  .book-confirmed { background: var(--blue-light); color: var(--blue); }
  .book-pending   { background: #f3f4f6; color: var(--text-secondary); }
  .book-detail    { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 1px; }
  .actions-col  { display: flex; flex-direction: column; gap: 6px; }
  .btn-view-sm  { background: var(--red); color: #fff; border: none; border-radius: 7px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; white-space: nowrap; touch-action: manipulation; }
  .btn-view-sm:hover { background: #dc2626; }

  /* PAGINATION */
  .pagination { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
  .page-btns { display: flex; gap: 4px; flex-wrap: wrap; }
  .page-btn  { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: var(--card); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); transition: all .15s; touch-action: manipulation; }
  .page-btn:hover  { background: var(--bg); }
  .page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
  .rows-sel { font-family: inherit; font-size: 13px; border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px; background: var(--card); color: var(--text); cursor: pointer; }

  /* PENDING SECTION */
  .section-label { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
  .pending-table-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; animation: fadeUp .4s ease both; animation-delay: .2s; }
  .pending-table-card thead th { background: #fffbf0; }
  .time-elapsed   { color: var(--red); font-weight: 700; font-size: 13px; font-family: 'DM Mono', monospace; }
  .btn-remind     { display: inline-flex; align-items: center; gap: 5px; background: var(--blue-light); color: var(--blue); border: 1px solid var(--blue-mid); border-radius: 7px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; touch-action: manipulation; }
  .btn-remind:hover { background: var(--blue-mid); }
  .btn-cancel-win { display: inline-flex; align-items: center; gap: 5px; background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; border-radius: 7px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; touch-action: manipulation; }
  .btn-cancel-win:hover { background: #fecaca; }
  .empty-row td { text-align: center; padding: 40px; color: var(--text-muted); font-style: italic; font-size: 13.5px; }

  /* RIGHT PANEL */
  .right-section { padding: 18px; border-bottom: 1px solid var(--border); }
  .right-title   { font-size: 13.5px; font-weight: 700; margin-bottom: 14px; }
  .right-title span { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 4px; }
  .donut-wrap   { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
  .donut-svg    { width: 90px; height: 90px; flex-shrink: 0; }
  .donut-legend { flex: 1; }
  .legend-row   { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-bottom: 7px; }
  .legend-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .legend-label { flex: 1; color: var(--text-secondary); }
  .legend-count { font-weight: 700; font-size: 12px; }
  .legend-pct   { color: var(--text-muted); font-size: 11px; margin-left: 2px; }
  .status-row   { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
  .status-row:last-child { border-bottom: none; }
  .status-dot   { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .status-pct   { color: var(--text-muted); font-size: 12px; }
  .status-count { font-weight: 700; }
  .recent-item  { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .recent-item:last-child { border-bottom: none; }
  .recent-icon  { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex-shrink: 0; }
  .recent-name  { font-size: 13px; font-weight: 600; }
  .recent-sub   { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }
  .recent-time  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
  .completed-tag { font-size: 11px; font-weight: 600; color: var(--green); background: var(--green-light); border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
  .view-all-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--blue); cursor: pointer; margin-top: 12px; font-weight: 500; }
  .view-all-link:hover { text-decoration: underline; }
  .right-empty  { font-size: 12.5px; color: var(--text-muted); font-style: italic; }

  #main-content     { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
  #main-table-card  { flex: 1; min-height: 0; display: flex; flex-direction: column; }

  /* ANIMATIONS */
  @keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
  @keyframes spin   { to { transform: rotate(360deg); } }
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

  /* ── RIGHT PANEL TOGGLE (hidden on desktop) ── */
  .right-panel-toggle {
    display: none;
    align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    font-family: inherit; border: 1px solid var(--border);
    background: var(--card); color: var(--text);
    transition: background .15s; touch-action: manipulation;
  }
  .right-panel-toggle:hover { background: var(--bg); }

  /* ── TABLET ≤1100px ── */
  @media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }

    .right-col {
      position: fixed;
      top: 0; right: 0;
      height: 100vh;
      z-index: 300;
      transform: translateX(110%);
      transition: transform .25s ease;
      box-shadow: -4px 0 24px rgba(0,0,0,.12);
    }
    .right-col.open { transform: translateX(0); }
    .right-panel-toggle { display: inline-flex; }
    .right-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,.3); z-index: 299;
      backdrop-filter: blur(2px);
    }
    .right-overlay.open { display: block; }
  }

  /* ── PHONE ≤640px ── */
  @media (max-width: 640px) {
    .topbar { padding: 12px 16px; }
    .topbar-title p  { display: none; }
    .topbar-title h1 { font-size: 17px; }
    .content { padding: 14px 16px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .stat-card { padding: 13px; }
    .stat-value { font-size: 20px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 0; }
    .week-nav { flex-wrap: wrap; gap: 4px; }
    .pagination { flex-direction: column; align-items: flex-start; }
  }

  /* ── VERY SMALL ≤400px ── */
  @media (max-width: 400px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .btn-arrow { padding: 7px 8px; }
    #btn-period { min-width: 0; font-size: 12px; }
  }