:root {
  --navy-950: #071226; --navy-900: #0B1A36; --navy-800: #12264B; --navy-700: #1B3566; --navy-600: #24457F;
  --navy-500: #2F5BA8; --navy-100: #E6ECF7; --navy-50: #F2F5FB;
  --gold: #C9A864; --gold-soft: #F5EEDD;
  --bg: #F4F6FA; --surface: #FFFFFF; --line: #E3E8F0; --line-2: #EEF1F6;
  --surface-2: #FAFBFD; --surface-3: #EEF1F6; --line-strong: #C9D2E1;
  --tx-500: var(--navy-500); --tx-600: var(--navy-600); --tx-700: var(--navy-700); --tx-800: var(--navy-800); --tx-900: var(--navy-900);
  --gold-ink: #7A5F22; --gold-line: #E6D3A6; --red-ink: #B4372D; --green-ink: #1F7A4D;
  --text: #0E1A30; --text-2: #4A5874; --muted: #8592A8;
  --hot: #D2463A; --hot-bg: #FCEDEB; --warm: #D98E1F; --warm-bg: #FCF3E3;
  --ok: #1D8F63; --ok-bg: #E5F5EE; --danger: #C83A3A;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 26, 54, .04), 0 4px 16px rgba(11, 26, 54, .05);
  --shadow-lg: 0 20px 50px rgba(7, 18, 38, .22);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Be Vietnam Pro', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--tx-500); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: #C9D3E6; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 26px; }
.brand-mark { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; background: #13264A; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.brand-mark .xmark { display: block; width: 100%; height: 100%; fill: #F2F2F2; }
.login-logo { display: block; height: 64px; width: auto; margin: 0 0 26px; }
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand small { color: #7F8EAB; font-size: 11.5px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: #B4C0D8; font-weight: 500; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255,255,255,.08); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav .badge { margin-left: auto; background: var(--hot); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: #7F8EAB; font-size: 11.5px; }
.icon-btn { background: transparent; border: 0; color: inherit; padding: 7px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(127,142,171,.15); }
.main { min-width: 0; padding: 26px 32px 48px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.2px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .grow { flex: 1; }

/* ---------- Primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-h .grow { flex: 1; }
.card-b { padding: 16px 18px; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); background: var(--navy-50); text-decoration: none; }
.btn.primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn.primary:hover { background: var(--navy-700); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--navy-50); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: default; }
.input, select.input, textarea.input { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 11px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(47,91,168,.12); }
.field { display: grid; gap: 6px; margin-bottom: 12px; align-content: start; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--navy-50); color: var(--tx-700); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip.gold { background: var(--gold-soft); color: var(--gold-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.temp { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .3px; }
.temp::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.temp.hot { color: var(--hot); background: var(--hot-bg); }
.temp.warm { color: var(--warm); background: var(--warm-bg); }
.temp.cool { color: #2F7FC1; background: #E8F2FB; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(11,26,54,.12); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-100); color: var(--tx-700); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.side .avatar { background: var(--navy-700); color: var(--gold); width: 32px; height: 32px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.overdue { color: var(--danger) !important; font-weight: 600; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.search .input { padding-left: 34px; width: 230px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 600; margin: 8px 0 4px; letter-spacing: -.5px; }
.kpi .hint { font-size: 12.5px; color: var(--text-2); }
.kpi.feature { background: linear-gradient(135deg, var(--navy-800), var(--navy-950)); border-color: var(--navy-800); color: #fff; }
.kpi.feature .lbl, .kpi.feature .hint { color: #A9B6CF; }
.kpi.feature::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; border: 1px solid rgba(201,168,100,.35); }
.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 92px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.funnel-bar { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--navy-500)); border-radius: 5px; }
.funnel-row .v { text-align: right; color: var(--text-2); }

/* ---------- Task list ---------- */
.tlist { list-style: none; margin: 0; padding: 0; }
.titem { display: grid; grid-template-columns: 22px 30px 1fr auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.titem:last-child { border-bottom: 0; }
.titem:hover { background: var(--surface-2); }
.check { width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid #B9C3D4; background: var(--surface); cursor: pointer; display: grid; place-items: center; padding: 0; }
.check:hover { border-color: var(--ok); background: var(--ok-bg); }
.check svg { width: 12px; height: 12px; stroke: var(--ok); stroke-width: 3; opacity: 0; }
.check:hover svg, .check.done svg { opacity: 1; }
.check.done { background: var(--ok); border-color: var(--ok); } .check.done svg { stroke: #fff; }
.ttype { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--navy-50); color: var(--tx-600); }
.ttype.call { background: #E8F0FE; color: #2557B8; } .ttype.zalo { background: #E5F1FF; color: #0068FF; }
.ttype.sms { background: #EEF0FA; color: #5A4FB8; } .ttype.meeting, .ttype.demo { background: var(--gold-soft); color: var(--gold-ink); }
.ttype.quote, .ttype.contract { background: #E8F3EF; color: #1D7A57; } .ttype.negotiate { background: #FDEFE2; color: #B5651D; }
.ttype.wait_contract, .ttype.wait_payment { background: #F1EEF8; color: #6A4FA8; }
.ttitle { font-weight: 500; line-height: 1.35; }
.tmeta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tdue { font-size: 12.5px; color: var(--text-2); text-align: right; white-space: nowrap; }
.tdone .ttitle { color: var(--muted); text-decoration: line-through; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 7px; align-items: center; }
.tabs button.on { color: var(--tx-800); border-color: var(--navy-800); }
.tabs .count { background: var(--line-2); border-radius: 10px; padding: 0 7px; font-size: 11.5px; }
.tabs button.on .count { background: var(--navy-800); color: #fff; }
.tabs .count.red { background: var(--hot-bg); color: var(--hot); }

/* ---------- Pipeline board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(244px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: stretch; }
/* Mỗi cột cao bằng nhau, tự cuộn dọc khi nhiều thẻ; tiêu đề cột dính trên đầu */
.board > .col { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.board > .col > .col-h { position: sticky; top: -10px; z-index: 2; }
.board > .col:not(.stage) > .col-h { background: inherit; }
.board-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--gold-soft); color: var(--gold-ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }
.board-hint .i { width: 16px; height: 16px; flex: none; } .board-hint span { flex: 1; min-width: 200px; }
:root[data-theme="dark"] .board-hint { background: #2B2414; color: #E9C27A; }
.col { background: var(--surface-3); border-radius: var(--radius); padding: 10px; min-height: 240px; transition: background .15s, box-shadow .15s; }
.col.drop { background: #DFE7F4; box-shadow: inset 0 0 0 2px var(--navy-500); }
.col-h { display: flex; align-items: baseline; gap: 8px; padding: 4px 6px 10px; }
.col-h b { font-size: 13px; font-weight: 600; }
.col-h .n { color: var(--muted); font-size: 12px; }
.col-h .sum { margin-left: auto; font-size: 12px; color: var(--text-2); font-weight: 500; }
.col.won .col-h b { color: var(--ok); } .col.lost .col-h b { color: var(--muted); }
.opp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; margin-bottom: 9px; cursor: grab; box-shadow: 0 1px 2px rgba(11,26,54,.04); transition: box-shadow .15s, transform .15s; }
.opp-card:hover { box-shadow: 0 6px 18px rgba(11,26,54,.1); }
.opp-card.dragging { opacity: .5; }
.opp-card .t { font-weight: 600; font-size: 13.5px; line-height: 1.35; margin: 7px 0 3px; }
.opp-card .c { font-size: 12.5px; color: var(--text-2); }
.opp-card .f { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.opp-card .f .next { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-card .val { font-weight: 600; color: var(--tx-800); font-size: 13px; }

/* ---------- Opportunity detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.opp-head { padding: 20px 22px; margin-bottom: 16px; }
.opp-head h1 { font-size: 21px; margin: 0; font-weight: 600; letter-spacing: -.2px; }
.opp-head .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: 13px; }
.opp-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.opp-fields .field { margin: 0; }
.stepper { display: flex; gap: 10px; margin-top: 18px; align-items: stretch; }
.steps { flex: 1; display: flex; min-width: 0; filter: drop-shadow(0 1px 1px rgba(11,26,54,.06)); }
.step { --notch: 12px; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 calc(var(--notch) - 2px) 0 calc(var(--notch) + 4px); margin-left: calc(var(--notch) * -1 + 3px); border: 0; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text-2); background: var(--surface-3);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% 50%, calc(100% - var(--notch)) 100%, 0 100%, var(--notch) 50%); transition: background .15s, color .15s; }
.step:first-child { margin-left: 0; padding-left: 10px; clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% 50%, calc(100% - var(--notch)) 100%, 0 100%); border-radius: 10px 0 0 10px; }
.step:hover { background: #DCE3EE; color: var(--text); }
.step .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step .dot { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px #C9D2E1; }
.step .dot svg { width: 12px; height: 12px; stroke-width: 3; }
.step.past { background: var(--navy-100); color: var(--tx-700); }
.step.past:hover { background: #D6E0F0; }
.step.past .dot { background: var(--navy-600); color: #fff; box-shadow: none; }
.step.cur { background: var(--navy-800); color: #fff; font-weight: 600; }
.step.cur .dot { background: var(--gold); color: var(--navy-950); box-shadow: 0 0 0 3px rgba(201,168,100,.3); }
.outcomes { display: flex; gap: 6px; padding-left: 10px; border-left: 1px dashed var(--line); }
.out { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 12.5px; cursor: pointer; }
.out svg { width: 14px; height: 14px; }
.out.won:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.out.lost:hover { border-color: #9AA5B8; color: var(--text); }
.out.won.cur { background: var(--ok); border-color: var(--ok); color: #fff; }
.out.lost.cur { background: #6B778C; border-color: #6B778C; color: #fff; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.section-t { font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 16px 0 10px; }
.section-t:first-child { margin-top: 0; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat3 div { background: var(--navy-50); border-radius: 8px; padding: 9px 10px; text-align: center; }
.stat3 b { display: block; font-size: 16px; color: var(--tx-800); }
.stat3 small { color: var(--muted); font-size: 11.5px; }
.composer-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line-2); }
.composer-tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; font-weight: 500; color: var(--text-2); border-bottom: 2px solid transparent; display: flex; gap: 6px; align-items: center; }
.composer-tabs button.on { color: var(--tx-800); border-color: var(--gold); }
.composer-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer-foot .grow { flex: 1; font-size: 12px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 4px 18px 10px; }
.tl { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.tl:last-child { border-bottom: 0; }
.tl .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-50); color: var(--tx-600); }
.tl .dot.in { background: #E5F1FF; color: #0068FF; }
.tl .dot.bownow { background: var(--gold-soft); color: var(--gold-ink); }
.tl .txt { white-space: pre-wrap; line-height: 1.5; }
.tl .when { font-size: 12px; color: var(--muted); margin-top: 3px; }
.add-task { display: grid; grid-template-columns: 200px 1fr 215px auto; grid-template-areas: none; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.note-box { background: var(--gold-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5; color: var(--gold-ink); }

/* ---------- Modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(7,18,38,.45); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal { width: min(480px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .18s;
  display: flex; flex-direction: column; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: hidden; }
.modal:has(.nopp-sec), .modal:has(.role-pick) { width: min(560px, 100%); }
.modal-h { padding: 18px 20px 4px; } .modal-h h3 { margin: 0; font-size: 16px; }
.modal-h { flex: none; }
/* Nội dung dài thì cuộn bên trong, tiêu đề và nút Lưu / Huỷ luôn hiện */
.modal-b { padding: 14px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.modal-f { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; flex: none; border-top: 1px solid transparent; }
.modal-b.scrolled + .modal-f { border-top-color: var(--line-2); }
@media (max-width: 760px) { .overlay { padding: 12px; } .modal { max-height: calc(100dvh - 24px); } }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.opt { border: 1px solid var(--line); border-radius: 9px; padding: 11px; cursor: pointer; background: var(--surface); text-align: left; font-weight: 500; }
.opt.on { border-color: var(--navy-700); background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy-700); }
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px; animation: pop .2s; }
.toast.err { background: var(--danger); }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(ellipse at 20% 10%, var(--navy-700), transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-950)); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(201,168,100,.25); right: -180px; bottom: -180px; }
.login-art h2 { font-size: 34px; line-height: 1.25; font-weight: 600; max-width: 460px; margin: 0 0 14px; letter-spacing: -.5px; }
.login-art p { color: #A9B6CF; max-width: 420px; line-height: 1.6; }
.login-art .gold { color: var(--gold); }
.login-form { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-form form { width: min(360px, 100%); }
.login-form h1 { font-size: 22px; margin: 0 0 6px; }

/* ---------- Settings ---------- */
.set-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #B9C3D4; display: inline-block; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); } .status-dot.sim { background: var(--warm); box-shadow: 0 0 0 3px var(--warm-bg); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--navy-50); padding: 7px 9px; border-radius: 7px; word-break: break-all; display: block; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 18px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.log-err { color: var(--danger); }
.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }

@media (max-width: 1100px) { .kpis, .set-grid { grid-template-columns: 1fr 1fr; } .dash-grid, .detail-grid { grid-template-columns: 1fr; } .opp-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; }
  .brand { padding: 0; } .brand small { display: none; } .nav { display: flex; margin-left: auto; } .nav a span { display: none; } .side-foot { display: none; }
  .main { padding: 18px 16px 40px; } .kpis, .set-grid, .grid2, .opp-fields { grid-template-columns: 1fr; } .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .add-task { grid-template-columns: 1fr; } .search .input { width: 100%; }
  .opp-head > .row { flex-wrap: wrap; } .opp-head > .row > div:first-child { flex: 1 1 100% !important; } .stepper { flex-direction: column; } .steps { overflow-x: auto; padding-bottom: 2px; } .step { flex: none; min-width: 132px; } .outcomes { padding-left: 0; border-left: 0; } .out { flex: 1; justify-content: center; }
  .kv { grid-template-columns: 110px 1fr; } .titem { grid-template-columns: 22px 30px 1fr; } .tdue { grid-column: 3; text-align: left; }
}

/* ---------- Công việc: các góc nhìn ---------- */
.viewseg button { display: inline-flex; align-items: center; gap: 6px; }
.hint-line { margin: -6px 0 14px; color: var(--muted); font-size: 12.5px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(11,26,54,.04); }
.tcard[draggable="true"] { cursor: grab; }
.tcard.dragging { opacity: .5; }
.tcard .ttitle { font-size: 13px; }
.tcard .f > span:first-child { white-space: nowrap; }
.tcard .tsub { font-size: 12px; color: var(--text-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tcard .f { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--text-2); }
.tcard.done { opacity: .7; } .tcard.done .ttitle { text-decoration: line-through; color: var(--muted); }
.tcard .check { width: 22px; height: 22px; }
.col.overdue { background: #F7E9E8; } .col.done { background: #E6F2EC; }
.opp-card.group { cursor: default; }
.opp-card.group a.t { display: block; color: var(--text); }
.mini { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 7px; }
.mini li { display: grid; grid-template-columns: 20px 16px 1fr; gap: 3px 7px; align-items: center; font-size: 12.5px; }
.mini li .check { width: 18px; height: 18px; } .mini li svg.i { width: 14px; height: 14px; color: var(--tx-600); }
.mini .mt { line-height: 1.35; } .mini .md { grid-column: 3; font-size: 11.5px; color: var(--muted); }
.mini .nostep { display: flex; justify-content: space-between; }
.cal-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-label { font-size: 15px; margin-left: 6px; }
.gcal { margin-bottom: 14px; }
.gcal-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.gcal-row > svg.i { width: 22px; height: 22px; color: var(--tx-600); }
.gcal-row .muted { font-size: 12.5px; margin-top: 2px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal-dow { background: var(--navy-50); padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.cal-day { background: var(--surface); min-height: 120px; padding: 6px; display: flex; flex-direction: column; gap: 5px; min-width: 0; transition: background .15s; }
.cal.week .cal-day { min-height: 420px; }
.cal-day.past { background: var(--surface-2); } .cal-day.other { background: var(--surface-3); } .cal-day.other .cal-date { opacity: .5; }
.cal-day.drop { background: var(--navy-100); box-shadow: inset 0 0 0 2px var(--navy-500); }
.cal-date { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 2px 4px; }
.cal-day.today .cal-date span { background: var(--navy-800); color: #fff; border-radius: 6px; padding: 2px 7px; }
.cal-items { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ev { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; font-size: 11.5px; line-height: 1.3; cursor: pointer; border-left: 3px solid var(--navy-500); background: var(--navy-50); color: var(--text); text-decoration: none; min-width: 0; }
.ev:hover { text-decoration: none; filter: brightness(.97); }
.ev svg.i { width: 12px; height: 12px; }
.ev .et { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ev .en { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev small { flex-basis: 100%; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.call { border-color: #2557B8; background: #EEF3FD; } .ev.zalo { border-color: #0068FF; background: #EBF4FF; }
.ev.sms { border-color: #5A4FB8; background: #F1F0FA; } .ev.meeting, .ev.demo { border-color: var(--gold); background: var(--gold-soft); }
.ev.quote, .ev.contract { border-color: #1D7A57; background: #EAF5F0; } .ev.negotiate { border-color: #B5651D; background: #FDF1E6; }
.ev.wait_contract, .ev.wait_payment { border-color: #6A4FA8; background: #F3F0F9; }
.ev.late { border-color: var(--hot); background: var(--hot-bg); } .ev.late .et { color: var(--hot); }
.ev.done { opacity: .55; } .ev.done .en { text-decoration: line-through; }
.ev[draggable="true"] { cursor: grab; } .ev.dragging { opacity: .4; }
.ev.g { background: var(--surface); border: 1px dashed var(--gold); border-left: 3px solid var(--gold); color: var(--gold-ink); }
.gdot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; }
.more { border: 0; background: none; color: var(--tx-500); font-size: 11.5px; text-align: left; padding: 2px 6px; cursor: pointer; }
@media (max-width: 760px) {
  .viewseg span { display: none; } .viewseg button { padding: 6px 10px; }
  .cal-wrap { overflow-x: auto; } .cal { min-width: 720px; }
}

/* ---------- Danh bạ: Công ty & Người liên hệ ---------- */
.span2 { grid-column: 1 / -1; }
.tbl-wrap { overflow-x: auto; }
.table.dir { min-width: 760px; }
.table.dir tbody tr { cursor: pointer; } .table.dir tbody tr:hover { background: var(--surface-2); }
.table.dir td { vertical-align: middle; }
.avatar.sq { border-radius: 8px; background: var(--navy-800); color: var(--gold); }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.stat3.wide { grid-template-columns: repeat(4, 1fr); margin-top: 18px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip svg.i { width: 11px; height: 11px; }
.chip.st-won { background: var(--ok-bg); color: var(--ok); } .chip.st-lost { background: var(--surface-3); color: #6B778C; }
.picker { position: relative; }
.pick-list { display: grid; position: absolute; left: 0; right: 0; top: 64px; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg); overflow: hidden; }
.pick-list:empty { display: none; }
.pick-list button { text-align: left; border: 0; background: var(--surface); padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.pick-list button:hover { background: var(--navy-50); }
.pick-hint { font-size: 12px; color: var(--muted); min-height: 16px; } .pick-hint.ok { color: var(--ok); }
.people { list-style: none; margin: 0; padding: 4px 0; }
.person { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 11px 18px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.person:last-child { border-bottom: 0; } .person .avatar { width: 34px; height: 34px; }
.person .muted { font-size: 12.5px; margin-top: 2px; }
.people.past .person { opacity: .65; }
.role-note { margin-top: 5px; font-size: 12.5px; background: var(--gold-soft); color: var(--gold-ink); border-radius: 6px; padding: 4px 8px; display: inline-block; }
.roles { list-style: none; margin: 0; padding: 8px 18px 12px; position: relative; }
.role { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; position: relative; font-size: 13px; }
.role + .role { border-top: 1px dashed var(--line); }
.rdot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); margin-top: 5px; flex: none; box-shadow: 0 0 0 3px var(--ok-bg); }
.role.past .rdot { background: #B9C3D4; box-shadow: 0 0 0 3px var(--line-2); }
.role .muted { font-size: 12.5px; margin-top: 3px; }
@media (max-width: 760px) { .stat3.wide { grid-template-columns: 1fr 1fr; } }

/* ---------- Tệp & hình ảnh đính kèm ---------- */
.dropzone { position: relative; border-radius: 10px; }
.dropzone .dz-over { display: none; position: absolute; inset: 0; border: 2px dashed var(--navy-500); border-radius: 10px; background: rgba(230,236,247,.92); color: var(--tx-700); font-weight: 600; place-items: center; }
.dropzone.over .dz-over { display: grid; }
.att-tray { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att-tray:empty { display: none; }
.att-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att { position: relative; margin: 0; }
.att .thumb { display: block; width: 84px; height: 84px; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--navy-50); cursor: zoom-in; }
.att .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att.pend .thumb { cursor: default; }
.file-chip { display: flex; align-items: center; gap: 9px; max-width: 260px; padding: 8px 30px 8px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); text-decoration: none; }
.file-chip:hover { text-decoration: none; border-color: var(--line-strong); background: var(--navy-50); }
.file-chip .ext { flex: none; width: 36px; height: 36px; border-radius: 7px; background: var(--navy-800); color: var(--gold); display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .3px; }
.file-chip .fn { min-width: 0; display: grid; }
.file-chip .fn b { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip .fn small { font-size: 11.5px; color: var(--muted); }
.att-del { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: 0 1px 4px rgba(11,26,54,.15); }
.att-del svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.att-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.att.file .att-del { top: 50%; right: 6px; transform: translateY(-50%); box-shadow: none; }
.viewer-img { display: block; max-width: 100%; max-height: 62vh; margin: 0 auto; border-radius: 8px; }
.modal:has(.viewer-img) { width: min(860px, 100%); }

.add-task { grid-template-columns: 210px minmax(0, 1fr) auto; } .add-task > :nth-child(2) { grid-column: 2 / 4; } .add-task > :nth-child(3) { grid-column: 1; } .add-task > :nth-child(4) { grid-column: 3; }
@media (max-width: 760px) { .add-task { grid-template-columns: 1fr; } .add-task > * { grid-column: 1 !important; } }

/* ---------- Màu theo giai đoạn: lạnh (mới) chuyển dần sang ấm (sắp chốt) ---------- */
.stg-new { --sc: #5B7BB6; } .stg-contacted { --sc: #2F6FD6; } .stg-qualified { --sc: #0E8FA3; }
.stg-meeting { --sc: #7A5AC8; } .stg-proposal { --sc: #B8892E; } .stg-negotiation { --sc: #D9732B; }
.stg-won { --sc: #1D8F63; } .stg-lost { --sc: #8592A8; }
.col.stage { background: color-mix(in srgb, var(--sc) 7%, var(--surface-3)); }
.col.stage.drop { background: color-mix(in srgb, var(--sc) 16%, var(--surface-3)); box-shadow: inset 0 0 0 2px var(--sc); }
.col.stage .col-h { align-items: center; background: var(--surface); border-radius: 9px; padding: 10px 11px; margin-bottom: 10px; border-top: 3px solid var(--sc); box-shadow: 0 1px 3px rgba(11,26,54,.06); }
.col.stage .col-h b { color: color-mix(in srgb, var(--sc) 70%, var(--text)); }
.col.stage .col-h .n { background: color-mix(in srgb, var(--sc) 14%, var(--surface)); color: color-mix(in srgb, var(--sc) 80%, var(--text)); font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.col.stage .col-h .sum { color: color-mix(in srgb, var(--sc) 75%, var(--text)); font-weight: 600; }
.sdot { width: 9px; height: 9px; border-radius: 50%; background: var(--sc); flex: none; display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 20%, transparent); }
.col.stage .opp-card { border-left: 3px solid color-mix(in srgb, var(--sc) 55%, var(--surface)); }
.funnel-row span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.funnel-row .funnel-bar i { background: var(--sc); }

/* ---------- Đánh giá cơ hội ---------- */
.assess { display: grid; grid-template-columns: minmax(0, 1fr) 330px; margin-bottom: 16px; overflow: hidden; }
.assess-sig { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; background: var(--surface); }
.sig { background: var(--surface); padding: 12px 16px; min-width: 0; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.sig.wide { grid-column: span 2; }
.sig small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: .2px; margin-bottom: 5px; }
.sig b { font-weight: 500; font-size: 13.5px; line-height: 1.45; display: block; word-break: break-word; }
.sig .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.hot { background: var(--hot-bg); color: var(--hot); }
.assess-scores { display: grid; align-content: start; gap: 10px; padding: 14px; background: linear-gradient(160deg, var(--navy-900), var(--navy-950)); color: #fff; }
.score summary { display: flex; align-items: center; gap: 14px; cursor: pointer; list-style: none; border-radius: 10px; padding: 6px; }
.score summary::-webkit-details-marker { display: none; }
.score summary:hover { background: rgba(255,255,255,.05); }
.score summary small { display: block; color: #A9B6CF; font-size: 12px; }
.score summary b { display: block; font-size: 18px; margin: 2px 0; }
.score summary .muted { font-size: 11.5px; color: #7F8EAB; text-decoration: underline; text-underline-offset: 2px; }
.score[open] summary .muted { color: var(--gold); }
.gauge { width: 64px; height: 64px; flex: none; }
.gauge .g-bg { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 7; }
.gauge .g-fg { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.gauge text { fill: #fff; font-size: 20px; font-weight: 600; font-family: inherit; }
.gauge.hi .g-fg { stroke: #3CC48B; } .gauge.mid .g-fg { stroke: var(--gold); } .gauge.lo .g-fg { stroke: #E2675C; }
.score.hi summary b { color: #6FDCAB; } .score.mid summary b { color: #E5C98A; } .score.lo summary b { color: #F0938A; }
.score-rows { list-style: none; margin: 4px 0 6px; padding: 8px 10px; background: rgba(255,255,255,.05); border-radius: 9px; display: grid; gap: 6px; }
.score-rows li { display: grid; grid-template-columns: 1fr auto 62px; gap: 8px; font-size: 12px; align-items: baseline; }
.score-rows li.na span, .score-rows li.na em { opacity: .6; }
.score-rows li.na b { font-size: 10.5px; font-weight: 500; white-space: nowrap; }
.score-rows b small { font-size: 10px; color: #7F8EAB; font-weight: 400; }
.score-rows li.note { display: block; font-size: 11px; line-height: 1.45; color: #7F8EAB; border-top: 1px solid rgba(255,255,255,.08); padding-top: 6px; margin-top: 2px; }
.gauge.na .g-fg { stroke: transparent; } .score.na summary b { color: #A9B6CF; font-size: 15px; }
.score-rows span { color: #C9D3E6; } .score-rows em { font-style: normal; color: #8E9BB5; text-align: right; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-rows b { text-align: right; font-variant-numeric: tabular-nums; color: #8E9BB5; } .score-rows b.pos { color: #6FDCAB; } .score-rows b.neg { color: #F0938A; }
@media (prefers-reduced-motion: reduce) { .gauge .g-fg { transition: none; } }
@media (max-width: 1100px) { .assess { grid-template-columns: 1fr; } .assess-sig { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.assess-tips { grid-column: 1 / -1; padding: 12px 16px 14px; background: var(--gold-soft); }
.assess-tips small { display: block; font-size: 11.5px; color: var(--gold-ink); font-weight: 600; letter-spacing: .2px; margin-bottom: 6px; }
.assess-tips ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; color: #4F3E17; line-height: 1.45; }

/* ---------- Màu trạng thái BowNow ---------- */
.bns { --bc: #8592A8; display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--bc) 82%, var(--text)); background: color-mix(in srgb, var(--bc) 13%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bc) 28%, transparent); }
.bns::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--bc); flex: none; }
.bns-hot { --bc: #D2463A; } .bns-warm { --bc: #D98E1F; } .bns-cool { --bc: #2F8FD6; } .bns-cold { --bc: #5B7BB6; }
.bns-appt { --bc: #7A5AC8; } .bns-visited { --bc: #4B5FC9; } .bns-opp { --bc: #0E8FA3; } .bns-po { --bc: #1D8F63; }
.bns-lost { --bc: #6B778C; } .bns-off { --bc: #9AA3B2; } .bns-hold { --bc: #A0773A; } .bns-unk { --bc: #A7B0BF; }
.bns-off { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bc) 60%, transparent); }
.bn-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stf { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px 3px 4px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.stf:first-of-type { padding-left: 10px; }
.stf b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stf:hover { border-color: var(--line-strong); } .stf.on { border-color: var(--navy-700); box-shadow: inset 0 0 0 1px var(--navy-700); background: var(--navy-50); }

/* ---------- Trường tuỳ chỉnh ---------- */
.req { color: var(--hot); }
.cf-opt { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.cf-multi { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.field small.muted { font-size: 12px; }
.cf-preview { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 12px 2px; background: var(--surface-2); }
.icon-btn[disabled] { opacity: .3; cursor: default; }
.btn.danger:hover { background: var(--hot-bg); }

/* ---------- Chống trùng ---------- */
.dup-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius); background: var(--warm-bg); border: 1px solid #F1D9A8; color: #6B4A10; font-size: 13px; }
.dup-banner > svg.i { width: 20px; height: 20px; color: var(--warm); }
.dup-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.dup-rules > div { background: var(--navy-50); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; display: grid; gap: 3px; }
.dup-rules b { color: var(--tx-800); } .dup-rules span { color: var(--text-2); }
.dup-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.dup-h { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.dup-item { display: flex; gap: 10px; align-items: center; padding: 7px 4px; border-top: 1px dashed var(--line); font-size: 13px; cursor: pointer; }
@media (max-width: 760px) { .dup-rules { grid-template-columns: 1fr; } }

/* ---------- Giải pháp / Dịch vụ ---------- */
.kpis.kpis3 { grid-template-columns: repeat(3, 1fr); }
.kpi .val.sm { font-size: 18px; line-height: 1.3; margin: 10px 0 6px; }
.check-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.field .hint, .modal .hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sol-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.sol-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; background: var(--gold-soft); color: var(--gold-ink); font-size: 11.5px; font-weight: 500; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sol-list { list-style: none; margin: 0; padding: 0; }
.sol-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.sol-list li:last-child { border-bottom: 0; }
.sol-main { min-width: 0; } .sol-main .muted { font-size: 12px; margin-top: 2px; }
.sol-note { font-size: 12.5px; color: var(--text-2); margin-top: 5px; padding-left: 9px; border-left: 2px solid var(--gold); }
.sol-val { font-weight: 600; color: var(--tx-800); font-size: 13.5px; text-align: right; } .sol-val .muted { font-weight: 400; font-size: 12px; }
.sol-act { display: flex; gap: 2px; }
.sol-sum { display: flex; align-items: center; gap: 10px; padding: 11px 18px; background: var(--navy-50); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; color: var(--text-2); }
.sol-sum b { color: var(--tx-800); font-size: 15px; } .sol-sum .btn { margin-left: auto; }
.sol-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.sol-opt { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; background: var(--surface); }
.sol-opt:has(input:checked) { border-color: var(--navy-600); background: var(--navy-50); color: var(--tx-800); }
.sol-agg { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; } .sol-agg li { display: flex; align-items: center; gap: 6px; }
.sol-table td { vertical-align: middle; } .sol-table tr.inactive td { opacity: .55; }
.sol-bar { width: 120px; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.sol-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--gold)); border-radius: 3px; }
.sol-av { display: grid; place-items: center; } .sol-av .i { width: 24px; height: 24px; }
.sol-desc { margin: 8px 0 6px; color: var(--text-2); max-width: 760px; line-height: 1.55; }
.sol-filter { width: auto; max-width: 210px; }
@media (max-width: 760px) { .kpis.kpis3 { grid-template-columns: 1fr; } .sol-bar { width: 80px; } }

/* ---------- Báo cáo: tối giản, đường kẻ mảnh, số liệu căn cột ---------- */
.rp-head .seg button { padding: 5px 11px; }
select.input.rp-own { width: auto; min-width: 150px; }
.rp-head { row-gap: 10px; }
.rp-kpis { display: grid; grid-template-columns: repeat(6, 1fr); padding: 0; overflow: hidden; }
.rp-k { padding: 18px 20px 16px; border-left: 1px solid var(--line-2); min-width: 0; }
.rp-k:first-child { border-left: 0; }
.rp-l { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rp-v { font-size: 26px; font-weight: 600; letter-spacing: -.5px; color: var(--tx-900); margin: 10px 0 6px; white-space: nowrap; }
.rp-k:first-child .rp-v { color: var(--tx-700); }
.rp-s { font-size: 12.5px; min-height: 18px; }
.rp-p { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.rp-d { font-weight: 600; font-variant-numeric: tabular-nums; }
.rp-d.up { color: var(--green-ink); } .rp-d.down { color: var(--red-ink); } .rp-d.flat { color: var(--muted); font-weight: 500; }
.rp-note { font-size: 12px; color: var(--muted); margin: 8px 2px 18px; }
.rp-grid { display: grid; gap: 18px; margin-bottom: 18px; align-items: start; }
.rp-grid.g21 { grid-template-columns: 1.7fr 1fr; } .rp-grid.g11 { grid-template-columns: 1fr 1fr; } .rp-grid.g111 { grid-template-columns: 1fr 1fr 1fr; }
.rp-sec { margin-bottom: 18px; }
.rp-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-left: 12px; }
.rp-leg i { width: 16px; height: 0; border-top: 2px solid var(--navy-700); } .rp-leg i.lp { border-top: 2px dashed #A7B1C2; }
.rp-chart { width: 100%; height: 240px; display: block; overflow: visible; }
.rp-chart .g { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rp-chart .yl { font-size: 10.5px; fill: var(--muted); text-anchor: end; } .rp-chart .xl { font-size: 10.5px; fill: var(--muted); text-anchor: middle; }
.rp-chart .lc { fill: none; stroke: var(--tx-700); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.rp-chart .lp { fill: none; stroke: #A7B1C2; stroke-width: 1.6; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.rp-chart .today { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.rp-chart .dc { fill: var(--tx-700); } .rp-chart .dp { fill: var(--surface); stroke: #A7B1C2; stroke-width: 1.5; }
.rp-foot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 28px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.rp-foot small { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; } .rp-foot b { font-size: 16px; color: var(--tx-900); }
.rp-verdict { margin-left: auto; font-size: 13px; font-weight: 600; } .rp-verdict.up { color: var(--green-ink); } .rp-verdict.down { color: var(--red-ink); }
.rp-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-t th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rp-t th:first-child, .rp-t td:first-child { padding-left: 18px; } .rp-t th:last-child, .rp-t td:last-child { padding-right: 18px; }
.rp-t.fc td:first-child { white-space: nowrap; }
.rp-t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.rp-t .r { text-align: right; } .rp-t small { color: var(--muted); font-size: 11.5px; }
.rp-t tfoot td { border-bottom: 0; border-top: 1px solid var(--line); font-weight: 600; color: var(--tx-900); }
.rp-t tr.warn td:first-child { color: var(--red-ink); font-weight: 500; }
.rp-t td.best { color: var(--tx-700); font-weight: 700; }
.rp-t td.bad { color: var(--red-ink); font-weight: 600; }
.rp-t.team td:first-child { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.rp-t .empty { text-align: center; }
.rp-bar { height: 3px; background: var(--line-2); margin-top: 6px; max-width: 160px; } .rp-bar i { display: block; height: 100%; background: var(--navy-600); }
.rp-hint { font-size: 12px; color: var(--muted); margin: 0; padding: 10px 18px 14px; line-height: 1.5; } .card-b .rp-hint { padding: 12px 0 0; }
.rp-hint b { color: var(--text-2); }
.rp-fun { list-style: none; margin: 0; padding: 0; }
.rp-fun li { display: grid; grid-template-columns: 130px 1fr 44px 48px; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; }
.rp-fun .fb { height: 18px; background: var(--navy-50); } .rp-fun .fb i { display: block; height: 100%; background: var(--navy-700); }
.rp-fun li:nth-child(n+4) .fb i { background: var(--navy-600); } .rp-fun li:last-child .fb i { background: var(--gold); }
.rp-fun .fc { text-align: right; font-weight: 600; } .rp-fun .fr { text-align: right; color: var(--muted); }
.rp-fun li.weak .fr { color: var(--red-ink); font-weight: 600; } .rp-fun li.weak .fn { color: var(--red-ink); }
.rp-att { list-style: none; margin: 0; padding: 0; }
.rp-att li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.rp-att li:last-child { border-bottom: 0; }
.rp-att .v { font-weight: 600; color: var(--tx-900); } .rp-att .muted { font-size: 12px; }
.rp-att .fl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rp-att .fl span { font-size: 11.5px; color: #8A3A2F; border: 1px solid #EBCFCB; padding: 1px 7px; border-radius: 4px; }
.rp-lost { list-style: none; margin: 0; padding: 4px 0; }
.rp-lost li { display: grid; grid-template-columns: 1fr 30px 70px; gap: 10px; padding: 9px 18px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.rp-lost li:last-child { border-bottom: 0; } .rp-lost .num { text-align: right; }
@media (max-width: 1280px) { .rp-kpis { grid-template-columns: repeat(3, 1fr); } .rp-k:nth-child(4) { border-left: 0; } .rp-k:nth-child(n+4) { border-top: 1px solid var(--line-2); } .rp-grid.g111 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) { .rp-grid.g21, .rp-grid.g11 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .rp-kpis { grid-template-columns: 1fr 1fr; } .rp-k { border-left: 0 !important; border-top: 1px solid var(--line-2); } .rp-k:nth-child(-n+2) { border-top: 0; } .rp-k:nth-child(even) { border-left: 1px solid var(--line-2) !important; }
  .rp-v { font-size: 21px; } .rp-grid.g111 { grid-template-columns: 1fr; } .rp-fun li { grid-template-columns: 96px 1fr 34px 40px; gap: 8px; } .rp-verdict { margin-left: 0; width: 100%; }
  .rp-head .seg { overflow-x: auto; max-width: 100%; } .rp-head .seg button { white-space: nowrap; }
  .rp-sec .tbl-wrap, .rp-t.team { overflow-x: auto; } .rp-t.team td:first-child { white-space: nowrap; }
  .nav { overflow-x: auto; }
}
.rp-t .avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.rp-t td.num, .rp-t .r { white-space: nowrap; }
.table td.num { white-space: nowrap; }
/* Nhóm giải pháp */
.grp-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.grp-filter button { height: 30px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; font-weight: 500; }
.grp-filter button span { color: var(--muted); font-weight: 400; margin-left: 3px; font-variant-numeric: tabular-nums; }
.grp-filter button.on { background: var(--navy-800); border-color: var(--navy-800); color: #fff; } .grp-filter button.on span { color: #A9B6CF; }
.grp-table .icon-btn { display: inline-grid; } .grp-table .icon-btn:disabled { opacity: .3; cursor: default; }
.grp-table tr.inactive td { opacity: .7; }
.i.rot90 { transform: rotate(90deg); } .i.rot270 { transform: rotate(-90deg); }

/* ---------- Cài đặt hệ thống / phân quyền ---------- */
.set-tabs { display: flex; gap: 2px; box-shadow: inset 0 -1px 0 var(--line); margin: -6px 0 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.set-tabs::-webkit-scrollbar { display: none; }
.set-tabs button { border: 0; background: none; padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; flex: none; }
.set-tabs button.on { color: var(--tx-800); font-weight: 600; box-shadow: inset 0 -2px 0 var(--navy-700); }
.set-narrow { max-width: 820px; }
.perm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.perm { padding: 16px 18px; } .perm-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.perm p { margin: 0 0 10px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.perm ul { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.role-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.role-chip.r-admin { background: var(--navy-800); color: #fff; } .role-chip.r-manager { background: var(--gold-soft); color: var(--gold-ink); } .role-chip.r-sales { background: var(--navy-50); color: var(--tx-700); border: 1px solid var(--navy-100); }
.users-t tr.off td { opacity: .5; } .users-t td { vertical-align: middle; }
.role-pick { display: grid; gap: 8px; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--navy-600); background: var(--navy-50); }
.role-opt input { margin-top: 4px; } .role-opt span { display: grid; gap: 4px; justify-items: start; } .role-opt small { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.me-btn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; padding: 4px; margin: -4px; border-radius: 8px; }
.me-btn:hover { background: rgba(255,255,255,.06); }
.scope-note { font-size: 12.5px; color: var(--text-2); background: var(--navy-50); border: 1px solid var(--navy-100); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.input.ro { background: var(--navy-50); color: var(--text-2); }
/* Chọn công ty / người liên hệ */
.nopp-sec { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; margin-bottom: 14px; background: var(--surface-2); }
.nopp-h { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--tx-700); margin-bottom: 10px; }
.nopp-h .i { width: 15px; height: 15px; } .nopp-h .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.nopp-sec #ct-note { display: block; margin: -4px 0 10px; }
.pick-list { max-height: 300px; overflow-y: auto; }
.pick-sec { padding: 7px 12px 5px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.pick-list .pick-new { display: flex; align-items: center; gap: 6px; color: var(--tx-700); background: var(--navy-50); }
.pick-list .pick-new .i { width: 14px; height: 14px; }
.pick-hint.new { color: var(--tx-600); }
.picker.picked .input { border-color: var(--ok); }
@media (max-width: 900px) { .perm-grid { grid-template-columns: 1fr; } }
.users-t td:nth-child(3), .users-t td:nth-child(7) { white-space: nowrap; } .me-btn .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Marketing: chế độ chỉ xem (máy chủ vẫn chặn mọi thao tác ghi) */
body.ro #newopp, body.ro #at, body.ro #nop, body.ro #editc, body.ro #eco, body.ro #ect, body.ro #addp, body.ro #addc, body.ro #addco, body.ro #addct,
body.ro #addsol, body.ro #solapply, body.ro .sol-act, body.ro [data-edit], body.ro #delco, body.ro #delct, body.ro #cfco, body.ro #cfct,
body.ro .mini .check, body.ro .tcard .check, body.ro .composer-tabs button:not([data-k="note"]) { display: none !important; }
body.ro .stepper .step, body.ro .stepper .out { pointer-events: none; }
body.ro .titem .check { visibility: hidden; }
body.ro .opp-card { cursor: pointer; }
.role-chip.r-marketing { background: #E8F3EE; color: #1F6B4A; }
.ro-note { background: #E8F3EE; color: #1F6B4A; border: 1px solid #CBE5D8; border-radius: 9px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 14px; }
.perm-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .perm-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }
/* Cài đặt chung */
.gen-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.gen-grid .span-all { grid-column: 1 / -1; }
.req { color: var(--danger, #B4372D); }
.wd-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.wd { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; background: var(--surface); }
.wd:has(input:checked) { border-color: var(--navy-600); background: var(--navy-50); color: var(--tx-800); font-weight: 500; }
.hol { display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.rule-list { margin: 12px 0 14px; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.wt-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.wt-h { padding: 9px 14px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.wt-row { display: grid; grid-template-columns: 1fr 120px 20px 120px; gap: 10px; padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--line-2); align-items: center; font-variant-numeric: tabular-nums; }
.wt-row:last-child { border-bottom: 0; } .wt-row b { color: var(--tx-800); } .wt-arrow { color: var(--muted); text-align: center; }
@media (max-width: 1000px) { .gen-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .wt-row { grid-template-columns: 1fr auto; } .wt-row .muted, .wt-arrow { display: none; } .hol { grid-template-columns: 1fr auto; } .hol [data-hn] { grid-column: 1; } }
.wsum { background: var(--navy-50); border: 1px solid var(--navy-100); color: var(--tx-800); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
/* Danh sách người liên hệ: cột Họ tên rộng hơn, tên không bị xuống dòng */
.ct-table th.col-name { min-width: 230px; }
.ct-table td:first-child b { white-space: nowrap; }
.ct-table th { white-space: nowrap; }
/* Danh sách gợi ý trong hộp thoại: nằm trong luồng nội dung để không bị che, hộp thoại tự cuộn */
.modal .pick-list { position: static; margin-top: 6px; box-shadow: none; max-height: 232px; }
/* Cảnh báo trùng khi nhập */
.dup-warn { display: flex; gap: 10px; align-items: flex-start; margin: -4px 0 12px; padding: 10px 12px; border-radius: 9px; font-size: 12.5px; line-height: 1.5; }
.dup-warn > .i { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.dup-warn.strong { background: #FDF1F0; border: 1px solid #F1C9C4; color: #8A2E25; }
.dup-warn.weak { background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold-ink); }
.dup-warn .dw-who { margin: 2px 0 6px; color: var(--text); } .dup-warn .dw-who > span:first-child { font-weight: 600; }
.dup-warn .dw-act { display: flex; gap: 6px; flex-wrap: wrap; }
/* Pending (tạm hoãn) */
.out.pending:hover { border-color: #B8892E; color: var(--gold-ink); background: var(--gold-soft); }
.out.pending.cur { background: #B8892E; border-color: #B8892E; color: #fff; }
.stg-pending { --sc: #A88B5A; }
.chip.st-pending { background: var(--gold-soft); color: var(--gold-ink); }
.pending-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 11px 14px; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: #5E4718; font-size: 13px; line-height: 1.55; }
.pending-box > .i { width: 18px; height: 18px; flex: none; margin-top: 1px; } .pending-box .muted { color: #8A7448; font-size: 12.5px; }
.pend-date { height: 36px; display: flex; align-items: center; padding: 0 11px; border-radius: 9px; background: var(--navy-50); border: 1px solid var(--navy-100); color: var(--tx-800); font-weight: 600; font-variant-numeric: tabular-nums; }
.pend-rule { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .pend-rule { grid-template-columns: 1fr; } }
/* Pipeline: thu gọn cột, tên giai đoạn hiển thị dọc */
.col-h .col-tog { margin-left: 2px; }
.col-tog { border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; display: inline-grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.col-tog:hover { background: var(--navy-50); color: var(--tx-700); }
.col-tog .i { width: 15px; height: 15px; }
.i.rot180 { transform: rotate(180deg); }
.col.stage.collapsed { padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; }
.col.stage.collapsed:hover { background: color-mix(in srgb, var(--sc) 12%, var(--surface-3)); }
.col-v { display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface); border-radius: 9px; border-top: 3px solid var(--sc); padding: 10px 0 12px; width: 40px; box-shadow: 0 1px 3px rgba(11,26,54,.06); }
.col-v b, .col-v .sum { writing-mode: vertical-rl; white-space: nowrap; }
.col-v b { font-size: 13px; font-weight: 600; color: color-mix(in srgb, var(--sc) 70%, var(--text)); }
.col-v .sum { font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, var(--sc) 75%, var(--text)); }
.col-v .n { background: color-mix(in srgb, var(--sc) 14%, var(--surface)); color: color-mix(in srgb, var(--sc) 80%, var(--text)); font-weight: 600; font-size: 12px; padding: 1px 7px; border-radius: 10px; }
.col.stage .col-h b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.col.stage .col-h .sum, .col.stage .col-h .n { white-space: nowrap; flex: none; }
/* Cài đặt Sales pipeline */
.ps-preview { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.ps-chev { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 16px 0 12px; font-size: 12.5px; font-weight: 600; color: color-mix(in srgb, var(--sc) 75%, var(--text)); background: color-mix(in srgb, var(--sc) 12%, var(--surface)); clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); padding-left: 16px; }
.ps-chev:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); padding-left: 12px; border-radius: 6px 0 0 6px; }
.ps-chev b { font-size: 11px; opacity: .7; } .ps-chev.sys { margin-left: 8px; clip-path: none; border-radius: 6px; padding: 0 12px; }
.ps-head, .ps-row { display: grid; grid-template-columns: 22px 30px 22px minmax(160px, 1fr) 110px 230px 90px 110px; gap: 10px; align-items: center; }
.ps-head { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.ps-list { display: grid; gap: 6px; margin-bottom: 10px; }
.ps-row { padding: 8px 10px; border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 10px; background: var(--surface); }
.ps-row[draggable="true"] { cursor: grab; } .ps-row.dragging { opacity: .45; } .ps-row.over { box-shadow: 0 -3px 0 var(--navy-600); }
.ps-row.sys { background: var(--surface-2); }
.ps-grip { color: var(--muted); font-weight: 700; letter-spacing: -2px; text-align: center; } .ps-grip .i { width: 14px; height: 14px; }
.ps-color { position: relative; width: 26px; height: 26px; cursor: pointer; } .ps-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ps-color i { display: block; width: 26px; height: 26px; border-radius: 7px; background: var(--sc); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.ps-idx { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.ps-prob { display: flex; align-items: center; gap: 6px; } .ps-prob .input { width: 70px; } .ps-prob span { color: var(--muted); font-size: 13px; }
.ps-pb { justify-content: flex-start; } .ps-pb .i { width: 15px; height: 15px; }
.ps-cnt { font-size: 12.5px; } .ps-act { display: flex; justify-content: flex-end; gap: 2px; } .ps-act .icon-btn { display: inline-grid; } .ps-act .icon-btn:disabled { opacity: .3; cursor: default; }
.ps-dirty { font-size: 12.5px; color: var(--gold-ink); background: var(--gold-soft); padding: 4px 10px; border-radius: 6px; }
.pb-row { display: grid; grid-template-columns: 150px 1fr 170px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.pb-due { display: flex; align-items: center; gap: 6px; } .pb-due .input[type=number] { width: 64px; } .pb-due select { width: 80px; }
.modal:has(.pb-row), .modal:has(#pbl) { width: min(720px, 100%); }
@media (max-width: 1100px) { .ps-head { display: none; } .ps-row { grid-template-columns: 22px 30px 1fr 100px; } .ps-idx, .ps-cnt { display: none; } .ps-pb { grid-column: 3 / 4; } .ps-act { grid-column: 4; } }
@media (max-width: 640px) { .pb-row { grid-template-columns: 1fr auto; } .pb-row [data-t="title"], .pb-due { grid-column: 1 / -1; } }
.ps-warn { font-size: 12.5px; color: var(--gold-ink); margin: 8px 0 0; } .ps-warn:empty { display: none; }

/* Loại công việc */
.tt-head, .tt-row { display: grid; grid-template-columns: 22px 44px 30px minmax(200px, 1fr) 120px 170px 180px; gap: 10px; align-items: center; }
.tt-head { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.tt-row { padding: 8px 10px; border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 10px; background: var(--surface); }
.tt-row.sys { background: var(--surface-2); }
.tt-icw { position: relative; }
.tt-ic { width: 34px; height: 34px; border-radius: 9px; border: 0; cursor: pointer; display: grid; place-items: center; background: color-mix(in srgb, var(--sc) 12%, var(--surface)); color: var(--sc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sc) 25%, transparent); }
.tt-ic .i { width: 17px; height: 17px; } .tt-ic:hover { box-shadow: inset 0 0 0 1.5px var(--sc); }
.tt-pop { position: absolute; z-index: 30; top: 40px; left: 0; display: grid; grid-template-columns: repeat(6, 34px); gap: 4px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(14, 26, 48, .14); }
.tt-pop button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--tx-600); cursor: pointer; display: grid; place-items: center; }
.tt-pop button:hover { background: var(--navy-50); } .tt-pop button.on { background: var(--navy-50); box-shadow: inset 0 0 0 1.5px var(--navy-600); }
.tt-pop .i { width: 16px; height: 16px; }
.tt-min { display: flex; align-items: center; gap: 6px; } .tt-min .input { width: 70px; } .tt-min span { color: var(--muted); font-size: 13px; }
.tt-use { font-size: 12.5px; line-height: 1.45; color: var(--ink-2, #3B4A63); }
.tt-row .ps-act { align-items: center; gap: 4px; } .tt-row .ps-act .chip { margin-right: 6px; }
@media (max-width: 1100px) { .tt-head { display: none; } .tt-row { grid-template-columns: 44px 30px 1fr 110px; } .tt-row .ps-idx, .tt-use { display: none; } .tt-row .ps-act { grid-column: 1 / -1; } }

/* ================= Giao diện tối (Cài đặt > Giao diện, hoặc theo hệ thống) ================= */
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy-800: #2C4F8E; --navy-700: #375D9F; --navy-600: #5A82C6; --navy-500: #8CB0F0;
  --navy-100: #1E2C49; --navy-50: #18233A;
  --gold-soft: #2E2716; --gold-ink: #E1C38A; --gold-line: #5A4A26; --red-ink: #F08A80; --green-ink: #5FD3A0;
  --bg: #0A111E; --surface: #111A2B; --surface-2: #0E1626; --surface-3: #172238; --line: #24324F; --line-2: #1B2741; --line-strong: #34466B;
  --text: #E4EAF5; --text-2: #A8B5CC; --muted: #7C8AA5;
  --tx-500: #8CB0F0; --tx-600: #9DB9EC; --tx-700: #B4C9F0; --tx-800: #D5E1F7; --tx-900: #E9EFFA;
  --hot: #F0675B; --hot-bg: #3A1B1B; --warm: #E9A23F; --warm-bg: #36280F; --ok: #3CC28B; --ok-bg: #0F2C21; --danger: #EE6A6A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
}
:root[data-theme="dark"] .side { background: linear-gradient(180deg, #0B1630, #060C18); border-right: 1px solid #16213A; }
:root[data-theme="dark"] .btn.primary { background: #2C4F8E; border-color: #2C4F8E; color: #fff; }
:root[data-theme="dark"] .btn.primary:hover { background: #375D9F; }
:root[data-theme="dark"] .kpi.feature, :root[data-theme="dark"] .assess-scores { background: linear-gradient(135deg, #18305C, #0B1630); border-color: #24407A; }
:root[data-theme="dark"] .toast { background: #1E2C49; border: 1px solid #2E4068; }
:root[data-theme="dark"] .overlay { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .input:focus { box-shadow: 0 0 0 3px rgba(140, 176, 240, .18); }
:root[data-theme="dark"] .seg button.on { box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
:root[data-theme="dark"] .col.drop { background: #1B2944; }
:root[data-theme="dark"] .col.overdue { background: #2A1719; } :root[data-theme="dark"] .col.done { background: #11261D; }
:root[data-theme="dark"] .cal-day.past { background: var(--surface-2); } :root[data-theme="dark"] .cal-day.other { background: #0C1422; }
:root[data-theme="dark"] .dropzone .dz-over { background: rgba(17, 26, 43, .92); }
:root[data-theme="dark"] .check { border-color: #4A5B7C; }
:root[data-theme="dark"] .step .dot { box-shadow: inset 0 0 0 1px var(--line-strong); }
:root[data-theme="dark"] .step.cur { background: #2C4F8E; }
:root[data-theme="dark"] .login-form { background: var(--surface); }
/* Nền màu nhạt của loại công việc / sự kiện lịch / nhãn: pha trên nền tối */
:root[data-theme="dark"] .ttype.call, :root[data-theme="dark"] .ev.call { background: color-mix(in srgb, #5B8DEF 20%, var(--surface)); color: #9DB9F5; }
:root[data-theme="dark"] .ttype.zalo, :root[data-theme="dark"] .ev.zalo, :root[data-theme="dark"] .tl .dot.in { background: color-mix(in srgb, #3D8BFF 20%, var(--surface)); color: #8DBBFF; }
:root[data-theme="dark"] .ttype.sms, :root[data-theme="dark"] .ev.sms { background: color-mix(in srgb, #8C82E8 20%, var(--surface)); color: #B7B0F2; }
:root[data-theme="dark"] .ttype.meeting, :root[data-theme="dark"] .ttype.demo { color: #E1C38A; }
:root[data-theme="dark"] .ttype.quote, :root[data-theme="dark"] .ttype.contract, :root[data-theme="dark"] .ev.quote, :root[data-theme="dark"] .ev.contract { background: color-mix(in srgb, #3CC28B 18%, var(--surface)); color: #7FDBB4; }
:root[data-theme="dark"] .ttype.negotiate, :root[data-theme="dark"] .ev.negotiate { background: color-mix(in srgb, #E8924A 18%, var(--surface)); color: #F2B482; }
:root[data-theme="dark"] .ttype.wait_contract, :root[data-theme="dark"] .ttype.wait_payment, :root[data-theme="dark"] .ev.wait_contract, :root[data-theme="dark"] .ev.wait_payment { background: color-mix(in srgb, #9A80DB 20%, var(--surface)); color: #C5B4F0; }
:root[data-theme="dark"] .ev.g { color: #E1C38A; }
:root[data-theme="dark"] .chip.st-lost { color: #A8B5CC; }
:root[data-theme="dark"] .role-chip.r-marketing, :root[data-theme="dark"] .ro-note { background: #0F2C21; color: #7FDBB4; border-color: #1E4A37; }
:root[data-theme="dark"] .dup-warn.strong { background: #2E1618; border-color: #5A2A2C; color: #F2A9A2; }
:root[data-theme="dark"] .ps-dirty { color: #E9C27A; }
:root[data-theme="dark"] .ps-chev, :root[data-theme="dark"] .col.stage .col-h .n, :root[data-theme="dark"] .col-v .n { color: color-mix(in srgb, var(--sc) 55%, #fff); }
:root[data-theme="dark"] .col.stage .opp-card { border-left-color: color-mix(in srgb, var(--sc) 70%, var(--surface)); }
:root[data-theme="dark"] img, :root[data-theme="dark"] video { color-scheme: light; }
/* Chuyển đổi giao diện */
.theme-sw { display: flex; gap: 2px; background: rgba(255, 255, 255, .06); border-radius: 9px; padding: 3px; margin: 0 8px 12px; }
.theme-sw button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; padding: 0 6px; white-space: nowrap; border: 0; border-radius: 7px; background: transparent; color: #8E9BB5; font-size: 12px; font-weight: 500; cursor: pointer; }
.theme-sw button:hover { color: #fff; } .theme-sw button.on { background: rgba(255, 255, 255, .12); color: #fff; }
.theme-sw svg.i { width: 14px; height: 14px; }
.nav + .theme-sw { margin-top: auto; } .nav + .theme-sw + .side-foot { margin-top: 0; }
@media (max-width: 760px) { .shell > * { min-width: 0; } .side .nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; } .theme-sw { margin: 0 0 0 8px; flex: none; } .theme-sw span { display: none; } .theme-sw button { padding: 0 7px; } .nav + .theme-sw { margin-top: 0; } }

/* Link mạng xã hội trong trường tuỳ chỉnh */
.social-link { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.social-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-link svg.i { width: 15px; height: 15px; flex: none; }
.sl-facebook svg.i { color: #1877F2; } .sl-linkedin svg.i { color: #0A66C2; } .sl-zalo svg.i { color: #0068FF; }
:root[data-theme="dark"] .sl-facebook svg.i { color: #5B9BFF; } :root[data-theme="dark"] .sl-linkedin svg.i { color: #5AA6E8; }
.cf-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-pre { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.cf-pre:hover { border-color: var(--line-strong); color: var(--text); } .cf-pre.on { border-color: var(--tx-700); box-shadow: inset 0 0 0 1px var(--tx-700); color: var(--text); background: var(--navy-50); }
.cf-pre svg.i { width: 14px; height: 14px; }

/* Phễu bán hàng dạng tam giác ngược (Tổng quan) */
.fnl { display: grid; gap: 3px; }
.fnl-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 14px; text-decoration: none !important; color: inherit; }
.fnl-band { display: grid; place-items: center; height: 38px; background: var(--sc); transition: filter .15s; }
.fnl-band b { color: #fff; font-size: 14px; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.fnl-row:hover .fnl-band { filter: brightness(1.08); }
.fnl-row.zero .fnl-band { background: color-mix(in srgb, var(--sc) 22%, var(--surface)); }
.fnl-row.zero .fnl-band b { color: color-mix(in srgb, var(--sc) 70%, var(--text)); text-shadow: none; font-weight: 500; }
.fnl-lbl { display: grid; min-width: 0; line-height: 1.3; }
.fnl-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnl-v { font-size: 12px; color: var(--text-2); }
.fnl-row.zero .fnl-name { color: var(--text-2); } .fnl-row.zero .fnl-v { color: var(--muted); }
.fnl-foot { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--text-2); }
.fnl-foot .num { font-weight: 600; color: var(--text); }
@media (max-width: 760px) { .fnl-row { grid-template-columns: minmax(0, 1fr) 120px; } }

.login-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; color: #6F7E9C; }
.login-foot a { color: #A9B6CF; } .login-foot a:hover { color: var(--gold); text-decoration: none; }
.login-foot > * + *::before { content: ''; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: #3E4D6B; margin-right: 14px; vertical-align: middle; }

/* Phân quyền Bộ phận x Cấp bậc */
.perm-head { margin-bottom: 12px; } .perm-head b { display: block; font-size: 14px; margin-bottom: 3px; } .perm-head .muted { font-size: 12.5px; line-height: 1.5; }
.perm ul { color: var(--text-2); }
.role-chip.r-sales-staff { background: var(--navy-50); color: var(--tx-700); box-shadow: inset 0 0 0 1px var(--line); }
.role-chip.r-sales-manager { background: var(--navy-100); color: var(--tx-800); }
.role-chip.r-mkt-staff { background: #E8F3EE; color: #1F6B4A; }
.role-chip.r-mkt-manager { background: #D3EBDF; color: #17573A; }
.role-chip.r-bod { background: var(--gold-soft); color: var(--gold-ink); box-shadow: inset 0 0 0 1px var(--gold-line); }
.role-chip.r-admin { background: var(--navy-800); color: #fff; }
:root[data-theme="dark"] .role-chip.r-mkt-staff { background: #0F2C21; color: #7FDBB4; } :root[data-theme="dark"] .role-chip.r-mkt-manager { background: #154030; color: #9BE6C5; }
.modal:has(.acc-pick) { width: min(580px, 100%); }
.acc-pick { display: grid; gap: 2px; margin-bottom: 4px; }
.seg-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-pick label { cursor: pointer; } .seg-pick input { position: absolute; opacity: 0; pointer-events: none; }
.seg-pick span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500; }
.seg-pick label:hover span { border-color: var(--line-strong); color: var(--text); }
.seg-pick input:checked + span { border-color: var(--tx-700); background: var(--navy-50); color: var(--text); box-shadow: inset 0 0 0 1px var(--tx-700); }
.seg-pick input:focus-visible + span { outline: 2px solid var(--navy-500); outline-offset: 2px; }
#usysw { margin: 4px 0 10px; } #usysw:has(input:disabled) { color: var(--text-2); }
.acc-sum { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.acc-sum-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; } .acc-sum-h .muted { font-size: 12.5px; }
.acc-sum ul, .acc-mine { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.acc-mine { margin: 0 0 14px; }

/* ---------- Hợp đồng ---------- */
.nav .badge.warn { background: var(--warm); }
.ks { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.ks-active { background: var(--ok-bg); color: var(--ok); }
.ks-expiring { background: var(--warm-bg); color: var(--warm); }
.ks-expired { background: var(--hot-bg); color: var(--hot); }
.ks-upcoming { background: var(--navy-50); color: var(--tx-700); }
.ks-renewed { background: var(--gold-soft); color: var(--gold-ink); }
.kleft { font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.kleft.ok { color: var(--ok); } .kleft.warn { color: var(--warm); } .kleft.hot { color: var(--hot); }
.kleft.over { color: #fff; background: var(--hot); padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.kpi-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.kpi-btn:hover { border-color: var(--line-strong); }
.kpi-btn.on { border-color: var(--tx-700); box-shadow: inset 0 0 0 1px var(--tx-700); }
.kpi .val.warn { color: var(--warm); }
.ktabs { overflow-x: auto; } .ktabs .seg { flex: none; }
.ktabs .seg em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-left: 3px; }
.nowrap { white-space: nowrap; }
tr.k-over td:first-child { box-shadow: inset 3px 0 0 var(--hot); }
.k-ico { background: var(--gold-soft); color: var(--gold-ink); }
.k-ico svg { width: 26px; height: 26px; }
.opp-head .meta a { display: inline-flex; align-items: center; gap: 4px; }
.k-acts { flex-wrap: wrap; justify-content: flex-end; }
.k-bar { margin-top: 18px; }
.k-bar-t { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.k-track { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.k-track i { display: block; height: 100%; background: var(--ok); border-radius: 5px; }
.k-track.expiring i { background: var(--warm); } .k-track.expired i { background: var(--hot); }
.k-renew { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: 10px; background: var(--warm-bg); color: var(--text); border: 1px solid var(--line); font-size: 13.5px; }
.k-renew svg { width: 18px; height: 18px; color: var(--warm); stroke: currentColor; flex: none; margin-top: 1px; }
.k-renew.won { background: var(--ok-bg); } .k-renew.won svg { color: var(--ok); }
.k-note { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.k-chain { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.k-chain li { position: relative; display: grid; gap: 1px; font-size: 13px; }
.k-chain li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.k-chain li.me::before { background: var(--gold); border-color: var(--gold); }
.k-chain small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.k-marks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.k-marks li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.k-marks li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.k-marks li span svg { width: 13px; height: 13px; }
.k-marks li em { margin-left: auto; font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.k-marks li.done { color: var(--text); } .k-marks li.done span { background: var(--ok-bg); color: var(--ok); }
.k-marks li.done span svg { stroke: var(--ok); }
.k-mini { list-style: none; margin: 0; padding: 0; }
.k-mini li { padding: 11px 18px; border-top: 1px solid var(--line); }
.k-mini li:first-child { border-top: 0; }
.k-mini li > a { display: block; color: var(--text); text-decoration: none; }
.k-mini li > a span { color: var(--text-2); }
.k-mini li > a:hover b { text-decoration: underline; }
.k-mini li.closed { opacity: .65; }
.k-mini .tmeta, .k-link .tmeta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.k-link + .k-link { margin-top: 10px; }
.k-from { display: flex; gap: 8px; align-items: flex-start; background: var(--gold-soft); color: var(--gold-ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.k-from svg { width: 16px; height: 16px; flex: none; stroke: currentColor; margin-top: 1px; }
.k-co { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 8px; background: var(--surface-3); }
.k-co svg { width: 16px; height: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid3 .input { min-width: 0; width: 100%; }
.k-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; font-size: 12.5px; }
@media (max-width: 640px) { .grid3 { grid-template-columns: 1fr; } }
body.ro #addk, body.ro #kedit, body.ro .k-acts, body.ro #mkk, body.ro #kdel { display: none !important; }

/* ---------- Xoá hồ sơ (gõ DELETE để xác nhận) ---------- */
.modal-f .del-left { margin-right: auto; }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--hot-bg); }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.modal-f .btn.danger:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; }
.del-box { border: 1px solid var(--danger); background: var(--hot-bg); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; color: var(--text); }
.del-box b { color: var(--danger); }
.del-box ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.del-box p { margin: 8px 0 0; font-weight: 600; }
.del-box.blocked { border-color: var(--warm); background: var(--warm-bg); }
.del-box.blocked > b { color: var(--text); }
.del-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.del-input.ok { border-color: var(--danger); box-shadow: 0 0 0 3px var(--hot-bg); }
.del-word { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--danger); letter-spacing: .08em; }

/* ---------- Sơ đồ nhân sự (dạng cây) ---------- */
.org-card { margin-top: 18px; }
.org-wrap { overflow-x: auto; padding: 8px 18px 22px; }
.org { min-width: max-content; margin: 0 auto; width: max-content; --ol: var(--line-strong); }
.org ul { display: flex; justify-content: center; margin: 0; padding: 22px 0 0; position: relative; }
.org li { list-style: none; position: relative; padding: 22px 10px 0; display: flex; flex-direction: column; align-items: center; }
.org > ul { padding-top: 0; } .org > ul > li { padding-top: 0; }
/* đường nối: ngang giữa các nhánh anh em, dọc xuống từng nhánh */
.org li::before, .org li::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 2px solid var(--ol); }
.org li::before { right: 50%; } .org li::after { left: 50%; border-left: 2px solid var(--ol); }
.org li:only-child::before, .org li:only-child::after { display: none; } .org li:only-child { padding-top: 0; }
.org > ul > li:only-child { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid var(--ol); border-radius: 0 8px 0 0; }
.org li:first-child::after { border-radius: 8px 0 0 0; }
.org ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--ol); }
.org-group { display: flex; gap: 10px; justify-content: center; position: relative; }
.org-group.root { padding: 8px; border-radius: 14px; background: var(--gold-soft); }
.org-node { display: flex; align-items: center; gap: 10px; min-width: 190px; max-width: 230px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; position: relative; box-shadow: 0 1px 2px rgba(11,26,54,.06); transition: border-color .15s, box-shadow .15s, transform .15s; }
.org-node:hover { border-color: var(--tx-600); box-shadow: 0 4px 14px rgba(11,26,54,.12); transform: translateY(-1px); }
.org-node:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.org-node .avatar { flex: none; }
.org-who { display: grid; min-width: 0; line-height: 1.3; }
.org-who b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-who small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-who em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--gold-ink); }
.org-edit { margin-left: auto; opacity: 0; transition: opacity .15s; color: var(--muted); }
.org-edit svg { width: 14px; height: 14px; }
.org-node:hover .org-edit { opacity: 1; }
.org-node.bod { border-color: var(--gold-line); } .org-node.bod .avatar { background: var(--gold); color: #fff; }
.org-node.mgr { border-width: 1.5px; border-color: var(--tx-600); }
.od-sales .avatar { background: var(--navy-50); color: var(--tx-700); }
.od-marketing .avatar { background: #E8F3EE; color: #1F6B4A; }
.org-node.od-sys .avatar { background: var(--navy-800); color: #fff; }
.org-node.empty { border-style: dashed; background: transparent; box-shadow: none; color: var(--muted); }
.org-node.empty > svg { width: 18px; height: 18px; margin: 0 4px; }
.org-dept { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px 6px 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--text); position: relative; }
.org-dept small { font-weight: 500; color: var(--muted); }
.org-dept.od-sales { background: var(--navy-50); color: var(--tx-700); }
.org-dept.od-marketing { background: #E8F3EE; color: #1F6B4A; }
.org-add { width: 22px; height: 22px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface); color: inherit; cursor: pointer; }
.org-add svg { width: 13px; height: 13px; } .org-add:hover { background: var(--navy-800); color: #fff; }
:root[data-theme="dark"] .org-dept.od-marketing, :root[data-theme="dark"] .od-marketing .avatar { background: #0F2C21; color: #7FDBB4; }
:root[data-theme="dark"] .org-node.bod .avatar { color: #0B1A36; }
body.ro .org-add { display: none; }

/* ---------- Ô chọn người phụ trách (họ tên · chức danh · vị trí) ---------- */
.userpick { position: relative; }
.userpick .up-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.up-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: auto; min-height: 40px; padding: 6px 10px; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.up-btn:disabled { cursor: default; opacity: .75; }
.up-btn:disabled .up-caret { display: none; }
.userpick.open .up-btn { border-color: var(--tx-600); box-shadow: 0 0 0 3px var(--navy-50); }
.up-caret { width: 16px; height: 16px; margin-left: auto; flex: none; color: var(--muted); }
.up-av { width: 30px; height: 30px; font-size: 11.5px; flex: none; }
.up-who { display: grid; min-width: 0; line-height: 1.25; flex: 1; }
.up-who b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-who small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-btn .role-chip, .up-list .role-chip { flex: none; font-size: 11px; }
.up-list { position: fixed; z-index: 300; max-height: 300px; overflow: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(11,26,54,.18); }
.up-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.up-list button:hover { background: var(--surface-3); }
.up-list button.on { background: var(--navy-50); }
.up-bod { background: var(--gold); color: #fff; } .up-marketing { background: #E8F3EE; color: #1F6B4A; } .up-sys { background: var(--navy-800); color: #fff; }
:root[data-theme="dark"] .up-marketing { background: #0F2C21; color: #7FDBB4; }
.opp-fields .up-btn { min-height: 38px; }

/* ---------- Link hợp đồng ---------- */
.k-links { list-style: none; margin: 0; padding: 0; }
.k-links li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); }
.k-links li:first-child { border-top: 0; }
.k-links a { color: var(--text); text-decoration: none; } .k-links a:hover b { text-decoration: underline; }
.k-links .muted { font-size: 12px; }
.kl-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--navy-50); color: var(--tx-700); flex: none; }
.kl-ic svg { width: 16px; height: 16px; }
.kl-del { opacity: .5; } .k-links li:hover .kl-del { opacity: 1; }
.kl-form { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) auto; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 640px) { .kl-form { grid-template-columns: 1fr; } }
body.ro .kl-form, body.ro .kl-del { display: none !important; }

/* ---------- Sửa / huỷ công việc ---------- */
.titem.has-act { grid-template-columns: 22px 30px 1fr auto auto; }
.t-act { display: flex; gap: 2px; opacity: .35; transition: opacity .15s; }
.titem:hover .t-act, .t-act:focus-within { opacity: 1; }
.t-act .icon-btn { width: 28px; height: 28px; }
.t-act [data-act="cancel"]:hover { color: var(--danger); background: var(--hot-bg); }
@media (hover: none) { .t-act { opacity: .8; } }
@media (max-width: 760px) { .titem.has-act { grid-template-columns: 22px 30px 1fr; } .titem.has-act .t-act { grid-column: 3; justify-content: flex-start; } }
body.ro .t-act { display: none !important; }
.tcard:hover .t-act { opacity: 1; } .tcard .t-act { margin-right: 4px; }

/* ---------- Trang ghi chú kiểu Notion ---------- */
.nb-card .card-b.nb-host { position: relative; padding: 10px 26px 22px 30px; }
.nb { min-height: 180px; outline: none; font-size: 14.5px; line-height: 1.65; color: var(--text); caret-color: var(--gold-ink); }
.nb > * { margin: 0 0 4px; }
.nb p { min-height: 1.65em; }
/* Lớp trạng thái riêng nb-blank: không dùng .empty vì trùng lớp chung (căn giữa, đệm 28px) */
.nb.nb-blank > p:first-child::before { content: 'Gõ / để chọn kiểu khối, hoặc viết ghi chú tự do...'; color: var(--muted); pointer-events: none; position: absolute; left: 0; top: 0; right: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb.nb-blank > p:first-child { position: relative; }
.nb.ro.nb-blank > p:first-child::before { content: none; }
.nb h2 { font-size: 22px; font-weight: 700; margin: 18px 0 6px; letter-spacing: -.2px; }
.nb h3 { font-size: 17px; font-weight: 650; margin: 14px 0 4px; }
.nb ul, .nb ol { padding-left: 24px; margin: 2px 0 6px; }
.nb li { margin: 2px 0; padding-left: 2px; }
.nb ul.todo { list-style: none; padding-left: 2px; }
.nb ul.todo > li { position: relative; padding-left: 28px; }
.nb ul.todo > li::before { content: ''; position: absolute; left: 2px; top: .33em; width: 16px; height: 16px; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); cursor: pointer; }
.nb ul.todo > li[data-checked="true"] { color: var(--muted); text-decoration: line-through; }
.nb ul.todo > li[data-checked="true"]::before { background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--ok); }
.nb blockquote { border-left: 3px solid var(--text); padding: 2px 0 2px 14px; margin: 6px 0; font-size: 15px; }
.nb .callout { display: block; background: var(--gold-soft); border-radius: 8px; padding: 12px 14px 12px 40px; margin: 8px 0; position: relative; }
.nb .callout::before { content: '!'; position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.nb hr { border: 0; border-top: 1px solid var(--line-strong); margin: 14px 0; }
.nb a { color: #2F5BA8; text-decoration: underline; text-underline-offset: 2px; }
.nb code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: #C0504D; }
.nb.ro { min-height: 0; }
.nb-menu { position: absolute; z-index: 40; width: 250px; max-height: 320px; overflow: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(11,26,54,.18); }
.nb-mh { font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 8px 4px; text-transform: uppercase; letter-spacing: .04em; }
.nb-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.nb-menu button.on, .nb-menu button:hover { background: var(--surface-3); }
.nb-menu b { display: block; font-size: 13.5px; font-weight: 550; }
.nb-menu small { color: var(--muted); font-size: 11.5px; }
.nb-g { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-2); flex: none; background: var(--surface); }
.nb-st { font-size: 12px; }
/* Mở rộng: trang ghi chú chiếm gần toàn màn hình để viết thoải mái */
.nb-card.nb-full { position: fixed; inset: 24px max(24px, calc((100vw - 980px) / 2)); z-index: 70; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(7,18,38,.35); }
.nb-card.nb-full .nb-host { flex: 1; overflow: auto; padding: 24px 56px 40px; }
.nb-card.nb-full .nb { font-size: 15.5px; min-height: 60vh; }
body.nb-lock::after { content: ''; position: fixed; inset: 0; background: rgba(7,18,38,.45); z-index: 69; }
@media (max-width: 760px) { .nb-card.nb-full { inset: 0; border-radius: 0; } .nb-card.nb-full .nb-host { padding: 16px 18px 30px; } }
.pg-ind { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 6px; color: var(--gold-ink); }
.pg-ind svg { width: 14px; height: 14px; }
/* Lát cuối của phễu: Deal Win (thắng trong 30 ngày) */
.fnl-row.win { margin-top: 4px; }
.fnl-row.win .fnl-band { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sc) 60%, transparent); }
.fnl-row.win .fnl-name { font-weight: 650; display: inline-flex; align-items: center; gap: 4px; }
.fnl-row.win .fnl-name svg { width: 13px; height: 13px; color: var(--gold); }
.fnl-row.win .fnl-v { font-weight: 600; color: var(--ok); }

/* ---------- Bộ lọc tuỳ chỉnh & xuất dữ liệu ---------- */
.flt-bar { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; flex-wrap: wrap; }
.flt-saved { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.flt-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.flt-chip svg { width: 13px; height: 13px; }
.flt-chip:hover { border-color: var(--line-strong); color: var(--text); }
.flt-chip.on { border-color: var(--tx-700); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--tx-700); }
.btn.primary-soft { background: var(--navy-50); border-color: var(--navy-100); color: var(--tx-800); }
.flt-n { font-style: normal; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--navy-800); color: #fff; font-size: 11px; }
.flt-sum { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; font-size: 13px; }
.flt-panel { margin-bottom: 14px; }
.flt-rules { display: grid; gap: 8px; margin-bottom: 10px; }
.flt-rule { display: grid; grid-template-columns: 44px minmax(170px, 1.1fr) minmax(120px, .7fr) minmax(0, 2fr) 32px; gap: 8px; align-items: start; }
.flt-and { font-size: 12.5px; color: var(--muted); padding-top: 10px; text-align: right; }
.flt-enum { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.flt-opt { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; cursor: pointer; }
.flt-opt input { margin: 0; accent-color: var(--navy-800); }
.flt-opt.on { border-color: var(--tx-700); background: var(--navy-50); }
.flt-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.icon.rot90, svg.rot90 { transform: rotate(90deg); }
@media (max-width: 760px) { .flt-rule { grid-template-columns: 1fr 32px; } .flt-rule .flt-and { display: none; } .flt-rule > select, .flt-rule .flt-val { grid-column: 1; } .flt-rule .icon-btn { grid-column: 2; grid-row: 1; } }
/* Nút hoàn thành luôn tròn: không bị co méo trong hàng flex chật (thẻ kanban, danh sách nhỏ) */
.check { flex: 0 0 auto; aspect-ratio: 1; box-sizing: border-box; min-width: 20px; min-height: 20px; }
.tcard .check { min-width: 22px; min-height: 22px; }
.tcard .f { gap: 6px; }
.tcard .f > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tcard .f .avatar { flex: 0 0 auto; }
.tcard .t-act { flex: 0 0 auto; gap: 0; margin-right: 0; }
.tcard .t-act .icon-btn { width: 24px; height: 24px; }
/* Thẻ kanban: nút sửa / huỷ nổi ở góc trên khi rê chuột, để dòng hạn và nút hoàn thành không bị chật */
@media (hover: hover) {
  .tcard { position: relative; }
  .tcard .t-act { position: absolute; top: 6px; right: 6px; opacity: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(11,26,54,.12); padding: 1px; }
  .tcard:hover .t-act, .tcard .t-act:focus-within { opacity: 1; }
}

/* Nguồn cơ hội (Cài đặt hệ thống) */
.src-list { display: grid; gap: 8px; margin-bottom: 12px; max-width: 720px; }
.src-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 110px auto; gap: 10px; align-items: center; }
.src-cnt { font-size: 12.5px; }
/* Nhóm khách hàng (Công ty) */
.grp-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.grp-bar .seg { flex-wrap: wrap; }
.grp-bar .seg em { font-style: normal; font-size: 11.5px; color: var(--text-3, var(--text-2)); margin-left: 4px; }
.grp-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.grp-chip.g-potential { background: var(--surface-3); color: var(--text-2); }
.grp-chip.g-existing { background: rgba(29,122,87,.12); color: #1D7A57; border-color: rgba(29,122,87,.25); }
.grp-chip.g-partner { background: var(--gold-soft); color: var(--gold-ink); border-color: var(--gold-line); }
:root[data-theme="dark"] .grp-chip.g-existing { color: #5CC79A; }
.opp-fields { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .opp-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .src-row { grid-template-columns: 24px minmax(0, 1fr) auto; } .src-cnt { display: none; } }
/* Số thứ tự nguồn luôn hiện: nếu ẩn (theo luật chung .ps-idx ở màn hình hẹp) thì ô tên bị đẩy vào cột hẹp đầu tiên */
.src-row .ps-idx { display: block; }
.src-row .ps-act { justify-content: flex-end; }
@media (max-width: 1100px) { .opp-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .opp-fields { grid-template-columns: 1fr; } }

/* ---------- Xoá cơ hội: luôn ở cuối trang chi tiết ---------- */
.danger-zone { margin-top: 18px; display: flex; align-items: center; gap: 16px; padding: 14px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.danger-zone > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.danger-zone b { font-size: 13.5px; font-weight: 600; }
.danger-zone .muted { font-size: 12.5px; }

/* ---------- Thanh điều hướng dưới và bảng "Thêm" (chỉ điện thoại) ---------- */
.tabbar { display: none; }
.sheet-wrap { position: fixed; inset: 0; z-index: 55; background: rgba(7, 18, 38, 0); transition: background .2s; display: flex; align-items: flex-end; }
.sheet-wrap.open { background: rgba(7, 18, 38, .45); }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease-out; max-height: 85dvh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 4px auto 14px; }
.sheet-me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line-2); }
.sheet-me .avatar { width: 40px; height: 40px; background: var(--navy-800); color: var(--gold); }
.sheet-me .who { flex: 1; min-width: 0; } .sheet-me .who b { display: block; font-size: 15px; } .sheet-me .who small { color: var(--muted); font-size: 12.5px; }
.sheet-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 0; }
.sheet-nav a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 12px; background: var(--surface-3); color: var(--text); font-weight: 500; text-decoration: none; position: relative; }
.sheet-nav a.on { background: var(--navy-50); color: var(--tx-800); box-shadow: inset 0 0 0 1px var(--navy-100); }
.sheet-nav a svg.i { width: 20px; height: 20px; color: var(--tx-600); }
.sheet-nav a .badge { margin-left: auto; background: var(--warm); color: #fff; font-size: 11px; font-style: normal; padding: 1px 7px; border-radius: 10px; }
.sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line-2); }
.sheet-row .theme-sw { margin: 0; background: var(--surface-3); }
.sheet-row .theme-sw button { color: var(--text-2); height: 34px; padding: 0 10px; }
.sheet-row .theme-sw button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(11,26,54,.12); }
.sheet-out { width: 100%; justify-content: center; height: 46px; margin-top: 4px; }

/* ====================== ĐIỆN THOẠI (≤ 760px) ====================== */
@media (max-width: 760px) {
  body { font-size: 15px; }
  /* Khung: thanh trên gọn + thanh dưới cố định */
  .shell { display: block; min-height: 100dvh; }
  .side { position: sticky; top: 0; z-index: 30; height: auto; min-height: 0; flex-direction: row; align-items: center; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .side .nav, .side .theme-sw, .side .side-foot { display: none !important; }
  .brand { padding: 0; } .brand small { display: block; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand-mark { width: 32px; height: 32px; }
  .main { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgba(11, 26, 54, .06); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 58px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar svg.i { width: 23px; height: 23px; stroke-width: 1.7; }
  .tabbar .on { color: var(--tx-800); }
  .tabbar .on::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
  .tabbar .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hot); color: #fff; font-size: 10.5px; font-style: normal; font-weight: 600; display: grid; place-items: center; }
  #toast-root { left: 14px; right: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  /* Chữ, nút, ô nhập đủ lớn để chạm (ô nhập 16px để iPhone không tự phóng to) */
  .input, select.input, textarea.input { height: 44px; font-size: 16px; border-radius: 10px; }
  textarea.input { height: auto; min-height: 96px; padding: 10px 12px; }
  .btn { height: 42px; padding: 0 14px; border-radius: 10px; }
  .btn.sm { height: 36px; }
  .icon-btn { min-width: 36px; min-height: 36px; }
  .field label { font-size: 13px; }

  /* Đầu trang: tiêu đề, tìm kiếm full ngang, các nút xuống dòng gọn */
  .page-head { gap: 10px; margin-bottom: 16px; }
  .page-head > div:first-child { flex: 1 1 100%; }
  .page-head h1 { font-size: 21px; }
  .page-head .sub { font-size: 12.5px; }
  .page-head .grow { display: none; }
  .page-head .search { flex: 1 1 100%; order: 2; }
  .page-head .search .input { width: 100%; }
  .page-head .btn.primary { order: 1; }
  .page-head select.input { flex: 1 1 auto; width: auto; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; padding: 8px 12px; font-size: 13.5px; }
  .tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; } .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; flex: none; padding: 12px 12px; }
  .set-tabs button { white-space: nowrap; flex: none; }
  .card-h { flex-wrap: wrap; padding: 14px 16px; }
  .card-b { padding: 14px 16px; }

  /* Lưới: không cho phần tử con đẩy rộng quá màn hình */
  .dash-grid, .detail-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .dash-grid > *, .detail-grid > *, .stack > * { min-width: 0; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kv { grid-template-columns: 104px minmax(0, 1fr); }
  .kv dd { overflow-wrap: anywhere; }

  /* Pipeline và Công việc (Kanban, Theo pipeline): các giai đoạn xếp dọc, cuộn lên xuống */
  .board { display: flex; flex-direction: column; align-items: stretch; gap: 10px; overflow: visible; padding-bottom: 12px; }
  .d-only { display: none; }
  .board .col { min-height: 0; padding: 8px; }
  .board > .col { overflow: visible; }
  .board > .col > .col-h, .board .col-h { position: sticky; top: 62px; z-index: 2; }
  .board .col:not(.stage) .col-h { background: inherit; border-radius: 9px; padding: 8px 6px; }
  .board .col.stage .col-h { margin-bottom: 8px; }
  .board .col .empty { padding: 10px !important; font-size: 13px; }
  .board .opp-card:last-child, .board .tcard:last-child { margin-bottom: 0; }
  /* Giai đoạn thu gọn: chỉ còn một dòng tiêu đề, bấm để mở */
  .col.stage.collapsed { flex-direction: row; align-items: stretch; min-height: 0; padding: 8px; gap: 0; }
  .col.stage.collapsed .col-v { flex-direction: row; width: auto; flex: 1; gap: 8px; padding: 10px 11px; }
  .col.stage.collapsed .col-v b, .col.stage.collapsed .col-v .sum { writing-mode: horizontal-tb; }
  .col.stage.collapsed .col-v .n { order: 2; } .col.stage.collapsed .col-v .sum { order: 3; margin-left: auto; }
  .col.stage.collapsed .col-v b { order: 1; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .col.stage.collapsed > .col-tog { order: 5; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
  .col.stage.collapsed { position: relative; } .col.stage.collapsed .col-v { padding-right: 52px; }
  .col-tog { width: 32px; height: 32px; }
  .col-h .col-tog .i { transform: rotate(90deg); }
  .col.stage.collapsed > .col-tog .i { transform: rotate(-90deg); }
  .opp-card { padding: 14px; }

  /* Chi tiết cơ hội */
  .opp-head h1 { font-size: 20px; line-height: 1.3; }
  .opp-head > .row > .row { width: 100%; } .opp-head > .row > .row .btn { flex: 1; justify-content: center; }
  .stepper { gap: 8px; }
  .steps { margin: 0 -4px; padding: 0 4px 2px; scrollbar-width: none; } .steps::-webkit-scrollbar { display: none; }
  .step { min-width: 124px; height: 42px; }
  .outcomes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .opp-fields { gap: 12px; }
  .danger-zone { flex-direction: column; align-items: stretch; text-align: left; }
  .danger-zone .btn { justify-content: center; border: 1px solid var(--hot-bg); }
  .composer-tabs { overflow-x: auto; scrollbar-width: none; } .composer-tabs button { white-space: nowrap; flex: none; }

  /* Bảng danh bạ (Công ty, Người liên hệ) thành thẻ dễ đọc */
  .tbl-wrap:has(table.m-cards) { overflow: visible; }
  table.m-cards { display: block; min-width: 0 !important; }
  table.m-cards thead { display: none; }
  table.m-cards tbody { display: block; }
  table.m-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  table.m-cards tr:last-child { border-bottom: 0; }
  table.m-cards td { display: block; padding: 0 !important; border: 0 !important; text-align: left !important; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
  table.m-cards td:first-child { grid-column: 1 / -1; font-size: 15px; }
  table.m-cards td:not(:first-child)::before { content: attr(data-l); display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
  table.m-cards td.m-empty { display: none; }
  table.m-cards td[colspan] { grid-column: 1 / -1; text-align: center !important; }
  table.m-cards td[colspan]::before { display: none; }

  /* Hộp thoại thành bảng trượt từ dưới lên, nút bấm to */
  .overlay { padding: 0; align-items: end; place-items: end stretch; }
  .modal { width: 100% !important; max-height: 92dvh; border-radius: 18px 18px 0 0; animation: sheetup .22s ease-out; }
  .modal-h { padding: 18px 18px 4px; } .modal-b { padding: 12px 18px; }
  .modal-f { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-f .btn { flex: 1 1 0; justify-content: center; height: 46px; }
  .modal-f .del-left { flex: 1 1 100%; order: 3; }
}
@keyframes sheetup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (max-width: 380px) { .kpis { grid-template-columns: 1fr; } .sheet-nav { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .composer-foot { flex-wrap: wrap; } .composer-foot .grow { flex: 1 1 100%; } .composer-foot .btn { flex: 1 1 auto; justify-content: center; }
  .rp-grid { grid-template-columns: minmax(0, 1fr) !important; } .rp-grid > * { min-width: 0; }
  .rp-leg { margin-left: 0; }
  .grp-bar .seg { flex-wrap: nowrap; }
  .flt-bar { flex-wrap: wrap; gap: 8px; }
  .flt-bar .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 760px) {
  .rp-t th, .rp-t td { padding-left: 8px; padding-right: 8px; } .rp-t th { white-space: normal; letter-spacing: 0; }
  .rp-t th:first-child, .rp-t td:first-child { padding-left: 14px; } .rp-t th:last-child, .rp-t td:last-child { padding-right: 14px; }
  .rp-t.fc { font-size: 12.5px; }
}
/* ---------- Máy tính bảng (761 - 1100px) ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
  .shell { grid-template-columns: 208px minmax(0, 1fr); }
  .main { padding: 22px 22px 40px; }
  .stepper { flex-direction: column; }
  .steps { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .steps::-webkit-scrollbar { display: none; }
  .step { flex: none; min-width: 130px; }
  .outcomes { padding-left: 0; border-left: 0; } .out { flex: 1; justify-content: center; }
  .dash-grid > *, .detail-grid > * { min-width: 0; }
}

/* ---------- Thông báo ---------- */
.brand { min-width: 0; }
.brand-t { flex: 1; min-width: 0; }
.bell { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: #8E9BB5; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.bell svg.i { width: 19px; height: 19px; }
.bell:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.bell.has { color: var(--gold); }
.bell:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.bell-n { position: absolute; top: 1px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--gold); color: var(--navy-950); font-size: 10.5px; font-weight: 700; font-style: normal; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--navy-900); }
.notif { position: fixed; z-index: 58; left: 244px; top: 16px; width: 384px; max-height: min(580px, calc(100dvh - 32px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-4px); transition: opacity .16s, transform .16s; }
.notif.open { opacity: 1; transform: none; }
.nf-h { display: flex; align-items: center; gap: 10px; padding: 14px 12px 12px 18px; border-bottom: 1px solid var(--line-2); }
.nf-h b { font-size: 15px; font-weight: 600; }
.nf-h .grow { flex: 1; }
.nf-unread { font-size: 12px; color: var(--gold-ink); background: var(--gold-soft); border-radius: 10px; padding: 1px 8px; font-weight: 500; }
.nf-link { border: 0; background: none; color: var(--tx-500); font-size: 12.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.nf-link:hover { background: var(--surface-3); }
.nf-list { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; padding: 4px 0; }
.nf-item { position: relative; width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) 10px; gap: 12px; align-items: start; text-align: left; border: 0; background: none; padding: 12px 18px; cursor: pointer; color: var(--text); font: inherit; }
.nf-item + .nf-item { border-top: 1px solid var(--line-2); }
.nf-item:hover { background: var(--surface-2); }
.nf-item:focus-visible { outline: 2px solid var(--navy-500); outline-offset: -2px; }
.nf-item .avatar { width: 32px; height: 32px; font-size: 11.5px; background: var(--navy-800); color: var(--gold); }
.nf-body { display: grid; gap: 3px; min-width: 0; }
.nf-line { font-size: 13.5px; line-height: 1.45; }
.nf-line b { font-weight: 600; }
.nf-snip { font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.nf-when { font-size: 11.5px; color: var(--muted); }
.nf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; box-shadow: 0 0 0 3px var(--gold-soft); }
.nf-item.read { color: var(--muted); }
.nf-item.read .nf-line b { font-weight: 500; }
.nf-item.read .nf-snip { color: var(--muted); }
.nf-item.read .avatar { background: var(--surface-3); color: var(--muted); }
.nf-empty { display: grid; justify-items: center; gap: 10px; padding: 34px 28px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }
.nf-empty svg.i { width: 26px; height: 26px; color: var(--line-strong); }
.nf-f { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-2); }
.nf-f .grow { flex: 1; }
/* Nhắc tên trong ghi chú */
.dropzone { position: relative; }
.mention-box { position: absolute; left: 0; top: 100%; z-index: 20; margin-top: 4px; width: min(340px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.mb-h { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); padding: 4px 8px 6px; }
.mb-h svg.i { width: 13px; height: 13px; }
.mb-i { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 7px 8px; border-radius: 8px; text-align: left; cursor: pointer; color: var(--text); font: inherit; }
.mb-i .avatar { width: 28px; height: 28px; }
.mb-i b { display: block; font-size: 13.5px; font-weight: 500; } .mb-i small { display: block; font-size: 11.5px; color: var(--muted); }
.mb-i.on, .mb-i:hover { background: var(--navy-50); }
.mention { color: var(--tx-700); background: var(--navy-50); border-radius: 5px; padding: 0 3px; font-weight: 500; white-space: nowrap; }
.mention.me { color: var(--gold-ink); background: var(--gold-soft); }
.tl.flash { animation: actflash 3s ease-out; }
@keyframes actflash { 0%, 40% { background: var(--gold-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .notif, .sheet { transition: none; } .tl.flash { animation: none; background: var(--gold-soft); } }
@media (max-width: 760px) {
  .side .brand { flex: 1; }
  .bell { width: 40px; height: 40px; }
  .notif { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 86dvh; border-radius: 18px 18px 0 0; border: 0; transform: translateY(24px); padding-bottom: env(safe-area-inset-bottom); }
  .nf-item { padding: 14px 16px; }
  .nf-f .btn { height: 40px; }
  .mention-box { width: 100%; }
}

/* ---------- Điện thoại: chống tràn ngang (Báo cáo, Sales pipeline, hồ sơ người liên hệ / công ty) ---------- */
@media (max-width: 760px) {
  .main { overflow-x: clip; }
  /* Nút thao tác ở đầu hồ sơ: xuống dòng, chia đều */
  .opp-head .row:has(> .btn) { flex-wrap: wrap; width: 100%; gap: 8px; }
  .opp-head .row:has(> .btn) > .btn { flex: 1 1 calc(50% - 4px); justify-content: center; min-width: 0; }
  /* Báo cáo: bảng Dự báo chốt vừa màn hình, bảng đội ngũ cuộn ngang trong khung */
  .rp-t th, .rp-t td { padding: 9px 8px; }
  .rp-t th:first-child, .rp-t td:first-child { padding-left: 14px; } .rp-t th:last-child, .rp-t td:last-child { padding-right: 14px; }
  .rp-t.fc th { white-space: normal; letter-spacing: 0; font-size: 10.5px; }
  .rp-t.fc td:first-child { white-space: normal; }
  .rp-t.team { display: block; overflow-x: auto; max-width: 100%; }
  .card-h { min-width: 0; } .card-h .muted { min-width: 0; overflow-wrap: anywhere; }
  /* Cài đặt > Sales pipeline: hàng 1 tên + xác suất, hàng 2 việc tự động + nút */
  .ps-row { grid-template-columns: 26px minmax(0, 1fr) 84px; gap: 8px; padding: 8px 10px; }
  .ps-grip { display: none; } /* kéo thả không dùng được trên màn hình cảm ứng, dùng nút lên / xuống */
  .ps-name { min-width: 0; }
  .ps-prob { gap: 4px; } .ps-prob .input { width: 100%; min-width: 0; }
  .ps-pb { grid-column: 1 / 3; min-width: 0; overflow: hidden; white-space: nowrap; }
  .ps-act { grid-column: 3; gap: 0; } .ps-act .icon-btn { width: 28px; height: 32px; }
  .ps-preview { gap: 4px 2px; } .ps-chev { height: 28px; font-size: 12px; }
  .tt-row { grid-template-columns: 40px 28px minmax(0, 1fr) 96px; }
}

/* ---------- Phân quyền chi tiết (Cài đặt > Người dùng & phân quyền) ---------- */
.pm-card .card-h { flex-wrap: wrap; row-gap: 8px; }
.pm-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.pm-t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 880px; }
.pm-t th, .pm-t td { border-bottom: 1px solid var(--line-2); }
.pm-t thead th { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 8px 6px; text-align: center; white-space: nowrap; }
.pm-t thead tr:first-child th.pm-m { font-size: 12.5px; color: var(--tx-900); border-left: 1px solid var(--line); }
.pm-t thead th.pm-a { font-weight: 500; color: var(--muted); padding-top: 0; }
.pm-t .g0 { border-left: 1px solid var(--line); }
.pm-t th.pm-u { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--surface); padding: 10px 14px 10px 18px; font-weight: 400; min-width: 210px; }
.pm-t thead th.pm-u { background: var(--surface-2); font-weight: 600; font-size: 12px; vertical-align: bottom; }
.pm-t th.pm-u { display: table-cell; } .pm-t tbody th.pm-u > * { vertical-align: middle; }
.pm-t tbody th.pm-u { white-space: nowrap; }
.pm-uin { display: flex; align-items: center; gap: 10px; }
.pm-t .pm-who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.pm-t .pm-who small { color: var(--muted); font-size: 11.5px; }
.pm-t td.pm-c { text-align: center; padding: 0; position: relative; }
.pm-t td.pm-r { text-align: right; padding: 0 14px 0 8px; white-space: nowrap; }
.pm-all { font-size: 12px; }
.pm-t tbody tr:hover th.pm-u, .pm-t tbody tr:hover td { background: var(--navy-50); }
.pm-t tbody tr.pm-chg th.pm-u { box-shadow: inset 3px 0 0 var(--gold-ink); }
.pm-box { display: grid; place-items: center; width: 100%; height: 44px; cursor: pointer; }
.pm-box input { position: absolute; top: 0; left: 0; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pm-box span { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #B9C3D6; background: var(--surface); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.pm-box input:checked + span { background: var(--navy-700, #1F3A68); border-color: var(--navy-700, #1F3A68); }
.pm-box input:checked + span::after { content: ''; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.pm-box input:focus-visible + span { outline: 2px solid var(--navy-500); outline-offset: 2px; }
.pm-box input:disabled + span { opacity: .45; } .pm-bod .pm-box { cursor: default; }
.pm-t td.diff::after { content: ''; position: absolute; top: 9px; right: calc(50% - 15px); width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.pm-note { font-size: 12.5px; }
:root[data-theme="dark"] .pm-box span { border-color: #4A5A78; }
@media (max-width: 760px) {
  .pm-t { min-width: 760px; } .pm-t th.pm-u { min-width: 150px; padding-left: 12px; } .pm-t .pm-who small { display: none; }
  .pm-t .avatar.sm { display: none; }
}

/* Ẩn nút theo Phân quyền chi tiết (body.np-<hạng mục>-<quyền>) */
body.np-opp-create #newopp, body.np-opp-create #nop { display: none !important; }
body.np-opp-edit .stepper .step, body.np-opp-edit .stepper .out, body.np-opp-edit .opp-fields { pointer-events: none; }
body.np-opp-edit #addsol, body.np-opp-edit #solapply, body.np-opp-edit .sol-act { display: none !important; }
body.np-task-create #at, body.np-task-create .nostep a { display: none !important; }
body.np-task-edit .tcard .check, body.np-task-edit .mini .check, body.np-task-edit [data-act="edit"], body.np-task-edit [data-act="done"] { display: none !important; }
body.np-task-edit .titem .check { visibility: hidden; }
body.np-task-delete [data-act="cancel"] { display: none !important; }
body.np-company-create #addco, body.np-company-create #addc { display: none !important; }
body.np-company-edit #eco, body.np-company-edit #addp { display: none !important; }
body.np-contact-create #addct { display: none !important; }
body.np-contact-edit #ect, body.np-contact-edit #editc, body.np-contact-edit [data-edit] { display: none !important; }
body.np-contract-create #addk, body.np-contract-create #mkk { display: none !important; }
body.np-contract-edit #kedit, body.np-contract-edit .k-acts { display: none !important; }
/* Máy tính bảng: tên phần mềm trên thanh bên hẹp không xuống dòng */
@media (min-width: 761px) and (max-width: 1100px) {
  .brand { gap: 8px; padding-left: 4px; padding-right: 4px; } .brand-mark { width: 32px; height: 32px; }
  .brand-t b, .brand-t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-t b { font-size: 14px; }
  .theme-sw button { padding: 0 6px; font-size: 11.5px; gap: 4px; }
}

/* Ô mật khẩu có nút ẩn / hiện */
.pw-wrap { position: relative; display: block; }
.pw-wrap > .input { width: 100%; padding-right: 46px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.pw-eye:hover { color: var(--tx-700); background: var(--navy-50); }
.pw-eye:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }
.pw-eye .i { width: 18px; height: 18px; }
.pw-wrap > .input::-ms-reveal { display: none; }

/* Đăng nhập: ghi nhớ, quên mật khẩu */
.lf-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lf-row label { margin: 0; }
.lf-link { border: 0; background: none; padding: 0; color: var(--navy-500); font: inherit; font-size: 12.5px; cursor: pointer; }
.lf-link:hover { text-decoration: underline; }
.field .lf-row { margin-bottom: 6px; }
.lf-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: 2px 0 14px; cursor: pointer; user-select: none; }
.lf-remember input { width: 16px; height: 16px; accent-color: var(--navy-700); margin: 0; }
.fp-err { background: #FBECEA; color: var(--red-ink); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-top: 4px; }
:root[data-theme="dark"] .fp-err { background: #3A1C1A; color: #F2A39A; }
/* Sơ đồ nhân sự: nhánh chỉ có 1 người vẫn đi xuống đủ 2 đoạn như nhánh tách đôi, để các thẻ cùng cấp nằm ngang hàng */
.org ul ul > li:only-child { padding-top: 22px; }
.org ul ul > li:only-child::after { display: block; left: 50%; width: 0; border-top: 0 none; border-left: 2px solid var(--ol); border-radius: 0; }
.org-dept { min-height: 30px; box-sizing: border-box; } /* nhóm không có nút + vẫn cao bằng nhóm có nút, thẻ quản lý ngang hàng */

/* Bản demo: danh sách tài khoản demo dưới form đăng nhập */
.demo-acc { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 6px; }
.demo-acc-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-bottom: 4px; }
.demo-acc-h b { font-size: 13.5px; } .demo-acc-h .muted { font-size: 12px; }
.demo-acc-i { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.demo-acc-i:hover { border-color: var(--line-strong); background: var(--surface-2); }
.demo-acc-i.on { border-color: var(--navy-700); box-shadow: inset 3px 0 0 var(--gold); }
.demo-acc-i:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }
.demo-acc-t { display: grid; min-width: 0; line-height: 1.3; }
.demo-acc-t b { font-size: 13px; } .demo-acc-t small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-acc-l { color: var(--text-2) !important; }
.demo-acc-r { font-size: 11px; white-space: nowrap; }
@media (max-width: 420px) { .demo-acc-i { grid-template-columns: 30px minmax(0, 1fr); } .demo-acc-r { grid-column: 2; justify-self: start; } }
/* Màn hình đăng nhập dài (có danh sách tài khoản demo): khung bên trái đứng yên, cao bằng màn hình */
@media (min-width: 761px) { .login { align-items: start; } .login-art { position: sticky; top: 0; height: 100vh; } .login-form { min-height: 100vh; } }

/* Điện thoại: bảng thường (không thành thẻ) cuộn ngang trong khung, không đẩy rộng cả trang */
@media (max-width: 760px) {
  table.table:not(.m-cards) { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .rp-t:not(.fc) { display: block; overflow-x: auto; max-width: 100%; }
  .ktabs { min-width: 0; max-width: 100%; }
  .ktabs .seg { max-width: none; }
}
@media (max-width: 760px) {
  /* Bảng dạng thẻ: chữ trong ô (ngày, số tiền...) được xuống dòng, không tràn sang cột bên cạnh */
  table.m-cards td, table.m-cards td * { white-space: normal !important; }
  table.m-cards td.nowrap, table.m-cards td .num { overflow-wrap: anywhere; }
}
.rp-grid > *, .dash-grid > *, .detail-grid > * { min-width: 0; } /* ô lưới không bị nội dung (bảng rộng) đẩy tràn */
/* Giải pháp đã / đang quan tâm: thẻ dài tự xuống dòng, không tràn khung */
.sol-agg li { flex-wrap: wrap; row-gap: 4px; min-width: 0; }
.sol-agg .sol-tag { max-width: 100%; white-space: normal; }
@media (max-width: 1100px) { .card:has(> table.rp-t) { overflow-x: auto; } }
/* Cột Giá trị: tiêu đề và số tiền trên một dòng, cột đủ rộng */
th.th-val { white-space: nowrap; min-width: 96px; }
table.dir td.num { white-space: nowrap; }
/* Bảng Hợp đồng: cột chữ đủ rộng để không vỡ từng chữ trên màn hình vừa; thiếu chỗ thì cuộn ngang */
@media (min-width: 761px) {
  table.dir:has(th.th-val) { min-width: 980px; }
  table.dir:has(th.th-val) th:nth-child(1) { min-width: 170px; }
  table.dir:has(th.th-val) th:nth-child(2) { min-width: 160px; }
  table.dir:has(th.th-val) th:nth-child(3), table.dir:has(th.th-val) th:nth-child(4) { min-width: 110px; }
  table.dir:has(th.th-val) th:nth-child(6) { white-space: nowrap; }
}

:root[data-theme="dark"] .temp.cool { color: #7DB8EA; background: #13283D; }

/* Nút ‹ › cho thanh cuộn ngang */
.hs-wrap { position: relative; min-width: 0; max-width: 100%; }
.hs-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: 0 2px 8px rgba(11,26,54,.16); }
.hs-btn[hidden] { display: none; }
.hs-btn .i { width: 15px; height: 15px; }
.hs-btn:hover { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.hs-l { left: -6px; } .hs-r { right: -6px; }
.hs-wrap::before, .hs-wrap::after { content: ''; position: absolute; top: 0; bottom: 0; width: 28px; pointer-events: none; z-index: 4; opacity: 0; transition: opacity .15s; }
.hs-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.hs-wrap::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }
.hs-wrap:has(> .hs-l:not([hidden]))::before, .hs-wrap:has(> .hs-r:not([hidden]))::after { opacity: 1; }
.card .hs-wrap::before { background: linear-gradient(90deg, var(--surface), transparent); } .card .hs-wrap::after { background: linear-gradient(270deg, var(--surface), transparent); }
.hs-board > .hs-btn { top: 180px; width: 36px; height: 36px; }
.hs-board::before, .hs-board::after { display: none; }
@media (hover: none) { .hs-btn { width: 32px; height: 32px; } }

/* Cài ứng dụng (PWA): chỉ hiện trên điện thoại / máy tính bảng, ẩn khi đã mở như ứng dụng */
.inst-btn, .sheet-inst, .lf-inst { display: none; }
@media (max-width: 760px) {
  .inst-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; margin-left: auto; margin-right: 6px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #fff; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
  .inst-btn .i { width: 16px; height: 16px; }
  .sheet-inst { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; margin: 4px 0 10px; border-radius: 12px; border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--text); font: inherit; cursor: pointer; }
  .sheet-inst .i { width: 22px; height: 22px; color: var(--gold-ink); flex: none; }
  .sheet-inst span { display: grid; line-height: 1.35; } .sheet-inst small { color: var(--text-2); font-size: 12px; }
  .lf-inst { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 38px; margin: 0 0 14px; border-radius: 10px; border: 1px dashed var(--line-strong); background: transparent; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
  .lf-inst .i { width: 16px; height: 16px; }
}
@media (max-width: 340px) { .inst-btn span { display: none; } .inst-btn { padding: 0 8px; } }
body.pwa .inst-btn, body.pwa .sheet-inst, body.pwa .lf-inst { display: none !important; }
.inst-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
:root[data-theme="dark"] .sheet-inst { background: #2B2414; border-color: #4A3D1E; }

/* Bản demo: lưu ý phiên thử 6 giờ ở màn hình đăng nhập và thanh nhắc trong ứng dụng */
.demo-note { border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.55; margin-bottom: 4px; }
.demo-note > b { display: block; color: var(--gold-ink); font-size: 13px; margin-bottom: 4px; }
.demo-note ul { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 3px; }
.demo-note.need { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hot) 35%, transparent); border-color: var(--hot); }
.demo-ack { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; user-select: none; }
.demo-ack input { width: 17px; height: 17px; accent-color: var(--navy-700); margin: 0; }
.demobar { position: fixed; z-index: 40; left: 236px; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 7px 16px; font-size: 12.5px; background: var(--gold-soft); color: var(--gold-ink); border-top: 1px solid var(--gold-line); }
body:has(.demobar) .main { padding-bottom: 72px; }
@media (min-width: 761px) and (max-width: 1100px) { .demobar { left: 208px; } }
@media (max-width: 760px) { .demobar { left: 0; bottom: calc(60px + env(safe-area-inset-bottom)); padding: 6px 12px; font-size: 11.5px; } body:has(.demobar) .main { padding-bottom: 130px; } }
.demobar .i { width: 15px; height: 15px; flex: none; }
:root[data-theme="dark"] .demo-note, :root[data-theme="dark"] .demobar { background: #2B2414; border-color: #4A3D1E; color: #E9C27A; }
:root[data-theme="dark"] .demo-note { color: var(--text); }

.demo-note-again { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--navy-500); cursor: pointer; text-align: left; justify-self: start; }
.demo-note-again:hover { text-decoration: underline; }
.demo-note[hidden] { display: none; }

/* democrm: link giới thiệu phần mềm ở màn hình đăng nhập */
.login-intro { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 10px 16px; border-radius: 10px; border: 1px solid rgba(201,168,100,.55); color: var(--gold); text-decoration: none; font-weight: 600; font-size: 14px; position: relative; z-index: 1; transition: background .15s, color .15s; }
.login-intro .i { width: 16px; height: 16px; }
.login-intro:hover { background: var(--gold); color: var(--navy-950); }
.login-intro-m { display: none; }
@media (max-width: 760px) { .login-intro-m { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy-500); text-decoration: none; margin: -2px 0 4px; } .login-intro-m .i { width: 14px; height: 14px; } }

/* Số liệu truy cập BowNow: Phiên · PV · CV */
.bn-stats { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-weight: 400; }
.bn-stats > span { white-space: nowrap; color: var(--muted); font-size: 13px; }
.bn-stats em { font-style: normal; font-weight: 600; color: var(--text); font-size: 14px; margin-right: 3px; }
.bn-stats-at { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; margin-top: 2px; }

/* Xem cách tính: mũi tên đôi hướng xuống (mở rộng) / hướng lên (thu gọn) */
.score summary .how { display: inline-flex; align-items: center; gap: 4px; }
.score summary .how-ic { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.score[open] summary .how-ic { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .score summary .how-ic { transition: none; } }
