:root {
  --ink: #17161a; --muted: #6b6877; --faint: #9a97a6; --line: #e4e2ea; --mist: #f4f3f7; --paper: #fff;
  --pink: #db1e80; --pink-soft: #fde8f3; --teal: #15bcc1; --teal-ink: #0b7f83; --teal-soft: #dff6f7;
  --warn: #9a5b00; --warn-soft: #fff1d6; --bad: #b3261e; --bad-soft: #fde7e5;
  --serif: 'Fraunces', Georgia, serif; --sans: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--mist); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.15; } h2 { font-size: 20px; } h3 { font-size: 17px; }
a { color: var(--pink); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 13px; } .muted { color: var(--muted); } .small { font-size: 13px; }
.right { margin-left: auto; } .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side { background: var(--paper); border-right: 1px solid var(--line); padding: 22px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { font-family: var(--serif); font-size: 21px; line-height: 1.15; padding: 0 10px 20px; font-weight: 600; }
.brand small { display: block; font: 400 12px var(--mono); color: var(--muted); margin-top: 6px; }
.nav a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; color: var(--ink); font-weight: 500; border-left: 3px solid transparent; }
.nav a:hover { background: var(--mist); text-decoration: none; }
.nav a.on { border-left-color: var(--pink); background: var(--pink-soft); border-radius: 0 6px 6px 0; }
.nav .count { font: 500 12px var(--mono); background: var(--pink); color: #fff; border-radius: 10px; padding: 1px 7px; }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 10px; }
.side .foot { margin-top: auto; padding: 0 10px; font-size: 13px; }
.main { padding: 28px 32px 64px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { margin-right: auto; }

/* controls */
.btn { background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 6px; padding: 8px 14px; font-weight: 500; cursor: pointer; }
.btn:hover { background: #000; } .btn.pink { background: var(--pink); border-color: var(--pink); } .btn.pink:hover { background: #c0156e; }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--line); } .btn.ghost:hover { border-color: var(--ink); }
.btn.sm { padding: 4px 10px; font-size: 13px; } .btn.danger { color: var(--bad); }
.link { background: none; border: 0; padding: 0; color: var(--pink); cursor: pointer; } .link:hover { text-decoration: underline; } .link.danger { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--paper); }
textarea { resize: vertical; line-height: 1.5; }
label.f { display: block; font-size: 13px; font-weight: 500; margin-bottom: 12px; } label.f > span { display: block; margin-bottom: 4px; }
label.f .hint { font-weight: 400; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; font-size: 14px; } label.check input { margin-top: 4px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.panel > h2 { margin-bottom: 12px; } .panel .head2 { display: flex; align-items: center; margin-bottom: 12px; gap: 10px; } .panel .head2 h2 { margin-right: auto; }
.empty { color: var(--muted); padding: 6px 0; }
.pill { display: inline-block; font: 500 12px var(--sans); padding: 2px 9px; border-radius: 20px; background: var(--mist); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--teal-soft); color: var(--teal-ink); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.pink { background: var(--pink-soft); color: var(--pink); }
table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; } tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--mist); }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.list > div { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; } .list > div:last-child { border-bottom: 0; }
.acts { display: flex; gap: 12px; margin-left: auto; font-size: 13px; flex-wrap: wrap; }

/* pipeline */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; min-height: 60vh; }
.col { flex: 0 0 224px; background: #ebe9f0; border-radius: 8px; padding: 10px; min-height: 160px; }
.col.over { outline: 2px dashed var(--pink); outline-offset: -2px; }
.col h3 { font: 600 13px var(--sans); display: flex; justify-content: space-between; padding: 2px 4px 10px; letter-spacing: 0; }
.col h3 span { font: 400 12px var(--mono); color: var(--muted); }
.col .sum { font: 400 12px var(--mono); color: var(--muted); padding: 0 4px 8px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 8px; cursor: grab; display: block; color: var(--ink); }
.card:hover { border-color: var(--ink); text-decoration: none; } .card.dragging { opacity: .4; }
.card .nm { font: 500 17px/1.2 var(--serif); }
.card .dt { font: 500 12.5px var(--mono); margin-top: 8px; display: flex; justify-content: space-between; gap: 6px; }
.card .dt .cd { color: var(--pink); font-weight: 400; } .card .dt .cd.past { color: var(--muted); }
.card .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 6px; }
.col.lost { background: transparent; border: 1px dashed var(--line); }

