/* Inkwell dashboard — riso cobalt & coral, from the design canvas. */
:root{
  --bg:#F5EDE1; --side:#EFE4D4; --card:#FBF6EE; --line:#E3D5C2; --line-soft:#EDE3D5; --dash:#D9C7B0;
  --ink:#1E2546; --head:#172447; --muted:#535877; --faint:#6E7189;
  --blue:#23418F; --blue-hover:#1A3A78; --blue-tint:#E3E8F5;
  --coral:#F2876A; --coral-tint:#FBE6DC; --red:#D4583C; --red-dark:#B5452D;
  --plum:#5B3A78; --plum-tint:#ECE3F2; --green:#2F6B4F; --green-tint:#E1EFE6;
  --serif:'Instrument Serif',Georgia,serif; --sans:'Hanken Grotesk',system-ui,sans-serif; --hand:'Caveat',cursive;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--sans);font-size:15px;line-height:1.5}
a{color:var(--blue)}a:hover{color:var(--blue-hover)}
button,input,select,textarea{font-family:inherit;font-size:14px;color:var(--ink)}
h1,h2,h3{margin:0}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.muted{color:var(--muted)} .faint{color:var(--faint)} .small{font-size:13px} .tiny{font-size:12px}
.serif{font-family:var(--serif);font-weight:400} .hand{font-family:var(--hand)}
.row{display:flex;flex-wrap:wrap;align-items:center;gap:10px} .between{justify-content:space-between}
.stack{display:flex;flex-direction:column;gap:14px} .stack-s{display:flex;flex-direction:column;gap:6px}
.grow{flex:1;min-width:0} .right{text-align:right} .nowrap{white-space:nowrap}
.grid{display:grid;gap:14px;grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
.grid-wide{grid-column:1/-1}

/* ---------- shell */
.shell{min-height:100vh;display:flex;flex-wrap:wrap;align-items:stretch}
.side{flex:1 1 240px;max-width:100%;padding:24px 18px;border-right:1px solid var(--line);background:var(--side);display:flex;flex-direction:column;gap:22px}
.logo{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--blue);padding:0 6px}
.logo span{font-family:var(--serif);font-size:28px;line-height:1}
.agency-card{display:flex;align-items:center;gap:10px;padding:10px 12px;background:var(--card);border:1px solid var(--line);border-radius:14px}
.agency-card select{border:0;background:transparent;font-weight:600;padding:0;max-width:150px}
.square{width:32px;height:32px;flex:none;border-radius:9px;background:var(--blue);color:var(--bg);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px}
.nav{display:flex;flex-direction:column;gap:4px}
.nav a{display:flex;align-items:center;gap:12px;text-decoration:none;color:var(--ink);font-weight:500;padding:10px 12px;min-height:44px;border-radius:12px}
.nav a:hover{background:rgba(35,65,143,.07);color:var(--ink)}
.nav a[aria-current=page]{background:var(--blue);color:var(--bg);font-weight:600}
.badge{font-size:12px;font-weight:700;background:var(--coral);color:var(--head);border-radius:999px;padding:1px 8px;margin-left:auto}
.balance{margin-top:auto;padding:16px;background:var(--card);border:1px solid var(--line);border-radius:16px;display:flex;flex-direction:column;gap:10px}
.eyebrow{font-size:12px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.bar{height:8px;border-radius:999px;background:var(--line);overflow:hidden}
.bar>div{height:100%;background:var(--blue);border-radius:999px}
.me{display:flex;align-items:center;gap:10px;padding:0 6px}
.main{flex:999 1 560px;min-width:0;padding:28px clamp(16px,3vw,40px) 48px;display:flex;flex-direction:column;gap:22px}
.page-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:16px}
.page-head h1{font-family:var(--serif);font-weight:400;font-size:clamp(34px,3.4vw,46px);line-height:1.05;color:var(--head)}
.status-pill{display:inline-flex;align-items:center;gap:8px;font-weight:600;font-size:13px;padding:8px 12px;border:1px solid var(--line);border-radius:999px;background:var(--card)}
.dot{width:8px;height:8px;border-radius:50%;background:var(--blue);display:inline-block;flex:none}

