:root{
  --bg:#0b0f17;
  --panel:#101827;
  --muted:#8aa0b6;
  --text:#e6eef7;
  --line:#1b2a3d;
  --pill:#162338;
  --good:#1ed760;
  --warn:#ffb020;
  --bad:#ff5c7a;
}

*{box-sizing:border-box}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.topbar{
  display:flex;
  gap:20px;
  align-items:flex-end;
  justify-content:flex-start;   /* ✅ key change */
  padding:16px 20px;
  border-bottom:1px solid var(--line);
  position:sticky;
  top:0;
  background:rgba(11,15,23,.92);
  backdrop-filter: blur(8px);
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:38px; height:38px; border-radius:10px;
  display:grid; place-items:center;
  background:linear-gradient(135deg,#2a76ff,#7c3aed);
  font-weight:800;
}
.title{font-size:18px; font-weight:700}
.subtitle{font-size:12px; color:var(--muted)}

/* NEW: top-right dropdown controls */
/* NEW: top-right dropdown controls (kept together) */
.top-controls{
  display:flex;
  align-items:flex-end;
  gap:12px;
  flex-wrap: nowrap;
  margin-left: 24px;
}

.ctrl{
  display:flex;
  flex-direction:column;
  gap:6px;

  /* slightly smaller so they don't force wrap */
  min-width: 150px;
}

@media (max-width: 980px){
  /* allow wrapping only on smaller screens */
  .top-controls{
    flex-wrap: wrap;
  }
  .ctrl{
    min-width: 140px;
  }
}

.ctrl-label{
  font-size:11px;
  color:var(--muted);
  line-height: 1;
}
.ctrl-select{
  background:var(--panel);
  border:1px solid var(--line);
  color:var(--text);
  padding:8px 10px;
  border-radius:12px;
  cursor:pointer;
}

.container{max-width:1200px; margin:0 auto; padding:18px}

.kpis{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:12px;
  margin-bottom:14px;
}
.kpi{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
}
.kpi-label{font-size:12px; color:var(--muted)}
.kpi-value{font-size:18px; font-weight:800; margin-top:6px}
.kpi-sub{font-size:12px; color:var(--muted); margin-top:2px}

.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
}
.panel-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 14px;
  border-bottom:1px solid var(--line);
}
.panel-title{font-weight:800}
.btn{
  background:#18253a; border:1px solid var(--line); color:var(--text);
  padding:8px 10px; border-radius:10px; cursor:pointer;
}
.btn:hover{filter:brightness(1.08)}

.filters{
  display:flex; gap:12px; flex-wrap:wrap;
  padding:12px 14px; border-bottom:1px solid var(--line);
}
.field{display:flex; flex-direction:column; gap:6px}
label{font-size:12px; color:var(--muted)}
input, select{
  background:#0e1624; border:1px solid var(--line); color:var(--text);
  padding:9px 10px; border-radius:10px; min-width:180px;
}
input{min-width:260px}

