/* EasyReturns portal — brand: blue #227BC3, navy #003B77, red #FE2A5C, white.
   Fonts: League Spartan (headings, the website's "Spartan") + Poppins (body). */

:root {
  --blue: #227BC3;
  --navy: #003B77;
  --red: #FE2A5C;
  --red-dark: #d81b48;
  --ink: #0f1d33;
  --muted: #5b6577;
  --line: #dfe5ee;
  --bg: #f3f6fa;
  --card: #ffffff;
  --blue-soft: #e8f2fb;
  --red-soft: #ffe9ef;
  --green: #1f8a4c;
  --green-soft: #e3f5ea;
  --amber: #a86200;
  --amber-soft: #fff3df;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 29, 51, .06), 0 4px 14px rgba(15, 29, 51, .05);
  --font-head: "League Spartan", "Poppins", system-ui, sans-serif;
  --font-body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
}
a { color: var(--blue); }
a:hover { color: var(--navy); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-head); color: var(--navy); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code { background: var(--blue-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* ---------- Top bar & nav ---------- */
.topbar { background: #fff; border-bottom: 4px solid var(--blue); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; max-width: 1200px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 170px; height: auto; display: block; }
.brand-tag { background: var(--navy); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; letter-spacing: .04em; text-transform: uppercase; }
.nav-toggle { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; font: 500 14px var(--font-body); color: var(--navy); cursor: pointer; }
.mainnav { display: none; flex-direction: column; padding: 0 16px 12px; max-width: 1200px; margin: 0 auto; }
.mainnav.open { display: flex; }
.mainnav a { padding: 10px 4px; text-decoration: none; color: var(--ink); font-weight: 500; border-bottom: 1px solid var(--line); }
.mainnav a.active { color: var(--red); }
.nav-user { padding: 10px 4px; color: var(--muted); font-size: 14px; }
.nav-user a { border: 0; padding: 0; display: inline; color: var(--blue); }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 0 max(16px, calc((100vw - 1200px) / 2)); }
  .topbar-inner { padding: 12px 0; margin: 0; }
  .mainnav { display: flex; flex-direction: row; align-items: center; gap: 4px; padding: 0; margin: 0; flex-wrap: wrap; }
  .mainnav a { border: 0; padding: 8px 10px; border-radius: 6px; font-size: 14px; }
  .mainnav a:hover { background: var(--blue-soft); }
  .mainnav a.active { background: var(--red-soft); }
  .nav-user { margin-left: 8px; font-size: 13px; }
}

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 40px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* ---------- Stat tiles (action queue) ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; text-decoration: none; color: var(--ink); border-top: 4px solid var(--blue); display: block; }
.stat:hover { transform: translateY(-1px); }
.stat .n { font: 700 2rem/1 var(--font-head); color: var(--navy); }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat.attn { border-top-color: var(--red); }
.stat.attn .n { color: var(--red); }
.stat.warn { border-top-color: #e89a1c; }
.stat.ok { border-top-color: var(--green); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; background: var(--red); color: #fff;
  font: 600 14px var(--font-body); padding: 10px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { background: var(--red-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { background: var(--blue-soft); color: var(--navy); }
.btn-blue { background: var(--blue); }
.btn-blue:hover { background: var(--navy); }
.btn-danger { background: #fff; color: var(--red-dark); border-color: #f3b4c3; }
.btn-danger:hover { background: var(--red-soft); color: var(--red-dark); }
.btn-sm { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #c9d3e1; border-radius: 8px; font: 400 15px var(--font-body); color: var(--ink); background: #fff; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.form-grid { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-bottom: 8px; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; color: var(--navy); }

/* Big tap-friendly choice chips (intake on phones) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { margin: 0; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 9px 14px; border: 1px solid #c9d3e1; border-radius: 99px; background: #fff; font-weight: 500; cursor: pointer; }
.chips input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips input:focus-visible + span { outline: 2px solid var(--blue); }

/* Disposition picker */
.dispositions { display: grid; gap: 8px; }
@media (min-width: 640px) { .dispositions { grid-template-columns: 1fr 1fr; } }
.disp { position: relative; margin: 0; }
.disp input { position: absolute; opacity: 0; }
.disp .box { display: block; border: 1px solid #c9d3e1; border-radius: 8px; padding: 10px 12px; cursor: pointer; background: #fff; height: 100%; }
.disp .box strong { display: block; color: var(--navy); }
.disp .box small { display: block; font-weight: 400; }
.disp input:checked + .box { border-color: var(--red); box-shadow: 0 0 0 2px var(--red) inset; background: var(--red-soft); }
.disp input:focus-visible + .box { outline: 2px solid var(--blue); }
.disp.locked .box { opacity: .55; cursor: not-allowed; background: #f6f7f9; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #fafcff; }
table.list .thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--blue-soft); display: block; }
table.list .chk { width: 36px; }
table.list .chk input { width: 18px; height: 18px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; font-weight: 500; }

/* Card list for phones */
@media (max-width: 699px) {
  table.list.responsive thead { display: none; }
  table.list.responsive tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.list.responsive td { border: 0; padding: 0; }
  table.list.responsive td[data-hide-sm] { display: none; }
  table.list.responsive td.cell-thumb { grid-row: span 3; }
}

/* ---------- Badges, clocks, alerts ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--blue-soft); color: var(--navy); }
.badge-unmatched { background: var(--amber-soft); color: var(--amber); }
.badge-awaiting_instruction { background: var(--red-soft); color: var(--red-dark); }
.badge-instructed, .badge-in_progress { background: var(--blue-soft); color: var(--navy); }
.badge-on_hold { background: #efe8fb; color: #5b3aa0; }
.badge-pending_discard { background: #2a2b2b; color: #fff; }
.badge-completed { background: var(--green-soft); color: var(--green); }
.badge-plan { background: var(--navy); color: #fff; }
.badge-new { background: var(--red); color: #fff; font-size: 11px; padding: 2px 7px; vertical-align: 1px; }
.clock { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.clock-ok { color: var(--green); }
.clock-soon { color: var(--amber); }
.clock-urgent, .clock-expired { color: var(--red-dark); }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.alert-success { background: var(--green-soft); border-color: #b7e2c6; color: #145c33; }
.alert-error { background: var(--red-soft); border-color: #f6b8c7; color: #9c1236; }
.alert-warning { background: var(--amber-soft); border-color: #f2d29f; color: #7a4700; }
.alert-info { background: var(--blue-soft); border-color: #b9d6f0; color: var(--navy); }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* ---------- Photos ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gallery a { display: block; position: relative; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--blue-soft); display: block; }
.gallery .cap { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 59, 119, .85); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.doclist { list-style: none; margin: 0; padding: 0; }
.doclist li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.photo-input { border: 2px dashed #b9c8dc; border-radius: 10px; padding: 16px; text-align: center; background: #fbfdff; }
.photo-input input[type=file] { width: 100%; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 10px; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.picker-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.picker-buttons .btn { flex: 1 1 140px; max-width: 220px; }
.preview-tile { position: relative; }
.preview-file { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: 4px; border-radius: 6px; background: var(--blue-soft); font-size: 11px; word-break: break-all; overflow: hidden; }
.preview-remove { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; font-size: 16px; line-height: 24px; padding: 0; cursor: pointer; }
.picker-count { margin-top: 6px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.timeline .internal { color: var(--amber); font-size: 11px; font-weight: 600; }

/* ---------- Instruction progress ---------- */
.steps { display: flex; gap: 4px; margin: 10px 0 4px; }
.steps div { flex: 1; text-align: center; font-size: 12px; color: var(--muted); padding-top: 8px; border-top: 4px solid var(--line); }
.steps div.done { border-top-color: var(--green); color: var(--ink); }
.steps div.now { border-top-color: var(--blue); color: var(--ink); font-weight: 600; }

/* ---------- Bulk bar ---------- */
.bulkbar { position: sticky; bottom: 0; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 10px; display: none; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; z-index: 10; }
.bulkbar.show { display: flex; }
.bulkbar .btn-secondary { border-color: transparent; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 140px; flex: 1 1 160px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { text-decoration: none; padding: 7px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 13.5px; font-weight: 500; }
.tabs a.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs a .c { opacity: .7; margin-left: 4px; }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; margin: 16px 0; font-size: 14px; }

/* ---------- Bars (reports) ---------- */
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 110px 1fr 46px; gap: 8px; align-items: center; font-size: 13px; }
.bar .track { background: var(--blue-soft); border-radius: 4px; height: 14px; overflow: hidden; }
.bar .fill { background: var(--blue); height: 100%; border-radius: 4px; }
.meter { background: var(--blue-soft); border-radius: 99px; height: 10px; overflow: hidden; margin: 6px 0; }
.meter > div { height: 100%; background: var(--blue); }
.meter.over > div { background: var(--red); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--blue) 100%); }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }
.auth .logo { display: block; margin: 0 auto 18px; width: 220px; }
.auth h1 { text-align: center; font-size: 1.4rem; }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: 18px; }

/* ---------- Print (receiving report) ---------- */
@media print {
  .topbar, .footer, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
[hidden] { display: none !important; }
