/* Th!nk Partner Pipeline — look of Thijs's prototype:
   concrete grey, white, charcoal, Th!nk red #e84139; Jost headings, Inter text.
   Phone first: big cards and buttons. PC (≥ 1000 px): wide tables, list + lead card side by side. */

:root {
  --bg: #fff; --ink: #1d1d1b; --mut: #6b6b68; --rule: #e3e2df; --soft: #f3f3f2; --soft2: #ecebe8; --soft3: #dad9d5;
  --concrete: #8c8a85; --red: #e84139; --red-dk: #b8261f; --redbg: #fce9e8; --ok: #2f7d4f; --okbg: #e6f2ea; --warn: #9a5b00; --warnbg: #fdf1dd;
  --r: 10px; --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Inter, system-ui, sans-serif; overflow-x: clip; }
body.modal-open { overflow: hidden; }
h1, h2, h3 { font-family: Jost, Inter, sans-serif; font-weight: 500; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; font-size: 16px; color: inherit; }
input, select, textarea { background: var(--bg); border: 1px solid var(--soft3); border-radius: 8px; padding: 10px 12px; min-height: var(--tap); width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
label { display: block; font-size: 13px; color: var(--mut); margin: 0 0 4px; }
.req::after { content: ' *'; color: var(--red); }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.note { font-size: 13px; color: var(--mut); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.hide { display: none !important; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.red { color: var(--red); }
.ok { color: var(--ok); }

/* ---------- buttons, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--soft3); background: var(--bg); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--soft); }
.btn.pri { background: var(--red); border-color: var(--red); color: #fff; }
.btn.pri:hover { background: var(--red-dk); border-color: var(--red-dk); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--mut); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn.big { min-height: 56px; font-size: 17px; padding: 0 22px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.yes { border-color: var(--red); color: var(--red); }
.btn.yes:hover { background: var(--redbg); }
.lnk { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--mut); cursor: pointer; font-size: 14px; min-height: 40px; padding: 0 4px; }
.lnk:hover { color: var(--ink); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 99px; border: 1.5px solid var(--soft3); background: var(--bg); cursor: pointer; font-weight: 500; font-size: 15px; }
.opt small { color: var(--mut); font-size: 12px; font-weight: 400; }
.opt[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.opt[aria-pressed="true"] small { color: #d6d5d1; }
.opts.sm .opt { min-height: 38px; padding: 0 13px; font-size: 14px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--ink); white-space: nowrap; }
.tag .ic { width: 14px; height: 14px; }
.tag.r { background: var(--redbg); color: var(--red-dk); }
.tag.ok { background: var(--okbg); color: var(--ok); }
.tag.warn { background: var(--warnbg); color: var(--warn); }
.tag.dark { background: var(--ink); color: #fff; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; }

/* ---------- top bar & navigation ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--rule); }
.top-in { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 6px max(3vw, 14px); min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { height: 40px; width: auto; }
.brand span { font: 500 17px Jost, sans-serif; white-space: nowrap; color: var(--mut); }
.nav { display: flex; gap: 2px; margin-left: 8px; align-self: stretch; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; text-decoration: none; color: var(--mut); font-weight: 500; font-size: 15px; border-bottom: 3px solid transparent; margin-bottom: -7px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
.nav .badge { margin-left: 2px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mut); }
.who b { color: var(--ink); font-weight: 500; }
.who select { min-height: 38px; width: auto; max-width: 240px; padding: 4px 8px; background: var(--soft); font-size: 14px; }
.demo-bar { background: var(--warnbg); color: var(--warn); font-size: 13.5px; text-align: center; padding: 6px 12px; }
.demo-bar button { border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; font-size: 13.5px; padding: 0 4px; }
.tabbar { display: none; }

main { max-width: 1400px; margin: 0 auto; padding: 18px max(3vw, 14px) 40px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.page-h .note { margin-top: 2px; }

/* ---------- cards & lists ---------- */
.card { background: var(--bg); border: 1px solid var(--rule); border-radius: 14px; padding: 16px; }
.card + .card { margin-top: 14px; }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.sec-h h2 { font-size: 19px; }
.sec-h .ic { color: var(--red); width: 20px; height: 20px; }
.items { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg); cursor: pointer; }
.item:hover { border-color: var(--soft3); background: #fcfcfb; }
.item .t { font-weight: 600; font-size: 16px; line-height: 1.3; }
.item .s { font-size: 14px; color: var(--mut); }
.item .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.item.late { border-left: 4px solid var(--red); }
.empty { padding: 18px; text-align: center; color: var(--mut); background: var(--soft); border-radius: 12px; font-size: 15px; }
.today-grid { display: grid; gap: 18px; }
.inline-fu { grid-column: 1 / -1; padding-top: 4px; }
.inline-fu p { margin: 0 0 6px; font-size: 14px; font-weight: 500; }

/* ---------- funnel bar (stage filter) ---------- */
.fn { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 0 0 8px; }
.fn button { border: 0; background: var(--soft); color: var(--ink); text-align: left; cursor: pointer; padding: 10px 16px 10px 24px; min-height: 70px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.fn button:first-child { padding-left: 12px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.fn button:nth-child(2) { background: var(--soft2); } .fn button:nth-child(3) { background: #e3e2df; } .fn button:nth-child(4) { background: var(--redbg); }
.fn button span { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fn button b { display: block; font: 500 26px/1.1 Jost, sans-serif; }
.fn button small { display: block; font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fn button[aria-pressed="true"] { background: var(--red); color: #fff; }
.fn button[aria-pressed="true"] small { color: #fff; }

/* step chevrons on a lead */
.steps { display: flex; gap: 3px; }
.steps > div { flex: 1 1 0; display: flex; flex-direction: column; justify-content: center; min-height: 46px; background: var(--soft); color: var(--mut); font-size: 13px; font-weight: 500; padding: 4px 12px 4px 20px; line-height: 1.25;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.steps > div:first-child { padding-left: 12px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.steps > div.on { background: var(--red); color: #fff; }
.steps > div small { font-weight: 400; font-size: 11.5px; opacity: .9; }
.steps.mini > div { min-height: 26px; padding: 2px 8px 2px 14px; font-size: 0; }
.steps.mini > div:first-child { padding-left: 8px; }
.steps.lost > div.on { background: var(--concrete); }

/* ---------- leads: toolbar, table, split view ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 12px; }
.toolbar .search { flex: 1 1 220px; position: relative; }
.toolbar .search .ic { position: absolute; left: 12px; top: 15px; color: var(--mut); }
.toolbar .search input { padding-left: 38px; }
.toolbar select { width: auto; min-width: 150px; }
.split { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { position: sticky; top: 0; background: var(--soft); font-size: 12.5px; font-weight: 600; color: var(--mut); text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; user-select: none; }
table.t th[data-sort] { cursor: pointer; }
table.t th[data-sort]:hover { color: var(--ink); }
table.t th .arr { font-size: 10px; margin-left: 3px; }
table.t td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover { background: #fafaf9; }
table.t tbody tr.sel { background: var(--redbg); }
table.t tbody tr.lost td { color: var(--mut); }
table.t td.co b { font-weight: 600; }
.lead-cards { display: grid; gap: 10px; }
.side { display: none; }

/* ---------- lead card ---------- */
.lead-h { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.lead-h h1 { font-size: 25px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin: -4px 0 8px -4px; }
.next { background: var(--soft); border-radius: 12px; padding: 14px; margin: 14px 0; }
.next .q { font-weight: 600; margin: 0 0 10px; font-size: 16px; }
.next .row .btn { flex: 1 1 140px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--mut); font-size: 13.5px; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.form { display: grid; grid-template-columns: 1fr; gap: 12px; }
.form .full { grid-column: 1 / -1; }
.hist { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.hist li { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.hist li:last-child { border-bottom: 0; }
.hist .d { color: var(--mut); font-size: 12.5px; }
.hist .w { color: var(--mut); font-size: 12.5px; }
.offer-box { border: 1px solid var(--rule); border-radius: 12px; padding: 12px; }
.offer-box + .offer-box { margin-top: 10px; }
.vers { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.vers li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--rule); }
.vers li .grow { color: var(--mut); }
details.more > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--mut); font-size: 14px; min-height: 40px; }
details.more > summary::-webkit-details-marker { display: none; }

/* ---------- offer screen ---------- */
.offer-grid { display: grid; gap: 16px; }
.calc { display: grid; grid-template-columns: 1fr; gap: 8px; }
.stepper { border: 1px solid var(--rule); border-radius: 12px; padding: 8px 10px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper label { margin: 0; font-size: 15px; color: var(--ink); font-weight: 500; }
.stepper .ctl { display: grid; grid-template-columns: 44px 64px 44px; align-items: center; gap: 4px; flex: none; }
.stepper input { text-align: center; font: 500 22px Jost, sans-serif; padding: 4px; border: 0; min-height: 44px; }
.pm { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--soft3); background: var(--bg); cursor: pointer; display: grid; place-items: center; padding: 0; }
.pm:hover { border-color: var(--ink); }
.pm:disabled { opacity: .35; }
.prods { list-style: none; margin: 0; padding: 0; }
.prods li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.prods li .nm { font-weight: 500; line-height: 1.3; }
.prods li .nm small { display: block; color: var(--mut); font-weight: 400; font-size: 12.5px; }
.prods li .q { display: grid; grid-template-columns: 38px 52px 38px; align-items: center; gap: 4px; }
.prods li .q .pm { width: 38px; height: 38px; }
.prods li .q input { min-height: 38px; text-align: center; padding: 4px; font-weight: 600; }
.prods li .lt { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 13px; color: var(--mut); }
.prods li.zero .nm { color: var(--mut); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: 15px; }
.totals .big { font: 500 26px Jost, sans-serif; color: var(--red); }
.sendbar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 18%); padding: 16px 0 calc(8px + var(--safe-b)); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; z-index: 5; }
.sendbar .btn.pri { grid-column: 1 / -1; }
.limit { font-size: 13px; color: var(--mut); }

/* ---------- weekly call ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.tile b { display: block; font: 500 28px/1.1 Jost, sans-serif; }
.tile span { font-size: 13px; color: var(--mut); display: block; }
.tile.hot { background: var(--redbg); }
.tile.hot b { color: var(--red-dk); }
.bars { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 4px 10px; padding: 5px 0; }
.bars li .bar { grid-column: 1 / -1; height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.bars li .bar i { display: block; height: 100%; background: var(--red); }
.conv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.conv > div { border: 1px solid var(--rule); border-radius: 12px; padding: 12px; }
.conv b { font: 500 26px Jost, sans-serif; display: block; }
.conv span { font-size: 13px; color: var(--mut); display: block; }
.cols { display: grid; gap: 14px; }
.act-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.act-list li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.act-list li:hover { background: var(--soft); }

/* ---------- dialogs, toast, login ---------- */
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(29, 29, 27, .45); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.dlg { background: var(--bg); border-radius: 18px 18px 0 0; max-height: 92vh; overflow: auto; padding: 18px 18px calc(18px + var(--safe-b)); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.dlg-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.dlg-h h2 { font-size: 22px; }
.dlg .q2 { font-weight: 600; margin: 14px 0 8px; }
.dlg .acts { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 18px; }
.x { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--mut); min-width: 40px; min-height: 40px; }
.x:hover { background: var(--soft); color: var(--ink); }
#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100vw - 28px); }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red-dk); }
.boot { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 10px; }
.login { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.login img { width: 170px; margin-bottom: 18px; }
.login h1 { margin-bottom: 6px; }
.login form { display: grid; gap: 12px; margin-top: 18px; }
.code { letter-spacing: .3em; font: 500 26px Jost, sans-serif; text-align: center; }

/* ---------- phone ---------- */
@media (max-width: 999px) {
  .nav, .who .name, .desk { display: none !important; }
  .top-in { min-height: 52px; }
  .brand img { height: 34px; }
  .fn button span { white-space: normal; line-height: 1.15; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--rule); padding-bottom: var(--safe-b); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; text-decoration: none; color: var(--mut); font-size: 11.5px; font-weight: 500; position: relative; }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--red); }
  .tabbar a .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; }
  .tabbar a.add .ic { width: 30px; height: 30px; color: #fff; background: var(--red); border-radius: 50%; padding: 5px; }
  main { padding-bottom: calc(90px + var(--safe-b)); }
  .tbl-wrap { display: none; }
  .fn button { min-height: 62px; padding: 8px 8px 8px 18px; }
  .fn button:first-child { padding-left: 8px; }
  .fn button span { font-size: 11.5px; }
  .fn button span .ic { display: none; }
  .fn button small { display: none; }
  .fn button b { font-size: 22px; }
  .steps > div { font-size: 11.5px; padding: 4px 6px 4px 14px; min-height: 42px; }
  .steps > div:first-child { padding-left: 8px; }
  .lead-cards { display: grid; }
}
@media (min-width: 1000px) {
  .lead-cards, .mob { display: none !important; }
  .dlg { border-radius: 18px; }
  .ov { align-items: center; padding: 20px; }
  .split.has-side { grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr); }
  .split.has-side .side { display: block; position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow: auto; border: 1px solid var(--rule); border-radius: 14px; padding: 18px; }
  .today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offer-grid { grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); align-items: start; }
  .calc { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stepper { flex-direction: column; align-items: stretch; text-align: center; padding: 10px; }
  .stepper .ctl { grid-template-columns: 44px 1fr 44px; }
  .offer-grid .sum { position: sticky; top: 74px; }
  .form { grid-template-columns: 1fr 1fr; }
  .sendbar { position: static; background: none; padding: 12px 0 0; }
  .item .acts { grid-column: auto; }
  .today-grid .item { grid-template-columns: 1fr; }
  .today-grid .item .acts { grid-column: 1; }
  #toast { bottom: 24px; }
}
@media print { .top, .tabbar, .demo-bar { display: none; } }
@media (max-width: 999px) {
  body.in-offer .tabbar { display: none; }
  body.in-offer main { padding-bottom: 20px; }
}
