/* MM Digital Dashboard. MM Digital teal on slate; dark and light. */
:root {
  --bg: #0E1419; --bg2: #151D24; --bg3: #1D2731; --bg4: #26323D;
  --fg: #F2F6F8; --text: #C3CCD3; --muted: #8796A3;
  --line: rgb(255 255 255 / .07); --line2: rgb(255 255 255 / .13);
  --brand: #13B5BE; --brand2: #0E9AA2; --on-brand: #04252A; --brand-soft: rgb(19 181 190 / .12);
  --good: #3BD18F; --warn: #F2B84B; --bad: #F26D6D;
  --c-domain: #FF8A4C; --c-website: #5B9BFF; --c-social: #C08BF5; --c-none: #E9C64A; --c-unchecked: #6B7785;
  --shadow: 0 18px 50px rgb(0 0 0 / .45);
  --radius: 12px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F2F5F6; --bg2: #FFFFFF; --bg3: #EEF2F4; --bg4: #E3E9EC;
  --fg: #14212A; --text: #3C4A54; --muted: #66747E;
  --line: rgb(20 33 42 / .08); --line2: rgb(20 33 42 / .15);
  --brand: #0095A0; --brand2: #007C85; --on-brand: #FFFFFF; --brand-soft: rgb(0 149 160 / .09);
  --good: #13965F; --warn: #B7791F; --bad: #D64545;
  --c-domain: #E0602A; --c-website: #2F6FE4; --c-social: #8A4FD3; --c-none: #A88710; --c-unchecked: #7A8691;
  --shadow: 0 18px 50px rgb(20 33 42 / .16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: 'Syne', 'DM Sans', sans-serif; color: var(--fg); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: 'DM Sans', sans-serif; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
b { color: var(--fg); font-weight: 600; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); } .hint { color: var(--muted); font-size: 12.5px; margin: 6px 0; }
.err { color: var(--bad); min-height: 1em; font-size: 13px; margin-top: 6px; } .bad-text { color: var(--bad); }
kbd { font: 11px/1 ui-monospace, monospace; padding: 2px 5px; border: 1px solid var(--line2); border-radius: 4px; color: var(--muted); background: var(--bg3); }
code { font: 12px ui-monospace, monospace; background: var(--bg3); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.only-light { display: none; } :root[data-theme="light"] .only-light { display: inline; } :root[data-theme="light"] .only-dark { display: none; }
.is-online .pc-only { display: none !important; } .is-pc .online-only { display: none !important; }

/* Form controls */
input, select, textarea { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); padding: 0; flex: none; }
input[type="date"] { color-scheme: inherit; }
.lbl { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
.tick { display: flex; gap: 9px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
.tick input { margin-top: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 13.5px 'DM Sans', sans-serif; color: var(--fg); background: var(--bg3);
  border: 1px solid var(--line2); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--bg4); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn kbd { margin-left: 4px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--text); cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: var(--bg3); }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
.link.small { font-size: 12px; color: var(--muted); }
.chip-btn { font: 600 12px 'DM Sans', sans-serif; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2); background: var(--bg3); color: var(--text); cursor: pointer; }
.chip-btn:hover, .chip-btn.on { border-color: var(--brand); color: var(--brand); }

/* ---- sign-in ------------------------------------------------------------------- */
body.locked #app { display: none !important; }
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 80% -10%, var(--brand-soft), transparent 60%), radial-gradient(700px 400px at -10% 110%, var(--brand-soft), transparent 60%), var(--bg); }
.signin-card { width: min(400px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 34px 32px 26px; box-shadow: var(--shadow); }
.signin-logo { display: block; height: 34px; width: auto; margin: 0 0 22px; }
.signin h1 { font-size: 24px; }
.signin-sub { color: var(--muted); margin: 4px 0 18px; }
.signin form .btn.block { margin-top: 16px; padding: 11px; }
.signin form .btn.ghost.block { margin-top: 8px; }
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font: 600 12px 'DM Sans', sans-serif; cursor: pointer; padding: 6px; }
.code-input { font: 600 26px/1 ui-monospace, monospace; letter-spacing: .45em; text-align: center; padding: 12px; }
.setup-steps { padding-left: 20px; margin: 0 0 10px; color: var(--text); }
#si-qr { display: block; margin: 8px auto; background: #fff; padding: 10px; border-radius: 12px; }
.signin-foot { margin: 20px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---- layout -------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 14px; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; }
.side-brand img { height: 24px; width: auto; }
.side-brand span { font: 700 13px 'Syne', sans-serif; color: var(--muted); }
.search-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg); color: var(--muted); cursor: pointer; font: inherit; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--bg3); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a .ni { width: 18px; text-align: center; opacity: .8; }
.nav a kbd { margin-left: auto; opacity: 0; }
.nav a:hover kbd { opacity: 1; }
.nav .count { margin-left: auto; font: 600 11px 'DM Sans'; background: var(--bg4); color: var(--fg); padding: 1px 7px; border-radius: 999px; }
.nav .count:empty { display: none; }
.nav .count + kbd { margin-left: 6px; }
.side-foot { margin-top: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pc-badge { font-size: 11px; color: var(--brand); border: 1px solid var(--brand); border-radius: 999px; padding: 2px 8px; margin-left: auto; }
.main { overflow-y: auto; outline: none; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 32px 60px; }
.page.wide { max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.loading { padding: 40px; color: var(--muted); }
.banner { background: var(--bg3); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--bg2)); color: var(--fg); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty h3 { margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

/* ---- Today --------------------------------------------------------------------- */
.focus-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.focus { display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); transition: border-color .12s, transform .12s; }
.focus:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.focus-n { font: 700 32px/1.1 'Syne', sans-serif; color: var(--fg); }
.focus-l { font-weight: 600; color: var(--fg); }
.focus-s { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.focus-cta { margin-top: 10px; font-weight: 600; color: var(--brand); }
.focus.go { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: linear-gradient(160deg, var(--brand-soft), var(--bg2) 60%); }
.focus.warn .focus-n { color: var(--warn); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.cols .panel { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; cursor: pointer; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--bg3); }
.row-item.static { cursor: default; }
.ri-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ri-main b, .ri-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-main span { font-size: 12.5px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0; }
.stats div { background: var(--bg3); border-radius: 10px; padding: 12px; }
.stats b { display: block; font: 700 22px 'Syne', sans-serif; }
.stats span { font-size: 12px; color: var(--muted); }

/* ---- tags, pills, score -------------------------------------------------------- */
.tag { display: inline-block; font: 600 11.5px 'DM Sans'; padding: 2px 8px; border-radius: 999px; background: var(--bg4); color: var(--text); white-space: nowrap; }
.tag.due { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tag.late { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.tag.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.tag.prio { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tag.who { background: var(--brand-soft); color: var(--brand); }
.chip { display: inline-block; font: 600 11.5px 'DM Sans'; padding: 2px 9px; border-radius: 6px; background: var(--bg4); color: var(--fg); }
.chip.stage-shortlisted { background: var(--brand-soft); color: var(--brand); }
.chip.stage-consent-asked, .chip.stage-letter-sent, .chip.stage-visited { background: color-mix(in srgb, var(--c-website) 16%, transparent); color: var(--c-website); }
.chip.stage-in-talks, .chip.stage-quoted { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chip.stage-won { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.chip.stage-do-not-contact { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-unchecked); }
.pill.b-domain i { background: var(--c-domain); } .pill.b-website i { background: var(--c-website); } .pill.b-social i { background: var(--c-social); } .pill.b-none i { background: var(--c-none); }
.score { display: inline-grid; place-items: center; min-width: 32px; height: 24px; padding: 0 6px; border-radius: 6px; font: 700 12.5px 'DM Sans'; background: var(--bg4); color: var(--text); }
.score.warm { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.score.hot { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }

/* ---- Leads table --------------------------------------------------------------- */
.toolbar { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; color: var(--muted); font: 600 13px 'DM Sans'; cursor: pointer; margin-bottom: -1px; }
.tab b { color: inherit; font-weight: 500; opacity: .8; margin-left: 2px; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.bulk { display: flex; gap: 8px; align-items: center; background: var(--brand-soft); border: 1px solid var(--brand); padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }
.bulk span { font-weight: 600; color: var(--fg); margin-right: 6px; }
.table-wrap { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 600 11.5px 'DM Sans'; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; background: var(--bg3); border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--bg3); }
.table td small { display: block; color: var(--muted); }
.table .cb { width: 36px; }
.table tr.row-due td { background: color-mix(in srgb, var(--warn) 7%, transparent); } .table tr.row-late td { background: color-mix(in srgb, var(--bad) 7%, transparent); }
#ld-more { margin-top: 12px; }

/* ---- drawer -------------------------------------------------------------------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100vw); background: var(--bg2); border-left: 1px solid var(--line2); box-shadow: var(--shadow);
  overflow-y: auto; padding: 22px 22px 40px; z-index: 50; animation: slide .16s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-close { position: absolute; top: 14px; right: 14px; }
.lead-head { padding-right: 40px; margin-bottom: 14px; }
.lead-title { display: flex; gap: 10px; align-items: center; }
.lead-title h2 { font-size: 20px; }
.lead-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; }
.lead-summary { margin: 10px 0 0; color: var(--text); font-size: 13px; }
.next { border: 1px solid var(--line2); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--bg3); }
.next.go { border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: linear-gradient(160deg, var(--brand-soft), var(--bg3)); }
.next.stop { border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--bg3)); }
.next.muted { opacity: .8; }
.next-label { font: 700 11px 'DM Sans'; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-bottom: 4px; }
.next.stop .next-label { color: var(--bad); }
.next p { margin: 6px 0 0; font-size: 13px; }
.card-sec { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.card-sec > h4, .card-sec > summary { margin-bottom: 8px; }
details.card-sec summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.links-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.log-row { display: flex; gap: 6px; align-items: flex-start; }
.log-row select { width: auto; flex: none; max-width: 45%; }
.log-row .btn { flex: none; }
.timeline { list-style: none; padding: 0; margin: 10px 0 0; }
.timeline li { border-left: 2px solid var(--line2); padding: 2px 0 10px 12px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li.muted::before { background: var(--line2); }
.timeline time { margin-left: 8px; font-size: 12px; color: var(--muted); }
.timeline p { margin: 2px 0 0; white-space: pre-wrap; }
.facts { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; word-break: break-word; }
.popia { font-size: 12.5px; background: var(--bg3); border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.popia.stop { color: var(--bad); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.checks li::before { content: '✕'; color: var(--bad); margin-right: 6px; font-weight: 700; }
.checks li.ok::before { content: '✓'; color: var(--good); }
.shots { display: grid; grid-template-columns: 3fr 1fr; gap: 8px; margin-top: 10px; }
.shots img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.tried { font-size: 12.5px; padding-left: 16px; }
.danger-zone { opacity: .85; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; margin-bottom: 4px; }
.seg-b { border: 0; background: transparent; color: var(--text); padding: 6px 14px; font: 600 12.5px 'DM Sans'; cursor: pointer; }
.seg-b.on { background: var(--brand); color: var(--on-brand); }
.links-list, .plain { list-style: none; padding: 0; margin: 0; }
.links-list li, .plain li { padding: 4px 0; display: flex; gap: 10px; align-items: baseline; }
.pre { white-space: pre-wrap; font-size: 13px; }

/* ---- Pipeline ------------------------------------------------------------------ */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 420px; }
.lane > header { display: flex; justify-content: space-between; padding: 12px 14px 8px; }
.lane > header b { color: var(--muted); }
.lane-body { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lane.over, .drop-out.over { outline: 2px dashed var(--brand); outline-offset: -4px; }
.lane-empty { color: var(--muted); font-size: 12.5px; padding: 8px 4px; }
.pcard { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; }
.pcard:hover { border-color: var(--brand); }
.pc-top { display: flex; gap: 8px; align-items: center; }
.pc-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pc-next { font-size: 12.5px; margin-top: 6px; color: var(--fg); }
.pc-foot { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pc-foot:empty { display: none; }
.drop-out { display: none; margin-top: 12px; border: 1px dashed var(--line2); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); }
body.dragging .drop-out { display: block; }
.lost { margin-top: 14px; } .lost summary { cursor: pointer; color: var(--muted); }
.lost-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 10px; }

/* ---- Outreach ------------------------------------------------------------------ */
.split { display: grid; grid-template-columns: 270px 1fr; gap: 14px; align-items: start; }
.queue { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; max-height: calc(100vh - 170px); overflow-y: auto; position: sticky; top: 0; }
.q-item { display: grid; grid-template-columns: 12px 1fr; column-gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text); font: inherit; }
.q-item:hover { background: var(--bg3); }
.q-item.on { background: var(--brand-soft); }
.q-dot { grid-row: span 2; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.q-dot.ok { background: var(--good); }
.q-name { font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-sub { font-size: 12px; color: var(--muted); }
.composer { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.comp-head > div:first-child { display: flex; gap: 10px; align-items: center; }
.comp-meta { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 12.5px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.step { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.step.done { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.step input:not([type]) , .step input[id] { margin-top: 6px; }
.mail { border: 1px solid var(--line2); border-radius: 10px; padding: 12px; background: var(--bg); }
.mail-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.mail-row span { color: var(--muted); font-size: 12.5px; }
.mail textarea { font-family: 'DM Sans', sans-serif; min-height: 300px; }
.comp-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }

/* ---- Tasks --------------------------------------------------------------------- */
.tasks-page { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: start; }
.subnav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 4px; max-height: calc(100vh - 60px); overflow-y: auto; }
.subnav h4 { margin: 16px 8px 6px; }
.sn-item { display: flex; justify-content: space-between; gap: 8px; background: none; border: 0; text-align: left; padding: 6px 8px; border-radius: 7px; color: var(--text); cursor: pointer; font: inherit; }
.sn-item:hover { background: var(--bg3); }
.sn-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sn-item.dim { opacity: .55; }
.sn-item b { font-weight: 500; color: inherit; opacity: .8; }
.tasks-main .page-head input { max-width: 320px; }
.quick-add input { padding: 11px 14px; border-style: dashed; background: var(--bg2); }
.tgroup { margin-top: 18px; }
.tgroup h3 { margin-bottom: 6px; font-size: 14px; } .tgroup h3 b { color: var(--muted); font-weight: 500; margin-left: 4px; }
.tlist { list-style: none; margin: 0; padding: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.trow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--bg3); }
.trow.done .tmain b { text-decoration: line-through; color: var(--muted); }
.tnum { font: 600 12px ui-monospace, monospace; color: var(--muted); }
.tmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tmain small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st { flex: none; width: 70px; font: 600 11.5px 'DM Sans'; padding: 4px 0; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg3); color: var(--text); cursor: pointer; }
.st-todo { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.st-waiting { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.st-done { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.chip.st-todo { background: var(--brand-soft); } .chip.st-waiting { background: color-mix(in srgb, var(--warn) 14%, transparent); } .chip.st-done { background: color-mix(in srgb, var(--good) 14%, transparent); }

/* ---- Clients ------------------------------------------------------------------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.client-card { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; gap: 2px 12px; text-align: left; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer; color: var(--text); font: inherit; }
.client-card:hover { border-color: var(--brand); }
.client-card.dim { opacity: .6; }
.cc-avatar { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font: 700 13px 'Syne'; }
.cc-main { display: flex; flex-direction: column; min-width: 0; }
.cc-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Find ---------------------------------------------------------------------- */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.area { background: var(--bg3); border-radius: 10px; padding: 10px 12px; }
.area.dim { opacity: .7; }
.area small { display: block; color: var(--muted); }
.area .btn-row { margin-top: 8px; }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 260px; overflow: auto; font: 12px/1.5 ui-monospace, monospace; white-space: pre-wrap; margin: 0; }
.hits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dupe { border-top: 1px solid var(--line); padding: 10px 0; }
.dupe-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dupe-card { background: var(--bg3); border-radius: 8px; padding: 8px 10px; }
.dupe-card small { display: block; color: var(--muted); }

/* ---- palette, dialog, toasts --------------------------------------------------- */
.palette, .dialog { position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 100; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.dialog { align-items: center; padding-top: 16px; }
.palette-box { width: min(620px, 100%); background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.palette-box input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; background: transparent; }
.palette-box input:focus { box-shadow: none; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.pal-item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--fg); font: inherit; }
.pal-item small { color: var(--muted); grid-row: 2; }
.pal-item em { grid-row: span 2; grid-column: 2; align-self: center; font-style: normal; font-size: 11.5px; color: var(--muted); }
.pal-item.sel { background: var(--brand-soft); }
.pal-empty { padding: 16px; color: var(--muted); }
.palette-foot { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dialog-box { width: min(520px, 100%); max-height: 88vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); padding: 22px 24px; }
.dialog-box.wide { width: min(820px, 100%); }
.dialog-box h2 { margin-bottom: 10px; }
.dialog-box .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.dialog-box .actions .ghost { margin-right: auto; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.keys dd { margin: 0; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast { background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast.good { background: var(--good); color: #062B1A; } .toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---- small screens ------------------------------------------------------------- */
@media (max-width: 1100px) {
  .focus-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  .side { flex-direction: row; flex-wrap: wrap; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; } .nav a kbd, .search-btn kbd { display: none; }
  .search-btn { width: auto; } .side-foot { margin-top: 0; }
  .page { padding: 18px 14px 40px; }
  .cols, .split, .tasks-page, .row2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(5, 240px); }
  .subnav { position: static; max-height: none; }
  .table th:nth-child(5), .table td:nth-child(5), .table th:nth-child(7), .table td:nth-child(7) { display: none; }
}

/* Layout fixes: long text never stretches a column (grid/flex children may shrink). */
.view { min-width: 0; }
.tasks-page { grid-template-columns: 230px minmax(0, 1fr); }
.tasks-main, .composer, .panel, .ri-main, .tmain, .cc-main, .lane { min-width: 0; }
.split { grid-template-columns: 270px minmax(0, 1fr); }
.cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* Tablet */
@media (max-width: 1100px) {
  .app { grid-template-columns: 200px minmax(0, 1fr); }
  .tasks-page { grid-template-columns: 190px minmax(0, 1fr); gap: 16px; }
  .split { grid-template-columns: 220px minmax(0, 1fr); }
  .board { grid-template-columns: repeat(5, 230px); }
  .page { padding: 22px 20px 50px; }
}

/* Phone: one compact top bar, the menu scrolls sideways. */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 10px; padding: 10px 12px; position: sticky; top: 0; z-index: 20; }
  .side-brand { padding: 0; } .side-brand span { display: none; }
  .search-btn { justify-self: end; width: auto; padding: 6px 10px; } .search-btn span { display: none; } .search-btn::before { content: '⌕'; font-size: 16px; }
  .side-foot { grid-column: 3; grid-row: 1; margin: 0; flex-wrap: nowrap; } .side-foot .pc-badge, #keys-btn { display: none; }
  .nav { grid-column: 1 / -1; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 7px 11px; white-space: nowrap; }
  .nav a .ni { display: none; }
  .tasks-page, .split, .cols { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; max-height: none; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .subnav h4, .subnav .btn.block { display: none; }
  .subnav .sn-item { flex: none; white-space: nowrap; border: 1px solid var(--line2); }
  .queue { position: static; max-height: 220px; }
  .focus-grid, .stats { grid-template-columns: 1fr 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; } .toolbar #f-q { grid-column: 1 / -1; }
  .page-head h1 { font-size: 22px; }
  .tasks-main .page-head input { max-width: none; }
  .mail-row { grid-template-columns: 1fr auto; } .mail-row span { grid-column: 1 / -1; }
  .drawer { padding: 18px 16px 40px; }
  .checks { grid-template-columns: 1fr; }
  .log-row { flex-wrap: wrap; } .log-row select { max-width: none; flex: 1 1 100%; }
  .table td:first-child, .table th:first-child { display: none; }
}
.table-wrap { overflow-x: auto; }
@media (max-width: 820px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; white-space: nowrap; }
  .table { min-width: 560px; }
}

/* ---- wider layout ---------------------------------------------------------------- */
.page { max-width: 1640px; }
.page.wide { max-width: none; }
.today-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.today-grid.two-one { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.today-grid .panel { margin-bottom: 0; }
.stack-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stack-col .panel { margin: 0; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 90px 1fr 32px; align-items: center; gap: 10px; font-size: 13px; }
.bars i { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--brand) var(--w), var(--bg4) var(--w)); }
.bars b { text-align: right; }
.row-item .tnum { flex: none; }

/* ---- detail pages (lead, task, client) ------------------------------------------ */
.detail-page { max-width: 1480px; }
.crumbs { font-size: 13px; margin-bottom: 10px; display: flex; gap: 8px; color: var(--muted); }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--brand); }
.detail-head { margin-bottom: 18px; }
.detail-head h1 { font-size: 28px; line-height: 1.25; margin-top: 6px; }
.detail-kicker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; }
.detail-lead { font-size: 15px; color: var(--text); margin: 8px 0 0; max-width: 80ch; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.detail-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.detail-main .next { margin: 0; }
.detail-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.detail-side > .btn { align-self: flex-start; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card > h4 { margin-bottom: 10px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-top h4 { margin: 0; }
details.card summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.prose { color: var(--text); line-height: 1.65; max-width: 90ch; word-wrap: break-word; }
.prose p { margin: 0 0 10px; } .prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 22px; } .prose li { margin: 3px 0; }
.prose a { word-break: break-all; }
.meta { display: grid; grid-template-columns: 70px 1fr; gap: 8px 10px; align-items: center; margin: 14px 0 6px; font-size: 13px; }
.meta dt { color: var(--muted); } .meta dd { margin: 0; }
.meta input, .meta select { padding: 6px 8px; }
.seg.full { display: flex; width: 100%; } .seg.full .seg-b { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.stack .btn { align-self: flex-start; }
.note-add { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.note-add .btn { align-self: flex-end; }
.timeline.big li { padding-bottom: 16px; }
.tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.tl-head time { margin: 0; }
.tl-head .link, .tl-head small { margin-left: auto; }
.plain li { flex-direction: column; gap: 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
.plain li .muted { font-size: 12.5px; }
.links-row a { font-weight: 600; }

@media (max-width: 1300px) {
  .today-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .today-grid > .panel:nth-child(3) { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 900px) {
  .today-grid, .today-grid.two-one { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-side { position: static; }
  .detail-head h1 { font-size: 22px; }
}
