/*
 * Kashef — Courier Matching Tool · styles
 * Design system container: 960px. Flat colours only — no gradients, no glow.
 * Logical properties are used so RTL/LTR flip cleanly.
 */
:root{
  --brand:#0B4543;        /* Kashef primary */
  --brand-tint:#E4EFED;
  --paper:#F7F6F2;
  --surface:#FFFFFF;
  --ink:#17211F;
  --muted:#5C6B67;
  --line:#DCD8CE;
  --red:#A93226;
  --red-tint:#F9ECEA;
  --amber-tint:#FBF3DF;
  --amber-line:#D9A441;
  --radius:10px;
}
*{box-sizing:border-box}
/* The hidden attribute must always win — e.g. .tag is display:inline-block,
   which otherwise overrides [hidden] and leaks the sample tag onto real files. */
[hidden]{display:none!important}
body{margin:0;background:var(--paper);color:var(--ink);
  font-family:system-ui,"Segoe UI",Tahoma,Arial,sans-serif;line-height:1.65}
.wrap{max-width:960px;margin:0 auto;padding:0 20px}

/* Header */
.topbar{background:var(--brand);color:#fff}
.topbar-in{display:flex;justify-content:space-between;align-items:center;padding-top:14px;padding-bottom:14px}
.brand{font-size:19px}.brand-name{font-weight:800}.brand-sep{opacity:.6;margin:0 6px}

/* Buttons + text links */
.btn{background:var(--brand);color:#fff;border:1px solid var(--brand);border-radius:var(--radius);
  padding:11px 22px;font-size:16px;font-weight:700;cursor:pointer;font-family:inherit}
.btn-quiet{background:transparent;color:var(--brand);border-color:var(--line)}
.topbar .btn-quiet{color:#fff;border-color:#ffffff55}
.btn:focus-visible,.dropbox:focus-visible,.textlink:focus-visible{outline:3px solid var(--brand);outline-offset:2px}
.textlink{background:none;border:0;padding:4px 2px;font:inherit;font-weight:700;color:var(--brand);
  cursor:pointer;text-decoration:underline;text-underline-offset:4px}
.link-row{margin:16px 0 0;display:flex;gap:10px;align-items:center}
.link-sep{color:var(--muted)}

/* Step indicator */
.steps{display:flex;align-items:center;gap:12px;padding:22px 0 0;color:var(--muted);font-size:16px}
.step-num{font-weight:800}
.step.is-active{color:var(--brand);font-weight:800}
.step-arrow{color:var(--muted)}
[dir="rtl"] .step-arrow{transform:scaleX(-1)} /* arrow follows reading direction */

/* Sections & type */
.section{padding:32px 0 8px}
h1{font-size:28px;margin:0 0 8px}h2{font-size:24px;margin:0 0 12px}h3{font-size:19px;margin:28px 0 10px}
.lede{color:var(--muted);max-width:640px;margin:0 0 20px}
.tag{display:inline-block;font-size:13px;font-weight:700;color:var(--brand);
  border:1px solid var(--brand);border-radius:6px;padding:1px 8px;vertical-align:middle}
.tag-red{color:var(--red);border-color:var(--red)}
.tag-amber{color:#7A5B12;border-color:var(--amber-line)}

/* Drop zone: dashed frame + icon; solid green + tint once a file is loaded */
.dropbox{border:2px dashed #9DB8B3;background:var(--surface);border-radius:var(--radius);
  padding:34px 20px;text-align:center;cursor:pointer;color:var(--brand)}
.dropbox.dragover{border-color:var(--brand);background:var(--brand-tint)}
.dropbox.loaded{border:2px dashed var(--brand);background:var(--brand-tint)} /* stays dashed: it is a drop zone */
.drop-icon{margin-bottom:8px}
.drop-title{font-size:18px;font-weight:700;margin:0;color:var(--ink)}
.drop-or{margin:6px 0;color:var(--muted)}
.drop-choose{margin:0;font-weight:700;text-decoration:underline;text-underline-offset:4px}
.drop-hint{color:var(--muted);margin:12px 0 0}
.drop-file{margin:12px 0 0;font-weight:700;color:var(--brand)}

#pasteWrap textarea{width:100%;margin:12px 0;padding:12px;border:1px solid var(--line);
  border-radius:var(--radius);font-family:ui-monospace,Menlo,Consolas,monospace;font-size:14px;background:var(--surface)}
.footer{padding:28px 20px 36px;color:var(--muted);font-size:14px}

/* Messages */
.error{background:var(--red-tint);color:var(--red);border:1px solid var(--red);
  border-radius:var(--radius);padding:12px 16px;margin-top:16px}
.warn{background:var(--amber-tint);border:1px solid var(--line);border-radius:var(--radius);
  padding:12px 16px;margin-top:16px}
.notice{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius);
  padding:11px 16px;margin:14px 0 0;font-weight:600}

/* Mapping: one-line summary bar; expands to one card per field */
.map-summary{display:flex;justify-content:space-between;align-items:center;gap:12px;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px 16px}
.map-summary.has-warning{background:var(--amber-tint);border-color:var(--amber-line)}
.map-rows{display:grid;gap:10px;margin:16px 0 8px} /* full width: selects stretch with the row */
.map-row{display:grid;grid-template-columns:210px 1fr;gap:14px;align-items:center;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px 16px}
.map-row.is-unmatched{background:var(--amber-tint);border-color:var(--amber-line)} /* the unmatched row itself is coloured */
.map-row label{font-weight:700}
.map-src{display:block;font-weight:400;font-size:13px;color:var(--muted);margin-top:2px}
.map-row select{padding:10px;border:1px solid var(--line);border-radius:var(--radius);
  font-size:16px;font-family:inherit;background:var(--surface);width:100%}
.req-note{color:var(--muted);font-size:14px;margin:6px 0 0}
.analyze-row{display:flex;justify-content:flex-end;margin-top:18px}

/* Results */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px 22px}
.panel h3{margin-top:0}
.rec-text{font-size:18px;margin:0}
.only-one{margin:10px 0 0;color:var(--muted)}
.loser-text{margin:12px 0 0} /* normal text colour; only the tag is red */
.scroll-hint{display:none;color:var(--muted);font-size:14px;margin:0 0 8px}
.table-wrap{overflow-x:auto;overflow-y:hidden;max-width:100%;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius)}
table{border-collapse:collapse;width:100%}
th,td{padding:10px 12px;font-size:15px;text-align:start;border-bottom:1px solid var(--line)}
td:first-child{min-width:110px;white-space:nowrap} /* name + Best tag stay on one line, row height unchanged */
td .tag{padding-top:0;padding-bottom:0;font-size:12.5px;line-height:1.5;flex:none}
td:nth-child(2){min-width:100px;white-space:nowrap} /* "5 (open: 1)" never wraps */
.open-note{white-space:nowrap;color:var(--muted)}
thead th{background:var(--brand-tint);font-size:14px} /* headers wrap — never cut off */
th.num,td.num{text-align:end} /* numbers to the end side, text to the start */
tbody tr:last-child td{border-bottom:0}
/* Sticky first column (courier name) while scrolling sideways */
th:first-child,td:first-child{position:sticky;inset-inline-start:0;background:var(--surface);font-weight:700}
thead th:first-child{background:var(--brand-tint)}
tr.row-highlight td{background:var(--brand-tint)}
td.net{font-weight:800}td.neg{color:var(--red)}
.courier-cards{display:none}
.region-list{display:grid;gap:10px}
.region-item{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px 18px}
.region-item strong{color:var(--brand)}
.row-between{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:16px;flex-wrap:wrap}
bdi{font-variant-numeric:tabular-nums}