/* ---------- cards & text */
.card{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:18px 22px;display:flex;flex-direction:column;gap:14px;min-width:0}
.card h2{font-size:17px;font-weight:600}
.card.blue{background:var(--blue);color:var(--bg);border-color:var(--blue)}
.card.dashed{background:transparent;border:1.5px dashed var(--dash);align-items:center;justify-content:center;text-align:center;color:var(--muted);min-height:220px}
.cols{display:flex;flex-wrap:wrap;gap:20px;align-items:flex-start}
.cols>*{flex:1 1 300px}
.cols>.wide{flex:2 1 480px}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:16px 18px;display:flex;flex-direction:column;gap:6px}
.kpi .value{font-family:var(--serif);font-size:38px;line-height:1;color:var(--head)}
.delta{font-size:12px;font-weight:700;border-radius:999px;padding:2px 8px}
.delta.up{background:var(--green-tint);color:var(--green)} .delta.down{background:var(--coral-tint);color:var(--red-dark)} .delta.flat{background:var(--line-soft);color:var(--muted)}
.big-serif{font-family:var(--serif);font-size:40px;line-height:1}

/* ---------- controls */
.seg{display:inline-flex;flex-wrap:wrap;gap:3px;padding:4px;border:1px solid var(--line);border-radius:999px;background:var(--card)}
.seg a,.seg button{border:0;cursor:pointer;font-size:13px;padding:8px 14px;min-height:38px;border-radius:999px;background:transparent;color:var(--muted);font-weight:500;text-decoration:none;display:inline-flex;align-items:center}
.seg a[aria-current],.seg button[aria-pressed=true]{background:var(--blue);color:var(--bg);font-weight:600}
.tabs{display:inline-flex;flex-wrap:wrap;gap:4px;padding:4px;border:1px solid var(--line);border-radius:14px;background:var(--card);max-width:100%;align-self:flex-start}
.tabs a{font-size:14px;padding:9px 14px;min-height:40px;border-radius:10px;text-decoration:none;color:var(--muted);font-weight:500;display:inline-flex;align-items:center}
.tabs a[aria-current]{background:var(--blue);color:var(--bg);font-weight:600}
.chip{display:inline-flex;align-items:center;gap:7px;font-size:13px;font-weight:500;padding:7px 12px;min-height:36px;border-radius:999px;border:1px solid var(--line);background:var(--card);color:var(--ink);text-decoration:none;cursor:pointer}
.chip[aria-current],.chip.on{border-color:var(--blue);background:var(--blue-tint);color:var(--blue);font-weight:600}
.chip .dot{width:9px;height:9px}
label.chip input{position:absolute;opacity:0;pointer-events:none}
label.chip:has(input:checked){border-color:var(--blue);background:var(--blue-tint);color:var(--blue);font-weight:600}
label.chip:has(input:focus-visible){outline:2px solid var(--blue);outline-offset:2px}
.tag{font-size:12px;font-weight:600;border-radius:999px;padding:3px 10px;display:inline-block;white-space:nowrap}
.tag.blue{background:var(--blue-tint);color:var(--blue)} .tag.coral{background:var(--coral-tint);color:var(--red-dark)}
.tag.plum{background:var(--plum-tint);color:var(--plum)} .tag.grey{background:var(--line-soft);color:var(--muted)} .tag.green{background:var(--green-tint);color:var(--green)}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;cursor:pointer;font-weight:600;font-size:14px;border-radius:999px;padding:0 20px;min-height:44px;text-decoration:none;background:var(--blue);color:var(--bg);white-space:nowrap}
.btn:hover{background:var(--blue-hover);color:var(--bg)}
.btn.ghost{background:transparent;border:1px solid var(--blue);color:var(--blue)} .btn.ghost:hover{background:var(--blue-tint)}
.btn.quiet{background:var(--card);border:1px solid var(--line);color:var(--ink)} .btn.quiet:hover{background:var(--bg)}
.btn.danger{background:transparent;border:1px solid var(--red-dark);color:var(--red-dark)} .btn.danger:hover{background:var(--coral-tint)}
.btn.plum{background:transparent;border:1px solid var(--plum);color:var(--plum)}
.btn.sm{min-height:36px;padding:0 14px;font-size:13px}
.btn.block{width:100%}
.btn.light{background:#fff;color:var(--ink)}
.linkbtn{border:0;background:none;padding:6px 4px;color:var(--muted);cursor:pointer;font-size:13px;text-decoration:underline}

.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted)}
.input,.field input:not([type=checkbox]):not([type=radio]),.field select,.field textarea{font-size:14px;padding:10px 12px;min-height:44px;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink);width:100%}
.field textarea{min-height:auto;resize:vertical}
.input:focus,.field input:focus,.field select:focus,.field textarea:focus{outline:2px solid var(--blue);outline-offset:1px;border-color:var(--blue)}
.input.sm{min-height:36px;padding:6px 10px}
.hint{font-size:12px;color:var(--muted)}
.inline-form{display:inline}