.table-wrap{overflow:auto}
.tbl{width:100%; border-collapse:collapse}
.tbl th, .tbl td{
  padding:10px 10px;
  border-bottom:1px solid var(--line);
  text-align:left;
  font-size:13px;
  white-space:nowrap;
}
.tbl th{color:#cfe0f1; font-size:12px; text-transform:uppercase; letter-spacing:.06em}
.tbl tr:hover td{background:rgba(255,255,255,.02)}
.muted{color:var(--muted)}

.pill{
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  border: 1.5px solid;
  display: inline-block;
}

/* GOOD (low premium) — strong green */
.pill.good{
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
  border-color: #2ecc71;
  box-shadow: 0 0 6px rgba(46,204,113,.4);
}

/* WARN (mid premium) — strong amber */
.pill.warn{
  color: #f5b041;
  background: rgba(245, 176, 65, 0.15);
  border-color: #f5b041;
  box-shadow: 0 0 6px rgba(245,176,65,.4);
}

/* BAD (high premium) — strong red */
.pill.bad{
  color: #ff5c7a;
  background: rgba(255, 92, 122, 0.15);
  border-color: #ff5c7a;
  box-shadow: 0 0 6px rgba(255,92,122,.4);
}

a{color:#8ab4ff; text-decoration:none}
a:hover{text-decoration:underline}

.footnote{
  margin-top:18px;
  padding:18px 20px;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

@media (max-width: 980px){
  .kpis{grid-template-columns: 1fr 1fr}
  input{min-width:200px}
  .ctrl{min-width: 140px}
}

/* --- brighter blue price update flash --- */
@keyframes flashBg {
  0% { background-color: rgba(20, 90, 220, 0.65); }
  40% { background-color: rgba(20, 90, 220, 0.35); }
  100% { background-color: transparent; }
}
.flash {
  animation: flashBg 3.0s ease-out;
  border-radius: 10px;
}

.logo-img { height: 40px; width: auto; }

/* ---------- About Section ---------- */
.about{
  margin-top: 40px;
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
.about-inner{
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}
.about h2{
  font-size: 15px;
  margin-bottom: 16px;
  font-weight: 800;
}
.about p{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 14px;
}
.about-foot{
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.85;
}

.hidden { display: none !important; }

/* ---------- Pagination ---------- */
.pager{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  padding:12px 14px;
  border-top:1px solid var(--line);
}
.pager-mid{
  min-width: 220px;
  text-align:center;
}
.btn:disabled,
.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
}

/* ---------- WRAP long product + ETA (override table nowrap) ---------- */
.product-col,
.product-col a{
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.eta-col{
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
  max-width: 360px; /* stop ETA from forcing huge width */
}

/* --- Mobile / small screens: keep logo at the TOP --- */
@media (max-width: 980px){
  .topbar{
    align-items: flex-start;   /* move brand/logo to top */
  }

  .brand{
    align-self: flex-start;    /* ensure brand stays top */
  }
}

@media (max-width: 980px){
  .top-controls{
    align-items: flex-start;
  }
}

/* ---------- Welcome (vendor not selected) ---------- */
.welcome{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 320px;
}

.welcome-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  max-width: 680px;
  width: 100%;
  text-align: center;
}

.welcome-title{
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 8px;
}

.welcome-sub{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.ctrl-select:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}


/* ---------- Mobile header layout: use top space better ---------- */
@media (max-width: 720px){
  .topbar{
    align-items: flex-start;     /* key: don't vertically center */
    padding: 10px 12px;          /* reduce topbar height */
  }

  .top-controls{
    align-items: flex-start;     /* key: don't align to bottom */
    margin-top: 0;
  }

  .brand{
    align-items: flex-start;
  }

  /* optional: slightly tighter brand so more room for controls */
  .logo-img{ height: 32px; }
  .title{ font-size: 16px; }
  .subtitle{ font-size: 11px; }
}

/* ---------- Mobile header: Vendor primary, Metal/Mode secondary ---------- */
@media (max-width: 720px){

  /* turn header into vertical layout */
  .topbar{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  /* brand row */
  .brand{
    width: 100%;
    align-items: center;
    gap: 10px;
  }

  /* controls become a grid */
  .top-controls{
    width: 100%;
    margin-left: 0;             /* IMPORTANT: remove desktop offset */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: start;
  }

  /* Vendor spans full width and looks primary */
  .top-controls .ctrl:nth-child(1){
    grid-column: 1 / -1;
  }

  /* make Vendor select larger */
  .top-controls .ctrl:nth-child(1) .ctrl-select{
    padding: 12px 12px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
  }

  /* Metal & Mode secondary sizing */
  .top-controls .ctrl:nth-child(2) .ctrl-select,
  .top-controls .ctrl:nth-child(3) .ctrl-select{
    padding: 9px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.95;
  }

  /* prevent min-width from forcing weird spacing */
  .ctrl{
    min-width: 0;
  }

  /* slightly tighten labels */
  .ctrl-label{
    font-size: 10px;
    margin-left: 2px;
  }

  /* tighten logo/title a bit */
  .logo-img{ height: 32px; }
  .title{ font-size: 16px; }
  .subtitle{ font-size: 11px; }
}

/* ===== Mobile/Tablet header overhaul (strong override) ===== */
@media (max-width: 980px){

body{ outline: 6px solid #ff00ff !important; }

  .topbar{
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 10px 12px !important;
  }

  .brand{
    width: 100% !important;
    align-items: center !important;
  }

  .top-controls{
    width: 100% !important;
    margin-left: 0 !important;         /* IMPORTANT */
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    align-items: start !important;
  }

  /* Vendor = primary (full width) */
  .top-controls .ctrl:nth-child(1){
    grid-column: 1 / -1 !important;
  }

  .top-controls .ctrl:nth-child(1) .ctrl-select{
    padding: 12px 12px !important;
    border-radius: 14px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
  }

  /* Metal + Mode = secondary */
  .top-controls .ctrl:nth-child(2) .ctrl-select,
  .top-controls .ctrl:nth-child(3) .ctrl-select{
    padding: 9px 10px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    opacity: 0.95 !important;
  }

  .ctrl{ min-width: 0 !important; }

  .logo-img{ height: 32px !important; }
  .title{ font-size: 16px !important; }
  .subtitle{ font-size: 11px !important; }
}

/* ===== Mobile filters: make Search primary, others secondary ===== */
@media (max-width: 980px){

  /* the filter row itself */
  .filters{
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    padding: 12px 12px !important;
  }

  /* stop your global min-width rules from forcing wide controls */
  .filters .field,
  .filters input,
  .filters select{
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Search = full width (first field in your HTML) */
  .filters .field:nth-child(1){
    grid-column: 1 / -1 !important;
  }

  /* Bigger tap targets */
  .filters input,
  .filters select{
    padding: 12px 12px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
  }

  .filters label{
    font-size: 11px !important;
    margin-bottom: 2px !important;
  }

  /* Optional: Search looks slightly more "primary" */
  .filters .field:nth-child(1) input{
    font-size: 15px !important;
    font-weight: 650 !important;
  }
}

/* ===== Fix ETA wrapping on mobile (prevent vertical letter stacking) ===== */
.eta-col{
  /* override your current "anywhere" behavior */
  overflow-wrap: break-word !important;
  word-break: normal !important;
  white-space: normal !important;
  hyphens: auto;
}

/* nicer alignment for wrapped cells */
.tbl td{ vertical-align: top; }

/* mobile: stop ETA column from collapsing too narrow */
@media (max-width: 980px){
  .eta-col{
    min-width: 220px;   /* tweak: 200–280 depending on your taste */
    max-width: 360px;
  }
}

/* ===== Mobile: widen PRODUCT column ===== */
@media (max-width: 980px){

  /* Allow table to auto-adjust column width */
  .tbl{
    table-layout: auto !important;
  }

  /* Let PRODUCT column grow */
  .product-col{
    min-width: 180px !important;   /* adjust 160–220 if needed */
    max-width: 240px !important;
  }

  /* Allow wrapping properly */
  .product-col,
  .product-col a{
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.3;
  }

  /* Reduce less important columns slightly */
  .tbl td:not(.product-col){
    font-size: 12px;
  }
}
