:root {
  --bg: #f4f5f9; --panel: #fff; --line: #e5e7ef; --line2: #eef0f5; --text: #1d2233; --muted: #6b7185; --faint: #9aa0b2;
  --side: #161a2e; --side2: #20253d; --sidetext: #c4c8d8; --accent: #1c4e80; --accent2: #e9f0f8; --accentdk: #163f68;
  --ok: #12936b; --okbg: #e3f6ee; --warn: #b7791f; --warnbg: #fdf3e1; --bad: #d03c3c; --badbg: #fde8e8;
  --r: 8px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13.5px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; height: var(--vh); }
.shell.collapsed { grid-template-columns: 60px 1fr; }
.side { background: var(--side); color: var(--sidetext); overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #fff; font-weight: 700; font-size: 16px; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.brand .logo svg { stroke: #fff; width: 18px; height: 18px; stroke-width: 2.4; }
.side nav { padding: 4px 8px 16px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--sidetext); margin: 1px 0; white-space: nowrap; }
.side a.nav:hover { background: var(--side2); text-decoration: none; color: #fff; }
.side a.nav.on { background: #2f3555; color: #fff; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7c829b; padding: 14px 10px 4px; display: flex; justify-content: space-between; cursor: pointer; user-select: none; }
.side .grp.closed + .grpbody { display: none; }
.shell.collapsed .side .lbl, .shell.collapsed .side .grp, .shell.collapsed .brand span { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; height: var(--vh); }
.top { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 54px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.top h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsearch { position: relative; width: 300px; }
.gsearch input { width: 100%; padding: 7px 10px 7px 32px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.gsearch svg { position: absolute; left: 9px; top: 9px; color: var(--faint); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; cursor: pointer; border: 0; }
.content { flex: 1; overflow: auto; padding: 18px 20px 40px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; white-space: nowrap; font-weight: 500; }
.btn:hover { background: #f7f8fb; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:hover { background: var(--accentdk); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { border: 0; background: transparent; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--muted); display: inline-flex; }
.iconbtn:hover { background: var(--line2); color: var(--text); }
input.in, select.in, textarea.in { width: 100%; padding: 7px 9px; border: 1px solid #d6d9e3; border-radius: 6px; background: #fff; outline: none; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent2); }
input.in.err, select.in.err { border-color: var(--bad); }
textarea.in { min-height: 80px; resize: vertical; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card > h3, .card .hd { margin: 0; padding: 12px 16px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 8px; }
.card .bd { padding: 14px 16px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--line2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--okbg); color: var(--ok); } .pill.warn { background: var(--warnbg); color: var(--warn); } .pill.bad { background: var(--badbg); color: var(--bad); } .pill.acc { background: var(--accent2); color: var(--accent); }

/* toolbar + list */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent2); color: var(--accent); }
.listwrap { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
.listwrap.nofilter { grid-template-columns: 1fr; }
.filters { position: sticky; top: 0; max-height: calc(var(--vh) - 140px); overflow: auto; }
.filters .f { padding: 4px 14px; }
.filters label.ck { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.filters .fx { padding: 4px 0 8px 22px; display: grid; gap: 5px; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.grid th { font-weight: 600; font-size: 12.5px; color: var(--muted); background: #fafbfd; position: sticky; top: 0; cursor: pointer; user-select: none; z-index: 1; }
table.grid tr:hover td { background: #f6f9fc; }
table.grid td.ck, table.grid th.ck { width: 36px; padding-right: 0; }
.tablecard { overflow: auto; max-height: calc(var(--vh) - 190px); border-radius: var(--r); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line2); background: #fff; border-radius: 0 0 var(--r) var(--r); }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--accent2); border-radius: 7px; margin-bottom: 10px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { flex: 0 0 270px; background: #eceef4; border-radius: var(--r); max-height: calc(var(--vh) - 170px); display: flex; flex-direction: column; }
.kcol .kh { padding: 10px 12px; font-weight: 600; border-top: 3px solid var(--accent); border-radius: var(--r) var(--r) 0 0; background: #fff; }
.kcol .kh small { display: block; font-weight: 400; color: var(--muted); }
.kcol .kb { padding: 8px; overflow-y: auto; flex: 1; min-height: 60px; }
.kcol.over .kb { background: var(--accent2); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.kcard b { display: block; margin-bottom: 3px; }
.kcard div { color: var(--muted); font-size: 12.5px; }

/* form + detail */
.formhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: sticky; top: -18px; background: var(--bg); padding: 8px 0; z-index: 5; }
.formhead h2 { margin: 0; font-size: 18px; flex: 1; }
.section { margin-bottom: 14px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 36px; padding: 16px 20px; }
.fgrid .fld { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.fgrid .fld.wide { grid-column: 1 / -1; }
.fgrid .fld > label { text-align: right; color: var(--muted); }
.fgrid .fld > label.req::after { content: " *"; color: var(--bad); }
.fgrid .val { min-height: 22px; word-break: break-word; }
.fgrid .val.pre { white-space: pre-wrap; }
.lookup { position: relative; }
.dd { position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 8px 24px rgba(16,24,40,.12); z-index: 30; max-height: 260px; overflow: auto; }
.dd div { padding: 7px 10px; cursor: pointer; }
.dd div:hover, .dd div.hl { background: var(--accent2); }
.dd .hdr { font-size: 11px; text-transform: uppercase; color: var(--faint); cursor: default; padding-top: 9px; }
.dd .hdr:hover { background: none; }
.items { width: 100%; border-collapse: collapse; }
.items th, .items td { border-bottom: 1px solid var(--line2); padding: 6px; text-align: left; vertical-align: top; }
.items th { font-size: 12px; color: var(--muted); }
.items td.n, .items th.n { text-align: right; }
.items input.in { padding: 5px 7px; }
.dhead { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.dhead .big { width: 46px; height: 46px; border-radius: 10px; background: var(--accent2); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.dhead h2 { margin: 0; font-size: 19px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
.stagebar { display: flex; margin-bottom: 14px; border-radius: 7px; overflow: hidden; }
.stagebar button { flex: 1; border: 0; padding: 8px 4px; font-size: 12px; cursor: pointer; background: #e6e8f0; color: var(--muted); margin-right: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stagebar button.done { background: #c5d6ea; color: var(--accentdk); }
.stagebar button.cur { background: var(--accent); color: #fff; }
.stagebar button.lost { background: var(--bad); color: #fff; }
.stagebar button.won { background: var(--ok); color: #fff; }
.note { padding: 10px 0; border-bottom: 1px solid var(--line2); }
.note:last-child { border: 0; }
.tl { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.tl .ev { position: relative; padding-bottom: 14px; }
.tl .ev::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .v { font-size: 23px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--faint); }
.bars .b { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; align-items: center; padding: 4px 0; font-size: 12.5px; }
.bars .track { background: var(--line2); border-radius: 4px; height: 14px; overflow: hidden; }
.bars .fill { background: var(--accent); height: 100%; border-radius: 4px; }
.bars .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini { width: 100%; border-collapse: collapse; }
.mini td, .mini th { padding: 7px 4px; border-bottom: 1px solid var(--line2); text-align: left; }
.mini th { color: var(--muted); font-weight: 500; font-size: 12px; }
.mini tr:last-child td { border: 0; }
.progress { height: 12px; border-radius: 99px; background: var(--line2); overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: #fff; }
.cal .dh { padding: 7px; font-size: 12px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfd; }
.cal .d { min-height: 110px; padding: 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; }
.cal .d.out { background: #fafbfd; color: var(--faint); }
.cal .d.today .dn { background: var(--accent); color: #fff; border-radius: 50%; }
.cal .dn { display: inline-grid; place-items: center; width: 22px; height: 22px; font-size: 12px; }
.cal .e { font-size: 11.5px; padding: 2px 5px; border-radius: 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; color: var(--text); }
.cal .e.Meetings { background: #e8e6ff; } .cal .e.Tasks { background: #fff1d6; } .cal .e.Calls { background: #dcf4ea; }
.cal .e.done { text-decoration: line-through; opacity: .6; }

/* modal, menu, toast */
.overlay { position: fixed; inset: 0; background: rgba(15,18,35,.45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 10px; width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(860px, 100%); }
.modal .mh { padding: 14px 18px; font-weight: 600; font-size: 15px; border-bottom: 1px solid var(--line2); display: flex; }
.modal .mb { padding: 16px 18px; overflow: auto; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line2); display: flex; gap: 8px; justify-content: flex-end; }
.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; color: var(--muted); font-size: 12.5px; }
.menu { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(16,24,40,.15); z-index: 90; padding: 5px; min-width: 190px; max-height: 70vh; overflow: auto; }
.menu a, .menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--text); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--line2); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line2); margin: 4px 0; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: #1d2233; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); }

/* login */
.login { min-height: var(--vh); display: grid; place-items: center; background: linear-gradient(135deg, #161a2e, #2d2a73); }
.login .card { width: 360px; padding: 28px; }
.login h2 { margin: 12px 0 4px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 60px 1fr; }
  .side .lbl, .side .grp, .brand span { display: none; }
  .listwrap { grid-template-columns: 1fr; } .filters { display: none; }
  .fgrid, .two, .three { grid-template-columns: 1fr; }
  .gsearch { width: 160px; }
}
@media print { .side, .top, .formhead .btn, .tabs { display: none !important; } .shell { display: block; } .content { overflow: visible; } }

/* ================= v2 refresh ================= */
:root {
  --bg: #f3f4f8; --line: #e3e6ee; --line2: #edf0f5; --text: #1b2130; --muted: #646b7e; --faint: #98a0b3;
  --side: #182039; --side2: #222b4a; --sidetext: #b9c0d6; --accent: #1c4e80; --accent2: #e9f0f8; --accentdk: #163f68;
}
body { font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 13.5px; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -.01em; }

/* sidebar */
.side { border-right: 1px solid #0f1528; }
.brand { padding: 16px 18px 14px; border-bottom: 1px solid #243055; margin-bottom: 6px; }
.brand .logo { background: linear-gradient(135deg, #2a6aa6, #1c4e80); box-shadow: 0 2px 8px rgba(28,78,128,.40); }
.side a.nav { padding: 7px 12px; font-size: 13.5px; border-radius: 7px; }
.side a.nav svg { opacity: .8; }
.side a.nav.on { background: linear-gradient(90deg, rgba(28,78,128,.30), rgba(28,78,128,.12)); color: #fff; box-shadow: inset 3px 0 0 #2f6ea8; }
.side a.nav.on svg { opacity: 1; }
.side .grp { padding: 16px 12px 5px; font-weight: 600; font-size: 10.5px; color: #6f7899; }
.side::-webkit-scrollbar { width: 6px; } .side::-webkit-scrollbar-thumb { background: #2c375c; border-radius: 3px; }

/* top bar */
.top { height: 56px; gap: 6px; box-shadow: 0 1px 0 var(--line); border: 0; position: relative; z-index: 6; }
.top h1 { font-size: 17px; font-weight: 650; }
.gsearch { width: 320px; margin: 0 6px; }
.gsearch input { background: #f1f3f8; border-color: transparent; border-radius: 8px; padding: 8px 10px 8px 34px; }
.gsearch input:focus { background: #fff; border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent2); }
.top .iconbtn { padding: 8px; border-radius: 8px; }
.avbtn { border: 0; background: none; padding: 0 0 0 6px; cursor: pointer; }
.av { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex: none; letter-spacing: 0; line-height: 1; vertical-align: middle; }
.who { display: inline-flex; align-items: center; gap: 7px; }

/* buttons & inputs */
.btn { border-radius: 8px; border-color: #d9dde8; box-shadow: 0 1px 1px rgba(16,24,40,.04); font-weight: 550; }
.btn.pri { box-shadow: 0 1px 2px rgba(28,78,128,.30); }
input.in, select.in, textarea.in { border-color: #d5d9e4; border-radius: 7px; }
.card { border-radius: 10px; border-color: #e6e9f0; }
.card > h3, .card .hd { font-size: 14px; padding: 13px 18px; }

/* list */
.toolbar { gap: 8px; }
select.in.cvsel { width: auto; min-width: 190px; font-weight: 600; border-color: transparent; background: transparent; font-size: 15px; padding-left: 2px; cursor: pointer; }
select.in.cvsel:hover { background: #fff; border-color: #d5d9e4; }
table.grid th { background: #f8f9fc; text-transform: none; font-size: 12px; letter-spacing: .01em; color: #59607a; border-bottom: 1px solid var(--line); padding: 10px 12px; }
table.grid td { padding: 10px 12px; border-bottom-color: #eff1f6; }
table.grid tbody tr { transition: background .1s; }
table.grid tr:hover td { background: #f3f7fb; }
table.grid td a { font-weight: 550; }
table.grid.flat th { background: #fbfbfd; }
.tablecard { max-height: calc(var(--vh) - 200px); }
.filters .hd { font-size: 13px; }
.bulkbar { border: 1px solid #cfdded; }

/* kanban */
.kcol { background: #eef0f6; border: 1px solid #e3e6ee; }
.kcol .kh { border-top: 0; border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--accent); padding: 12px 12px 10px; }
.kcard { border-radius: 9px; transition: box-shadow .15s, transform .15s; }
.kcard:hover { box-shadow: 0 6px 18px rgba(16,24,40,.1); transform: translateY(-1px); }
.kcard .kfoot { display: flex; justify-content: flex-end; margin-top: 6px; }

/* record page */
.dhead { padding: 18px 20px; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.dhead .big { width: 52px; height: 52px; border-radius: 50%; color: #fff; font-size: 19px; flex: none; }
.dhead h2 { font-size: 20px; font-weight: 650; margin: 2px 0 8px; }
.dhead .facts { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.dhead .facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dhead .facts span:first-child { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.dhead .dact { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dlayout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.dnav { position: sticky; top: 0; padding: 8px; max-height: calc(var(--vh) - 100px); overflow: auto; }
.dnav .navh { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 8px 10px 6px; }
.dnav button, .dnav a { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text); text-align: left; font-size: 13px; }
.dnav button span { flex: 1; }
.dnav button b { font-weight: 600; font-size: 11.5px; background: var(--line2); color: var(--muted); border-radius: 99px; padding: 0 7px; }
.dnav button:hover, .dnav a:hover { background: var(--accent2); color: var(--accent); text-decoration: none; }
.dmain { min-width: 0; }
.dmain .tabs { background: #fff; border: 1px solid #e6e9f0; border-radius: 10px; padding: 0 8px; margin-bottom: 12px; }
.section { scroll-margin-top: 10px; transition: box-shadow .3s; }
.section.flash { box-shadow: 0 0 0 3px var(--accent2), 0 0 0 4px var(--accent); }
.fgrid { gap: 2px 40px; padding: 10px 18px 14px; }
.fgrid .fld { grid-template-columns: 170px 1fr; min-height: 36px; }
.fgrid .fld > label { font-size: 13px; }
.val.editable { position: relative; padding: 5px 30px 5px 8px; margin-left: -8px; border-radius: 6px; border: 1px solid transparent; cursor: default; }
.val.editable:hover { background: #f6f7fb; border-color: #e3e6ee; }
.val .pen { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--faint); cursor: pointer; padding: 3px; border-radius: 5px; display: none; }
.val.editable:hover .pen { display: inline-flex; }
.val .pen:hover { color: var(--accent); background: var(--accent2); }
.val.editing { background: none !important; border-color: transparent !important; padding-right: 0; }
.ie { display: flex; gap: 6px; align-items: flex-start; }
.ie .btn.sm { padding: 6px 9px; }
.nodata { padding: 22px 18px; color: var(--faint); text-align: center; font-size: 13px; }
.noteadd { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.noteadd textarea { min-height: 42px; }
.note { padding: 12px 0; }
.acttype { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.acttype.Tasks { background: #fff1d6; color: #95600f; } .acttype.Meetings { background: #e8e6ff; color: #4b3fc4; } .acttype.Calls { background: #dcf4ea; color: #157a52; }
.acttype svg { width: 13px; height: 13px; }
.stagebar { border-radius: 10px; margin-bottom: 12px; box-shadow: var(--shadow); }
.stagebar button { padding: 10px 4px; font-weight: 550; background: #e9ebf3; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -6px; }
.stagebar button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.stagebar button:hover:not(.cur) { background: #dde6f0; color: var(--text); }
.stagebar button.done { background: #c5d6ea; }

/* home */
.kpi { transition: box-shadow .15s, transform .15s; border-top: 3px solid transparent; }
.kpi:hover { box-shadow: 0 8px 22px rgba(16,24,40,.08); transform: translateY(-1px); border-top-color: var(--accent); }
.bars .fill { background: linear-gradient(90deg, #2f6ea8, #1c4e80); }

@media (max-width: 1100px) { .dlayout { grid-template-columns: 1fr; } .dnav { display: none; } .dhead { flex-wrap: wrap; } }

/* ================= font (closest free match to Zoho's Puvi) ================= */
body { font-family: "DM Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 14px; }
button, input, select, textarea { font-family: inherit; }

/* ================= analytics ================= */
.dashbar { background: #fff; border: 1px solid #e6e9f0; border-radius: 10px; padding: 8px 10px; margin-bottom: 14px; }
.dsel { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.dsel select.in.cvsel { min-width: 220px; color: var(--text); }
.dgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.dcomp { display: flex; flex-direction: column; min-height: 150px; min-width: 0; }
.dcomp.w2 { grid-column: span 2; } .dcomp.w3 { grid-column: span 3; } .dcomp.w4 { grid-column: span 4; }
.dcomp:not(.t-kpi) { min-height: 330px; }
.dch { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #333a4d; }
.dch .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dch .dper { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12px; white-space: nowrap; }
.iconbtn.sm { padding: 3px; }
.t-rank .dcb, .t-compare .dcb, .t-funnel .dcb { justify-content: flex-start; padding-top: 10px; }
.dcb { flex: 1; padding: 6px 16px 16px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.skel { height: 60%; min-height: 60px; border-radius: 8px; background: linear-gradient(90deg, #f1f3f8 25%, #e8ebf3 50%, #f1f3f8 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.kpiv { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kpiv > span:first-child { font-size: 30px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpis2 { color: var(--faint); font-size: 12.5px; margin-top: 10px; }
.chg { font-size: 13px; font-weight: 600; color: var(--muted); }
.chg.up { color: #12936b; } .chg.down { color: #d03c3c; } .chg.sm { font-size: 10px; }
.gauge { width: 100%; max-width: 300px; display: block; margin: 0 auto; }
.gauge .gl { font-size: 11px; fill: #8a91a5; }
.gsum { text-align: center; margin-top: 4px; }
.gsum b { font-size: 20px; }
.bullet { padding: 10px 0; }
.btrack { position: relative; height: 44px; background: #eef0f5; border-radius: 6px; }
.bfill { height: 100%; background: linear-gradient(90deg, #5cd6a4, #12b886); border-radius: 6px; display: flex; align-items: center; justify-content: flex-end; min-width: 2px; }
.bfill.out { justify-content: flex-start; }
.bfill.out span { color: var(--text); text-shadow: none; transform: translateX(calc(100% + 8px)); padding: 0; }
.bfill span { color: #fff; font-weight: 600; padding-right: 10px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.btarget { position: absolute; top: -6px; bottom: -6px; width: 3px; background: #2b3245; border-radius: 2px; }
.btarget span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11.5px; white-space: nowrap; color: var(--muted); }
.baxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hbars { display: grid; gap: 9px; }
.hb { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #454c60; }
.ht { height: 16px; background: #f1f3f8; border-radius: 4px; overflow: hidden; }
.ht div { height: 100%; border-radius: 4px; }
.hv { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; }
.colchart { width: 100%; height: auto; display: block; }
.colchart .gridl { stroke: #eef0f5; } .colchart .ax { font-size: 11px; fill: #8a91a5; } .colchart .vl { font-size: 11px; fill: #454c60; font-weight: 600; }
.donut { display: flex; align-items: center; gap: 18px; }
.donut svg { width: 46%; max-width: 210px; flex: none; }
.donut .dt { font-size: 18px; font-weight: 700; fill: var(--text); } .donut .ds { font-size: 10px; fill: #8a91a5; }
.dleg { flex: 1; display: grid; gap: 6px; min-width: 0; font-size: 13px; max-height: 240px; overflow: auto; }
.dleg div { display: flex; align-items: center; gap: 8px; }
.dleg i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dleg span.grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dleg .faint { width: 48px; text-align: right; }
.funnel { display: grid; gap: 6px; }
.fr { display: grid; grid-template-columns: minmax(90px, 30%) 1fr 30px; gap: 10px; align-items: center; font-size: 13px; }
.fl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc { display: flex; justify-content: center; }
.fc div { color: #fff; font-weight: 600; font-size: 12px; text-align: center; padding: 7px 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; }
.fn { color: var(--faint); text-align: right; }
table.rank { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.rank th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); }
table.rank td { padding: 8px 6px; border-bottom: 1px solid #f0f2f6; vertical-align: middle; }
.rk { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #eef0f5; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.rk.r1 { background: #ffe9a8; color: #8a6100; } .rk.r2 { background: #e3e7ef; color: #4d5568; } .rk.r3 { background: #f6d6bd; color: #8a4b1c; }
.rbar { height: 4px; background: #f1f3f8; border-radius: 2px; margin-top: 5px; } .rbar div { height: 100%; background: var(--accent); border-radius: 2px; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.cmp th { font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px; text-align: right; border-bottom: 2px solid var(--accent2); }
table.cmp td { padding: 11px 8px; text-align: right; border-bottom: 1px solid #f0f2f6; font-variant-numeric: tabular-nums; }
table.cmp td.cl { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #454c60; font-weight: 600; }
table.cmp tr:nth-child(even) td { background: #fafbfd; }
.ctypes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ctype { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 10px 12px; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.ctype span { font-size: 12px; color: var(--muted); }
.ctype:hover { border-color: #a9c2de; }
.ctype.on { border-color: var(--accent); background: var(--accent2); box-shadow: 0 0 0 1px var(--accent); }
.stack1 { display: grid; gap: 4px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 1200px) { .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dcomp.w3, .dcomp.w4 { grid-column: span 2; } }
@media (max-width: 700px) { .dgrid { grid-template-columns: 1fr; } .dcomp.w2, .dcomp.w3, .dcomp.w4 { grid-column: span 1; } }
.dcomp.w1 .donut { flex-direction: column; gap: 10px; }
.dcomp.w1 .donut svg { width: 62%; max-width: 170px; }
.dcomp.w1 .dleg { width: 100%; max-height: 120px; }
.dleg { overflow-x: hidden; }

/* ================= zoom (Zoho-like larger UI) ================= */
:root { --z: 1.1; --vh: calc(100vh / var(--z)); }
html { zoom: var(--z); }

/* ================= Saivyy theme: ink navy, deep sapphire, champagne gold ================= */
:root {
  --bg: #f4f5f8; --panel: #fff; --line: #e2e5ec; --line2: #edeff4; --text: #14203a; --muted: #5d667c; --faint: #939bad;
  --side: #0c1c33; --side2: #162d4e; --sidetext: #b7c4da;
  --accent: #1c4e80; --accent2: #e9f0f8; --accentdk: #143a61; --gold: #c9a45c;
}
.side { background: linear-gradient(180deg, #112a4a 0%, #0c1e37 48%, #081426 100%); border-right: 1px solid #060f1d; }
a.brand { text-decoration: none; }
.brand { gap: 11px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.09); margin-bottom: 6px; min-height: 62px; }
.mark { display: block; flex: none; border-radius: 9px; }
.btext { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.btext small { font-size: 11.5px; font-weight: 500; color: #8fa1bf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; margin-top: 5px; }
.wm { display: block; flex: none; }
.brand .mark { display: none; }
.shell.collapsed .brand .mark { display: block; }
@media (max-width: 900px) { .brand .mark { display: block; } .btext { display: none; } }
.shell.collapsed .btext { display: none; }
.shell.collapsed .brand { padding: 14px; }
.side a.nav { color: var(--sidetext); position: relative; }
.side a.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.nav.on { background: rgba(255,255,255,.11); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side a.nav.on svg { color: #e5c882; opacity: 1; }
.side .grp { color: #7587a8; align-items: center; }
.side .grp svg { width: 13px; height: 13px; transition: transform .15s; }
.side .grp.closed svg { transform: rotate(-90deg); }
.side::-webkit-scrollbar-thumb { background: #27436b; }
.btn.pri { background: linear-gradient(180deg, #22598f, #1a4a79); border-color: #163f68; box-shadow: 0 1px 2px rgba(12,35,66,.30), inset 0 1px 0 rgba(255,255,255,.10); }
.btn.pri:hover { background: linear-gradient(180deg, #1d4f80, #143a61); }
.btn.lg { justify-content: center; padding: 10px 16px; font-size: 14.5px; margin-top: 4px; }
:focus-visible { outline: 2px solid #2a6aa6; outline-offset: 2px; }
::selection { background: #cddcee; }
.kpi:hover { border-top-color: var(--gold); }
.bars .fill { background: linear-gradient(90deg, #3a7fb5, #1c4e80); }
.yes { color: var(--ok); display: inline-flex; }
.menu { max-width: 360px; }
.menu span { white-space: normal; }
.bell { position: relative; }
.badge { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: #b8452f; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border: 1px solid #fff; }
.badge[hidden] { display: none; }

/* sign in and setup */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: var(--vh); background: #fff; }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 52px; color: #fff; background: radial-gradient(120% 90% at 0% 0%, #1d4b7a 0%, #0f2a4a 45%, #081426 100%); }
.auth-logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-copy { position: relative; z-index: 1; max-width: 460px; }
.auth-copy h1 { font-size: 36px; line-height: 1.2; font-weight: 600; margin: 0 0 14px; letter-spacing: -.02em; }
.auth-copy p { margin: 0; color: #b7c4da; font-size: 16px; }
.auth-art { position: absolute; right: -60px; bottom: -40px; width: 620px; height: 620px; color: rgba(255,255,255,.07); pointer-events: none; }
.auth-art .gold { stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; opacity: .75; }
.auth-art .dot { fill: #e5c882; stroke: none; }
.auth-foot { display: flex; align-items: center; gap: 8px; color: #8fa1bf; font-size: 13px; position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 32px 24px; overflow: auto; }
.auth-form form { width: min(400px, 100%); }
.auth-form h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.015em; }
.auth-form p { margin: 0 0 6px; }
.auth-form .stack > label { color: var(--text); font-weight: 500; font-size: 13px; }
.auth-form .two label { display: grid; gap: 4px; color: var(--text); font-weight: 500; font-size: 13px; }
.auth-form input.in, .auth-form select.in { padding: 9px 11px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* first-run guidance */
.getstarted { margin-bottom: 18px; }
.gs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 16px; }
.gs-grid a { display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.gs-grid a:hover { text-decoration: none; border-color: #a9c2de; background: #f6f9fc; }
.gs-grid svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: 4px; }
.gs-grid span { color: var(--muted); font-size: 12.5px; }