/* Tablets/phones: mapping cards stack */
@media (max-width:760px){
  .map-row{grid-template-columns:1fr;gap:6px}
}
/* Compact table between 741px and 960px so it still fits without cutting */
@media (max-width:960px){
  th,td{padding:8px 7px;font-size:13.5px}
  td:first-child{min-width:96px}
  td:nth-child(2){min-width:88px}
}
/* Up to 740px: one card per courier instead of the table.
   Each stat is a full-width row: label at the start, value at the end —
   the same pattern as the net-received row above it. */
@media (max-width:740px){
  .table-wrap{display:none}
  .courier-cards{display:grid;gap:10px}
  .courier-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px}
  .courier-card .card-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
  .courier-card h4{margin:0;font-size:17px;color:var(--brand)}
  .courier-card .card-net{display:flex;justify-content:space-between;align-items:baseline;margin-top:8px}
  .courier-card .card-net span{color:var(--muted)}
  .courier-card .card-net strong{font-size:21px}
  .courier-card .card-stats{margin-top:8px}
  .courier-card .stat-row{display:flex;justify-content:space-between;align-items:baseline;
    padding:5px 0;border-top:1px solid var(--line);color:var(--muted);font-size:15px}
  .courier-card .stat-row bdi{color:var(--ink);font-weight:700}
  .courier-card.row-highlight{border-color:var(--brand);background:var(--brand-tint)}
}
@media (max-width:480px){
  .analyze-row .btn{width:100%}
}
@media (max-width:560px){
  .brand{font-size:16px}
  .topbar .btn-quiet{padding:8px 14px;font-size:14px}
  h1{font-size:24px}h2{font-size:21px}
  .section{padding-top:24px}
  .dropbox{padding:26px 14px}
  .steps{font-size:14px;gap:8px}
}

