:root {
  --nav-bg: #1c2a39;
  --nav-hover: #26384b;
  --nav-active: #2f4a63;
  --nav-text: #9fb0c2;
  --bg: #eef1f4;
  --panel: #ffffff;
  --line: #e2e6ea;
  --line-2: #d4d9df;
  --text: #2e3640;
  --muted: #8a96a3;
  --link: #1375ab;
  --primary: #4c8bf7;
  --primary-d: #3a76df;
  --green: #5ec27d;
  --red: #f37575;
  --orange: #f5a623;
  --yellow-bg: #fff8d6;
  --board-bg: linear-gradient(160deg, #1f4e79 0%, #23628f 45%, #2b7aa6 100%);
  --shadow: 0 1px 2px rgba(20, 40, 60, .12), 0 1px 1px rgba(20, 40, 60, .06);
  --shadow-lg: 0 10px 40px rgba(10, 25, 45, .28);
  --radius: 4px;
  --nav-w: 76px;
  font-family: 'PT Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { overflow: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }

/* ---------- layout ---------- */
.app { display: flex; height: 100vh; }
.nav { width: var(--nav-w); background: var(--nav-bg); display: flex; flex-direction: column; align-items: stretch; flex: none; z-index: 30; }
.nav-logo { height: 64px; display: flex; align-items: center; justify-content: center; }
.nav-logo .logo { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #ff8a00, #ff3d6e); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px; letter-spacing: -1px; }
.nav a.nav-item { color: var(--nav-text); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 2px 9px; font-size: 11px; text-align: center; position: relative; text-decoration: none; line-height: 1.15; }
.nav a.nav-item svg.i { width: 22px; height: 22px; stroke-width: 1.6; }
.nav a.nav-item:hover { background: var(--nav-hover); color: #fff; }
.nav a.nav-item.active { background: var(--nav-active); color: #fff; }
.nav a.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.nav .badge { position: absolute; top: 6px; right: 14px; background: var(--red); color: #fff; font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.nav-spacer { flex: 1; }
.nav-user { padding: 12px 0 16px; display: flex; justify-content: center; cursor: pointer; position: relative; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; text-transform: uppercase; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }

/* ---------- top bar ---------- */
.topbar { height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; flex: none; }
.topbar.dark { background: rgba(10, 30, 50, .35); border-bottom: 1px solid rgba(255, 255, 255, .08); color: #fff; }
.topbar h1 { font-size: 16px; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.topbar .sum { font-size: 13px; color: var(--muted); white-space: nowrap; }
.topbar.dark .sum { color: rgba(255, 255, 255, .75); }
.search { position: relative; flex: 1; max-width: 520px; min-width: 160px; }
.search input { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 10px 0 34px; background: #fff; outline: none; }
.topbar.dark .search input { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.topbar.dark .search input::placeholder { color: rgba(255, 255, 255, .6); }
.search input:focus { border-color: var(--primary); }
.topbar.dark .search input:focus { background: rgba(255, 255, 255, .2); border-color: transparent; }
.search > svg.i { position: absolute; left: 10px; top: 8px; color: var(--muted); }
.topbar.dark .search > svg.i { color: rgba(255, 255, 255, .7); }

/* ---------- buttons & inputs ---------- */
.btn { height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.btn:hover { background: #f5f7f9; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; text-transform: uppercase; font-weight: 700; font-size: 12px; letter-spacing: .4px; }
.btn.primary:hover { background: var(--primary-d); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: #d04848; }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.topbar.dark .btn.ghost { color: #fff; }
.topbar.dark .btn.ghost:hover, .topbar.dark .btn.ghost.on { background: rgba(255, 255, 255, .15); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.input, select.input, textarea.input { height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 10px; background: #fff; outline: none; width: 100%; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 70px; }
.input:focus { border-color: var(--primary); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 0 12px; height: 32px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary); color: #fff; }
.topbar.dark .seg { border-color: rgba(255, 255, 255, .2); }
.topbar.dark .seg button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .2); }
.topbar.dark .seg button.on { background: rgba(255, 255, 255, .22); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; white-space: nowrap; color: #2e3640; }
.tag { display: inline-block; background: #e3ecf7; color: #3a5f8a; border-radius: 3px; padding: 1px 6px; font-size: 11px; margin: 0 3px 3px 0; }

/* ---------- dropdown ---------- */
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 4px); left: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; z-index: 50; padding: 6px 0; color: var(--text); max-height: 420px; overflow: auto; }
.dd-menu.right { left: auto; right: 0; }
.dd-menu .dd-item { padding: 8px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.dd-menu .dd-item:hover, .dd-menu .dd-item.on { background: #f0f5fd; }
.dd-menu .dd-sep { height: 1px; background: var(--line); margin: 6px 0; }
.dd-menu .dd-title { padding: 6px 14px; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
.nav-user .dd-menu { left: calc(100% + 6px); top: auto; bottom: 10px; }

/* ---------- kanban ---------- */
.board-page { background: var(--board-bg); }
.board-wrap { flex: 1; overflow: auto; padding: 0 0 70px; position: relative; }
.board { display: flex; gap: 0; min-height: 100%; padding: 0 6px; }
.col { width: 272px; flex: none; display: flex; flex-direction: column; padding: 0 6px; }
.col-head { position: sticky; top: 0; z-index: 5; padding: 14px 4px 10px; color: #fff; background: inherit; }
.board-page .col-head { background: linear-gradient(to bottom, rgba(31, 78, 121, .97) 80%, rgba(31, 78, 121, 0)); }
.col-head .t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-head .s { font-size: 12px; color: rgba(255, 255, 255, .75); margin-top: 3px; }
.col-head .bar { height: 3px; border-radius: 2px; margin-top: 8px; }
.col-body { flex: 1; min-height: 120px; border-radius: var(--radius); transition: background .15s; padding-bottom: 20px; }
.col-body.over { background: rgba(255, 255, 255, .14); }
.quick-add { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); border: 1px dashed rgba(255, 255, 255, .35); border-radius: var(--radius); padding: 9px; text-align: center; cursor: pointer; margin-bottom: 8px; font-size: 13px; }
.quick-add:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.qa-form { background: #fff; border-radius: var(--radius); padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); }
.qa-form .input { height: 30px; margin-bottom: 6px; font-size: 13px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 9px 10px 8px; margin-bottom: 7px; cursor: pointer; border-left: 3px solid transparent; position: relative; }
.card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.card.dragging { opacity: .45; }
.card .c-top { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.card .c-contact { font-size: 13px; color: var(--text); }
.card .c-name { color: var(--link); font-size: 13px; line-height: 1.3; margin: 2px 0; word-break: break-word; }
.card .c-price { font-size: 13px; color: var(--text); margin-top: 3px; }
.card .c-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 12px; }
.task-st { display: inline-flex; align-items: center; gap: 4px; }
.task-st::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.task-st.none { color: var(--orange); }
.task-st.overdue { color: var(--red); }
.task-st.today { color: var(--green); }
.task-st.later { color: #9aa7b4; }
.card .c-actions { display: flex; gap: 6px; margin-top: 8px; }
.card.unsorted { border-left-color: #c1c8d0; }
.col.unsorted .col-body { background: rgba(255, 255, 255, .06); border-radius: 6px; padding: 6px 6px 20px; }
.drop-bar { position: fixed; left: var(--nav-w); right: 0; bottom: 0; height: 74px; display: flex; z-index: 40; transform: translateY(100%); transition: transform .18s; }
.drop-bar.show { transform: translateY(0); }
.drop-bar > div { flex: 1; display: grid; place-items: center; color: #fff; font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: .5px; opacity: .92; border-top: 3px solid rgba(255, 255, 255, .25); }
.drop-bar > div.over { opacity: 1; filter: brightness(1.12); }
.drop-bar .d-del { background: #5d6b78; }
.drop-bar .d-lost { background: #8e9aa6; }
.drop-bar .d-move { background: #4a7fb8; }
.drop-bar .d-won { background: #5bb36f; }
.empty-col { color: rgba(255, 255, 255, .5); text-align: center; font-size: 12px; padding: 20px 0; }

/* ---------- tables / lists ---------- */
.page { flex: 1; overflow: auto; }
.page-pad { padding: 20px; }
.tbl-wrap { background: #fff; margin: 0; overflow: auto; flex: 1; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; z-index: 2; white-space: nowrap; cursor: default; }
table.tbl th.sortable { cursor: pointer; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #eef0f2; vertical-align: middle; }
table.tbl tr:hover td { background: #f7fafd; }
table.tbl tr.sel td { background: #eaf2fe; }
table.tbl td.chk, table.tbl th.chk { width: 36px; padding-right: 0; }
.bulk { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: #2f4a63; color: #fff; flex: none; }
.bulk .btn { height: 28px; font-size: 12px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty svg.i { width: 40px; height: 40px; stroke-width: 1.2; margin-bottom: 10px; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 0 20px; flex: none; overflow-x: auto; }
.tabs a { padding: 12px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--primary); }
.tabs a:hover { color: var(--text); }

/* ---------- entity card ---------- */
.ecard { flex: 1; display: flex; min-height: 0; }
.eleft { width: 420px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ehead { background: #2f4a63; color: #fff; padding: 14px 18px 0; flex: none; }
.ehead .back { color: rgba(255, 255, 255, .7); display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-bottom: 8px; cursor: pointer; }
.ehead .back:hover { color: #fff; text-decoration: none; }
.ehead .title-row { display: flex; align-items: flex-start; gap: 8px; }
.ehead input.title { background: transparent; border: 0; border-bottom: 1px dashed transparent; color: #fff; font-size: 20px; font-weight: 700; width: 100%; outline: none; padding: 2px 0; }
.ehead input.title:hover { border-bottom-color: rgba(255, 255, 255, .35); }
.ehead input.title:focus { border-bottom-color: #fff; }
.ehead input.title::placeholder { color: rgba(255, 255, 255, .5); }
.ehead .eid { color: rgba(255, 255, 255, .55); font-size: 12px; margin-top: 4px; }
.ehead .tags-line { margin: 8px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ehead .tags-line .tag { background: rgba(255, 255, 255, .16); color: #fff; margin: 0; }
.ehead .tags-line input { background: transparent; border: 0; color: #fff; outline: none; font-size: 12px; min-width: 90px; flex: 1; }
.ehead .tags-line input::placeholder { color: rgba(255, 255, 255, .5); }
.ehead .menu-btn { color: #fff; }
.stagebar { margin: 14px -18px 0; padding: 10px 18px 12px; background: rgba(0, 0, 0, .14); }
.stagebar .sb-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 8px; gap: 8px; }
.stagebar .sb-top .dd > button { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.stagebar .sb-segs { display: flex; gap: 3px; }
.stagebar .sb-segs div { flex: 1; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, .18); cursor: pointer; transition: transform .1s; }
.stagebar .sb-segs div:hover { transform: scaleY(1.6); }
.etabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 18px; flex: none; }
.etabs a { padding: 11px 10px; font-size: 12px; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; letter-spacing: .3px; }
.etabs a.on { color: var(--text); border-bottom-color: var(--primary); }
.ebody { flex: 1; overflow: auto; padding: 8px 18px 20px; }
.frow { display: flex; align-items: center; min-height: 36px; border-bottom: 1px dotted #dfe3e7; gap: 8px; }
.frow > .fl { width: 40%; color: var(--muted); font-size: 13px; flex: none; padding: 8px 0; }
.frow > .fv { flex: 1; min-width: 0; }
.frow .fv .input, .frow .fv select.input { border-color: transparent; background: transparent; padding: 0 6px; height: 32px; }
.frow .fv .input:hover { border-color: var(--line); }
.frow .fv .input:focus { border-color: var(--primary); background: #fff; }
.frow .fv textarea.input { min-height: 50px; padding: 6px; }
.sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 20px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.mini { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; position: relative; }
.mini .m-name { font-weight: 700; }
.mini .m-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mini .m-line { font-size: 13px; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.mini .m-line svg.i { width: 14px; height: 14px; color: var(--muted); }
.mini .m-x { position: absolute; right: 6px; top: 6px; opacity: 0; }
.mini:hover .m-x { opacity: 1; }
.add-link { color: var(--link); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 6px 0; }
.add-link:hover { text-decoration: underline; }
.savebar { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; flex: none; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; background: #fff; box-shadow: var(--shadow-lg); border-radius: var(--radius); z-index: 20; max-height: 260px; overflow: auto; }
.ac-list div { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.ac-list div:hover { background: #f0f5fd; }
.ac-list .ac-new { color: var(--link); border-top: 1px solid var(--line); }

/* feed */
.eright { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #f2f4f7; }
.feed { flex: 1; overflow: auto; padding: 20px 28px 10px; }
.feed-day { text-align: center; margin: 14px 0 10px; }
.feed-day span { background: #dfe4ea; color: #6b7886; font-size: 11px; padding: 3px 10px; border-radius: 10px; text-transform: uppercase; letter-spacing: .3px; }
.ev { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; }
.ev .ev-time { font-size: 11px; color: var(--muted); width: 40px; flex: none; padding-top: 3px; text-align: right; }
.ev.sys .ev-body { font-size: 12.5px; color: #6b7886; padding-top: 2px; white-space: pre-wrap; }
.ev.sys .ev-body b { font-weight: 400; color: var(--text); }
.ev .bubble { background: #fff; border-radius: 6px; padding: 9px 12px; box-shadow: var(--shadow); max-width: 640px; word-break: break-word; position: relative; }
.ev .bubble .txt { white-space: pre-wrap; }
.ev .bubble .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 8px; align-items: center; }
.ev .bubble .del { opacity: 0; cursor: pointer; color: var(--muted); margin-left: auto; }
.ev .bubble:hover .del { opacity: 1; }
.ev.call .bubble { border-left: 3px solid var(--green); }
.task-box { background: var(--yellow-bg); border: 1px solid #f0e2a0; border-radius: 6px; padding: 10px 12px; margin: 8px 0; display: flex; gap: 10px; align-items: flex-start; }
.task-box.overdue { background: #fdeaea; border-color: #f4c2c2; }
.task-box .tb-main { flex: 1; min-width: 0; }
.task-box .tb-head { font-size: 12px; color: #7d6a2b; display: flex; gap: 8px; flex-wrap: wrap; }
.task-box.overdue .tb-head { color: #b03d3d; }
.task-box .tb-text { margin-top: 3px; white-space: pre-wrap; }
.composer { background: #fff; border-top: 1px solid var(--line); padding: 10px 20px 14px; flex: none; }
.composer .ctabs { display: flex; gap: 14px; margin-bottom: 8px; font-size: 13px; }
.composer .ctabs a { color: var(--muted); cursor: pointer; text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.composer .ctabs a.on { color: var(--text); border-bottom-color: var(--primary); }
.composer textarea { width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px 10px; min-height: 56px; resize: vertical; outline: none; }
.composer textarea:focus { border-color: var(--primary); }
.composer .c-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.composer .c-row .input { width: auto; height: 32px; }

/* ---------- tasks board ---------- */
.tcol { width: 300px; flex: none; padding: 0 8px; display: flex; flex-direction: column; }
.tcol .col-head { color: var(--text); background: var(--bg); }
.tcol .col-head .s { color: var(--muted); }
.tcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; }
.tcard .chk-btn { width: 20px; height: 20px; border: 2px solid #c3cbd3; border-radius: 50%; flex: none; cursor: pointer; margin-top: 1px; display: grid; place-items: center; background: #fff; }
.tcard .chk-btn:hover { border-color: var(--green); background: #effaf2; }
.tcard .chk-btn.done { background: var(--green); border-color: var(--green); color: #fff; }
.tcard .tc-main { flex: 1; min-width: 0; }
.tcard .tc-type { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.tcard .tc-text { margin: 3px 0; word-break: break-word; }
.tcard .tc-ent { font-size: 12px; }
.tcard.done .tc-text { text-decoration: line-through; color: var(--muted); }

/* ---------- dashboard ---------- */
.dash { flex: 1; overflow: auto; background: var(--board-bg); padding: 18px 20px 30px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.w { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; padding: 16px 18px; color: #fff; backdrop-filter: blur(6px); min-height: 128px; display: flex; flex-direction: column; }
.w.link { cursor: pointer; }
.w.link:hover { background: rgba(255, 255, 255, .16); }
.w .w-t { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: rgba(255, 255, 255, .72); }
.w .w-v { font-size: 36px; font-weight: 300; margin-top: 8px; line-height: 1.1; }
.w .w-s { font-size: 13px; color: rgba(255, 255, 255, .78); margin-top: auto; padding-top: 6px; }
.w.span2 { grid-column: span 2; }
.w.tall { grid-row: span 2; }
.w .w-list { margin-top: 10px; font-size: 13px; overflow: auto; }
.w .w-list .li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.w .w-list .li a { color: #9fd3ff; }
.w.red .w-v { color: #ffb3b3; }
.w.green .w-v { color: #b9f5c9; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; margin-top: 12px; }
.spark div { flex: 1; background: rgba(255, 255, 255, .45); border-radius: 2px 2px 0 0; min-height: 2px; }

/* ---------- analytics ---------- */
.an-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.an-card { background: #fff; border-radius: 6px; padding: 14px 16px; box-shadow: var(--shadow); }
.an-card .t { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.an-card .v { font-size: 24px; margin-top: 6px; }
.an-card .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 14px; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; }
.funnel-row { display: grid; grid-template-columns: 200px 1fr 90px 120px 70px; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid #f0f2f4; font-size: 13px; }
.funnel-row .fbar { height: 26px; border-radius: 3px; position: relative; background: #f1f3f6; }
.funnel-row .fbar div { height: 100%; border-radius: 3px; min-width: 3px; }
.funnel-row .fbar span { position: absolute; left: 8px; top: 4px; font-size: 12px; color: #2e3640; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding-top: 20px; border-bottom: 1px solid var(--line); }
.chart .cb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.chart .cb .bar { width: 70%; max-width: 46px; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart .cb .bar:hover { background: var(--primary-d); }
.chart .cb .val { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.chart-x { display: flex; gap: 10px; }
.chart-x div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); padding-top: 6px; min-width: 0; }

/* ---------- settings ---------- */
.set-wrap { max-width: 960px; }
.stage-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; background: #fff; }
.stage-row .sw { width: 22px; height: 22px; border-radius: 4px; cursor: pointer; flex: none; border: 1px solid rgba(0, 0, 0, .08); }
.stage-row input { flex: 1; border: 1px solid transparent; height: 30px; padding: 0 8px; border-radius: 3px; outline: none; background: transparent; }
.stage-row input:hover { border-color: var(--line); }
.stage-row input:focus { border-color: var(--primary); background: #fff; }
.stage-row.sys { background: #f7f8fa; }
.palette { display: grid; grid-template-columns: repeat(8, 24px); gap: 6px; padding: 10px; }
.palette div { width: 24px; height: 24px; border-radius: 4px; cursor: pointer; border: 1px solid rgba(0, 0, 0, .1); }
pre.code { background: #1f2b38; color: #d6e4f0; padding: 14px; border-radius: 6px; overflow: auto; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 30, 45, .5); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 8vh 16px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 6px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); }
.modal .m-head { padding: 16px 20px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .m-body { padding: 18px 20px 6px; }
.modal .m-foot { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #2f3d4c; color: #fff; padding: 11px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13px; animation: tin .2s; }
.toast.err { background: #c94545; }
.toast.ok { background: #3e9b5a; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ---------- global search ---------- */
.gsearch { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; box-shadow: var(--shadow-lg); border-radius: var(--radius); z-index: 60; max-height: 480px; overflow: auto; color: var(--text); }
.gsearch .gs-h { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 10px 14px 4px; letter-spacing: .4px; }
.gsearch a { display: flex; justify-content: space-between; padding: 7px 14px; color: var(--text); gap: 10px; }
.gsearch a:hover { background: #f0f5fd; text-decoration: none; }

/* ---------- login ---------- */
.login { height: 100vh; display: grid; place-items: center; background: var(--board-bg); padding: 16px; }
.login-box { background: #fff; border-radius: 8px; padding: 34px 32px 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-box .logo { width: 52px; height: 52px; border-radius: 13px; background: linear-gradient(135deg, #ff8a00, #ff3d6e); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 26px; margin: 0 auto 14px; }
.login-box h2 { text-align: center; margin: 0 0 24px; font-size: 20px; }
.login-box .btn { width: 100%; justify-content: center; height: 40px; margin-top: 6px; }
.login-box .err { color: #c94545; font-size: 13px; min-height: 18px; margin-bottom: 6px; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  :root { --nav-w: 0px; }
  .app { flex-direction: column-reverse; }
  .nav { width: 100%; flex-direction: row; height: 58px; overflow-x: auto; }
  .nav-logo, .nav-spacer { display: none; }
  .nav a.nav-item { flex: 1; min-width: 64px; padding: 8px 2px 6px; font-size: 10px; }
  .nav a.nav-item.active::before { width: auto; height: 3px; right: 0; }
  .nav-user { padding: 12px 10px; }
  .nav-user .dd-menu { left: auto; right: 0; bottom: 56px; }
  .app { height: 100dvh; }
  .topbar { padding: 0 12px; gap: 8px; height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .topbar .sum, .hide-m { display: none !important; }
  .ecard { flex-direction: column; overflow: auto; }
  .eleft { width: 100%; border-right: 0; }
  .ebody { overflow: visible; }
  .eright { min-height: 70vh; }
  .feed { padding: 14px 12px; }
  .funnel-row { grid-template-columns: 110px 1fr 60px; }
  .funnel-row > :nth-child(4), .funnel-row > :nth-child(5) { display: none; }
  .w.span2 { grid-column: span 1; }
  .drop-bar { left: 0; }
  .page-pad { padding: 14px 12px; }
}
