:root {
  --navy: #0b2545;
  --navy-2: #14315c;
  --steel: #3e5c86;
  --accent: #ee6a1f;       /* Browns orange */
  --accent-2: #ff8033;
  --accent-ink: #5a2600;
  --ok: #1a8f5a;
  --ok-bg: #e6f5ec;
  --warn: #b8720a;
  --warn-bg: #fdf1dd;
  --err: #c0392b;
  --err-bg: #fbeae7;
  --dupe: #6c4bb6;
  --ink: #16202e;
  --muted: #6b7686;
  --line: #e5e9f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(11,37,69,.06), 0 8px 26px rgba(11,37,69,.08);
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; min-height: 100vh; }
h1, h2, h3 { margin: 0 0 6px; letter-spacing: -.01em; }
h1 { font-size: 27px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0; } b { font-weight: 700; }
.muted { color: var(--muted); }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 24px; background: linear-gradient(100deg, var(--navy), var(--navy-2));
  color: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-mark { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 18px; font-weight: 600; }
.brand-name b { color: var(--accent-2); font-weight: 800; }
.brand-by { font-size: 11px; color: #9fb2ce; letter-spacing: .04em; text-transform: uppercase; }
.topbar-right { display: flex; gap: 8px; }
.pill { background: rgba(255,255,255,.12); color: #dce6f4; border: 1px solid rgba(255,255,255,.14); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ghost { background: transparent; }

/* ---- layout ---- */
.wrap { max-width: 1040px; margin: 26px auto 40px; padding: 0 22px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin-bottom: 22px; animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head.tight { margin-bottom: 12px; align-items: center; }
.head-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---- home ---- */
.home { padding: 34px 30px; }
.hero { max-width: 640px; margin-bottom: 26px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.hero h1 { color: var(--navy); font-size: 32px; }
.hero p { color: #45556b; font-size: 16px; margin-top: 10px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { text-align: left; background: #fbfcfe; border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px; cursor: pointer; font: inherit; transition: .16s ease; display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.card-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; background: color-mix(in srgb, var(--c) 12%, white); margin-bottom: 13px; }
.card h3 { color: var(--navy); }
.card p { color: var(--muted); font-size: 13px; flex: 1; margin-top: 3px; }
.card-go { color: var(--accent); font-weight: 700; font-size: 13px; margin-top: 14px; }
.home-foot { margin-top: 20px; }

/* ---- crumb / mode tag ---- */
.crumb { background: none; border: none; color: var(--steel); font: inherit; font-weight: 600; cursor: pointer; padding: 0 0 12px; }
.crumb:hover { color: var(--navy); }
.mode-tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.lede { max-width: 680px; margin-bottom: 22px; }
.lede h1 { color: var(--navy); font-size: 24px; } .lede p { color: #45556b; font-size: 15px; margin-top: 8px; }

/* ---- dropzone ---- */
.dropzone { border: 2px dashed #c3cede; border-radius: var(--radius); background: #fafbfe; padding: 46px 24px; text-align: center; color: var(--steel); cursor: pointer; transition: .18s ease; outline: none; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: #fff6ef; color: var(--navy); }
.dropzone.drag { border-color: var(--accent); background: #ffeede; transform: scale(1.005); }
.dz-icon { width: 42px; height: 42px; margin-bottom: 10px; color: var(--steel); }
.dropzone:hover .dz-icon { color: var(--accent); }
.dz-title { font-size: 17px; font-weight: 600; color: var(--navy); }
.dz-sub { margin-top: 5px; font-size: 13px; color: var(--muted); }
.drop-foot { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.linklike { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* ---- buttons ---- */
.btn { font: inherit; font-weight: 600; border-radius: 9px; padding: 9px 15px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--navy); transition: .15s ease; }
.btn:hover { border-color: #c3cede; background: #f7f9fd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- mapping ---- */
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.map-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fbfcfe; }
.map-target { display: flex; flex-direction: column; }
.map-target .t { font-weight: 600; color: var(--navy); }
.map-target .t .req { color: var(--err); }
.map-target .hint { font-size: 11px; color: var(--muted); }
.map-row select { font: inherit; padding: 7px 9px; border-radius: 8px; border: 1px solid #c9d3e2; background: #fff; min-width: 150px; }
.map-row.matched { border-color: #bfe3cf; background: #f2fbf6; }
.map-row.unmatched-req { border-color: #f2c9c2; background: #fdf2f0; }

/* ---- summary ---- */
.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; background: #fbfcfe; }
.stat .n { font-size: 24px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat.ok .n { color: var(--ok); } .stat.warn .n { color: var(--warn); }
.stat.err .n { color: var(--err); } .stat.dep .n { color: var(--accent); }

/* ---- filters ---- */
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--steel); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---- grid ---- */
.grid-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.grid th { text-align: left; background: #f7f9fc; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.grid td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
.grid tr:last-child td { border-bottom: none; }
.grid tr.row-error td { background: #fdf6f5; }
.grid tr.row-dupe td { background: #f8f5fd; }
.grid .company { font-weight: 600; color: var(--navy); }
.grid .addr { color: #4a5568; }
.grid .pc { font-variant-numeric: tabular-nums; font-weight: 600; }
.grid .pc.fixed::after { content: "fixed"; margin-left: 6px; font-size: 10px; color: var(--ok); font-weight: 600; background: var(--ok-bg); padding: 1px 5px; border-radius: 4px; }

.depot-badge { display: inline-flex; align-items: center; gap: 6px; }
.depot-badge .code { font-weight: 800; color: #fff; background: var(--steel); border-radius: 5px; padding: 1px 6px; font-size: 11px; font-variant-numeric: tabular-nums; }
.depot-badge.home .code { background: var(--navy); }
.depot-badge .dn { color: var(--ink); }
.depot-none { color: var(--warn); font-style: italic; }
.dsrc { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; vertical-align: middle; }
.dsrc.verified { color: var(--ok); background: var(--ok-bg); }
.dsrc.nearest { color: var(--steel); background: #eef2f7; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.ok::before { background: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.warn::before { background: var(--warn); }
.tag.error { background: var(--err-bg); color: var(--err); } .tag.error::before { background: var(--err); }
.tag.dupe { background: #f1ecfa; color: var(--dupe); } .tag.dupe::before { background: var(--dupe); }
.tag-note { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---- banner ---- */
.banner { border-radius: 12px; padding: 13px 16px; margin-bottom: 16px; font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.banner.warn { background: var(--warn-bg); border: 1px solid #f0d9ab; color: #7a4e06; }
.banner.warn.checked { background: var(--ok-bg); border-color: #bfe3cf; color: var(--ok); }

/* ---- footer ---- */
.foot { max-width: 1040px; margin: 0 auto; padding: 18px 22px 30px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.foot b { color: var(--navy); }

/* ---- push modal ---- */
#pushModal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
#pushModal .pm-back { position: absolute; inset: 0; background: rgba(11,37,69,.55); backdrop-filter: blur(2px); }
#pushModal .pm-card { position: relative; background: #fff; border-radius: 14px; padding: 26px 28px; width: 460px; max-width: 92vw; box-shadow: 0 22px 60px rgba(0,0,0,.35); animation: rise .2s ease; }
#pushModal h2 { color: var(--navy); margin-bottom: 8px; }
#pushModal label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; color: var(--navy); }
#pushModal input { width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid #c9d3e2; font: inherit; box-sizing: border-box; }
#pushModal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(238,106,31,.15); }
#pushModal .small { font-size: 11px; margin-top: 6px; }
#pushModal .pm-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#pushModal .pm-status { margin-top: 14px; padding: 12px; border-radius: 8px; background: #f7f9fc; border: 1px solid var(--line); font-size: 13px; }
#pushModal .pm-status .spin { display: inline-block; width: 12px; height: 12px; border: 2px solid #c9d3e2; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 8px; vertical-align: -1px; }
#pushModal .pm-ok .big { font-size: 15px; color: var(--ok); font-weight: 700; margin-bottom: 8px; }
#pushModal .pm-ok .tally { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin: 8px 0; }
#pushModal .pm-ok .tally .err { color: var(--err); }
#pushModal .pm-err { color: var(--err); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- toast ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; font-size: 13px; z-index: 40; animation: rise .2s ease both; }

@media (max-width: 760px) {
  .cards { grid-template-columns: 1fr; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .map-grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
  .head-actions { width: 100%; flex-wrap: wrap; }
  .hero h1 { font-size: 26px; }
}
