:root {
  --bg: #fafafa; --panel: #ffffff; --line: #e4e4e7; --line2: #f4f4f5;
  --text: #18181b; --muted: #71717a; --muted2: #85858f;
  --accent: #18181b; --accent-h: #27272a; --brand: #ea580c; --focus: rgba(24, 24, 27, .08);
  --danger: #dc2626; --ok: #16a34a; --warn: #ea580c;
  --r: 8px; --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font: 14px/1.45 var(--font);
  color: var(--text);
  font-feature-settings: "cv11", "ss01";
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }
.loading { height: 2px; background: linear-gradient(90deg, transparent, var(--text), transparent); background-size: 40% 100%; animation: load 1s linear infinite; }
@keyframes load { from { background-position: -40% 0; } to { background-position: 140% 0; } }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: var(--r); padding: 7px 10px; background: var(--panel); min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted2); }
input:hover, select:hover, textarea:hover { border-color: var(--line3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
textarea { resize: vertical; width: 100%; }
input[type=color] { padding: 2px; width: 34px; height: 32px; cursor: pointer; }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--text); cursor: pointer; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 7px 12px; cursor: pointer; white-space: nowrap; font-weight: 500; box-shadow: var(--shadow); transition: background .15s, border-color .15s; }
.btn:hover { background: var(--line2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-h); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 10px; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: var(--r); cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover:not(:disabled) { background: var(--line2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--danger); }
.link { border: 0; background: none; color: var(--text); cursor: pointer; padding: 6px 0; font-weight: 500; }
.link:hover { text-decoration: underline; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.ava { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 600;
  align-items: center; justify-content: center; flex: none; vertical-align: middle; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--line2); color: var(--text); white-space: nowrap; border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); filter: saturate(1.6) brightness(.85); }
