/* Drevonix CRM — warm paper, charcoal ink, terracotta actions; stage colours carry status. */
:root{
  --bg:#F6F2EB; --card:#FDFBF7; --ink:#2B2A28; --muted:#6B655E; --line:#E6DFD3; --line-2:#D8CFC1;
  --brand:#A2593A; --brand-ink:#FFFFFF; --brand-soft:#F3E2D7;
  --bad:#B3392B; --bad-soft:#F8E1DD; --ok:#2F6B45; --ok-soft:#DFF0E4;
  --st-new:#ECE8E1; --st-new-ink:#5E5850;
  --st-contacted:#F6E0D3; --st-contacted-ink:#8E4422;
  --st-meeting:#DDEBD9; --st-meeting-ink:#335D30;
  --st-proposal:#DDE6F3; --st-proposal-ink:#2C4E78;
  --st-won:#F6E6B9; --st-won-ink:#6E520B;
  --st-lost:#F1EEEA; --st-lost-ink:#6B655E;
  --f-head:"Sora","Helvetica Neue",Arial,sans-serif;
  --f-body:"IBM Plex Sans","Helvetica Neue",Arial,sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,Menlo,Consolas,monospace;
  --r:14px; --shadow:0 1px 2px rgba(43,42,40,.04),0 8px 24px -16px rgba(43,42,40,.25);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--f-body)}