/* switch built from a checkbox */
.switch{position:relative;display:inline-flex;align-items:center;gap:10px;cursor:pointer;font-size:14px}
.switch input{position:absolute;opacity:0;width:1px;height:1px}
.switch .track{flex:none;position:relative;width:46px;height:28px;border-radius:999px;background:var(--dash);transition:background .15s}
.switch .track::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(23,36,71,.25);transition:left .15s}
.switch input:checked+.track{background:var(--blue)} .switch input:checked+.track::after{left:21px}
.switch input:focus-visible+.track{outline:2px solid var(--blue);outline-offset:2px}
.setting{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;border-top:1px solid var(--line-soft)}
.setting:first-child{border-top:0}

/* ---------- tables */
.table-wrap{overflow-x:auto}
table.t{width:100%;border-collapse:collapse;font-size:14px}
table.t th{text-align:left;color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 8px 10px}
table.t td{padding:12px 8px;border-top:1px solid var(--line-soft);vertical-align:middle}
table.t th:first-child,table.t td:first-child{padding-left:0} table.t th:last-child,table.t td:last-child{padding-right:0}
.avatar{width:34px;height:34px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;color:#fff;background:var(--blue)}
.avatar.lg{width:44px;height:44px;font-size:17px}

/* ---------- chart & funnel */
.chart{display:flex;align-items:flex-end;justify-content:space-between;gap:4px;height:200px;border-bottom:1px solid var(--line)}
.chart .col{flex:1 1 0;max-width:56px;min-width:0;display:flex;flex-direction:column;justify-content:flex-end;height:100%;gap:2px}
.chart .top{background:var(--coral);border-radius:4px 4px 0 0}
.chart .base{background:var(--blue);border-radius:4px 4px 0 0}
.chart .top+.base{border-radius:0}
.swatch{width:10px;height:10px;border-radius:3px;display:inline-block}
.funnel-bar{height:12px;border-radius:999px;background:var(--line-soft);overflow:hidden}
.funnel-bar>div{height:100%;background:var(--blue);border-radius:999px}
.cr{padding:12px 14px;border-radius:12px;background:var(--blue-tint);display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.attention{display:flex;align-items:center;gap:12px}
.attention .n{width:36px;height:36px;flex:none;border-radius:10px;display:flex;align-items:center;justify-content:center;font-weight:700}

/* ---------- conversations */
.inbox{display:flex;flex-wrap:wrap;gap:16px;align-items:stretch}
.threads{flex:1 1 280px;min-width:0;padding:10px;gap:4px;align-self:flex-start;max-height:calc(100vh - 220px);overflow-y:auto}
.thread{display:flex;gap:12px;align-items:flex-start;padding:12px;border-radius:14px;text-decoration:none;color:var(--ink)}
.thread:hover{background:rgba(35,65,143,.05);color:var(--ink)}
.thread[aria-current]{background:var(--blue-tint)}
.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chatbox{flex:2 1 420px;min-width:0;padding:0;gap:0;min-height:620px}
.chatbox .head{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line)}
.messages{flex:1;padding:20px;display:flex;flex-direction:column;gap:10px;overflow-y:auto;max-height:60vh}
.msg{display:flex;flex-direction:column;gap:3px;max-width:78%}
.msg .bubble{padding:10px 14px;border-radius:16px;font-size:14px;white-space:pre-wrap;word-wrap:break-word}
.msg.fan{align-self:flex-start} .msg.fan .bubble{background:#fff;border:1px solid var(--line);border-bottom-left-radius:4px}
.msg.us{align-self:flex-end;align-items:flex-end} .msg.us .bubble{background:var(--blue);color:var(--bg);border-bottom-right-radius:4px}
.msg.us.member .bubble{background:var(--plum)}
.msg.queued .bubble{opacity:.7} .msg.failed .bubble{background:var(--coral-tint);color:var(--red-dark)}
.msg .meta{font-size:11px;color:var(--muted)}
.locked{display:inline-flex;align-items:center;gap:6px;font-weight:600}
.draft{margin:0 20px 16px;padding:14px 16px;background:var(--coral-tint);border:1.5px dashed var(--red);border-radius:14px;display:flex;flex-direction:column;gap:10px}
.composer{display:flex;gap:10px;padding:14px 20px;border-top:1px solid var(--line)}
.fanpanel{flex:1 1 220px;min-width:0;align-self:flex-start}

/* ---------- vault */
.vault{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.vitem{background:var(--card);border:1px solid var(--line);border-radius:18px;overflow:hidden;display:flex;flex-direction:column}
.thumb{position:relative;height:150px;background-color:var(--blue);background-size:cover;background-position:center}
.thumb .t1{position:absolute;top:10px;left:10px;font-size:12px;font-weight:600;color:#fff;background:rgba(23,36,71,.72);border-radius:999px;padding:4px 10px}
.thumb .price{position:absolute;bottom:10px;left:10px;font-size:14px;font-weight:700;color:var(--head);background:var(--card);border-radius:999px;padding:4px 12px}
.thumb-1{background-image:url(/static/img/card-starter.jpg)} .thumb-2{background-image:url(/static/img/card-growth.jpg)}
.thumb-3{background-image:url(/static/img/card-scale.jpg)} .thumb-4{background-image:url(/static/img/card-agency.jpg)}
.vbody{padding:14px 16px 16px;display:flex;flex-direction:column;gap:10px}
.stats3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.stats3 span{display:flex;flex-direction:column} .stats3 small{font-size:11px;color:var(--muted)} .stats3 b{font-size:14px}

/* ---------- models, sequences, plans */
.mcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
.step{display:grid;grid-template-columns:140px minmax(0,1fr) 130px auto;gap:8px;align-items:center;padding:10px;border:1px solid var(--line-soft);border-radius:12px;background:var(--bg)}
.step .wide{grid-column:1/-1;grid-row:2}
.step.blank{border-style:dashed;background:transparent}
@media (max-width:760px){.step{grid-template-columns:1fr 1fr}}
.phase{display:grid;grid-template-columns:28px minmax(140px,1fr) 2fr 150px auto;gap:8px;align-items:start;padding:10px;border:1px solid var(--line-soft);border-radius:12px;background:var(--bg)}
.phase.blank{border-style:dashed;background:transparent}
@media (max-width:760px){.phase{grid-template-columns:1fr}}
.num{width:28px;height:28px;border-radius:50%;background:var(--blue);color:var(--bg);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px}
.plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
.plan{border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:8px;background:var(--card)}
.plan.current{border:2px solid var(--blue)}
.plan .price{font-family:var(--serif);font-size:38px;line-height:1;color:var(--head)}
.matrix td,.matrix th{text-align:center} .matrix td:first-child,.matrix th:first-child{text-align:left}
.matrix input{width:20px;height:20px;accent-color:var(--blue)}

/* ---------- flash, empty, errors */
.flash{position:fixed;right:20px;bottom:20px;z-index:50;max-width:380px;padding:14px 18px;border-radius:14px;font-weight:600;box-shadow:0 8px 30px rgba(23,36,71,.18);animation:flash-out 6s forwards}
.flash.ok{background:var(--head);color:var(--bg)} .flash.error{background:var(--red-dark);color:#fff}
@keyframes flash-out{0%,85%{opacity:1;transform:none}100%{opacity:0;transform:translateY(8px);visibility:hidden}}
.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;border:1.5px dashed var(--dash);border-radius:18px;color:var(--muted);padding:32px 24px}
.empty b{color:var(--ink)}
.notice{padding:12px 14px;border-radius:12px;background:var(--blue-tint);color:var(--ink);font-size:14px}
.notice.warn{background:var(--coral-tint);color:var(--red-dark)}
.htmx-request .spin{opacity:.6}
details.more>summary{cursor:pointer;list-style:none;font-weight:600;color:var(--blue)}
details.more>summary::-webkit-details-marker{display:none}

/* ---------- auth pages */
.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.auth .card{width:100%;max-width:420px;padding:28px}
.auth h1{font-family:var(--serif);font-weight:400;font-size:42px;line-height:1;color:var(--head)}

@media (max-width:820px){
  .side{flex-basis:100%;border-right:0;border-bottom:1px solid var(--line);gap:14px}
  .nav{flex-direction:row;flex-wrap:wrap}
  .balance{margin-top:0}
}