.tag { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 11px; background: var(--line2); color: var(--text2); margin: 0 4px 2px 0; line-height: 18px; }
.badge { padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--line2); border: 1px solid var(--line); }
.badge.admin { background: var(--warn-bg); border-color: #fed7aa; color: #9a3412; }
.badge.won { background: var(--ok-bg); border-color: #bbf7d0; color: #15803d; }
.badge.lost { background: var(--line2); color: var(--muted); }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel); color: var(--text); padding: 10px 14px 10px 12px; border-radius: var(--r); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08); display: flex; align-items: center; gap: 8px; animation: pop .2s ease-out; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.toast.ok::before { background: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* auth */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-side { background: #18181b; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 34px; line-height: 1.15; max-width: 460px; font-weight: 600; letter-spacing: -.02em; margin: auto 0 28px; }
.auth-side ul { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 12px; color: #a1a1aa; font-size: 15px; }
.auth-side li::before { content: "—"; color: var(--brand); margin-right: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: inherit; text-decoration: none; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--panel); }
.auth-box { width: 100%; max-width: 360px; }
.auth-top { display: flex; justify-content: flex-end; margin-bottom: 40px; }
.auth-box h1 { font-size: 24px; }
.auth-box .muted { margin: 6px 0 24px; }
.auth-box input { padding: 9px 12px; }
.switch { text-align: center; margin-top: 20px; color: var(--muted); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.lang button { border: 0; background: none; padding: 3px 10px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
.lang button.on { background: var(--text); color: #fff; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.side { background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; }
.side .brand { margin: 0 6px 18px; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); margin: 0 10px 6px; font-weight: 500; }
.side > a[data-nav] { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); color: var(--text2); text-decoration: none; font-weight: 500; transition: background .12s, color .12s; }
.side > a[data-nav] svg { width: 18px; height: 18px; flex: none; }
.side > a[data-nav]:hover { background: var(--line2); color: var(--text); }
.side > a[data-nav].on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 1px var(--line); }
.side > a[data-nav] .cnt { margin-left: auto; font-size: 11px; background: var(--warn-bg); color: var(--brand); padding: 0 7px; border-radius: 10px; font-weight: 600; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-bottom .lang { align-self: flex-start; margin-left: 6px; }
.me-row { display: flex; align-items: center; gap: 4px; padding: 8px 6px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; padding: 4px; border-radius: var(--r); }
.me:hover { background: var(--line2); }
.me .ava { width: 30px; height: 30px; font-size: 11px; }
.me b { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: block; color: var(--muted); font-size: 11px; }
#view { overflow: auto; display: flex; flex-direction: column; min-width: 0; }

.top { display: flex; align-items: center; gap: 12px; padding: 18px 24px 14px; flex-wrap: wrap; position: sticky; top: 0; left: 0; z-index: 5; background: var(--bg); }
.top h1 { font-size: 22px; margin-right: auto; display: flex; gap: 18px; align-items: baseline; }
.top h1 small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.top h1.tabs a { color: var(--muted2); text-decoration: none; }
.top h1.tabs a.on { color: var(--text); }
.top h1.tabs a:hover { color: var(--text); }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tools input[type=search] { width: 240px; padding-left: 32px;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.seg button { border: 0; background: none; padding: 6px 8px; cursor: pointer; color: var(--muted2); display: flex; }
.seg button svg { width: 18px; height: 18px; }
.seg button.on { background: var(--line2); color: var(--text); }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0 24px 18px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.stat { padding: 14px 18px; border-right: 1px solid var(--line); margin-right: -1px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 2px 0; white-space: nowrap; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); }
.stat em.good { color: var(--ok); }
.stat em.bad { color: var(--warn); }
.stat em a { color: inherit; }

/* kanban */
.kanban { display: flex; gap: 16px; padding: 0 24px 90px; align-items: flex-start; overflow-x: auto; flex: 1; }
.col { flex: 0 0 280px; display: flex; flex-direction: column; border-radius: var(--r); transition: background .15s; min-height: 200px; }
.col.over { background: var(--line2); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 6px 2px 8px; border-bottom: 2px solid var(--c); margin-bottom: 10px; }
.col-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .n { font-size: 11px; background: var(--line2); border: 1px solid var(--line); padding: 0 6px; border-radius: 10px; color: var(--muted); }
.col-head .sum { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.qadd { margin-top: 8px; order: 2; }
.qadd summary { cursor: pointer; color: var(--muted); font-weight: 500; padding: 8px; list-style: none; text-align: center; border: 1px dashed var(--line); border-radius: var(--r); font-size: 13px; }
.qadd summary:hover { color: var(--text); border-color: var(--line3); }
.qadd summary::-webkit-details-marker { display: none; }
.qadd[open] summary { margin-bottom: 8px; }
.qadd form { display: flex; flex-direction: column; gap: 6px; background: var(--panel); padding: 10px; border-radius: var(--r); border: 1px solid var(--line); }
.lcard { background: var(--panel); border-radius: var(--r); padding: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); cursor: grab;
  display: flex; flex-direction: column; gap: 2px; transition: border-color .15s, box-shadow .15s; }
.lcard:hover { border-color: var(--line3); box-shadow: 0 2px 8px rgba(0, 0, 0, .05); }
.lcard.ghost { opacity: .35; }
.lc-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.lc-name { color: var(--text); font-weight: 600; word-break: break-word; text-decoration: none; }
.lc-name:hover { text-decoration: underline; }
.lc-sub { color: var(--muted); font-size: 12px; }
.lcard .tags { margin-top: 6px; }
.lc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.lc-price { font-weight: 600; font-size: 13px; }
.lc-task { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.lc-task::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.lc-task.none::before { background: var(--warn); }
.lc-task.over { color: var(--danger); }
.lc-task.over::before { background: var(--danger); }
.dropbar { position: fixed; left: 232px; right: 0; bottom: 0; display: none; gap: 8px; padding: 12px 24px; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }
.dragging .dropbar { display: flex; }
.dropbar > div { flex: 1; padding: 18px; text-align: center; font-weight: 600; border-radius: var(--r); border: 1.5px dashed; transition: background .15s, color .15s; }
.dropbar .won { color: var(--ok); border-color: #86efac; background: var(--ok-bg); }
.dropbar .lost { color: var(--muted); border-color: var(--line3); background: var(--panel); }
.dropbar .del { color: var(--danger); border-color: #fca5a5; background: var(--danger-bg); flex: .6; }
.dropbar > div.over { border-style: solid; }
.dropbar .won.over { background: var(--ok); color: #fff; }
.dropbar .lost.over { background: var(--muted); color: #fff; }
.dropbar .del.over { background: var(--danger); color: #fff; }

/* tables */
.list-wrap { padding: 0 24px 24px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl td a { text-decoration: none; font-weight: 500; }
.tbl td a:hover { text-decoration: underline; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.click tbody tr[data-href] { cursor: pointer; }
.tbl.click tbody tr[data-href]:hover td { background: var(--bg); }
.tbl tr.inactive td { color: var(--muted2); }

/* card */
.card { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; flex: 1; min-height: 0; }
.card-left { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 16px 20px 32px; }
.card-head { display: flex; align-items: center; gap: 4px; }
.card-title { flex: 1; font-size: 20px; font-weight: 600; border-color: transparent; padding: 4px 8px; letter-spacing: -.01em; }
.card-title:hover { border-color: var(--line); }
.card-id { color: var(--muted); font-size: 12px; margin: 2px 0 18px 42px; }
.stage-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.stagebar { display: flex; gap: 3px; }
.stagebar button { flex: 1; height: 6px; border: 0; border-radius: 3px; background: var(--line); cursor: pointer; padding: 0; transition: transform .1s; }
.stagebar button:hover { transform: scaleY(1.8); }
.stagebar button.on { background: var(--c); filter: saturate(1.4) brightness(.9); }
.stage-name { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.fields .field { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.fields input, .fields select { border-color: transparent; background: transparent; }
.fields input:hover, .fields select:hover { border-color: var(--line); }
.fields input:focus, .fields select:focus { background: var(--panel); border-color: var(--text); }
#related h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); margin: 22px 0 8px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.rel-item { display: block; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 6px; color: var(--text); text-decoration: none; }
.rel-item a { text-decoration: none; }
.rel-lead { display: flex; gap: 8px; align-items: center; }
.rel-lead span:first-child { flex: 1; font-weight: 500; }
.rel-lead:hover { border-color: var(--line3); background: var(--bg); }
.card-feed { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.feed { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.note { background: var(--panel); border-radius: var(--r); padding: 10px 14px; border: 1px solid var(--line); max-width: 720px; }
.note .meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.note .meta .ava { width: 18px; height: 18px; font-size: 8px; }
.note-text { white-space: pre-wrap; margin-top: 4px; word-break: break-word; }
.note.sys { background: none; border: 0; padding: 0 2px; font-size: 13px; color: var(--text2); }
.note.sys .meta { display: inline; }
.note.done svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--ok); }
.task-item { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 720px; }
.task-item.over { border-left-color: var(--danger); background: var(--danger-bg); }
.ti-top { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; color: var(--muted); }
.ti-top b { color: var(--text); }
.ti-top svg { width: 15px; height: 15px; }
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 24px 14px; }
.ctabs { display: flex; gap: 2px; margin-bottom: 8px; }
.ctabs button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.ctabs button.on { background: var(--line2); color: var(--text); }
.cfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.composer .field { margin-bottom: 8px; }

/* tasks */
.tlist { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1100px; }
.tgroup h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; font-weight: 500; }
.tgroup h3 span { background: var(--line2); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; margin-left: 4px; }
.tgroup.over h3 { color: var(--danger); }
.tgroup-body { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.trow { display: grid; grid-template-columns: 22px 130px 150px 1fr 200px 28px; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line2); }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--bg); }
.tgroup.over .t-due { color: var(--danger); font-weight: 500; }
.t-due { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.t-type { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.t-type svg { width: 15px; height: 15px; color: var(--muted); }
.t-ent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-ent a { text-decoration: none; font-weight: 500; }
.trow.is-done { opacity: .55; }

/* dashboard */
.dash { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.dash .stats { margin: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.dash .stat b { font-size: 22px; }
.panel .tbl td:first-child { white-space: nowrap; }
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel { background: var(--panel); border-radius: 10px; padding: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel .tbl { box-shadow: none; border: 0; border-radius: 0; }
.panel .tbl th { background: none; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-h h3 { font-size: 15px; }
.bar { display: grid; grid-template-columns: minmax(80px, 150px) minmax(60px, 1fr) 30px auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { background: var(--line2); border-radius: 4px; height: 8px; overflow: hidden; }
.bar-f { height: 100%; background: var(--c); border-radius: 4px; min-width: 2px; filter: saturate(1.5) brightness(.88); }
.bar-n { text-align: right; font-weight: 600; }
.bar-s { text-align: right; color: var(--muted); }

/* settings */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 0 24px 24px; align-items: start; }
.stabs { display: flex; flex-direction: column; gap: 2px; }
.stabs a { padding: 7px 10px; border-radius: var(--r); color: var(--text2); text-decoration: none; font-weight: 500; }
.stabs a:hover { background: var(--line2); color: var(--text); }
.stabs a.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 1px var(--line); }
.spane { background: var(--panel); border-radius: 10px; padding: 20px; border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; overflow-x: auto; }
.spane .tbl { box-shadow: none; }
.sform { max-width: 420px; }
.pipes { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.pipe-list { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 16px; }
.pipe-list button:not(.link) { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: var(--r); cursor: pointer; font-weight: 500; color: var(--text2); }
.pipe-list button:not(.link):hover { background: var(--line2); }
.pipe-list button.on { background: var(--line2); color: var(--text); }
.pipe-name { font-size: 18px; font-weight: 600; flex: 1; border-color: transparent; }
.pipe-name:hover { border-color: var(--line); }
.srow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.srow input:not([type]) { flex: 1; }
.srow.fixed { background: var(--bg); border-radius: var(--r); padding: 4px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(24, 24, 27, .35); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px; z-index: 50; animation: fade .15s; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 440px; border: 1px solid var(--line); box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .25); animation: pop .2s ease-out; }
.modal h2 { font-size: 17px; padding: 18px 20px 0; }
.modal-body { padding: 14px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line2); background: var(--bg); border-radius: 0 0 12px 12px; }

/* mobile */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .side { order: 2; flex-direction: row; padding: 4px; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); background: var(--panel); }
  .side .brand, .nav-sec, .side-bottom .lang, .me-row .me { display: none; }
  .side > a[data-nav] { flex: 1; flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 2px; }
  .side > a[data-nav].on { box-shadow: none; background: var(--line2); }
  .side > a[data-nav] .cnt { display: none; }
  .side-bottom { margin: 0; }
  .me-row { border: 0; padding: 0; }
  .dropbar { left: 0; }
  .top { padding: 14px 16px 12px; }
  .tools input[type=search] { width: 100%; }
  .stats, .dash .stats { margin: 0 16px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b, .dash .stat b { font-size: 18px; white-space: normal; }
  .stat { border-bottom: 1px solid var(--line); }
  .kanban { padding: 0 16px 90px; }
  .list-wrap, .tlist, .dash { padding: 0 16px 16px; }
  .dash .stats { margin: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.dash .stat b { font-size: 22px; }
.panel .tbl td:first-child { white-space: nowrap; }
  .card { grid-template-columns: 1fr; }
  .card-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .feed { min-height: 300px; }
  .panels, .settings, .pipes { grid-template-columns: 1fr; }
  .settings { padding: 0 16px 16px; }
  .pipe-list { border-right: 0; padding-right: 0; }
  .trow { grid-template-columns: 22px 1fr 28px; }
  .trow .t-due, .trow .t-type, .trow .t-ent, .trow .t-text { grid-column: 2; }
  .bar { grid-template-columns: 100px 1fr 30px; }
  .bar-s { display: none; }
}
.pipe-list .link { text-align: left; padding: 7px 10px; }

/* parity additions */
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); position: sticky; left: 0; }
.bulkbar[hidden], .ctabs [hidden] { display: none; }
.lc-accept { display: flex; gap: 6px; margin-top: 8px; }
.tcard { cursor: default; gap: 4px; }
.tcard .btn { align-self: flex-start; margin-top: 4px; }
.fields [data-tab][hidden] { display: none; }
.fields .field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fields select[multiple] { background: var(--panel); border-color: var(--line); }
.fields input[type=checkbox] { justify-self: start; }
#fieldTabs { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.modal:has(.imp) { max-width: 760px; }
.imp { overflow-x: auto; max-height: 60vh; overflow-y: auto; }
.imp .tbl select { width: 100%; }
.tbl.rights td { padding: 6px; }
.tbl.rights select { font-size: 12px; padding: 4px 6px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.chips { margin-bottom: 12px; }
.chips .link { padding: 0 2px; }
.sub-h { font-size: 14px; margin: 20px 0 4px; }
.code { font: 12px/1.5 ui-monospace, Menlo, monospace; margin-top: 8px; }
.stats.flush { margin: 0 0 18px; }
.panel-h.spaced { margin-top: 24px; }

/* ===== amoCRM-matched layout, scoped so the landing page keeps the base look ===== */
.shell { grid-template-columns: 65px minmax(0, 1fr); }
.shell a { text-decoration: none; }
.shell .side { padding: 0; gap: 0; align-items: stretch; background: var(--panel); }
.side-me { height: 83px; display: flex; align-items: center; justify-content: center; }
.side-me .ava { width: 36px; height: 36px; font-size: 13px; }
.shell .side > a[data-nav] { flex-direction: column; justify-content: center; gap: 3px; height: 62px; padding: 0 3px; border-radius: 0; font-size: 11px; line-height: 13px; text-align: center; font-weight: 400; color: var(--muted); }
.shell .side > a[data-nav] svg { width: 22px; height: 22px; }
.shell .side > a[data-nav]:hover { background: var(--line2); color: var(--text); }
.shell .side > a[data-nav].on { background: none; box-shadow: none; color: var(--brand); font-weight: 600; }
.shell .side-bottom { align-items: center; padding-bottom: 12px; gap: 6px; }
.shell .side-bottom .lang { margin: 0; flex-direction: column; }
.shell .side-bottom .lang button { padding: 3px 8px; }

.shell .top { height: 64px; min-height: 64px; padding: 0 30px; gap: 16px; flex-wrap: nowrap; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 10; }
.top-left { display: flex; align-items: center; gap: 10px; flex: none; }
.preset select { border: 0; background-color: transparent; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .02em; padding: 6px 4px; max-width: 240px; box-shadow: none; }
.view-sw { display: flex; }
.view-sw button { border: 0; background: none; padding: 6px; cursor: pointer; color: var(--muted2); display: flex; border-radius: 6px; }
.view-sw button svg { width: 20px; height: 20px; }
.view-sw button:hover, .view-sw button.on { color: var(--text); }
.view-sw button.on { background: var(--line2); }
.cal-sw { display: flex; gap: 2px; }
.cal-sw button { border: 0; background: none; cursor: pointer; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; border-radius: 6px; }
.cal-sw button.on, .cal-sw button:hover { color: var(--text); background: var(--line2); }
.top-search { flex: 1; min-width: 0; display: flex; align-items: center; position: relative; align-self: stretch; }
.top-search input[type=search] { flex: 1; width: auto; min-width: 0; height: 100%; border: 0; border-radius: 0; box-shadow: none; padding-left: 28px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 4px center; }
.top-sum { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; padding-left: 12px; font-weight: 500; }
.filter-pop { position: absolute; top: 100%; left: 0; width: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); padding: 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, .1); z-index: 30; }
.fp-list { display: flex; flex-direction: column; margin-bottom: 10px; }
.fp-list button { border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.fp-list button:hover { background: var(--line2); }
.fp-list button.on { background: var(--line2); font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }
.btn.up { text-transform: uppercase; font-size: 12px; font-weight: 600; letter-spacing: .03em; padding: 9px 14px; }
a.btn.up { display: inline-block; color: var(--text); }
details.more { position: relative; }
details.more > summary { list-style: none; cursor: pointer; padding: 4px 8px; font-size: 18px; line-height: 1; color: var(--muted); border-radius: 6px; user-select: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary:hover { background: var(--line2); color: var(--text); }
.more-pop { position: absolute; right: 0; top: calc(100% + 4px); min-width: 170px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 28px rgba(0, 0, 0, .1); padding: 4px; z-index: 40; }
.more-pop a, .more-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text); white-space: nowrap; font-size: 13px; }
.more-pop a:hover, .more-pop button:hover { background: var(--line2); }

/* board */
.shell #view { overflow: auto; display: block; background: var(--bg); }
.shell .top { position: sticky; top: 0; left: 0; width: calc(100vw - 65px); box-sizing: border-box; }
.shell .kanban { padding: 0 30px 90px; gap: 20px; overflow: visible; width: max-content; min-width: 100%; }
.shell .col { flex: 0 0 312px; width: 312px; min-height: 0; }
.shell .col-head { display: block; position: sticky; top: 64px; z-index: 4; height: 59px; padding: 15px 10px 10px; margin: 0 0 9px; text-align: center; background: var(--bg); border-bottom: 2px solid var(--c); }
.shell .col-title { font-size: 12px; font-weight: 700; text-transform: uppercase; line-height: 17px; }
.shell .col-meta { font-size: 13px; color: var(--muted); line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell .col-body { gap: 5px; }
.shell .qadd { order: 0; margin: 0 0 5px; }
.shell .qadd summary { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px 8px; color: var(--muted); }
.shell .lcard, .tcard { padding: 6px 8px; border-radius: 4px; gap: 1px; box-shadow: none; }
.tcard { background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; }
.lc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); line-height: 17px; }
.lc-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-meta span:last-child { flex: none; }
.shell .lc-name { font-size: 14px; font-weight: 500; line-height: 19px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .lc-name:hover { color: var(--brand); text-decoration: none; }
.shell .lc-sub { font-size: 13px; color: var(--text2); line-height: 18px; }
.shell .lc-sub:empty { display: none; }
.shell .lc-price { font-size: 13px; font-weight: 600; line-height: 18px; }
.shell .lc-foot { margin-top: 3px; min-height: 14px; align-items: center; }
.shell .lcard .tags { margin: 0; }
.shell .lcard .tag { margin: 1px 3px 1px 0; border-radius: 3px; border: 1px solid var(--line); background: none; }
.shell .lc-task { font-size: 11px; font-weight: 600; flex: none; margin-left: auto; }
.shell .lc-task.over { color: var(--danger); }
.shell .dropbar { left: 65px; }
.t-line { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; line-height: 18px; }
.t-line svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--muted); }
.t-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.is-done { opacity: .55; }
td.late { color: var(--danger); font-weight: 500; }

/* calendar */
.cal-wrap { padding: 12px 30px 30px; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-nav .icon-btn { font-size: 20px; line-height: 1; padding: 2px 10px; }
.cal { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-m-week, .cal-m-month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day { background: var(--panel); min-height: 96px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cal-m-week .cal-day, .cal-m-day .cal-day { min-height: 480px; }
.cal-day.off { background: var(--bg); color: var(--muted2); }
.cal-d { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.cal-day.today .cal-d { color: var(--brand); font-weight: 700; }
.cal-chip { border: 0; text-align: left; background: var(--line2); border-left: 3px solid var(--ok); padding: 2px 5px; font-size: 11px; border-radius: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.over { border-left-color: var(--danger); }

/* flat lists */
.shell .list-wrap { padding: 16px 15px 30px; }
.tbl.flat { background: none; border: 0; box-shadow: none; border-radius: 0; }
.tbl.flat th { background: none; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; height: 42px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tbl.flat td { height: 39px; padding: 0 10px; border-bottom: 1px solid var(--line2); background: var(--panel); }
.tbl.flat td a { font-weight: 500; }
.tbl.flat td a.u { font-weight: 400; text-decoration: underline; text-decoration-color: var(--line); }
.tbl.flat .ck { width: 37px; padding-right: 0; }

/* lead card: 435px left, feed right, compose docked */
.shell .card { grid-template-columns: 435px minmax(0, 1fr); height: 100vh; }
.shell .card-left { padding: 17px 30px 32px 22px; border-right: 1px solid var(--line); }
.shell .card-head { align-items: flex-start; }
.shell .card-title { font-size: 19px; font-weight: 700; line-height: 25px; padding: 0 4px; resize: none; overflow: hidden; background: none; }
.shell .card-id { margin: 4px 0 12px 30px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; }
.shell .card-id .tag { margin: 0; border-radius: 3px; }
.shell .stage-box { position: relative; margin: 0 0 14px 8px; padding: 0 0 6px; border: 0; gap: 3px; }
.sb-pipe { font-size: 12px; color: var(--muted); }
.sb-stage { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.sb-caret { margin-left: auto; color: var(--muted); }
.shell .stagebar { gap: 2px; margin-top: 3px; }
.shell .stagebar i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.shell .stagebar i.on { background: var(--c); filter: saturate(1.4) brightness(.9); }
#stageSel { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.card-tabs { display: flex; gap: 2px; margin: 0 0 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-tabs button { border: 0; background: none; padding: 5px 8px 6px; cursor: pointer; color: var(--muted); font-weight: 500; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.card-tabs button.on { color: var(--text); font-weight: 700; border-bottom-color: var(--text); }
.shell .fields { margin-left: 8px; }
.shell .fields .field { grid-template-columns: 126px minmax(0, 1fr); min-height: 32px; margin-bottom: 0; gap: 4px; }
.shell .fields .field > span { font-size: 14px; font-weight: 400; color: var(--muted); }
.shell .fields input, .shell .fields select { padding: 5px 6px; }
.ent-block { border-top: 1px solid var(--line); margin: 12px 0 0 8px; padding-top: 10px; }
.eb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.eb-head a { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-ava { width: 30px; height: 30px; border-radius: 50%; background: var(--line2); color: var(--muted); display: grid; place-items: center; font-weight: 600; flex: none; }
.eb-row { display: grid; grid-template-columns: 126px minmax(0, 1fr); gap: 4px; min-height: 28px; align-items: center; }
.eb-row > span { color: var(--muted); }
.eb-row a { text-decoration: underline; text-decoration-color: var(--line); }
.add-row { display: flex; align-items: center; gap: 12px; width: calc(100% - 8px); margin: 8px 0 0 8px; padding: 8px 0; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; color: var(--muted); text-align: left; }
.add-row i { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 18px; }
.add-row:hover { color: var(--text); }
.shell #related h4 { margin-left: 8px; }
.shell .rel-item { margin-left: 8px; }
.shell .card-feed { position: relative; background: var(--bg); }
.shell .feed { padding: 20px 20px 16px; gap: 8px; }
.day-sep { text-align: center; position: relative; margin: 8px 0; }
.day-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.day-sep span { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 1px 12px; font-size: 12px; color: var(--muted); }
.shell .note, .shell .task-item { max-width: none; display: flex; gap: 12px; flex-direction: row; align-items: flex-start; border-radius: 4px; padding: 10px; background: var(--panel); border: 1px solid var(--line); }
.shell .note.sys { display: block; background: none; border: 0; padding: 0 0 0 56px; font-size: 13px; }
.n-ico { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--muted); }
.n-ico svg { width: 17px; height: 17px; }
.shell .note .meta { font-size: 12px; display: block; }
.shell .note-text { margin-top: 2px; }
.shell .task-item { border-left-width: 1px; }
.shell .task-item.over { background: var(--panel); border-color: var(--danger); }
.shell .task-item.over .n-ico { color: var(--danger); border-color: var(--danger); }
.ti-body { flex: 1; min-width: 0; }
.ti-body .meta { font-size: 12px; color: var(--muted); }
.late { color: var(--danger); font-weight: 500; }
.ti-done { display: flex; gap: 8px; margin-top: 8px; }
.ti-done input { flex: 1; min-width: 0; }
.compose { margin: 0 15px 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 15px; display: flex; gap: 8px; align-items: flex-start; }
.c-type { display: flex; align-items: center; color: var(--muted); flex: none; line-height: 32px; }
.c-type details.more > summary { font-size: 14px; color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; padding: 0 3px; line-height: 32px; }
.c-type .more-pop { right: auto; left: 0; top: auto; bottom: calc(100% + 4px); }
.c-body { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: flex-start; }
.c-body[hidden] { display: none; }
.c-body textarea { flex: 1; border: 0; resize: none; overflow: hidden; padding: 6px 4px; box-shadow: none; max-height: 200px; }
.c-task { flex-wrap: wrap; }
.c-task input[name=text] { flex: 1; min-width: 140px; }

/* second-level menu for analytics and settings */
.sub-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.subnav { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.subnav-h { height: 64px; display: flex; align-items: center; padding: 0 22px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.subnav a { padding: 15px 22px; color: var(--text2); border-bottom: 1px solid var(--line2); }
.subnav a:hover { background: var(--bg); }
.subnav a.on { color: var(--brand); font-weight: 600; }
.sub-body { min-width: 0; padding: 20px 30px 40px; }
.sub-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.sub-body .spane { box-shadow: none; }

/* dashboard */
.shell .dash { padding: 24px 30px 40px; gap: 18px; }
.dash-head { position: relative; display: flex; justify-content: center; align-items: center; min-height: 44px; }
.dash-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.dash-head .btn { position: absolute; right: 0; }
.dash-tools { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.pills { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 2px; }
.pills button { border: 0; background: none; padding: 6px 16px; border-radius: 16px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; }
.pills button.on { background: var(--text); color: #fff; }
.widgets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.widget { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; }
.w-h h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.w-top { display: flex; justify-content: space-between; align-items: flex-start; margin: 6px 0 14px; }
.w-n { font-size: 38px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.widget.good .w-n { color: var(--ok); }
.widget.bad .w-n { color: var(--danger); }
.widget.warn .w-n { color: var(--brand); }
.w-sum { font-size: 13px; color: var(--muted); }
.w-today { text-align: right; }
.w-today b { display: block; font-size: 18px; font-weight: 600; }
.w-today span { font-size: 12px; color: var(--muted); }
.w-row { margin-top: 8px; font-size: 13px; }
.w-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-bar { height: 3px; background: var(--line2); border-radius: 2px; margin-top: 3px; }
.w-bar i { display: block; height: 100%; background: var(--text); border-radius: 2px; min-width: 2px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell .side { flex-direction: row; }
  .side-me, .shell .side-bottom .lang { display: none; }
  .shell .side { overflow-x: auto; }
  .shell .side > a[data-nav] { flex: 1 0 58px; height: 54px; white-space: nowrap; font-size: 10px; }
  .shell .side-bottom { padding: 0 4px; margin: 0; justify-content: center; flex: none; }
  .shell .top { width: 100vw; height: auto; min-height: 64px; flex-wrap: wrap; padding: 8px 16px; }
  .top-search { order: 5; flex-basis: 100%; height: 36px; }
  .top-right { margin-left: auto; }
  .shell .col-head { top: 0; position: static; }
  .shell .kanban { padding: 0 16px 90px; }
  .shell .card { grid-template-columns: minmax(0, 1fr); height: auto; }
  .shell .feed { min-height: 300px; max-height: 70vh; }
  .sub-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .subnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .subnav-h { display: none; }
  .subnav a { padding: 12px 14px; white-space: nowrap; border-bottom: 0; }
  .sub-body { padding: 12px 16px; }
  .widgets { grid-template-columns: minmax(0, 1fr); }
  .shell .dash { padding: 16px; }
  .dash-head .btn { position: static; margin-left: 12px; }
  .pills button { padding: 6px 10px; }
  .cal-wrap { padding: 12px 16px; overflow-x: auto; }
  .cal-m-week, .cal-m-month { min-width: 640px; }
}

/* search picker and infinite scroll */
.picker { display: flex; align-items: center; gap: 4px; min-width: 0; }
.picker .pk-q { flex: 1; min-width: 0; width: 100%; }
.pk-new { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 28px; height: 28px; flex: none; cursor: pointer; color: var(--muted); }
.pk-new:hover { color: var(--text); }
.col-more { height: 1px; }

/* imBox */
.shell .side > a[data-nav] { position: relative; }
.nav-badge { position: absolute; top: 6px; right: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.imbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 280px; height: 100vh; }
.ib-list { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.ib-head { height: 64px; flex: none; display: flex; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); }
.ib-head input { width: 100%; }
.ib-filters { display: flex; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.ib-filters button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; }
.ib-filters button.on { background: var(--line2); color: var(--text); }
.ib-items { overflow-y: auto; flex: 1; min-height: 0; }
.ib-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line2); color: var(--text); }
.ib-item:hover { background: var(--bg); }
.ib-item.on { background: var(--line2); }
.ib-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ib-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ib-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ib-row time { flex: none; font-size: 11px; color: var(--muted); }
.ib-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.ib-unread { flex: none; font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.ib-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.ib-chat-h { height: 64px; flex: none; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; background: var(--panel); border-bottom: 1px solid var(--line); }
.ib-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.ib-older { align-self: center; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: min(70%, 560px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.msg.out .bubble { background: var(--text); border-color: var(--text); color: #fff; }
.msg.out .bubble a { color: inherit; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-meta { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg.out .msg-meta { color: #a1a1aa; }
.bubble img, .bubble video { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; }
.bubble audio { display: block; max-width: 100%; width: 260px; }
.ib-compose { margin: 0 15px 15px; flex: none; align-items: flex-end; }
.ib-compose textarea { flex: 1; border: 0; resize: none; padding: 6px 4px; box-shadow: none; max-height: 200px; }
.ib-send { color: var(--text); }
.ib-info { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.ib-card { padding: 14px 16px; border-bottom: 1px solid var(--line2); display: flex; flex-direction: column; gap: 4px; }
.ib-card h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted2); font-weight: 500; }
.ib-card select { width: 100%; }
.ib-link { font-weight: 600; }
.ib-empty { margin: auto; text-align: center; padding: 24px; max-width: 420px; }
.ib-empty h3 { margin-bottom: 8px; }
.ib-empty .btn { margin-top: 8px; }
.howto { margin: 0 0 10px; padding-left: 20px; }
.howto li { margin-bottom: 4px; }
.feed .msg .bubble { max-width: 75%; }
@media (max-width: 860px) {
  .imbox { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ib-items { max-height: 36vh; }
  .ib-chat { height: 62vh; }
  .ib-info { border-left: 0; border-top: 1px solid var(--line); }
}

.au-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.modal .field .check { display: flex; margin-top: 3px; }

.c-clip { cursor: pointer; flex: none; line-height: 32px; padding: 0 4px; color: var(--muted); user-select: none; }
.c-clip:hover { color: var(--text); }
.file-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.file-row a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-add { display: inline-block; margin-top: 10px; cursor: pointer; }
.filter-pop { max-height: 70vh; overflow-y: auto; }
.tcard[draggable] { cursor: grab; }

/* incoming call */
#callPop { position: fixed; right: 16px; top: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: 300px; max-width: calc(100vw - 32px); }
.call-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r); padding: 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, .14); display: flex; flex-direction: column; gap: 8px; }
.call-card.answered { border-left-color: var(--ok); }
.call-top { display: flex; gap: 10px; align-items: flex-start; }
.call-top > div { flex: 1; min-width: 0; }
.call-top b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.call-ico svg { width: 20px; height: 20px; color: var(--brand); }
.call-card.answered .call-ico svg { color: var(--ok); }
.call-state { font-size: 12px; color: var(--muted); }
.call-card a.btn { text-align: center; text-decoration: none; color: var(--text); }

/* ===== themes ===== */
:root { --text2: #52525b; --line3: #d4d4d8; --danger-bg: #fef2f2; --ok-bg: #f0fdf4; --warn-bg: #fff7ed; --accent-fg: #fff; --overlay: rgba(24, 24, 27, .35); --pop-shadow: 0 12px 32px rgba(0, 0, 0, .14); color-scheme: light; }
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0f1620; --panel: #17212d; --line: #28384a; --line2: #1e2b39; --line3: #38495c;
  --text: #e8eef4; --text2: #b4c2d0; --muted: #8fa1b3; --muted2: #6b7e91;
  --accent: #e8eef4; --accent-h: #ffffff; --accent-fg: #0f1620; --focus: rgba(232, 238, 244, .14);
  --danger: #f87171; --ok: #4ade80; --warn: #fb923c; --brand: #f97316;
  --danger-bg: #2b1a1e; --ok-bg: #14281d; --warn-bg: #2d2015; --overlay: rgba(0, 0, 0, .55); --pop-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.btn.primary { color: var(--accent-fg); }
a.btn.primary { color: var(--accent-fg); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.92); }
.lang button.on, .pills button.on { color: var(--accent-fg); }
.msg.out .bubble { color: var(--accent-fg); }
.msg.out .msg-meta { color: inherit; opacity: .65; }
.overlay { background: var(--overlay); }
.pill, .tag, .badge { color: var(--text); }
.badge.won { color: var(--ok); border-color: transparent; }
.badge.admin { color: var(--warn); border-color: transparent; }
.dropbar .won { border-color: var(--ok); }
.dropbar .del { border-color: var(--danger); }
.dropbar .lost { background: var(--panel); }
html { background: var(--bg); }
* { scrollbar-width: thin; scrollbar-color: var(--line3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line3); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
input[type=file] { font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: var(--r); padding: 6px 12px; margin-right: 10px; cursor: pointer; font: inherit; }
input[type=checkbox] { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--line3); border-radius: 4px; background: var(--panel); display: inline-grid; place-content: center; flex: none; transition: background .12s, border-color .12s; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-fg); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
.theme-btn svg { width: 19px; height: 19px; }
.auth-top { align-items: center; gap: 8px; }

/* ===== custom controls ===== */
.ui-native { display: none !important; }
.ui-select { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 10px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.ui-select:hover { border-color: var(--line3); }
.ui-select:focus-visible { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
.ui-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-val.ui-empty { color: var(--muted2); }
.ui-val.multi:not(.ui-empty) { white-space: normal; display: flex; flex-wrap: wrap; gap: 3px; }
.ui-chip { background: var(--line2); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: 12px; line-height: 18px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-caret { width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); flex: none; }
.ui-cal { width: 14px; height: 14px; border: 1.5px solid var(--muted); border-top-width: 3.5px; border-radius: 3px; flex: none; }
.ui-pop { position: fixed; z-index: 90; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--pop-shadow); display: flex; flex-direction: column; overflow: hidden; outline: none; animation: pop .12s ease-out; }
.ui-search { padding: 6px; border-bottom: 1px solid var(--line2); flex: none; }
.ui-search input { width: 100%; }
.ui-list { overflow-y: auto; padding: 4px; flex: 1; min-height: 0; max-height: 300px; }
.ui-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted2); padding: 8px 8px 3px; font-weight: 500; }
.ui-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; text-align: left; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text); font: inherit; }
.ui-opt span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-opt small { color: var(--muted); font-size: 12px; flex: none; }
.ui-opt em { font-style: normal; color: var(--brand); font-weight: 700; flex: none; }
.ui-opt:hover, .ui-opt.act { background: var(--line2); }
.ui-opt.on { font-weight: 600; }
.ui-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ui-box { width: 15px; height: 15px; border: 1px solid var(--line3); border-radius: 4px; flex: none; display: grid; place-content: center; }
.ui-opt.on .ui-box { background: var(--accent); border-color: var(--accent); }
.ui-opt.on .ui-box::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--accent-fg); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.ui-none { padding: 12px; color: var(--muted); text-align: center; }
.ui-cal-pop { padding: 10px; overflow: visible; }
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-h b { font-weight: 600; }
.cal-h button { border: 0; background: none; font-size: 18px; line-height: 1; padding: 3px 9px; border-radius: 6px; cursor: pointer; color: var(--text); }
.cal-h button:hover { background: var(--line2); }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-wd span { font-size: 11px; color: var(--muted); padding: 3px 0; }
.cal-grid button { border: 0; background: none; height: 32px; border-radius: 6px; cursor: pointer; color: var(--text); font: inherit; font-size: 13px; }
.cal-grid button:hover { background: var(--line2); }
.cal-grid button.today { color: var(--brand); font-weight: 700; }
.cal-grid button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.cal-time { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line2); }
.cal-time span { flex: 1; color: var(--muted); font-size: 13px; }
.cal-time input { width: 48px; text-align: center; padding: 4px; }
.cal-f { display: flex; gap: 6px; margin-top: 8px; }
.cal-f button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; cursor: pointer; color: var(--text2); font: inherit; font-size: 13px; }
.cal-f button:hover { background: var(--line2); }
.cal-f .ok { margin-left: auto; background: var(--accent); color: var(--accent-fg); font-weight: 500; }
.cal-f .ok:hover { background: var(--accent-h); }
.ui-swatch { width: 28px; height: 28px; flex: none; border: 1px solid var(--line3); border-radius: 6px; cursor: pointer; padding: 0; }
.ui-swatches { display: grid; grid-template-columns: repeat(6, 26px); gap: 5px; padding: 8px; justify-content: center; overflow: visible; }
.ui-swatches button { width: 26px; height: 26px; border: 1px solid rgba(0, 0, 0, .1); border-radius: 6px; cursor: pointer; padding: 0; }
.ui-swatches button:hover { outline: 2px solid var(--text); }
.has-error input:not(.ui-native), .has-error .ui-select, .has-error textarea { border-color: var(--danger); }
.field-err { color: var(--danger); font-size: 12px; margin-top: 2px; }
.fields .field .field-err { grid-column: 2; }
.modal.confirm { max-width: 400px; }
.modal.confirm p { margin: 0; padding: 20px; }
.overlay.confirm-ov { z-index: 80; }

/* top bar and card fields use borderless triggers, like the rest of those panels */
.preset .ui-select { border: 0; background: none; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .02em; padding: 6px 4px; width: auto; max-width: 280px; min-height: 0; box-shadow: none; }
.fields .ui-select { background: transparent; border-color: transparent; min-height: 30px; padding: 4px 6px; }
.fields .ui-select:hover { border-color: var(--line); }
.shell .fields .field { align-items: start; padding: 1px 0; }
.shell .fields .field > span { white-space: normal; overflow: visible; padding-top: 5px; line-height: 1.3; }
.shell .fields input:not([type=checkbox]) { width: 100%; }
.shell .fields input[type=checkbox] { margin: 8px 6px; }
.more-fields > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 8px 0 8px 6px; list-style: none; }
.more-fields > summary::before { content: '▸ '; }
.more-fields[open] > summary::before { content: '▾ '; }
.more-fields > summary:hover { color: var(--text); }
.filter-pop .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-pop input:not([type=checkbox]) { width: 100%; min-width: 0; }
.stage-box { cursor: pointer; }
.stage-box:hover .sb-caret { color: var(--text); }
.pipe-arch { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted2); padding: 12px 10px 4px; border-top: 1px solid var(--line2); margin-top: 8px; }
.tools select + .ui-select, .sub-tools .ui-select, .filter-pop .ui-select { width: 100%; }
.sub-tools .ui-select { width: 180px; }
.bulkbar .ui-select { width: 190px; }
.srow .ui-swatch { margin: 0; }
.pills, .lang { background: var(--panel); }
.side-bottom .theme-btn { color: var(--muted); }
@media (max-width: 860px) {
  .ui-pop { max-width: calc(100vw - 16px); }
  .shell .side-bottom { flex-direction: row; }
}

#toasts { left: 80px; right: auto; bottom: 16px; }
.c-task { align-items: center; }
.c-task .ui-select { flex: 1 1 150px; width: auto; }
.c-task input[name=text] { flex: 2 1 240px; }
.c-task button.btn { flex: none; }
.compose { align-items: flex-start; }
@media (max-width: 860px) { #toasts { left: 16px; bottom: 70px; } }