a{color:var(--brand);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{font-family:var(--f-head);font-weight:600;letter-spacing:-.015em;margin:0;line-height:1.15}
h1{font-size:clamp(24px,3vw,32px)}h2{font-size:17px}h3.sub{font-size:13px;margin:16px 0 8px;color:var(--muted);font-family:var(--f-body);text-transform:uppercase;letter-spacing:.06em}
p{margin:0}
.num{font-family:var(--f-mono);font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}.small{font-size:13px}.bad{color:var(--bad)}.right{text-align:right}.r{text-align:right}.nowrap{white-space:nowrap}.grow{flex:1;min-width:0}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
[hidden]{display:none!important}
code{font-family:var(--f-mono);font-size:12.5px;background:var(--st-new);padding:1px 5px;border-radius:5px}

/* layout */
.shell{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh}
.side{position:sticky;top:0;height:100vh;align-self:start;display:flex;flex-direction:column;gap:18px;padding:18px 14px;background:#FBF8F3;border-right:1px solid var(--line);overflow:auto}
.brand{display:flex;align-items:center;gap:10px;font-family:var(--f-head);font-weight:600;font-size:18px}
.brand.big{font-size:22px}
.mark{width:32px;height:32px;border-radius:9px;background:var(--ink);color:#fff;display:grid;place-items:center;font-size:17px;box-shadow:inset -4px 0 0 var(--brand)}
.side nav{display:flex;flex-direction:column;gap:2px}
.nav-h{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.07em;padding:0 10px 6px}
.side nav a{display:flex;justify-content:space-between;align-items:center;padding:9px 10px;border-radius:9px;color:var(--ink);font-weight:500}
.side nav a:hover{background:var(--st-new);text-decoration:none}
.side nav a[aria-current="page"]{background:var(--card);box-shadow:var(--shadow)}
.today{display:flex;flex-direction:column;gap:2px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px 6px;margin-top:auto}
.today a{display:flex;justify-content:space-between;padding:4px 10px;color:var(--ink)}
.today a.bad{color:var(--bad)}
.me{display:flex;align-items:center;gap:10px;padding:6px 4px;position:relative}
.who{display:flex;flex-direction:column;min-width:0;flex:1}.who small{color:var(--muted)}
.menu summary{list-style:none;cursor:pointer;padding:4px 10px;border-radius:8px;font-size:18px}
.menu summary::-webkit-details-marker{display:none}
.menu-pop{position:absolute;bottom:48px;right:0;background:var(--card);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);padding:6px;min-width:180px;z-index:20}
.menu-pop a,.menu-pop button{display:block;width:100%;text-align:left;padding:8px 10px;border-radius:7px;background:none;border:0;font:inherit;color:var(--ink);cursor:pointer}
.menu-pop a:hover,.menu-pop button:hover{background:var(--st-new);text-decoration:none}
.topbar{display:none}
.main{padding:28px clamp(16px,3vw,36px) 64px;display:flex;flex-direction:column;gap:20px;min-width:0}
@media (max-width:900px){
  .shell{grid-template-columns:1fr}
  .side{position:fixed;inset:0 auto 0 0;width:270px;z-index:40;transform:translateX(-105%);transition:transform .2s ease;box-shadow:var(--shadow)}
  .side.open{transform:none}
  .topbar{display:flex;justify-content:space-between;align-items:center;gap:10px;position:sticky;top:0;z-index:30;padding:10px 16px;background:#FBF8F3;border-bottom:1px solid var(--line)}
  .main{padding-top:18px}
}

/* page header */
.ph{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
.ph p{margin-top:6px}
.crumbs{font-size:13px;color:var(--muted);margin-bottom:-10px}
.row{display:flex;gap:10px;align-items:center}.row.wrap{flex-wrap:wrap}.row.between{justify-content:space-between}.row.end{justify-content:flex-end}.row.tight{gap:6px}
.stack{display:flex;flex-direction:column;gap:14px}
.grid{display:grid;gap:20px}
.g-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g-2-1{grid-template-columns:minmax(0,2fr) minmax(0,1fr)}
.g-lead{grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr);align-items:start}
.g-form{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px}
.span2{grid-column:1/-1}
@media (max-width:1100px){.g-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:820px){.g-2,.g-3,.g-2-1,.g-lead{grid-template-columns:1fr}}
@media (max-width:560px){.g-form{grid-template-columns:1fr}}

/* cards */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:20px;box-shadow:var(--shadow);min-width:0}
.card>h2{margin-bottom:14px}
.card.stack>h2{margin-bottom:0}
.card.flush{padding:0;overflow:hidden}
.card.narrow{max-width:520px}
.ch{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:14px}
.ch p{margin-top:4px;font-size:13px}
.empty{border:1.5px dashed var(--line-2);border-radius:12px;padding:28px 16px;text-align:center;color:var(--muted)}
.empty.sm{padding:16px 8px;font-size:13px;border-width:1px}
.empty-page{max-width:520px;margin:12vh auto;text-align:center;display:flex;flex-direction:column;gap:14px;align-items:center}
.pad{padding:12px 16px}
.pre{white-space:pre-wrap}

/* kpis */
.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:0}
.kpis>div{padding:18px 20px;display:flex;flex-direction:column;gap:4px;border-left:1px solid var(--line);min-width:0}
.kpis>div:first-child{border-left:0}
.kpis .k{font-size:13px;color:var(--muted);font-weight:500}
.kpis b{font-size:clamp(18px,1.7vw,23px);font-weight:500;line-height:1.3;overflow-wrap:anywhere}
.kpis small{color:var(--muted);font-size:13px}
@media (max-width:820px){.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.kpis>div:nth-child(3){border-left:0}.kpis>div:nth-child(n+3){border-top:1px solid var(--line)}}

/* buttons & forms */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;font:600 14px var(--f-body);padding:9px 14px;border-radius:10px;border:1px solid var(--line-2);background:var(--card);color:var(--ink);cursor:pointer;white-space:nowrap;text-decoration:none!important}
.btn:hover{border-color:var(--muted)}
.btn.primary{background:var(--brand);border-color:var(--brand);color:var(--brand-ink)}
.btn.primary:hover{background:#8E4B2F}
.btn.ghost{background:transparent}
.btn.danger{color:var(--bad);border-color:#E6B8B1}
.btn.danger:hover{background:var(--bad-soft)}
.btn.sm{padding:6px 10px;font-size:13px;border-radius:8px}
.btn.lg{padding:13px 18px;font-size:15px}
.btn.block{width:100%}
input,select,textarea{font:inherit;color:var(--ink);background:#FFFEFC;border:1px solid var(--line-2);border-radius:10px;padding:9px 11px;width:100%;min-width:0}
textarea{resize:vertical}
input:focus,select:focus,textarea:focus{outline:2px solid var(--brand-soft);border-color:var(--brand)}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field>span{font-size:13px;font-weight:600}
.field em{font-style:normal;color:var(--bad);font-size:13px}
.field.has-err input,.field.has-err select{border-color:var(--bad)}
.check{display:inline-flex;gap:8px;align-items:center;font-size:14px;white-space:nowrap}
.check input{width:16px;height:16px;accent-color:var(--brand)}
.money-in{display:grid;grid-template-columns:90px minmax(0,1fr);gap:6px}
fieldset{border:0;padding:0 0 18px;margin:0 0 18px;border-bottom:1px solid var(--line)}
legend{font-family:var(--f-head);font-weight:600;font-size:16px;margin-bottom:12px;padding:0}
.form-sections{max-width:860px}
.sticky-actions{position:sticky;bottom:0;background:var(--card);padding-top:12px}
.note{padding:10px 12px;border-radius:10px;font-size:14px}
.note.err{background:var(--bad-soft);color:var(--bad)}.note.ok{background:var(--ok-soft);color:var(--ok)}
.toast{padding:12px 14px;border-radius:12px;background:var(--ok-soft);color:var(--ok);font-weight:600}
.toast.err{background:var(--bad-soft);color:var(--bad)}
.seg{display:grid;grid-template-columns:1fr 1fr;background:var(--st-new);border-radius:12px;padding:4px;gap:4px}
.seg label{cursor:pointer}.seg input{position:absolute;opacity:0}
.seg span{display:block;text-align:center;padding:9px;border-radius:9px;font-weight:600;color:var(--muted)}
.seg input:checked+span{background:var(--card);color:var(--ink);box-shadow:var(--shadow)}
.seg input:focus-visible+span{outline:2px solid var(--brand)}
.seg-links{display:inline-flex;background:var(--st-new);border-radius:10px;padding:3px}
.seg-links a{padding:6px 12px;border-radius:8px;color:var(--muted);font-weight:600;font-size:14px}
.seg-links a[aria-current]{background:var(--card);color:var(--ink);box-shadow:var(--shadow)}
.filters{display:flex;flex-wrap:wrap;gap:10px;align-items:center;padding:12px}
.filters input[type=search]{flex:1 1 260px}
.filters select{width:auto;flex:0 1 auto}

/* badges, chips, avatars */
.badge{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;font-size:12.5px;font-weight:600;white-space:nowrap}
.badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.8}
.st-new{background:var(--st-new);color:var(--st-new-ink)}
.st-contacted{background:var(--st-contacted);color:var(--st-contacted-ink)}
.st-meeting{background:var(--st-meeting);color:var(--st-meeting-ink)}
.st-proposal{background:var(--st-proposal);color:var(--st-proposal-ink)}
.st-won{background:var(--st-won);color:var(--st-won-ink)}
.st-lost{background:var(--st-lost);color:var(--st-lost-ink);outline:1px dashed var(--line-2)}
.chip{display:inline-block;font-size:12px;padding:2px 8px;border-radius:999px;background:var(--st-new);color:var(--muted);font-weight:600}
.chip.bad{background:var(--bad-soft);color:var(--bad)}
.pill{font-family:var(--f-mono);font-size:12px;padding:1px 7px;border-radius:999px;background:var(--st-new);color:var(--muted)}
.pill.bad{background:var(--bad-soft);color:var(--bad)}
.avatar{width:34px;height:34px;flex:none;border-radius:50%;display:grid;place-items:center;background:var(--st-proposal);color:var(--st-proposal-ink);font-weight:600;font-size:13px}
.avatar.sm{width:30px;height:30px;font-size:12px}.avatar.xs{width:24px;height:24px;font-size:10.5px}
.chips{display:flex;flex-wrap:wrap;gap:8px}

/* dashboard pieces */
.bars{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;height:220px;align-items:end}
.bar{display:grid;grid-template-rows:auto 1fr auto auto;height:100%;text-align:center;gap:4px}
.bar i{align-self:end;background:var(--brand);border-radius:8px 8px 3px 3px;min-height:3px;opacity:.85}
.bar small{color:var(--muted)}.bar em{font-style:normal;font-size:11px;color:var(--muted);overflow-wrap:anywhere}
.slip.has{border-color:#EBC6BF}
.slip.has h2{color:var(--bad)}
.slips{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px}
.slips li{display:flex;flex-direction:column;gap:6px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.slips select{padding:6px 8px}
.hbars{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.hbars li{display:grid;grid-template-columns:118px minmax(0,1fr) 28px minmax(70px,auto);gap:10px;align-items:center;font-size:14px}
.hbars i{height:8px;background:var(--st-new);border-radius:99px;overflow:hidden}
.hbars i b{display:block;height:100%;border-radius:99px;background:var(--brand)}
.hbars i b.st-new{background:#B9B1A6}.hbars i b.st-contacted{background:#D98D67}.hbars i b.st-meeting{background:#7FA678}.hbars i b.st-proposal{background:#7997C2}.hbars i b.st-won{background:#D6AD3E}.hbars i b.st-lost{background:#C9C3BB;outline:0}
.hbars .num{text-align:right;font-size:13px}
.hbars.src li{grid-template-columns:minmax(0,130px) minmax(0,1fr) 28px 44px}
.taglist{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}
.taglist a{display:inline-flex;gap:6px;padding:4px 10px;border-radius:999px;background:var(--st-new);color:var(--ink);font-size:13px}
.reps{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px}
.reps li{display:flex;gap:10px;align-items:flex-start}
.stack-bar{display:flex;height:6px;border-radius:99px;overflow:hidden;background:var(--st-new);margin:6px 0 4px}
.stack-bar i.st-new{background:#B9B1A6}.stack-bar i.st-contacted{background:#D98D67}.stack-bar i.st-meeting{background:#7FA678}.stack-bar i.st-proposal{background:#7997C2}.stack-bar i.st-won{background:#D6AD3E}.stack-bar i.st-lost{background:#C9C3BB;outline:0}
.feed{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.feed li{display:grid;grid-template-columns:12px minmax(0,1fr) auto;gap:12px;padding:10px 0;border-top:1px solid var(--line);align-items:start}
.feed li:first-child{border-top:0}
.dot{width:9px;height:9px;border-radius:50%;margin-top:6px;background:#B9B1A6}
.dot.t-stage{background:#7997C2}.dot.t-contact{background:#D98D67}.dot.t-note{background:#D6AD3E}.dot.t-assign{background:#7FA678}.dot.t-created{background:var(--brand)}

/* pipeline board */
.board{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(250px,1fr);gap:12px;overflow-x:auto;padding-bottom:8px;align-items:start}
.col{border-radius:var(--r);padding:10px;min-height:340px;display:flex;flex-direction:column;gap:10px;border:1px solid var(--line)}
.col header{display:flex;align-items:center;gap:8px;padding:2px 4px}
.st-bg-new{background:#F2EEE8}.st-bg-contacted{background:#F8EBE3}.st-bg-meeting{background:#EAF2E7}.st-bg-proposal{background:#E9EFF8}.st-bg-won{background:#F9F0D8}.st-bg-lost{background:#F4F2EF}
.drop{display:flex;flex-direction:column;gap:8px;flex:1;border-radius:10px;min-height:120px}
.col.over .drop{outline:2px dashed var(--brand);outline-offset:2px}
.lcard{display:flex;flex-direction:column;gap:6px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px;color:var(--ink);box-shadow:var(--shadow);cursor:grab}
.lcard:hover{text-decoration:none;border-color:var(--line-2)}
.lcard.dragging{opacity:.5}

/* table */
.tablewrap{overflow-x:auto}
.tbl{width:100%;border-collapse:collapse;min-width:860px}
.tbl th{text-align:left;font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:600;padding:12px 14px;border-bottom:1px solid var(--line);background:#FBF8F3}
.tbl td{padding:12px 14px;border-bottom:1px solid var(--line);vertical-align:middle}
.tbl tr:hover td{background:#FBF8F3}
.tbl tr.off td{opacity:.6}
.tbl th.r,.tbl td.r{text-align:right}
.cell-link{display:flex;flex-direction:column;color:var(--ink)}
.cell-link small,.tbl td small{display:block}
.pop{position:relative;display:inline-block;text-align:left}
.pop summary{list-style:none}.pop summary::-webkit-details-marker{display:none}
.pop-body{position:absolute;right:0;top:calc(100% + 6px);width:290px;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 40px -18px rgba(0,0,0,.35);padding:14px;z-index:15}

/* lead page */
.dl{display:grid;grid-template-columns:120px minmax(0,1fr);gap:8px 12px;margin:12px 0 0;font-size:14px}
.dl dt{color:var(--muted)}.dl dd{margin:0;overflow-wrap:anywhere}
.timeline{list-style:none;margin:12px 0 0;padding:0 0 0 18px;border-left:2px solid var(--line);display:flex;flex-direction:column;gap:14px}
.timeline li{position:relative;display:flex;flex-direction:column;gap:4px}
.timeline li::before{content:"";position:absolute;left:-24px;top:5px;width:10px;height:10px;border-radius:50%;background:#B9B1A6;border:2px solid var(--card)}
.timeline li.t-contact::before{background:#D98D67}.timeline li.t-stage::before{background:#7997C2}.timeline li.t-note::before{background:#D6AD3E}.timeline li.t-assign::before{background:#7FA678}.timeline li.t-created::before{background:var(--brand)}
.timeline p{font-size:14px;overflow-wrap:anywhere}
details.danger{border-top:1px solid var(--line);padding-top:12px}
details.danger summary{cursor:pointer;color:var(--bad);font-size:14px;font-weight:600}
details.danger form{margin-top:10px}
.add-member summary{list-style:none;display:inline-flex}.add-member summary::-webkit-details-marker{display:none}
.add-member[open] summary{margin-bottom:16px}
.steps{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:4px}

/* sign in */
body.bare{min-height:100vh;background:radial-gradient(1200px 600px at 10% 0%,#F7E9DD,transparent 60%),var(--bg)}
.auth{max-width:1100px;margin:0 auto;min-height:100vh;display:grid;grid-template-columns:1.1fr 1fr;gap:clamp(24px,6vw,80px);align-items:center;padding:32px max(20px,env(safe-area-inset-left))}
.auth-copy{display:flex;flex-direction:column;gap:20px}
.auth-copy h1{font-size:clamp(34px,5vw,58px);letter-spacing:-.03em;line-height:1.02}
.auth-copy .lead{font-size:17px;color:var(--muted);max-width:30em}
.auth-card{display:flex;flex-direction:column;gap:14px;padding:28px;border-radius:20px}
@media (max-width:820px){.auth{grid-template-columns:1fr;align-content:center}.auth-copy h1{font-size:34px}}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
@media (max-width:560px){.bar em{display:none}.bars{gap:8px}}
