/* Ferret CRM — plain stylesheet. Recreates the old Distributor_contacts admin look
   (blue sticky bar, stats strip, dense white table with icon columns) without Tailwind. */
:root{
  --blue-700:#1d4ed8; --blue-600:#2563eb; --blue-500:#3b82f6; --blue-400:#60a5fa;
  --blue-300:#93c5fd; --blue-50:#eff6ff;
  --ink:#111827; --gray-600:#4b5563; --gray-500:#6b7280; --gray-400:#9ca3af;
  --gray-200:#e5e7eb; --gray-100:#f3f4f6; --gray-50:#f9fafb;
  --green:#16a34a; --green-d:#15803d; --red:#dc2626; --red-d:#b91c1c;
  --amber:#eab308; --amber-d:#ca8a04; --purple:#9333ea;
  --ok-bg:#dcfce7; --ok-ink:#166534; --err-bg:#fee2e2; --err-ink:#991b1b;
  --shadow:0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
  --bar:#1f2430; --accent:#c7e70b;
  --score-hi:#16a34a; --score-mid:#f59e0b; --score-lo:#94a3b8;
  --day-hi:#16a34a; --day-mid:#65a30d; --day-warn:#f59e0b; --day-lo:#dc2626;
}
*{box-sizing:border-box}
[x-cloak]{display:none!important}
.muted{color:var(--gray-500)}
html,body{margin:0}

/* field-level provenance panel (contact / company edit sidebar) */
.sources .row{border-top:1px solid var(--gray-100);padding:4px 0;display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.sources .src{display:inline-block;font-size:10px;padding:1px 5px;border-radius:999px;background:var(--gray-100);color:var(--gray-600)}
.sources .src.scrape{background:var(--blue-50);color:var(--blue-700)}
.sources .src.manual{background:var(--ok-bg);color:var(--ok-ink)}
.linkish{background:none;border:0;color:var(--blue-600);cursor:pointer;padding:0;font:inherit;text-decoration:underline}

/* big clickable social icons on the contact / company edit page */
.sociallinks{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:10px 0 4px}
.sociallinks .soc{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--gray-200);border-radius:8px;color:var(--gray-600);text-decoration:none;font-size:16px;font-weight:700;transition:all .12s}
.sociallinks .soc:hover{border-color:var(--blue-400);color:var(--blue-600);background:var(--blue-50)}
.sociallinks .soc .ic{width:19px;height:19px;fill:currentColor}
.sociallinks .soc-linkedin:hover{color:#0a66c2;border-color:#0a66c2}
.soc-find{display:flex;gap:12px;justify-content:center;font-size:11px;margin-bottom:6px}
.soc-find a{color:var(--gray-500)}
body{
  font:13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink); background:var(--gray-50);
  min-width:1920px;               /* desktop-only: never reflow below 1920, just scroll */
}
:root{ --page-max:1880px; }        /* centred band the topbar + page share */
a{color:var(--blue-600); text-decoration:none}
a:hover{text-decoration:underline}
svg.ic{width:1.1em; height:1.1em; fill:currentColor; vertical-align:-.15em}