/* profile */
.phead { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; margin-bottom: 18px; }
.phead h1 { font-size: 40px; font-weight: 400; }
.bigdate { text-align: right; } .bigdate .d { font: 500 15px var(--mono); } .bigdate .c { font: 400 30px/1.1 var(--serif); color: var(--pink); } .bigdate .c.past { color: var(--muted); }
.steps { display: flex; gap: 3px; margin-bottom: 20px; overflow-x: auto; }
.steps button { flex: 1; border: 0; background: #e2dfe9; padding: 8px 10px; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--muted); }
.steps button:first-child { border-radius: 6px 0 0 6px; } .steps button:last-child { border-radius: 0 6px 6px 0; }
.steps button.done { background: var(--teal-soft); color: var(--teal-ink); } .steps button.cur { background: var(--pink); color: #fff; }
.steps button:hover { filter: brightness(.96); }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 0; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--pink); } .tabs a:hover { text-decoration: none; color: var(--ink); }
.two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; } dl.kv dt { color: var(--muted); font-size: 13px; } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.note { padding: 10px 0; border-bottom: 1px solid var(--line); } .note:last-child { border: 0; } .note p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .when { font: 400 12px var(--mono); color: var(--muted); display: flex; gap: 10px; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); } .task:last-child { border: 0; }
.task.done .t { text-decoration: line-through; color: var(--muted); } .task input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--pink); }
.task .due { font: 400 12px var(--mono); color: var(--muted); margin-left: auto; white-space: nowrap; } .task .due.late { color: var(--bad); }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.banner.lost { background: var(--bad-soft); color: var(--bad); }

/* analytics */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.kpi { padding: 16px 20px; border-right: 1px solid var(--line); } .kpi:last-child { border-right: 0; }
.kpi .v { font: 400 28px/1.1 var(--serif); } .kpi .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--mono); fill: var(--muted); } .chart .val { fill: var(--ink); }
.chart .bar { transition: opacity .1s; } .chart .hit:hover + .bar, .chart .hit:hover ~ .bar-self { opacity: .75; }
.hbar { display: grid; grid-template-columns: 130px 1fr 60px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 14px; } .hbar .fill { height: 100%; background: var(--pink); border-radius: 0 4px 4px 0; min-width: 2px; } .hbar .n { font-family: var(--mono); text-align: right; }
#tip { position: fixed; background: var(--ink); color: #fff; font: 12px var(--mono); padding: 5px 8px; border-radius: 4px; pointer-events: none; z-index: 50; white-space: nowrap; }

/* modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(23, 22, 26, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; z-index: 20; }
.modal { background: var(--paper); border-radius: 10px; width: 100%; max-width: 560px; padding: 24px; } .modal.wide { max-width: 820px; }
.modal h2 { margin-bottom: 16px; font-size: 22px; } .modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; align-items: center; }
.modal .err { color: var(--bad); font-size: 13px; margin-right: auto; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; }
.qa { margin-bottom: 14px; } .qa b { display: block; font-size: 13px; } .qa p { margin: 2px 0 0; white-space: pre-wrap; }
.frow { display: grid; grid-template-columns: 1fr 130px 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
pre.code { background: var(--mist); padding: 10px 12px; border-radius: 6px; font: 12px/1.5 var(--mono); overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 6px 0 0; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 32px; width: 100%; max-width: 400px; }
.auth h1 { margin-bottom: 6px; } .auth p { color: var(--muted); margin: 0 0 20px; } .auth .btn { width: 100%; padding: 10px; }
.auth .err { color: var(--bad); font-size: 13px; min-height: 20px; margin: 0 0 8px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; align-items: center; }
  .brand { padding: 0 10px; font-size: 18px; } .brand small, .side .foot, .nav hr { display: none; } .nav { display: flex; overflow-x: auto; }
  .nav a { border-left: 0; border-radius: 6px; white-space: nowrap; gap: 6px; } .nav a.on { border-radius: 6px; }
  .main { padding: 18px 14px 48px; } .two, .phead { grid-template-columns: minmax(0, 1fr); } .nav { max-width: 100%; } .side { min-width: 0; } .bigdate { text-align: left; } .phead h1 { font-size: 30px; }
  .cols2 { grid-template-columns: 1fr; } .charts { grid-template-columns: 1fr; } .frow { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.job { border-top: 1px solid var(--line); padding: 14px 0 4px; } .job:first-of-type { border-top: 0; padding-top: 0; }
.wf { margin: 10px 0 6px; padding: 10px 14px 4px; background: var(--mist); border-radius: 6px; } .wf > .row { margin-bottom: 6px; justify-content: space-between; }
.step { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.step .t { font-weight: 500; } .step.done .t, .step.skipped .t { color: var(--muted); font-weight: 400; } .step.skipped .t { text-decoration: line-through; }
.step .acts { margin-left: 0; }
.mail p { margin: 0 0 12px; } .mail ul { margin: 0 0 12px; padding-left: 22px; } .mail img { max-width: 260px; border-radius: 4px; } .mail.preview { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 12px; max-height: 320px; overflow: auto; }
.rt { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); margin-bottom: 12px; }
.rt-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; border-bottom: 1px solid var(--line); background: var(--mist); border-radius: 6px 6px 0 0; align-items: center; }
.rt-bar button { border: 1px solid transparent; background: none; border-radius: 4px; padding: 4px 10px; cursor: pointer; font-size: 14px; min-width: 32px; }
.rt-bar button:hover { background: var(--paper); border-color: var(--line); }
.rt-bar select { width: auto; margin-left: auto; padding: 4px 8px; font-size: 13px; }
.rt-url { display: flex; gap: 8px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); } .rt-url[hidden] { display: none; } .rt-url input { flex: 1; }
.rt-ed { padding: 12px 14px; max-height: 46vh; overflow-y: auto; outline: none; line-height: 1.55; } .rt-ed:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.rt-ed a { color: var(--pink); text-decoration: underline; }
.rt-doc .rt-bar select[data-cmd=block] { margin-left: 0; margin-right: 6px; } .rt-bar select + select, .rt-bar select[data-cmd=field] { margin-left: auto; }
.cdoc { font: 15px/1.6 Georgia, 'Times New Roman', serif; padding: 20px 26px; } .cdoc p { margin: 0 0 12px; } .cdoc ul, .cdoc ol { margin: 0 0 12px; padding-left: 24px; } .cdoc li { margin-bottom: 4px; }
.cdoc h1 { font: 700 18px Georgia, serif; text-align: center; letter-spacing: .04em; margin: 4px 0 18px; } .cdoc h2 { font: 700 15.5px Georgia, serif; margin: 20px 0 8px; } .cdoc h3 { font: 700 14.5px Georgia, serif; margin: 14px 0 6px; }
.qrow { border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 8px; display: grid; gap: 8px; } .qrow .q1 { display: grid; grid-template-columns: 1fr 200px; gap: 8px; align-items: start; }
.qrow .q2 { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .qrow .q2 select { width: auto; font-size: 13px; padding: 4px 8px; } .qrow .acts { margin-left: auto; } .qrow button:disabled { color: var(--faint); cursor: default; text-decoration: none; }
@media (max-width: 860px) { .qrow .q1 { grid-template-columns: 1fr; } }
.plan { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; } .plan:last-child { margin-bottom: 0; }
.planhead { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 6px; } .plan .list > div { padding: 7px 0; } .plan .list > div > .mono:first-child { min-width: 18px; }
.planacts { margin: 10px 0 0; justify-content: flex-start; }
.prow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 6px; } .prow input { margin: 0; }
