:root{
  --bg: #0b1220;
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --brand: #7c3aed;
  --danger:#ef4444;
  --shadow: 0 18px 60px rgba(0,0,0,0.45);
  --shadow2: 0 10px 25px rgba(0,0,0,0.28);
  --radius: 18px;
  --ring: 0 0 0 4px rgba(124,58,237,0.25);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 10% 10%, rgba(124,58,237,0.35), transparent 55%),
    radial-gradient(1000px 600px at 90% 20%, rgba(34,197,94,0.18), transparent 55%),
    radial-gradient(900px 500px at 50% 90%, rgba(59,130,246,0.16), transparent 60%),
    linear-gradient(180deg, #070b14 0%, #0b1220 60%, #070b14 100%);
  overflow-x:hidden;
}

.container{
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 18px 40px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(14px);
}

.brand{ display:flex; align-items:center; gap:12px; }
.dot{
  width: 14px; height:14px; border-radius:999px;
  background: radial-gradient(circle at 30% 30%, #c4b5fd 0%, var(--brand) 55%, #4c1d95 100%);
  box-shadow: 0 0 0 5px rgba(124,58,237,0.16);
}
.brandTitle{ font-weight:900; font-size:18px; }
.brandSub{ font-size:12px; color:var(--muted); margin-top:1px; }

.topActions{ display:flex; align-items:center; gap:10px; }

.pill{
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.25);
  color: var(--muted);
}
.pill.good{ color: rgba(34,197,94,0.95); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); }
.pill.bad{ color: rgba(239,68,68,0.95); border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }

.grid{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  margin-top: 16px;
}
@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
}

.col{ display:flex; flex-direction: column; gap: 18px; }

.card{
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.05));
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(14px);
}

.card h2{ margin: 0 0 10px; font-size: 16px; }
.miniHint{ font-size: 12px; margin-left: 10px; color: var(--muted); font-weight: 500; }

.muted{ color: var(--muted); margin: 10px 0 0; font-size: 13px; line-height: 1.35; }

.row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.uploadBox{ display:flex; gap: 10px; align-items:center; }

input{
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
input:focus{ border-color: rgba(124,58,237,.55); box-shadow: var(--ring); }

button{
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(124,58,237,.95), rgba(124,58,237,.65));
  color: #fff;
  font-weight: 800;
  padding: 11px 14px;
  border-radius: 12px;
  cursor:pointer;
  box-shadow: 0 10px 20px rgba(124,58,237,0.22);
  white-space: nowrap;
}
button.ghost{
  background: rgba(255,255,255,0.06);
  box-shadow: none;
  color: var(--text);
}
#btnLogout{
  background: rgba(239,68,68,0.12);
  box-shadow: none;
  border-color: rgba(239,68,68,0.35);
}

/* ===== Results Table Shell ===== */
.tableShell{
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  overflow: hidden; /* keep clean */
}

/* ✅ NO HORIZONTAL SCROLL. Fit everything in the card. */
.wideTable{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* KEY: forces columns to fit */
}

/* Compact sizing */
.wideTable.compact thead th{
  background: rgba(0,0,0,0.72);
  font-size: 11px;
  letter-spacing: .5px;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  padding: 8px 8px;             /* smaller */
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.wideTable.compact td{
  padding: 8px 8px;             /* smaller */
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;              /* smaller */
  color: rgba(255,255,255,0.86);
  vertical-align: top;
}

/* Hover */
.wideTable tbody tr:hover{ background: rgba(255,255,255,0.04); }

/* ✅ Column widths (must add to 100%) */
.colChk{ width: 36px; }
.colDate{ width: 110px; }
.colPartner{ width: 160px; }
.colCode{ width: 110px; }
.colQty{ width: 70px; text-align: right; }
.colName{ width: auto; }

/* Make long text wrap INSIDE cells so nothing is hidden */
.wideTable td, .wideTable th{
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
}

.wideTable .colName,
.wideTable td:nth-child(5){
  white-space: normal;       /* allow wrap for item name */
  line-height: 1.15;
}

.wideTable td:nth-child(3){ /* partner */
  white-space: normal;
  line-height: 1.15;
}

.wideTable td:nth-child(4){ /* item code */
  font-weight: 800;
  letter-spacing: .2px;
}

/* Qty stronger + aligned */
.wideTable td:nth-child(6){
  text-align: right;
  font-weight: 900;
}

/* Actions bar compact + wrap so it always fits */
.tableActions{
  margin: 10px 10px 12px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;           /* KEY */
}

.tableActions .left{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

.tableActions .right{
  display:flex;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;           /* KEY */
}

/* Make action buttons smaller so they fit */
.compactActions button{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

/* Footer note */
.footerNote{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.10);
}

/* ===== Checkbox styling (small squares) ===== */
input[type="checkbox"]{
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.25);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  vertical-align: middle;
}
input[type="checkbox"]::before{
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  transform: scale(0);
  transition: transform 120ms ease-in-out;
  background: rgba(130,90,255,0.95);
}
input[type="checkbox"]:checked::before{ transform: scale(1); }
input[type="checkbox"]:hover{ border-color: rgba(255,255,255,0.6); }

/* Mobile: make it even tighter */
@media (max-width: 520px){
  .colPartner{ width: 130px; }
  .colDate{ width: 96px; }
  .colCode{ width: 96px; }
  .colQty{ width: 60px; }
  .wideTable.compact td{ font-size: 11px; padding: 7px 6px; }
}
/* ===== MODALS ===== */
.primaryWide{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 900;
}

.modalOverlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  z-index: 9999;
  padding: 18px;
}

.modalOverlay.show{ display: flex; }

.modalCard{
  width: min(640px, 96vw);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(20, 16, 40, .95);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.modalHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.modalTitle{
  font-size: 18px;
  font-weight: 1000;
}

.modalSub{
  font-size: 12px;
  opacity: .75;
  margin-top: 2px;
}

.modalBody{
  padding: 16px;
}

.modalFooter{
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.iconBtn{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  font-weight: 900;
  cursor: pointer;
}