/* ---------- top bar ---------- */
.topbar{
  position:sticky; top:0; z-index:50;
  background:var(--bar); color:#fff;
}
.topbar-inner{
  max-width:var(--page-max); margin:0 auto; padding:6px 16px; min-height:52px;
  display:flex; align-items:center; gap:8px 10px; flex-wrap:wrap;
}
.topbar .brand{display:inline-flex; align-items:center; gap:9px; flex:none; text-decoration:none}
.topbar .brand:hover{text-decoration:none}
.topbar .brand img{display:block; width:26px; height:26px; image-rendering:pixelated}
.brand-name{font-weight:800; font-size:15px; letter-spacing:.07em; color:#fff}
.topbar .spacer{flex:1 1 8px; min-width:0}
.topnav{display:flex; align-items:stretch; align-self:stretch; gap:0; flex-wrap:nowrap; flex:none}
.pill{
  display:inline-flex; align-items:center; padding:0 11px; font-weight:600;
  font-size:12.5px; letter-spacing:.02em; text-transform:uppercase;
  background:transparent; color:rgba(255,255,255,.72); border:0; white-space:nowrap;
  box-shadow:inset 0 -3px 0 transparent;
}
.topbar .signout span{max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.pill:hover{text-decoration:none; color:#fff; background:rgba(255,255,255,.06)}
.pill.on{color:#fff; box-shadow:inset 0 -3px 0 var(--accent)}
.tb-btn{
  display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:6px;
  font:inherit; font-size:13px; cursor:pointer; border:1px solid var(--gray-200);
  background:#fff; color:var(--blue-600); white-space:nowrap;
}
.tb-btn:hover{background:var(--gray-50); border-color:var(--blue-400); text-decoration:none}
.tb-btn.green{background:var(--green); color:#fff; border-color:var(--green)}
.tb-btn.green:hover{background:var(--green-d); border-color:var(--green-d)}
.tb-btn.amber{background:var(--amber); color:#fff; border-color:var(--amber)}
.tb-btn.red{background:var(--red); color:#fff; border-color:var(--red)}
.signout{display:flex; align-items:center; gap:8px; font-size:12px}
.signout span{opacity:.85; white-space:nowrap}
.signout button{background:#fff; color:var(--blue-600); border:0; padding:5px 10px; border-radius:6px; font:inherit; font-weight:600; cursor:pointer}

/* ---------- page-head band (constant nav above; this holds the page title,
   filter box and page actions — so the nav position never shifts) ---------- */
.pagehead{background:#fff; border-bottom:1px solid var(--gray-200)}
.pagehead-inner{
  max-width:var(--page-max); margin:0 auto; padding:9px 16px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.pagehead h1{font-size:17px; font-weight:700; margin:0; color:var(--ink); white-space:nowrap}
.pagehead .spacer{flex:1}
.pagehead .ph-search{
  flex:0 1 320px; min-width:150px;
  padding:6px 10px; border:1px solid var(--gray-200); border-radius:6px; font:inherit;
}

/* ---------- strips ---------- */
.filterbar{background:#fff; border-bottom:1px solid var(--gray-200); padding:8px 16px; display:flex; gap:16px; align-items:center; flex-wrap:wrap; font-size:13px}
.filterbar label{display:flex; align-items:center; gap:6px; color:var(--gray-600)}
.filterbar input[type=text]{padding:5px 8px; border:1px solid var(--gray-200); border-radius:5px; font:inherit}
.statsbar{background:#fff; border-bottom:1px solid var(--gray-200)}
.statsbar-inner{max-width:var(--page-max); margin:0 auto; padding:7px 16px; display:flex; gap:22px; font-size:12px; color:var(--gray-600); flex-wrap:wrap}
.statsbar b{color:var(--ink)}
/* generic inline count strip (group pages) */
.statline{display:flex; gap:22px; font-size:12px; color:var(--gray-600); flex-wrap:wrap; align-items:center}
.statline b{color:var(--ink)}
.flash{padding:7px 16px; font-size:12px; font-weight:500}
.flash.ok{background:var(--ok-bg); color:var(--ok-ink)}
.flash.err{background:var(--err-bg); color:var(--err-ink)}
.flash ul{margin:0; padding-left:18px}

/* ---------- page body ---------- */
main{padding:14px 16px 40px}
.card{background:#fff; border-radius:8px; box-shadow:var(--shadow); overflow:hidden}
.card.pad{padding:18px}
.toolbar{display:flex; align-items:center; gap:12px; margin:2px 0 12px}
.toolbar h2{font-size:16px; margin:0}
.tag{display:inline-block; background:var(--blue-50); color:var(--blue-600); font-size:12px; font-weight:700; padding:2px 8px; border-radius:999px}

/* ---------- table ---------- */
.scroll-x{overflow-x:auto}
table.grid{border-collapse:collapse; width:100%; font-size:13px}
table.grid thead th{
  background:var(--gray-50); color:var(--gray-500);
  font-size:10.5px; letter-spacing:.05em; text-transform:uppercase; font-weight:600;
  text-align:left; padding:9px 8px; border-bottom:1px solid var(--gray-200); white-space:nowrap;
}
table.grid thead th a{color:inherit; display:inline-block}
table.grid thead th a:hover{color:var(--ink); text-decoration:none}
table.grid thead th.sorted a{color:var(--blue-600)}
table.grid thead th.ico{text-align:center; width:38px; padding:9px 2px}
table.grid tbody td{padding:7px 8px; border-bottom:1px solid var(--gray-200); vertical-align:middle}
table.grid tbody tr:nth-child(even){background:var(--gray-50)}
table.grid tbody tr:hover{background:var(--blue-50)}
table.grid td.ico{text-align:center; width:38px; padding:7px 2px; font-size:16px}
table.grid td.ico a{color:var(--blue-600)}
table.grid td.ico .none{color:var(--gray-400)}
table.grid td.name{font-weight:600; max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
table.grid td.trunc{max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
table.grid td.actions{white-space:nowrap; text-align:right; width:1%}
table.grid td.empty{text-align:center; color:var(--gray-500); padding:30px}
.hidden-row{display:none}
.avatar{width:40px; height:40px; border-radius:999px; object-fit:cover; border:1px solid var(--gray-200); display:block}
.avatar.ph,.logo.ph{background:var(--blue-50); color:var(--blue-500); font-weight:700; font-size:13px; display:inline-flex; align-items:center; justify-content:center}
.logo{width:44px; height:44px; border-radius:6px; object-fit:cover; border:1px solid var(--blue-200,#bfdbfe); display:block}

/* ---------- contacts list: two lines per entry + score tiles ---------- */
table.grid.clist tbody td{padding:6px 10px; vertical-align:middle}
table.grid.clist thead th{white-space:nowrap}
.clist .lines{display:flex; flex-direction:column; line-height:1.25; min-width:0}
.clist .lines .l1{font-weight:600; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.clist .lines .l2{font-size:11.5px; color:var(--gray-500); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.clist .lines .l2 a{color:var(--gray-500)}
.clist .c-who .cell{display:flex; align-items:center; gap:9px}
.clist .c-who .lines{max-width:280px}
.clist .c-role .lines{max-width:300px}
.clist .c-reach .lines{max-width:340px}
.clist .c-phone .lines{max-width:220px}
.clist .c-reach .dot{display:inline-block; width:6px; height:6px; border-radius:999px; background:var(--green); margin-right:5px; vertical-align:1px}
.clist .bday{display:inline-block; margin-left:6px; font-size:10.5px; color:var(--amber-d)}
.clist .bday.soon{background:#fef3c7; color:#92400e; border-radius:999px; padding:0 6px; font-weight:700}

/* score / action / days tiles */
.clist .c-score{width:1%; padding-left:4px; padding-right:16px}
.clist thead .c-score .sh{display:flex; gap:4px}
.clist thead .c-score .sh a{display:block; width:38px; text-align:center; font-size:10px; text-transform:uppercase; letter-spacing:.02em; color:var(--gray-500)}
.clist thead .c-score .sh a.on{color:var(--blue-600); font-weight:700}
.score-tiles{display:inline-flex; gap:3px}
.stile{width:38px; padding:4px 0; border-radius:5px; text-align:center; color:#fff; display:flex; flex-direction:column; line-height:1}
.stile b{font-size:15px; font-weight:800}
.stile i{font-size:8px; font-style:normal; text-transform:uppercase; opacity:.8; letter-spacing:.04em; margin-top:2px}
.stile.s-hi,.stile.a-hi,.stile.d-hi{background:var(--score-hi)}
.stile.s-mid,.stile.a-mid{background:var(--score-mid)}
.stile.s-lo,.stile.a-lo{background:var(--score-lo)}
.stile.a-hi{background:#0d9488}
.stile.a-mid{background:#f59e0b}
.stile.d-mid{background:var(--day-mid)}
.stile.d-warn{background:var(--day-warn)}
.stile.d-lo{background:var(--day-lo)}
.stile.d-na{background:var(--gray-200); color:var(--gray-500)}

/* big round social icons */
.soc-lg{display:inline-flex; align-items:center; gap:5px}
.soc-lg a,.soc-lg span{width:26px; height:26px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; color:#fff}
.soc-lg a .ic,.soc-lg span .ic{width:14px; height:14px; fill:currentColor}
.soc-lg .s-linkedin{background:#0a66c2}
.soc-lg .s-x{background:#111}
.soc-lg .s-facebook{background:#1877f2}
.soc-lg .s-instagram{background:#d6249f}
.soc-lg .s-film{background:#6b7280}
.soc-lg .s-off{background:var(--gray-100); color:var(--gray-400)}
.soc-lg a:hover{filter:brightness(1.12)}
.soc-lg .s-edit{background:#fff; color:var(--gray-500); border:1px solid var(--gray-200)}
.soc-lg .s-edit:hover{color:var(--blue-600); border-color:var(--blue-400)}

/* ---------- buttons ---------- */
.btn{display:inline-flex; align-items:center; gap:6px; background:var(--blue-600); color:#fff; border:0; padding:6px 12px; border-radius:6px; font:inherit; font-weight:600; cursor:pointer}
.btn:hover{background:var(--blue-700); text-decoration:none}
.btn.sm{padding:3px 9px; font-size:12px; font-weight:500}
.btn.green{background:var(--green)} .btn.green:hover{background:var(--green-d)}
.btn.red{background:var(--red)} .btn.red:hover{background:var(--red-d)}
.btn.ghost{background:#fff; color:var(--blue-600); border:1px solid var(--blue-400)}
.btn[disabled]{background:#d1d5db; color:#6b7280; cursor:not-allowed}
.rowact{display:inline-flex; gap:6px; align-items:center}
.rowact form{display:inline}
.iconbtn{background:var(--red); color:#fff; border:0; border-radius:6px; padding:4px 7px; cursor:pointer; font-size:12px}

/* ---------- forms ---------- */
.field{margin-bottom:11px}
.field label{display:block; font-size:10.5px; font-weight:700; color:var(--blue-600); margin-bottom:3px; letter-spacing:.02em}
.field input,.field select,.field textarea{width:100%; padding:6px 9px; border:1px solid #cbd5e1; border-radius:6px; font:inherit; background:#fff}
.field input:focus,.field select:focus,.field textarea:focus{outline:0; border-color:var(--blue-500); box-shadow:0 0 0 3px var(--blue-50)}
.field .hint{font-size:11px; color:var(--gray-500); margin-top:3px}
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:0 16px}
.grid3{display:grid; grid-template-columns:1fr 1fr 1fr; gap:0 16px}
fieldset{border:1px solid var(--gray-200); border-radius:7px; padding:12px 14px; margin:0 0 14px}
fieldset legend{font-size:10.5px; font-weight:700; text-transform:uppercase; color:var(--gray-500); padding:0 6px}
.form-actions{display:flex; gap:10px; align-items:center; margin-top:6px}

/* ---------- overview (grouped) ---------- */
.co-group{border-bottom:1px solid var(--gray-200)}
.co-head{background:var(--blue-50); border-left:4px solid var(--blue-600); padding:10px 14px; display:flex; align-items:center; gap:12px}
.co-head h3{font-size:15px; margin:0}
.co-head .meta{font-size:12px; color:var(--gray-600)}
.co-head .spacer{flex:1}
.co-contacts{padding:0}
.co-contacts tr:hover{background:var(--gray-50)}
.co-contacts td{padding:6px 14px 6px 40px; border-top:1px solid var(--gray-100); font-size:13px}

/* ---------- modal ---------- */
.modal-bg{position:fixed; inset:0; background:rgba(75,85,99,.5); z-index:60; display:flex; align-items:flex-start; justify-content:center; padding:48px 16px; overflow-y:auto}
.modal{background:#fff; border-radius:8px; box-shadow:0 10px 40px rgba(0,0,0,.3); width:520px; max-width:100%; padding:20px}
.modal h3{margin:0 0 12px; font-size:16px}

/* ---------- login ---------- */
.login-page{display:flex; min-height:100vh; align-items:center; justify-content:center; background:var(--blue-600)}
.login-card{background:#fff; padding:28px; border-radius:12px; width:340px; box-shadow:0 10px 40px rgba(0,0,0,.25)}
.login-card h1{font-size:18px; margin:0 0 16px; text-align:center; display:flex; align-items:center; justify-content:center; gap:8px}
.login-card h1 .login-mark{width:26px; height:26px; image-rendering:pixelated}
.login-card button .btn-mark{width:18px; height:18px; vertical-align:-4px; margin-right:6px; image-rendering:pixelated}
.login-card label{display:block; font-size:12px; font-weight:600; color:var(--blue-600); margin-bottom:10px}
.login-card label.row{display:flex; align-items:center; gap:6px; font-weight:400; color:var(--ink)}
.login-card input[type=email],.login-card input[type=password]{width:100%; padding:8px 10px; border:1px solid #cbd5e1; border-radius:6px; font:inherit; margin-top:3px}
.login-card button{width:100%; margin-top:6px; background:var(--blue-600); color:#fff; border:0; padding:9px; border-radius:6px; font:inherit; font-weight:600; cursor:pointer}
.login-card .err{background:var(--err-bg); color:var(--err-ink); padding:8px; border-radius:6px; font-size:13px; margin:0 0 12px}

/* Desktop-only app: min canvas is 1920px (see body{min-width}). Below that the
   page scrolls horizontally rather than reflowing — no mobile breakpoints. */
