@font-face { font-family: 'Lexend'; src: url('/assets/Lexend.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --navy: #273778; --navy-2: #3a4b91; --gold: #E5B243;
  --lime: #A4C639; --orange: #F28C28; --red: #EB3B3B; --purple: #824696; --cyan: #22B2DA;
  --bg: #F4F5F9; --card: #FFFFFF; --line: #E5E7EF; --text: #1E2547; --muted: #6B7090; --soft: #EEF0F7;
  --radius: 16px; --gap: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Lexend', system-ui, sans-serif; font-weight: 300; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- Shell: full window, no page scroll on desktop ---------- */
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand b { display: block; font-weight: 600; color: var(--navy); font-size: 14px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 400; position: relative; background: none; border: 0; cursor: pointer; text-align: left; }
.nav a:hover { background: var(--soft); color: var(--navy); }
.nav a.on { background: var(--soft); color: var(--navy); font-weight: 500; }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .mob { display: none; }
.side .grow { flex: 1; }
.who { border-top: 1px solid var(--line); padding: 12px 8px 6px; display: flex; align-items: center; gap: 10px; text-decoration: none; border-radius: 10px; }
.who:hover, .who.on { background: var(--soft); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 500; flex: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--gold); }
.hello b { display: block; font-weight: 500; color: var(--navy); font-size: 13.5px; }
.hello span { color: var(--muted); font-size: 12px; }
.logout { font-size: 12px; margin: 4px 8px 0; align-self: flex-start; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy); cursor: pointer; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }

.main { padding: 18px 22px; min-width: 0; height: 100vh; overflow: auto; }
.main.fit { display: flex; flex-direction: column; gap: var(--gap); overflow: hidden; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; font-weight: 500; color: var(--navy); letter-spacing: -0.01em; }
.head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 400; }
.seg button.on { background: var(--navy); color: #fff; font-weight: 500; }
.iconbtn { border: 1px solid var(--line); background: var(--card); color: var(--navy); border-radius: 11px; padding: 7px 12px; cursor: pointer; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--gap); }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.board { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.05fr); }
.col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; min-width: 0; }
.board .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.card h3 { margin: 0; font-size: 14px; font-weight: 500; color: var(--navy); }
.card .ch { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.fill { flex: 1; min-height: 0; }
.sub { color: var(--muted); font-size: 12px; }
.kpi .lab { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.kpi .big { font-size: 26px; font-weight: 500; color: var(--navy); margin: 2px 0 0; letter-spacing: -0.02em; line-height: 1.2; }
.kpi .vs { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; height: 6px; background: var(--soft); border-radius: 6px; margin-top: 10px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--navy); }
.bar em { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--text); opacity: .35; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; font-weight: 500; white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-good { color: #5d7a12; background: #f1f7e1; }
.s-warn { color: #b3600f; background: #fdf0e2; }
.s-bad { color: #c22424; background: #fde8e8; }
.s-none { color: var(--muted); background: var(--soft); }

/* Ranking rows (by school / product / channel) */
.rank { display: flex; flex-direction: column; justify-content: space-between; flex: 1; min-height: 0; gap: 2px; }
.rk { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) 74px 54px; gap: 10px; align-items: center; font-size: 12.5px; min-height: 0; }
.rk .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk .nm small { color: var(--muted); font-size: 11px; }
.rk .tr { height: 10px; background: var(--soft); border-radius: 5px; position: relative; }
.rk .tr i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--navy); }
.rk .tr em { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text); opacity: .35; }
.rk .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rk .v b { color: var(--navy); font-weight: 500; }
.rk .c { text-align: right; }

/* Story */
.story { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; flex: 1; min-height: 0; }
.story li { display: grid; grid-template-columns: 10px 1fr; gap: 8px; }
.story .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.story .dot.good { background: var(--lime); } .story .dot.warn { background: var(--orange); } .story .dot.bad { background: var(--red); }
.story b { display: block; font-weight: 500; color: var(--navy); font-size: 12.5px; }
.story p { margin: 0; font-size: 12.5px; line-height: 1.4; }

/* Funnel */
.fun { display: flex; flex-direction: column; gap: 4px; }
.fun .st { display: grid; grid-template-columns: 78px 1fr 84px; gap: 10px; align-items: center; font-size: 12.5px; }
.fun .tr { height: 18px; background: var(--soft); border-radius: 5px; position: relative; overflow: hidden; }
.fun .tr i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--navy); border-radius: 5px; }
.fun .tr em { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .35; }
.fun .num { text-align: right; color: var(--muted); }
.fun .num b { color: var(--navy); font-weight: 500; }
.fun .cv { font-size: 11.5px; color: var(--muted); padding-left: 88px; }

.chartbox { flex: 1; min-height: 0; display: flex; }
.chartbox svg { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 12px; white-space: nowrap; font-size: 11.5px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--navy); }
.legend span.t::before { background: #C4C8D8; }

/* Tables (input, audit, admin, modals) */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--soft); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }
.scroll { overflow: auto; }

/* Forms */
.form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.form input, .form select, .inp { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; font-size: 14px; color: var(--text); min-width: 0; }
.form input:focus, .form select:focus, .inp:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; }
.btn { border: 0; background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.btn:hover { background: var(--navy-2); }
.btn.ghost { background: var(--soft); color: var(--navy); }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: #c22424; font-size: 13px; }
.ok { color: #5d7a12; font-size: 13px; }
.note { background: var(--soft); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--text); }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; cursor: pointer; }
.check input { accent-color: var(--navy); width: 16px; height: 16px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; text-align: center; }
.login img { width: 120px; margin-bottom: 18px; }
.login h1 { font-size: 20px; font-weight: 500; color: var(--navy); margin: 0 0 4px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; text-align: left; }
.login .btn { width: 100%; padding: 12px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(30, 37, 71, .35); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: 18px; max-width: 520px; width: 100%; max-height: 86vh; overflow: auto; padding: 22px; box-shadow: 0 20px 50px rgba(30, 37, 71, .25); }
.modal.wide { max-width: 1000px; }
.modal h3 { margin: 0 0 10px; color: var(--navy); font-weight: 500; }
.modal ul { padding-left: 18px; margin: 10px 0; }

/* Short laptop screens: tighten so the dashboard still fits one screen */
@media (max-height: 820px) and (min-width: 1101px) {
  :root { --gap: 10px; }
  .main { padding: 12px 18px; }
  .card { padding: 10px 14px; }
  .kpi .big { font-size: 22px; }
  .head h1 { font-size: 19px; }
  .story p, .story b, .rk, .fun .st { font-size: 12px; }
}

/* Tablet / phone: stacked layout, scrolling allowed (a phone screen cannot hold everything) */
@media (max-width: 1100px) {
  .main, .main.fit { height: auto; overflow: visible; }
  .shell { height: auto; min-height: 100vh; }
  .board { grid-template-columns: 1fr; }
  .board .card { overflow: visible; }
  .chartbox { height: 220px; flex: none; }
  .rank { gap: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand, .who, .side .grow { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a, .nav button { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  .nav a.on::before { display: none; }
  .nav .mob { display: flex; }
  .main { padding: 14px 14px calc(14px + env(safe-area-inset-top)); padding-top: calc(14px + env(safe-area-inset-top)); }
  .rk { grid-template-columns: minmax(0, 1fr) 70px 50px; }
  .rk .tr { display: none; }
  .head .controls { width: 100%; }
  .seg { flex: 1; } .seg button { flex: 1; padding: 7px 4px; font-size: 12.5px; white-space: nowrap; }
  .board > .card:last-child { order: -1; }
  .kpi .vs { white-space: normal; }
}

/* ---------- Input page: weekly report grid ---------- */
.rp { flex: 1; min-height: 0; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px 28px; display: flex; flex-direction: column; gap: 14px; }
.rp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.rp-head h1 { margin: 2px 0 0; font-size: 26px; font-weight: 500; color: var(--navy); letter-spacing: -0.01em; }
.wk { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 14px; padding: 6px; }
.wk div { min-width: 150px; text-align: center; line-height: 1.25; }
.wk b { display: block; color: var(--navy); font-weight: 500; }
.wk small { font-size: 11.5px; color: var(--muted); }
.arrow { width: 36px; height: 36px; border-radius: 10px; border: 0; background: #fff; color: var(--navy); font-size: 20px; cursor: pointer; line-height: 1; }
.arrow:disabled { opacity: .35; cursor: default; }
.rp-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rp-bar b { color: var(--navy); font-weight: 500; }
.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ptabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.ptabs button.on { color: var(--navy); border-bottom-color: var(--gold); font-weight: 500; }
.ptabs span { font-size: 11px; background: var(--soft); color: var(--muted); padding: 1px 7px; border-radius: 99px; font-weight: 400; }
.ptabs span.full { background: #f1f7e1; color: #5d7a12; }
.rp-grid { flex: 1; min-height: 0; overflow: auto; }
.grid-t { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid-t th { position: sticky; top: 0; background: #fff; z-index: 1; font-size: 12px; padding: 6px 8px; }
.grid-t td { padding: 3px 8px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.grid-t td:first-child { white-space: nowrap; }
.grid-t td b { font-weight: 500; color: var(--text); margin-right: 8px; }
.grid-t td small { color: var(--muted); font-size: 11.5px; }
.grid-t tr.dirty td { background: #FFF8E8; }
.grid-t tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.cell { width: 100%; max-width: 110px; border: 1px solid transparent; background: var(--soft); border-radius: 8px; padding: 7px 10px; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.cell:hover { border-color: var(--line); }
.cell:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; background: #fff; }
.cell::placeholder { color: #B9BCCD; }
.who { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ok-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); margin-right: 6px; }
.rp-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.btn.send { display: inline-flex; gap: 10px; align-items: center; background: #1E2547; padding: 11px 20px; border-radius: 12px; }

@media (max-height: 820px) and (min-width: 1101px) {
  .rp { padding: 14px 20px; gap: 8px; }
  .rp-head h1 { font-size: 21px; }
  .ptabs button { padding: 7px 12px; }
  .grid-t td { padding: 2px 8px; }
  .cell { padding: 4px 9px; font-size: 13.5px; }
  .rp-foot { padding-top: 8px; }
  .btn.send { padding: 9px 18px; }
}
@media (max-width: 760px) {
  .rp { padding: 16px; border-radius: 16px; }
  .wk { width: 100%; } .wk div { flex: 1; }
  .rp-bar .seg { width: 100%; }
  .grid-t td small, .grid-t th:last-child, .grid-t td.who { display: none; }
  .cell { max-width: none; padding: 9px 6px; }
  .btn.send { width: 100%; justify-content: center; }
}

/* ---------- Tickets ---------- */
.tstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.tstats div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; display: flex; align-items: baseline; gap: 10px; }
.tstats b { font-size: 24px; font-weight: 500; color: var(--navy); }
.tstats span { color: var(--muted); font-size: 13px; }
.tstats .bad b { color: var(--red); }
.kanban { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kcol { background: #ECEEF5; border-radius: 16px; padding: 10px; display: flex; flex-direction: column; min-height: 0; }
.kcol h3 { margin: 2px 4px 10px; font-size: 13.5px; font-weight: 500; color: var(--navy); display: flex; justify-content: space-between; }
.kcol h3 span { background: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.kbody { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.empty { text-align: center; margin: 16px 0; font-size: 13px; }
.tcard { background: #fff; border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.tcard.is-late { border-color: #F5B5B5; box-shadow: inset 3px 0 0 var(--red); }
.tc-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.prio { font-weight: 600; border-radius: 6px; padding: 0 6px; background: var(--soft); color: var(--navy); }
.prio.p-P1 { background: #fde8e8; color: #c22424; } .prio.p-P2 { background: #fdf0e2; color: #b3600f; }
.tid { color: var(--muted); }
.auto { color: var(--purple); font-size: 11px; }
.clock { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.clock.soon { color: var(--orange); } .clock.late { color: var(--red); }
.tc-title { font-size: 13.5px; color: var(--text); font-weight: 400; line-height: 1.35; }
.tc-meta { font-size: 12px; color: var(--text); }
.tag { color: var(--navy); background: var(--soft); border-radius: 6px; padding: 0 6px; margin-right: 4px; }
.tc-wait, .tc-reason { font-size: 12px; color: var(--muted); }
.tc-reason { color: #b3600f; }
.linkbtn.need { color: var(--red); font-size: 12.5px; text-align: left; }
.tc-act { display: flex; gap: 6px; margin-top: 2px; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; color: var(--navy); }
.mini.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; cursor: pointer; font-size: 13px; color: var(--text); }
.pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.fl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text); }
.big-inp { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--text); width: 100%; }
.big-inp:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; }

/* ---------- Personal dashboard ---------- */
.mfs { display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.mf > b { display: block; color: var(--navy); font-weight: 500; margin-bottom: 4px; }
.mf .st { display: grid; grid-template-columns: 1fr auto 56px; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--soft); font-size: 13px; }
.mf .num { color: var(--muted); font-variant-numeric: tabular-nums; } .mf .num b { color: var(--navy); font-weight: 500; }
.mf .st .chip { justify-self: end; }
.miss { overflow: auto; display: flex; flex-direction: column; }
.miss div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--soft); font-size: 13px; }
.miss small { color: var(--muted); }

@media (max-width: 1100px) {
  .kanban { grid-template-columns: 1fr 1fr; }
  .kbody { overflow: visible; }
  .tstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .kanban { grid-template-columns: 1fr; }
  .nav a[href="#/audit"] { display: none; }
  .nav a, .nav button { padding: 6px 4px; font-size: 10.5px; }
}

.clock.calm { color: var(--navy); font-weight: 400; }
.tc-from { font-size: 11.5px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal { max-width: 560px; }

/* ticket detail drawer */
.tcard.clickable { cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.tcard.clickable:hover { border-color: var(--navy); box-shadow: 0 4px 14px rgba(39, 55, 120, .12); }
.drawer-back { position: fixed; inset: 0; background: rgba(30, 37, 71, .28); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { background: #fff; width: min(560px, 94vw); height: 100%; overflow: auto; padding: 20px 24px 28px; box-shadow: -12px 0 40px rgba(30, 37, 71, .18); animation: drin .18s ease-out; }
.drawer.full { width: 100vw; }
@keyframes drin { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.dr-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dr-title { margin: 6px 0 14px; font-size: 21px; font-weight: 500; color: var(--navy); line-height: 1.3; }
.dr-meta { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 8px; font-size: 13.5px; }
.dr-meta dt { color: var(--muted); } .dr-meta dd { margin: 0; }
.drawer h4 { margin: 18px 0 6px; font-weight: 500; color: var(--navy); font-size: 14px; }
.dr-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; background: #F6F7FB; border-radius: 10px; padding: 10px 12px; word-break: break-word; }
.dr-steps { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 8px; }
.dr-act { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.archive { grid-column: 1 / -1; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--panel, #EBEEF6); border-radius: 16px; padding: 14px; }
.archive .kbody { overflow: auto; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; align-content: start; }

/* ticket dashboard */
.tstory { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); }
.tstory b { font-weight: 500; color: var(--navy); }
.tstats.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tstats .warnc b { color: #C77A12; }
.tdash { flex: 1; min-height: 0; display: grid; align-items: start; grid-template-columns: 1.9fr .85fr 1.05fr; gap: var(--gap); }
.tdash .card { min-height: 0; display: flex; flex-direction: column; }
.tdash .scroll { flex: 1; min-height: 0; overflow: auto; }
.tptable td, .tptable th { padding: 7px 6px; font-size: 13px; white-space: nowrap; }
.tptable .tbad { color: var(--red); font-weight: 500; }
.tchart { width: 100%; height: auto; max-height: 340px; }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: middle; }
.attl { display: flex; flex-direction: column; gap: 6px; }
.attrow { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: #F6F7FB; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.attrow:hover { border-color: var(--navy); }
.attrow .chip { flex-shrink: 0; }
@media (max-width: 1100px) { .tdash { grid-template-columns: 1fr; } .tstats.five { grid-template-columns: repeat(2, 1fr); } }

/* A: workload strip */
.ldstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ld { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0; font: inherit; line-height: 1.2; }
.ld span { font-size: 10.5px; color: var(--muted); } .ld b { font-size: 11.5px; font-weight: 500; color: var(--text); } .ld i { font-style: normal; font-size: 13px; font-weight: 500; }
.ld-good i { color: #5d7a12; } .ld-warn { background: #fdf6ec; } .ld-warn i { color: #b3600f; } .ld-bad { background: #fdeeee; } .ld-bad i { color: #c22424; }
.ld.on { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy) inset; }
.ldmsg { margin: 6px 0 0; min-height: 18px; }

.btn.danger { background: #fff; color: var(--red); border: 1px solid #F5B5B5; }
.btn.danger:hover { background: #fde8e8; }
.modal .btn.danger { background: var(--red); color: #fff; border: 0; }

/* toasts, menu badge, ticket header, due picker */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, 92vw); }
.toast { background: var(--navy); color: #fff; border-radius: 12px; padding: 10px 12px 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(30, 37, 71, .3); animation: drin .18s ease-out; }
.toast span { flex: 1; } .toast b { font-weight: 500; }
.toast .linkbtn { color: #E5B243; font-weight: 500; }
.toast .tx { background: none; border: 0; color: #fff; opacity: .7; font-size: 18px; cursor: pointer; line-height: 1; }
.nbadge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 500; border-radius: 99px; padding: 1px 7px; line-height: 16px; }
.tkhead { flex-wrap: nowrap; }
.tkhead > div:first-child { flex-shrink: 0; }
.tkhead p { white-space: nowrap; }
.btn[disabled], .pill[disabled] { opacity: .65; cursor: progress; }
.pill.sm { padding: 4px 10px; font-size: 12.5px; }
.dp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dp-quick { margin-top: 4px; }
@media (max-width: 900px) { .tkhead { flex-wrap: wrap; } }

.dr-asg { padding: 5px 8px; font-size: 13.5px; max-width: 100%; }
.dr-more { position: relative; }
.dr-menu { position: absolute; right: 0; top: 34px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(30,37,71,.15); white-space: nowrap; z-index: 5; }
.dr-menu[hidden] { display: none; }
@media (max-width: 900px) { #toasts { left: 12px; right: 12px; bottom: 84px; max-width: none; } }

/* ---- Khách hàng (CRM) ---- */
.crm-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); margin: 14px 0; }
.crm-kpis .card { padding: 10px 14px; cursor: pointer; }
.crm-kpis .card b { display: block; font-size: 24px; font-weight: 500; color: var(--navy); line-height: 1.2; }
.crm-kpis .card span { font-size: 12px; color: var(--muted); }
.crm-kpis .card.on { outline: 2px solid var(--navy-2); }
.crm-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.crm-bar .inp { padding: 7px 10px; }
.crm-tbl tr.row { cursor: pointer; }
.crm-tbl tr.row:hover td { background: #F6F7FB; }
.crm-tbl td small { color: var(--muted); display: block; font-size: 11.5px; }
.crm-f { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.crm-f label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.crm-f label.w2 { grid-column: 1 / -1; }
.crm-f input, .crm-f select, .crm-f textarea { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; font: inherit; font-size: 14px; color: var(--text); min-width: 0; }
.crm-f input:disabled, .crm-f select:disabled, .crm-f textarea:disabled { background: #F6F7FB; color: var(--muted); }
.crm-stu { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.crm-stu .t { font-size: 12.5px; color: var(--navy); font-weight: 500; margin-bottom: 6px; display: flex; justify-content: space-between; }
.crm-hist { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
@media (max-width: 760px) { .crm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .crm-f { grid-template-columns: 1fr; } }

.crm-funnel { margin: 6px 0; }
.crm-funnel .fr { display: grid; grid-template-columns: 84px 1fr 36px; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.crm-funnel .bar { background: #EDEFF5; border-radius: 6px; height: 14px; overflow: hidden; }
.crm-funnel .bar i { display: block; height: 100%; background: var(--navy); border-radius: 6px; }
.crm-funnel em { font-style: normal; color: var(--muted); text-align: right; }
.crm-tabs { max-width: 100%; overflow-x: auto; }

/* v1.3.1: "Câu trả lời hôm nay" gọn, không dãn khoảng trống */
.board > .card:last-child { align-self: start; height: auto; }
.story { flex: none; justify-content: flex-start; gap: 0; }
.story li { padding: 8px 0; border-top: 1px solid var(--line); }
.story li:first-child { border-top: 0; padding-top: 0; }
.story li:last-child { padding-bottom: 0; }
.story li > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.story b { display: inline; }
.story p { display: inline; }
@media (max-width: 1100px) { .board > .card:last-child { align-self: stretch; } .story { flex: none; } }

/* ===================== v1.4 ===================== */
/* Dashboard: two compact columns, rows keep a natural height (no stretched empty space) */
.board2 { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.board2 .col > .card { flex: 0 1 auto; }
.board2 .col > .card.fill { flex: 1 1 0; min-height: 180px; }
.board2 .col > .card:first-child { overflow: auto; }
.board2 .rank { flex: none; justify-content: flex-start; gap: 10px; }
.board2 .rk { min-height: 28px; }
.board2 .story { flex: 1; min-height: 0; overflow: auto; }

/* Personal page: every list scrolls inside its own card */
.meboard { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); }
.meboard > .col > .card { flex: 1 1 0; min-height: 0; overflow: hidden; }
.meboard .kbody, .meboard .miss, .meboard .mfs { flex: 1; min-height: 0; overflow: auto; }
.kbody > * { flex-shrink: 0; }
.redtxt { color: var(--red); }
@media (max-width: 1100px) { .meboard { grid-template-columns: 1fr; } .meboard > .col > .card { flex: none; } .board2 { grid-template-columns: 1fr; } .board2 .col > .card.fill { min-height: 0; } }

/* Countdown: calm -> warm -> hot -> crit -> late. Friendly words, louder colour. */
.clock { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-weight: 600; font-size: 12.5px; background: var(--soft); color: var(--navy); font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.clock::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.clock.calm { background: transparent; font-weight: 400; padding: 0; }
.clock.calm::before { display: none; }
.clock.warm { background: #FFF1D6; color: #8A5200; }
.clock.hot { background: #FFE0BD; color: #A83F00; font-size: 13.5px; }
.clock.crit { background: #FFCFC5; color: #A91C0C; font-size: 14px; animation: cxpulse 1.4s ease-in-out infinite; }
.clock.late { background: var(--red); color: #fff; font-size: 14px; animation: cxpulse 1.8s ease-in-out infinite; }
.clock.late::before { background: #fff; opacity: 1; }
@keyframes cxpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(235, 59, 59, .45); } 50% { box-shadow: 0 0 0 6px rgba(235, 59, 59, 0); } }
.tcard[data-lv="warm"] { border-color: #F3D9A4; }
.tcard[data-lv="hot"] { border-color: #F2B27A; background: #FFFAF4; }
.tcard[data-lv="crit"] { border-color: #EE8A7A; background: #FFF6F4; }
.tcard.is-late { border-color: var(--red); background: #FFF0F0; box-shadow: inset 5px 0 0 var(--red), 0 2px 10px rgba(235, 59, 59, .18); }
.tcard.is-late .tc-title { color: #8E1B1B; font-weight: 500; }
.tprog { height: 5px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.tprog i { display: block; height: 100%; width: 0; background: var(--lime); transition: width 1s linear; }
.tcard[data-lv="warm"] .tprog i { background: #F2B21E; }
.tcard[data-lv="hot"] .tprog i { background: var(--orange); }
.tcard[data-lv="crit"] .tprog i, .tcard.is-late .tprog i { background: var(--red); }
.tc-urge { font-size: 12px; color: #A83F00; }
.tc-urge:empty { display: none; }
.tcard.is-late .tc-urge { color: #A91C0C; font-weight: 500; }
.tc-hit { font-size: 12px; color: #fff; background: var(--red); border-radius: 8px; padding: 5px 8px; }
.tc-stuck { font-size: 12px; color: var(--muted); }
.tc-stuck.risk, .tc-stuck.nudge { color: #B3600F; }

/* Automatic progress track on every ticket */
.trk { display: flex; gap: 3px; }
.trk span { flex: 1; text-align: center; font-size: 10.5px; padding: 2px 0; border-radius: 6px; background: var(--soft); color: var(--muted); }
.trk span.on { background: #DCE3F7; color: var(--navy); }
.trk span.blk { background: #FFE0BD; color: #A83F00; }

/* "Save in background" pill */
.sync { position: fixed; left: 16px; bottom: 16px; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; font-size: 13px; display: flex; gap: 8px; align-items: center; box-shadow: 0 6px 20px rgba(30, 37, 71, .15); transition: opacity .4s; }
.sync.ok { color: #5d7a12; }
.sync.err { color: #A91C0C; border-color: #F5B5B5; border-radius: 12px; max-width: min(520px, 90vw); }
.sync.gone { opacity: 0; pointer-events: none; }
.sync .tx { border: 0; background: none; font-size: 18px; cursor: pointer; color: inherit; }
.spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: cxspin .8s linear infinite; }
@keyframes cxspin { to { transform: rotate(360deg); } }
@media (max-width: 760px) { .sync { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* Leader inbox / FYI / radar rows */
.ib { background: #F6F7FB; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; border: 1px solid transparent; }
.ib:hover { border-color: var(--navy); }
.ib-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.ib-sub { font-size: 12px; color: var(--muted); }
.ib-ctx { font-size: 12.5px; background: #fff; border-radius: 8px; padding: 6px 8px; word-break: break-word; }
.ib-act { display: flex; gap: 6px; flex-wrap: wrap; }
.rd { padding: 8px 4px; border-bottom: 1px solid var(--soft); cursor: pointer; font-size: 13px; }
.rd:hover { background: #F6F7FB; }
.h-risk, .h-late { color: #A91C0C; } .h-nudge { color: #B3600F; }
.rdsum { margin: -4px 0 8px; }
.tdash .col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.tdash .col > .card { flex: 1 1 0; min-height: 0; }
.twarn { color: #C77A12; font-weight: 500; }

/* v1.5: chart fills its card at a friendly size; empty rows folded */
.board2 .chartcard { min-height: 0; }
.board2 .chartcard .chartbox { flex: 1; align-items: center; min-height: 200px; }
.board2 .chartcard .chartbox svg { width: 100%; height: auto; max-height: 100%; }
.rkrest { margin: 8px 0 0; }

/* v1.5 compact ticket card */
.tcard { padding: 12px 14px; }
.tcard .tc-title { margin: 4px 0 6px; line-height: 1.3; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; margin-top: 8px; }
.tc-urge:empty { display: none; }
.tc-urge { font-size: 12.5px; margin-top: 6px; font-weight: 500; }
.tcard .trk { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.tcard .trk i { width: 22px; height: 4px; border-radius: 3px; background: #E4E7F2; display: block; flex: none; }
.tcard .trk i.on { background: var(--navy); }
.tcard .trk i.blk { background: #E0A63A; }
.tcard .trk-t { margin-left: 6px; font-size: 12px; color: var(--muted); }
.tcard .trk-t.nudge, .tcard .trk-t.risk { color: #B7791F; }
.tcard .trk-t.late { color: #C0392B; }
.tcard .tc-reason { font-size: 12.5px; margin-top: 6px; }
.tcard .trk .trk-t { flex: none; background: none; padding: 0; text-align: left; border-radius: 0; }

/* v1.5 drawer: roomier meta, tidy actions */
.dr-late { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #FDEBEB; border-radius: 12px; padding: 10px 14px; margin: 14px 0 16px; font-size: 13.5px; color: #A32626; }
.btn.sm { padding: 6px 14px; font-size: 13px; }
.dr-meta { gap: 12px 16px; margin: 4px 0 14px; }
.dr-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.chipbtn { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
.chipbtn:hover { background: var(--soft); }
.chipbtn.on { background: #E8ECFA; border-color: #B9C3EA; }

/* v1.5 card header links and team progress stats */
.morelink { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--navy); background: var(--soft); border-radius: 999px; padding: 4px 12px; text-decoration: none; white-space: nowrap; }
.morelink:hover { background: #E8ECFA; }
.morelink span { font-size: 15px; line-height: 1; }
.rdstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 12px; }
.rds { background: var(--soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.rds b { font-size: 20px; font-weight: 500; color: var(--navy); line-height: 1.1; }
.rds span { font-size: 12px; color: var(--muted); }
.rds.warn b { color: #C77A12; }
@media (max-width: 520px) { .rdstats { grid-template-columns: repeat(2, 1fr); } }

/* v1.5 customer status: every stage has its own colour, SLA late is a small red line */
.s-new { color: #2B4BB5; background: #E8EEFC; }
.s-prog { color: #6B3FA0; background: #F1EAFB; }
.s-book { color: #0E7C86; background: #E1F4F5; }
.stcell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sla-late { font-size: 11.5px; color: #C22424; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.sla-late::before { content: '⏱'; font-size: 11px; }

/* v1.5: Người liên quan */
.rels { display: flex; flex-direction: column; gap: 6px; }
.relrow { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: #fff; }
.relrow .rr { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr auto auto; gap: 8px; align-items: center; }
.relrow .rr input, .relrow .rr select { border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; font: inherit; font-size: 13.5px; min-width: 0; background: #fff; color: var(--text); }
.relrow .rref { flex-direction: row; align-items: center; gap: 4px; white-space: nowrap; font-size: 12.5px; color: var(--navy); }
.relrow .rsug, .relrow .rlinked { font-size: 12.5px; margin-top: 6px; color: var(--muted); }
.relrow .rlinked { color: var(--navy); }
.refbox { margin: 8px 0 12px; }
@media (max-width: 560px) { .relrow .rr { grid-template-columns: 1fr 1fr; } }

/* v1.5: Phân tích */
.an-body { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.an-ks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.an-k { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 2px; }
.an-k b { font-size: 24px; font-weight: 500; color: var(--navy); }
.an-k span { font-size: 12px; color: var(--muted); }
.an-k.good { border-color: #BFE3CC; } .an-k.warn { border-color: #F3D9A4; } .an-k.bad { border-color: #F0B9B9; }
.an-k.bad b, .an-t td.bad { color: var(--red); }
.an-bars { display: flex; flex-direction: column; gap: 8px; }
.an-bar { display: grid; grid-template-columns: 90px 1fr 160px; gap: 10px; align-items: center; font-size: 13px; }
.an-bar .t { position: relative; height: 18px; background: #F2F4FA; border-radius: 9px; overflow: hidden; }
.an-bar .t i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 9px; }
.an-bar .t i.p { background: #D9DEF0; } .an-bar .t i.a { background: var(--navy); opacity: .9; height: 8px; top: 5px; }
.an-bar .v { color: var(--muted); font-size: 12.5px; }
.an-say { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.an-src { margin: 0; font-size: 12px; }
.an-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-t th, .an-t td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.an-t .n { text-align: right; font-variant-numeric: tabular-nums; }
.an-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #EEF0F8; color: var(--navy); }
.an-tag.hold { background: #E3F4EA; } .an-tag.push { background: #FBE5E5; } .an-tag.untapped { background: #FCEFD6; } .an-tag.outside { background: #E8EEFB; }
.an-swg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.an-sw { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; }
.an-sw h4 { margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--navy); }
.an-sw ul { margin: 0; padding-left: 18px; font-size: 13px; } .an-sw li { margin-bottom: 6px; } .an-sw li small { display: block; color: var(--muted); }
.an-ta { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13.5px; resize: vertical; }
.an-pf { display: grid; grid-template-columns: 1.4fr 130px 1.6fr; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.an-pf small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.an-pf select, .an-pf textarea { border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; font: inherit; font-size: 13.5px; }
.an details summary { cursor: pointer; font-size: 13px; color: var(--navy); }
@media (max-width: 700px) { .an-swg, .an-pf { grid-template-columns: 1fr; } .an-bar { grid-template-columns: 70px 1fr; } .an-bar .v { grid-column: 1 / -1; } }

/* v1.5.1: form khách hàng gọn */
.crm-f .w2x { grid-column: 1 / -1; min-width: 0; }
.crm-f details > summary { cursor: pointer; font-size: 13px; color: var(--navy); width: fit-content; }
.rels { display: flex; flex-direction: column; gap: 6px; }
.relrow { padding: 8px 10px; }
.relrow .rr { display: flex; gap: 8px; align-items: center; }
.relrow .rr select { flex: 0 0 118px; width: 118px; }
.relrow .rr input[name="rname"] { flex: 1 1 auto; width: auto; min-width: 0; }
.relrow .rr2 { margin-top: 6px; }
.relrow .rtelbox { flex-direction: row; align-items: center; gap: 8px; }
.relrow .rtelbox input { flex: 1; }
.relrow .rtel { font-size: 12.5px; margin-top: 4px; }
.relrow .rref input { flex: 0 0 auto; width: 16px; }
.relrow .rdel { flex: 0 0 auto; }

/* v1.5.1: Phân tích, kiểu gọn và thoáng */
.an { max-width: 1080px; margin: 0 auto; }
.an-st { font-size: 12.5px; color: var(--muted); align-self: center; } .an-st.ok { color: #2E8B57; } .an-st.err { color: var(--red); }
.an-tabs { display: flex; gap: 4px; background: #EEF0F6; padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.an-tabs button { border: 0; background: none; padding: 7px 16px; border-radius: 9px; cursor: pointer; color: #5C6384; font: inherit; font-size: 14px; white-space: nowrap; }
.an-tabs button.on { background: #fff; color: var(--navy); font-weight: 500; box-shadow: 0 1px 3px rgba(20,30,80,.12); }
.an-body { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.an-card { background: #fff; border: 1px solid #ECEEF5; border-radius: 20px; padding: 20px 24px; box-shadow: 0 1px 2px rgba(20,30,80,.03), 0 8px 24px rgba(39,55,120,.05); }
.an-k { border-radius: 18px; border: 0; background: #fff; box-shadow: 0 1px 2px rgba(20,30,80,.03), 0 8px 24px rgba(39,55,120,.05); }
.an-k.good { background: #F1F9F4; } .an-k.warn { background: #FFF8EA; } .an-k.bad { background: #FDF1F1; }
/* Ansoff */
.an-ans { display: grid; grid-template-columns: 64px 1.5fr 1fr; gap: 12px; align-items: stretch; }
.an-ax { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.3; }
.an-ax.c { padding-bottom: 2px; font-weight: 500; letter-spacing: .02em; }
.an-q { border-radius: 22px; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-height: 190px; }
.an-q h4 { margin: 0; font-size: 16px; font-weight: 600; color: var(--navy); } .an-q .sub { margin: 0; font-size: 12.5px; }
.an-q.q1 { background: #F3F5FC; } .an-q.q3 { background: #F6F2FB; } .an-q.q2 { background: #EFF8F3; } .an-q.q4 { background: #FDF6EA; }
.an-heat { display: grid; gap: 6px; align-items: center; margin: 6px 0; }
.an-heat .h { font-size: 12px; color: var(--muted); text-align: center; } .an-heat .rl { font-size: 13px; color: var(--navy); }
.an-tile { border-radius: 12px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; line-height: 1.15; background: #fff; }
.an-tile b { font-size: 18px; font-weight: 500; } .an-tile span { font-size: 11px; color: var(--muted); }
.an-tile.hold { background: #D8F0E2; } .an-tile.push { background: #F9D9D9; } .an-tile.untapped { background: #FBEBC8; } .an-tile.none { background: #fff; opacity: .5; min-height: 40px; }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; } .an-chip { background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; color: var(--navy); }
.an-note { width: 100%; border: 0; outline: 0; background: transparent; resize: none; font: inherit; font-size: 14.5px; line-height: 1.6; color: var(--text); padding: 0; min-height: 96px; }
.an-note:focus { background: rgba(255,255,255,.6); border-radius: 8px; }
.an-legend { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; justify-content: center; }
.an-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-left: 10px; } .an-legend i.hold { background: #D8F0E2; } .an-legend i.push { background: #F9D9D9; } .an-legend i.untapped { background: #FBEBC8; } .an-legend i.none { background: #fff; border: 1px solid #DDE0EC; }
/* SWOT */
.an-swg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 920px; margin: 0 auto; width: 100%; }
.an-sw { border-radius: 24px; padding: 22px 26px 24px; min-height: 250px; display: flex; flex-direction: column; gap: 12px; }
.an-sw .hd { display: flex; align-items: baseline; gap: 10px; } .an-sw .hd b { font-size: 34px; font-weight: 600; line-height: 1; } .an-sw .hd span { font-size: 16px; font-weight: 500; color: var(--navy); }
.an-sw.g { background: #EEF8F2; } .an-sw.g .hd b { color: #2E8B57; } .an-sw.r { background: #FCF0F0; } .an-sw.r .hd b { color: #D04A4A; }
.an-sw.o { background: #EFF3FC; } .an-sw.o .hd b { color: #3E63C9; } .an-sw.t { background: #FDF5E8; } .an-sw.t .hd b { color: #D9922B; }
.an-sw ul { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.5; } .an-sw li { margin-bottom: 10px; } .an-sw li small { display: block; color: var(--muted); font-size: 13px; }
.an-sw .empty { margin: 0; color: var(--muted); font-size: 14px; }
/* Porter */
.an-pt { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.an-radar { width: 100%; height: auto; }
.an-pfs { display: flex; flex-direction: column; gap: 12px; }
.an-pf { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.an-pf .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; } .an-pf .top b { font-size: 15px; font-weight: 600; color: var(--navy); }
.an-lv { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: #EEF0F6; color: #5C6384; } .an-lv.good { background: #E3F4EA; color: #2E7A4D; } .an-lv.warn { background: #FFF0D2; color: #9A6A12; } .an-lv.bad { background: #FBE2E2; color: #B03A3A; }
.an-pf .evid { margin: 0; font-size: 12.5px; color: #3E63C9; background: #EFF3FC; border-radius: 10px; padding: 6px 10px; }
.an-pf .q { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; } .an-pf .q > span:first-child { flex: 1; min-width: 0; }
.dots { display: inline-flex; gap: 4px; flex: 0 0 auto; } .dots button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #DDE0EC; background: #fff; cursor: pointer; font: inherit; font-size: 12.5px; color: #5C6384; padding: 0; }
.dots button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.an-ln { border: 0; border-bottom: 1px solid #ECEEF5; outline: 0; font: inherit; font-size: 13.5px; padding: 4px 0; background: transparent; }
@media (max-width: 860px) { .an-ans { grid-template-columns: 1fr; } .an-ax { display: none; } .an-swg, .an-pt { grid-template-columns: 1fr; } }

/* Phụ huynh: mỗi người một khối gọn */
.crm-f .par { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; background: #F7F8FC; border-radius: 12px; padding: 10px 12px; }
.crm-f .par .pt { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--navy); }
.crm-f .par label.w2 { grid-column: 1 / -1; }

/* Porter v2: biểu đồ lớn bên trái (dính khi cuộn), phần chấm điểm nhỏ gọn bên phải */
.an-pt { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.an-radarbox { position: sticky; top: 16px; padding: 20px 24px; }
.an-pfs { gap: 8px; }
.an-pf { padding: 10px 14px; gap: 5px; border-radius: 16px; }
.an-pf .top b { font-size: 13.5px; } .an-lv { font-size: 11.5px; padding: 2px 8px; }
.an-pf .evid { font-size: 11.5px; padding: 4px 8px; }
.an-pf .q { font-size: 12px; gap: 8px; }
.dots { gap: 2px; } .dots button { width: 22px; height: 22px; font-size: 11px; }
.an-ln { font-size: 12px; padding: 2px 0; }
@media (max-width: 860px) { .an-pt { grid-template-columns: 1fr; } .an-radarbox { position: static; } }

/* Avatar có ảnh */
.avatar { position: relative; overflow: hidden; cursor: pointer; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Design Thinking */
.dt { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.dt h2 { margin: 0; font-size: 22px; font-weight: 600; color: var(--navy); } .dt h4 { margin: 8px 0 0; }
.dt-hero { background: #fff; border: 1px solid #ECEEF5; border-radius: 24px; padding: 22px 26px; display: flex; flex-direction: column; gap: 10px; }
.dt-hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.dt-new { display: flex; gap: 10px; margin-top: 4px; } .dt-new input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font: inherit; font-size: 15px; }
.dt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dt-card { text-align: left; background: #fff; border: 1px solid #ECEEF5; border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; font: inherit; color: var(--text); transition: box-shadow .15s; }
.dt-card:hover { box-shadow: 0 6px 20px rgba(39,55,120,.08); } .dt-card b { font-size: 15px; font-weight: 600; color: var(--navy); }
.dt-dots { display: flex; gap: 5px; } .dt-dots i { width: 22px; height: 6px; border-radius: 3px; background: #E4E7F1; } .dt-dots i.ok { background: #5CBD8A; } .dt-dots i.cur { background: var(--navy); }
.dt-tags { display: flex; gap: 6px; min-height: 0; } .dt em { font-style: normal; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: #EEF0F6; color: #5C6384; }
.dt em.ok { background: #E3F4EA; color: #2E7A4D; } .dt em.bad { background: #FBE2E2; color: #B03A3A; } .dt em.wait { background: #FFF0D2; color: #9A6A12; } .dt em.off { background: #EEF0F6; }
.dt-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; } .dt-top > div { flex: 1; min-width: 200px; } .dt-top .sub { margin: 2px 0 0; }
.dt-stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.dt-st { background: #fff; border: 1px solid #ECEEF5; border-radius: 16px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font: inherit; color: var(--text); }
.dt-st .n { width: 24px; height: 24px; border-radius: 50%; background: #EEF0F6; display: grid; place-items: center; font-size: 12px; color: #5C6384; }
.dt-st b { font-size: 13px; font-weight: 600; } .dt-st small { font-size: 11px; color: var(--muted); text-align: center; }
.dt-st.on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy) inset; } .dt-st.on .n { background: var(--navy); color: #fff; } .dt-st.ok .n { background: #5CBD8A; color: #fff; }
.dt-st:disabled { opacity: .45; cursor: default; }
.dt-card2 { background: #fff; border: 1px solid #ECEEF5; border-radius: 24px; padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.dt-sh { display: flex; gap: 14px; align-items: flex-start; } .dt-sh .n { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.dt-sh h3 { margin: 0; font-size: 19px; font-weight: 600; color: var(--navy); } .dt-sh h3 small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; } .dt-sh p { margin: 2px 0 0; font-size: 14px; color: #3C4468; }
.dt-time { margin-left: auto; font-size: 12px; color: var(--muted); background: #F4F6FB; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.dt-tips summary { cursor: pointer; font-size: 13px; color: #3E63C9; width: fit-content; } .dt-tips ul { margin: 8px 0 0; padding-left: 20px; font-size: 13.5px; color: #3C4468; line-height: 1.55; }
.dt-fs { display: flex; flex-direction: column; gap: 14px; }
.dt-f { display: flex; flex-direction: column; gap: 5px; } .dt-f .lb { font-size: 13px; font-weight: 500; color: #3C4468; } .dt-f .lb i { color: #D04A4A; font-style: normal; } .dt-f small { color: var(--muted); font-size: 12px; }
.dt-f input, .dt-f select, .dt-f textarea { border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: 14.5px; min-width: 0; background: #fff; color: var(--text); }
.dt-f textarea { resize: vertical; line-height: 1.5; } .dt-f input:disabled, .dt-f select:disabled, .dt-f textarea:disabled { background: #F6F7FB; color: var(--muted); }
.dt-rows { display: flex; flex-direction: column; gap: 6px; }
.dt-rh, .dt-r { display: grid; gap: 8px; align-items: center; } .dt-rh span { font-size: 11.5px; color: var(--muted); }
.dt-r input, .dt-r select { width: 100%; }
.dt-ck { display: flex; justify-content: center; } .dt-ck input { width: 18px; height: 18px; padding: 0; }
.dt-x { width: 28px; height: 28px; border-radius: 50%; border: 0; background: #F1F2F8; color: #7A819F; cursor: pointer; font-size: 16px; line-height: 1; }
.dt-ex { background: #EFF3FC; border-radius: 16px; padding: 12px 16px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; } .dt-ex p { margin: 0; line-height: 1.55; } .dt-ex ul { margin: 4px 0 0; padding-left: 20px; } .dt-ex li em { background: #fff; color: #3E63C9; margin-left: 6px; }
.dt-nav { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; } .dt-fw { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; margin-left: auto; }
.dt-miss { margin: 0; font-size: 12.5px; color: #9A6A12; background: #FFF6E0; border-radius: 10px; padding: 6px 10px; text-align: right; }
.dt-rv { border-top: 1px solid #ECEEF5; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; } .dt-rv p { margin: 0; font-size: 14px; } .dt-cm { background: #F7F8FC; border-radius: 12px; padding: 8px 12px; }
.dt-rv textarea { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font: inherit; }
@media (max-width: 760px) { .dt-stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dt-card2, .dt-hero { padding: 16px; } .dt-rh { display: none; } .dt-r { grid-template-columns: 1fr 28px !important; } }

.dt-perf { width: 100%; border-collapse: collapse; font-size: 13.5px; } .dt-perf th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 6px 10px; } .dt-perf td { padding: 8px 10px; border-top: 1px solid #ECEEF5; } .dt-perf .n { text-align: right; }

.dt-tabs { align-self: flex-start; }
.dt-mr { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid #ECEEF5; flex-wrap: wrap; }
.dt-mi { display: flex; flex-direction: column; gap: 2px; min-width: 200px; flex: 1; } .dt-mi b { font-size: 14.5px; color: var(--navy); } .dt-last { color: #3E63C9; }
.dt-md { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .dt-note { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 13px; width: 200px; }
.dt-md .btn { padding: 6px 12px; font-size: 13px; }

.dt-arch { background: #fff; border: 1px solid #ECEEF5; border-radius: 16px; padding: 10px 16px; } .dt-arch summary { cursor: pointer; font-size: 13.5px; color: var(--muted); }
.dt-ar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #ECEEF5; font-size: 14px; margin-top: 6px; }

/* ---------- Phone: quick-look layout ---------- */
@media (max-width: 760px) {
  body { overflow-x: clip; }
  .side .logout { display: none; }
  .nav a, .nav button { flex: 1; min-width: 0; padding: 6px 2px; font-size: 11px; text-align: center; }
  /* Cards grow with their content (they were cut off at a fixed height) */
  .main.fit { display: block; }
  .board { display: flex; flex-direction: column; gap: var(--gap); }
  .board, .col, .board .card, .board2 .col > .card, .board2 .col > .card.fill { min-height: 0; height: auto; flex: none; overflow: visible; }
  .board2 .col > .card:first-child { overflow: visible; }
  .board2 .story { flex: none; overflow: visible; }
  .story, .rank { flex: none; min-height: 0; }
  .chartbox, .board2 .chartcard .chartbox { flex: none; height: 190px; min-height: 0; }
  .phone-only { text-align: center; padding: 28px 20px; }
  .phone-only .btn { display: inline-block; margin-top: 12px; text-decoration: none; }
}

/* ===== v1.6: huong dan tung buoc + nut ? ===== */
#tour-help { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 14px; z-index: 60; width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 1.5px solid var(--navy); background: var(--card); color: var(--navy); font: 500 15px/1 'Lexend', system-ui, sans-serif; cursor: pointer; display: grid; place-items: center; }
#tour-help:hover { background: var(--navy); color: #fff; }
.main .head, .main .rp-head, .main .rpt-hello { padding-right: 40px; }
#tourlist { text-align: left; padding: 6px 12px; }
@media (max-width: 760px) { #tourlist { display: none; } }
#tour-root .tour-dim { position: fixed; inset: 0; z-index: 100000; background: rgba(20, 28, 64, .58); pointer-events: none; }
#tour-root .tour-spot { position: fixed; z-index: 100000; border-radius: 12px; border: 2px solid var(--gold); box-shadow: 0 0 0 9999px rgba(20, 28, 64, .58); pointer-events: none; transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease; }
#tour-root .tour-card { position: fixed; z-index: 100001; width: 340px; max-width: calc(100vw - 20px); background: #fff; color: var(--text); border-radius: 14px; box-shadow: 0 14px 44px rgba(20, 28, 64, .38); padding: 14px 16px 12px; font-size: 14px; }
.tour-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--navy); font-weight: 500; font-size: 13px; }
.tour-h b { font-weight: 400; color: var(--muted); }
.tour-card p { margin: 8px 0 12px; line-height: 1.5; font-size: 15px; }
.tour-b { display: flex; align-items: center; gap: 8px; }
.tour-b button { font: inherit; font-size: 13px; cursor: pointer; border-radius: 10px; padding: 7px 14px; border: 1px solid var(--line); background: #fff; color: var(--navy); }
.tour-b .tour-next { background: var(--navy); color: #fff; border-color: var(--navy); }
.tour-b .tour-next:disabled { opacity: .4; cursor: default; }
.tour-b .tour-skip { border: 0; background: none; color: var(--muted); padding-left: 0; }
.tour-card p.tour-pass { margin: 8px 0 0; font-size: 12px; }
.tour-pass button { border: 0; background: none; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font: inherit; }
.tl { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; max-height: 46vh; overflow: auto; }
.tl-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.tl-row:hover { background: var(--soft); }
.tl-ck { width: 18px; color: var(--lime); font-weight: 600; }
.tl-row small { color: var(--muted); }
.tl-tb { width: 100%; font-size: 13px; border-collapse: collapse; }
.tl-tb td { padding: 4px 6px; border-top: 1px solid var(--line); }
.tl-tb td:last-child { text-align: right; }

/* ======================================================================
   v1.8 - Tinh chinh UI/UX (giu nguyen mau Victoria + Lexend).
   Y tuong chuyen dong lay tu Lucian UX/UI Prompt (MIT, (c) 2026 Seokwoooo): #436 #438 #424 #403.
   Quy tac: chuyen dong ngan, co y nghia, tat het khi nguoi dung bat "giam chuyen dong".
   ====================================================================== */
:root { --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.45, .64, 1); }
:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 2px; }
.kpi .big, .tcard .cd, td.n, .an-t td { font-variant-numeric: tabular-nums; }

/* Nut: nay nhe khi bam, tab/seg doi mau muot */
.btn { transition: background-color .15s, transform .4s var(--spring), box-shadow .2s; }
.btn:active:not(:disabled) { transform: scale(.96); transition-duration: .1s; }
.seg button, .an-tabs button, .ptabs button { transition: background-color .2s var(--ease), color .2s, box-shadow .2s; }

/* Hop thoai: truot len nhe thay vi hien ngay */
.modal-back { animation: v18fade .18s var(--ease); }
.modal { animation: v18pop .45s var(--spring); }
@keyframes v18fade { from { opacity: 0; } }
@keyframes v18pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.toast { animation: v18pop .4s var(--spring); }

/* Hop xac nhan xoa (#436): mac dinh o "Huy", bam Xoa moi nguy hiem */
.cfm { text-align: left; }
.cfm .actions { justify-content: flex-end; }
.cfm-ic { width: 52px; height: 52px; border-radius: 16px; margin-bottom: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.cfm-ic svg { width: 32px; height: 32px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cfm-ic .lid { transform-box: view-box; transform-origin: 6px 9.5px; animation: v18lid .9s .15s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes v18lid { 0%, 100% { transform: none; } 30%, 55% { transform: rotate(-32deg); } 75% { transform: rotate(5deg); } }
.btn.danger-solid { background: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #d22f2f; }

/* Nut luu (#438): quay khi dang luu, sang xanh lime + dau tick khi xong */
.btn .spin { display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: v18spin .7s linear infinite; }
@keyframes v18spin { to { transform: rotate(360deg); } }
.btn[aria-busy="true"] { opacity: .85; }
.flash-ok { animation: v18ok 1.1s var(--ease); }
.flash-ok::before { content: '\2713'; margin-right: 6px; font-weight: 600; }
@keyframes v18ok { 0% { box-shadow: 0 0 0 0 rgba(164, 198, 57, .7); } 100% { box-shadow: 0 0 0 10px rgba(164, 198, 57, 0); } }

/* Gap/mo muot cho "Them chi tiet", "Them dia chi"... (#424). Trinh duyet cu van mo/dong binh thuong */
details { interpolate-size: allow-keywords; }
details::details-content { block-size: 0; overflow: hidden; transition: block-size .4s var(--ease), content-visibility .4s allow-discrete; }
details[open]::details-content { block-size: auto; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(-45deg); transition: transform .35s var(--spring); }
details[open] > summary::before { transform: translateY(-3px) rotate(45deg); }

/* Dang nhap (#403): nhan noi len khi go, mat hien/an mat khau, lac nhe khi sai */
.login .fl { position: relative; }
.login .fl .inp { width: 100%; height: 50px; padding: 20px 44px 6px 12px; }
.login .fl label { position: absolute; left: 13px; top: 15px; font-size: 14px; color: var(--muted); transform-origin: left top; pointer-events: none; transition: transform .35s var(--spring), color .2s; }
.login .fl .inp:focus ~ label, .login .fl .inp:not(:placeholder-shown) ~ label { transform: translateY(-9px) scale(.76); }
.login .fl .inp:focus ~ label { color: var(--navy); }
.login .eye { position: absolute; right: 6px; top: 8px; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.login .eye:hover { background: var(--soft); color: var(--navy); }
.login .eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.login .eye .slash { transition: opacity .2s; }
.login .eye[aria-pressed="true"] .slash { opacity: 0; }
.login .err:not(:empty) { animation: v18pop .35s var(--spring); }
.login .box.shake { animation: v18shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes v18shake { 15% { transform: translateX(-7px); } 35% { transform: translateX(6px); } 55% { transform: translateX(-4px); } 75% { transform: translateX(2px); } }

/* Chan thanh ben: Huong dan + Dang xuat cung mot hang cho gon */
.side-foot { display: flex; gap: 14px; align-items: center; margin: 4px 8px 0; }
.side-foot .logout { margin: 0; align-self: auto; }

/* Giam chuyen dong theo cai dat he dieu hanh: trang thai cuoi van dung */
@media (prefers-reduced-motion: reduce) {
  .modal-back, .modal, .toast, .cfm-ic .lid, .btn .spin, .flash-ok, .login .box.shake, .login .err { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  .btn, .seg button, .an-tabs button, .ptabs button, details::details-content, details > summary::before, .login .fl label { transition-duration: .001ms !important; }
}

/* v1.8b - tab truot, tooltip, menu tai khoan, so KPI */
.seg, .an-tabs { position: relative; }
.ux-thumb { position: absolute; left: 0; top: 0; border-radius: 8px; pointer-events: none; z-index: 0; transition: transform .5s var(--spring), width .5s var(--spring), height .5s var(--spring), opacity .2s; }
.seg .ux-thumb { background: var(--navy); }
.an-tabs .ux-thumb { background: #fff; border-radius: 9px; box-shadow: 0 1px 3px rgba(20,30,80,.12); }
.seg.has-thumb button, .an-tabs.has-thumb button { position: relative; z-index: 1; }
.seg.has-thumb button.on, .an-tabs.has-thumb button.on { background: transparent; box-shadow: none; }

.ux-tip { position: fixed; z-index: 100002; pointer-events: none; padding: 6px 10px; border-radius: 9px; background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 400; white-space: nowrap; box-shadow: 0 8px 20px -8px rgba(30,37,71,.5); opacity: 0; transform: translateY(5px) scale(.9); transform-origin: var(--ax, 50%) 100%; transition: opacity .14s var(--ease), transform .14s var(--ease); }
.ux-tip::after { content: ''; position: absolute; left: var(--ax, 50%); bottom: -4px; width: 8px; height: 8px; margin-left: -4px; background: inherit; border-radius: 2px; transform: rotate(45deg); }
.ux-tip.below::after { bottom: auto; top: -4px; }
.ux-tip.on { opacity: 1; transform: none; transition: opacity .16s var(--ease), transform .45s var(--spring); }

.acct { position: relative; margin: 4px 8px 0; }
.acct-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 6px 4px 0; color: var(--muted); font-size: 12px; cursor: pointer; border-radius: 8px; }
.acct-btn:hover { color: var(--navy); }
.acct-btn svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .45s var(--spring); }
.acct.open .acct-btn svg { transform: rotate(180deg); }
.acct-menu { position: absolute; left: 0; bottom: calc(100% + 6px); min-width: 150px; display: flex; flex-direction: column; padding: 5px; border-radius: 12px; background: #fff; border: 1px solid var(--line); box-shadow: 0 14px 34px -14px rgba(30,37,71,.35); transform-origin: 0 100%; opacity: 0; visibility: hidden; transform: translateY(6px) scale(.92); transition: opacity .14s, transform .16s, visibility 0s .16s; z-index: 30; }
.acct.open .acct-menu { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .45s var(--spring), visibility 0s; }
.acct-menu button { margin: 0; padding: 8px 10px; text-align: left; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 13px; }
.acct-menu button:hover, .acct-menu button:focus-visible { background: var(--soft); }
.acct-menu #logout { color: var(--red); align-self: stretch; }
.acct-menu .logout, .acct-menu .linkbtn { margin: 0; align-self: stretch; }
@media (prefers-reduced-motion: reduce) {
  .ux-thumb, .ux-tip, .acct-menu, .acct-btn svg { transition-duration: .001ms !important; }
}

/* v1.8c - Dien thoai: gon lai (it khoang trong thua, thanh duoi 1 dong, bo menu Tai khoan vi da co nut Thoat) */
@media (max-width: 760px) {
  :root { --gap: 10px; }
  .shell { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .side { padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
  .side .acct { display: none; }
  .nav a, .nav button { white-space: nowrap; flex-direction: column; gap: 1px; font-size: 10.5px; padding: 5px 2px; line-height: 1.2; }
  .nav a svg, .nav button svg { width: 20px; height: 20px; }
  .main { padding: 10px 12px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .main .head, .main .rp-head { padding-right: 0; }
  .main .head > :first-child, .main .rp-head > :first-child, .main .rpt-hello { padding-right: 38px; }
  .head .controls { gap: 8px; }
  .head .controls select { width: 100%; }
  .head { gap: 8px; }
  .head h1 { font-size: 20px; }
  .head .sub { line-height: 1.35; }
  .head select, .head .controls select { max-width: 100%; }
  .kpis, .tstats, .crm-kpis, .rdstats { gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .big { font-size: 22px; margin-top: 0; }
  .kpi .vs { font-size: 11.5px; line-height: 1.35; }
  .card { padding: 12px 14px; border-radius: 16px; }
  .card .empty, .empty { margin: 8px 0; }
  .rp, .dt-card2, .dt-hero { padding: 12px; }
  .tcard { padding: 10px 12px; }
}

/* v1.8d - 3 thanh phan tu Lucian UX/UI Prompt (MIT, (c) 2026 Seokwoooo): #417 thanh ben thu gon, #003 giu de xoa, #450 len dau trang. Mau/font van la Victoria */
@media (min-width: 761px) { .side { position: relative; } }
.shell { transition: grid-template-columns .6s cubic-bezier(.3, 1.3, .45, 1); }
.side-tg { position: absolute; right: -12px; top: 26px; z-index: 6; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--muted); cursor: pointer; box-shadow: 0 0 0 1px var(--line), 0 2px 6px -2px rgba(30, 37, 71, .3); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1), color .2s; }
.side-tg:hover { color: var(--navy); transform: scale(1.12); }
.side-tg svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .55s cubic-bezier(.3, 1.6, .5, 1); }
.shell.rail .side-tg svg { transform: rotate(180deg); }
.nav .lb, .brand > div, .hello { white-space: nowrap; overflow: hidden; transition: opacity .3s var(--ease) .1s; }
@media (min-width: 761px) {
  .shell.rail { grid-template-columns: 72px minmax(0, 1fr); }
  .shell.rail .nav .lb, .shell.rail .brand > div, .shell.rail .hello, .shell.rail .acct { opacity: 0; width: 0; flex: none; transition: opacity .15s; }
  .shell.rail .acct { display: none; }
  .shell.rail .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .shell.rail .nav a { justify-content: center; padding: 10px 0; gap: 0; }
  .shell.rail .nav a.on::before { left: -12px; }
  .shell.rail .who { justify-content: center; padding-left: 0; padding-right: 0; }
}
@media (max-width: 760px) { .side-tg { display: none; } }

/* Giu de xoa (#003): dai do dang day len khi giu, day thi moi xoa */
.btn.hold-btn { --p: 0; position: relative; overflow: hidden; isolation: isolate; min-width: 150px; touch-action: none; user-select: none; -webkit-user-select: none; background: color-mix(in srgb, var(--red) 12%, #fff); color: var(--red); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--red) 40%, transparent); transition: transform .5s var(--spring); }
.btn.hold-btn:hover { background: color-mix(in srgb, var(--red) 16%, #fff); }
.hold-btn .hb-l, .hold-btn .hb-f { display: block; text-align: center; }
.hold-btn .hb-f { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--red); color: #fff; clip-path: inset(0 calc(100% - var(--p) * 100%) 0 0); pointer-events: none; }
.hold-btn.is-holding { transform: scale(.97); }
.hold-btn.is-shake { animation: v18shk .12s linear infinite; }
@keyframes v18shk { 0%, 100% { translate: 0 0; } 25% { translate: -.6px .3px; } 75% { translate: .6px -.3px; } }
.hold-btn.is-done { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .hold-btn.is-shake { animation: none; } }

/* Nut len dau trang (#450): vong tron cho biet da doc bao nhieu */
.ux-top { position: fixed; right: 18px; bottom: 74px; z-index: 55; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--navy); cursor: pointer; box-shadow: 0 0 0 1px var(--line), 0 10px 22px -12px rgba(30, 37, 71, .45); overflow: hidden; opacity: 0; visibility: hidden; transform: translateY(10px) scale(.6); transition: transform .5s var(--spring), opacity .25s, visibility 0s .5s; }
.ux-top.on { opacity: 1; visibility: visible; transform: none; transition: transform .5s var(--spring), opacity .25s, visibility 0s; }
.ux-top.on:hover { transform: translateY(-2px); }
.ux-top.on:active { transform: scale(.92); }
.ux-top > * { grid-area: 1 / 1; }
.ux-top svg.rg { position: absolute; inset: 0; width: 44px; height: 44px; transform: rotate(-90deg); }
.ux-top .rg circle { fill: none; stroke-width: 2.5; }
.ux-top .rg .tr { stroke: var(--line); }
.ux-top .rg .pr { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 122.5; stroke-dashoffset: calc(122.5 * (1 - var(--p, 0))); transition: stroke-dashoffset .15s linear; }
.ux-top svg.ar { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ux-top.is-fly svg.ar { animation: v18fly .7s cubic-bezier(.5, 0, .3, 1); }
@keyframes v18fly { 45% { transform: translateY(-30px); opacity: 0; } 46% { transform: translateY(26px); opacity: 0; } }
@media (min-width: 761px) { .ux-top { bottom: 22px; right: 22px; } }
@media (prefers-reduced-motion: reduce) { .ux-top, .side-tg, .side-tg svg, .shell { transition-duration: .001ms !important; } .ux-top.is-fly svg.ar { animation: none; } }
@media (max-width: 760px) { .rank { gap: 0; } .rk { padding: 5px 0; } .rk .c .chip, .rk .c span { white-space: nowrap; } }

/* v1.8e - Bot chu va so phu tren dashboard: giu so chinh, phan con lai gom vao "Xem them" hoac tooltip */
details.more { margin-top: 6px; border-top: 1px solid var(--soft); padding-top: 6px; }
details.more > summary { font-size: 12.5px; color: var(--muted); }
details.more > summary:hover { color: var(--navy); }
.kpi .vs { font-size: 12px; }

/* ===== v1.8d ===== Lucian #435 thong bao xep chong, #430 chon nguoi co tim kiem, #429 tim nhanh */
#toasts { position: fixed; right: 18px; bottom: 18px; left: auto; width: min(420px, 92vw); max-width: none; height: 0; display: block; pointer-events: none; z-index: 80; transition: height .45s var(--spring); }
.toast { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: 12px; pointer-events: auto; overflow: hidden; transform-origin: 50% 100%; transform: translate3d(var(--x, 0px), var(--y, 0px), 0) scale(var(--s, 1)); opacity: var(--o, 1); transition: transform .6s cubic-bezier(.3, 1.42, .52, 1), opacity .3s var(--ease); animation: none; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.toast.is-drag { transition: opacity .3s var(--ease); cursor: grabbing; }
.toast > * { transition: opacity .25s var(--ease); }
.toast.is-back { height: var(--fh); }
.toast.is-back > * { opacity: 0; }
.toast.is-out { opacity: 0 !important; transform: translate3d(var(--x, 0px), calc(var(--y, 0px) + 14px), 0) scale(.94); pointer-events: none; transition: transform .28s cubic-bezier(.4, 0, .6, 1), opacity .26s; }
.toast .tm { flex: 1; min-width: 0; }
.toast .tbar { position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; flex: none; border-radius: 2px; overflow: hidden; }
.toast .tbar i { display: block; height: 100%; background: var(--gold); opacity: .85; transform-origin: 0 50%; animation: uxtbar linear forwards; animation-duration: var(--d); }
#toasts.is-open .tbar i { animation-play-state: paused; }
@keyframes uxtbar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.toast :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
@media (max-width: 900px) { #toasts { left: 12px; right: 12px; width: auto; bottom: 84px; } }

.kbd { display: inline-grid; place-items: center; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); font: inherit; font-size: 11px; color: var(--muted); }
.acct-menu .kbd { margin-left: 10px; }

.cb-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; }
.cb-tr { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; text-align: left; cursor: pointer; font: inherit; color: var(--text); transition: transform .4s var(--spring), border-color .2s; }
.cb-tr:active { transform: scale(.985); }
.cb-tr[aria-expanded="true"] { outline: 2px solid var(--navy-2); outline-offset: -1px; }
.cb-tr:focus-visible { outline: 2px solid var(--navy-2); outline-offset: -1px; }
.cb-tx { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 7px; white-space: nowrap; overflow: hidden; }
.cb-tx b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.cb-tx small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.cb-tr .ph, .cb-o .ph { color: var(--muted); font-weight: 400; }
.cb-tr > svg { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--spring); }
.cb-tr[aria-expanded="true"] > svg { transform: rotate(180deg); }
.cb-av { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 500; background: var(--navy); color: #fff; }
.cb-av.c1 { background: color-mix(in srgb, var(--gold) 32%, #fff); color: var(--navy); }
.cb-av.c2 { background: color-mix(in srgb, var(--lime) 32%, #fff); color: var(--navy); }
.cb-av.c3 { background: var(--soft); color: var(--navy); }
.cb-pop { position: fixed; z-index: 95; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(30, 37, 71, .22); padding: 6px; transform-origin: 50% 0; animation: cbin .38s var(--spring); }
.cb-pop.up { transform-origin: 50% 100%; }
@keyframes cbin { from { opacity: 0; transform: translateY(-8px) scale(.96); } }
.cb-s, .qf-f { display: flex; align-items: center; gap: 8px; }
.cb-s { height: 36px; margin-bottom: 4px; padding: 0 10px; border-radius: 9px; background: var(--soft); }
.cb-s svg, .qf-f svg { flex: none; width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.cb-q, .qf-in { flex: 1; min-width: 0; border: 0; background: none; padding: 0; font: inherit; color: var(--text); outline: none; }
.cb-q { font-size: 13.5px; }
.cb-lb { position: relative; max-height: 240px; overflow: auto; overscroll-behavior: contain; }
.cb-o { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px 0 8px; border-radius: 9px; cursor: pointer; animation: cbrow .4s var(--spring) both; animation-delay: calc(var(--i) * 30ms); }
@keyframes cbrow { from { opacity: 0; transform: translateY(-6px); } }
.cb-o.act, .qf-o[aria-selected="true"] { background: var(--soft); }
.cb-o .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cb-o b { font-weight: 500; font-size: 13.5px; }
.cb-o small { color: var(--muted); font-size: 12px; }
.cb-o mark, .qf-o mark { background: none; color: inherit; font-weight: 700; }
.cb-ck { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--navy); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.2) rotate(-30deg); transition: opacity .15s, transform .2s var(--ease); }
.cb-o[aria-selected="true"] .cb-ck { opacity: 1; transform: none; transition: opacity .15s, transform .5s cubic-bezier(.3, 1.9, .5, 1); }
.cb-no { padding: 12px 10px; font-size: 13px; color: var(--muted); }

.qf-back { position: fixed; inset: 0; z-index: 96; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 14px 0; background: rgba(30, 37, 71, .35); animation: v18fade .18s var(--ease); }
.qf { width: min(560px, 100%); background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(30, 37, 71, .3); overflow: hidden; animation: v18pop .45s var(--spring); }
.qf-f { height: 54px; padding: 0 14px 0 16px; border-bottom: 1px solid var(--line); }
.qf-f svg { width: 18px; height: 18px; }
.qf-in { font-size: 15px; }
.qf-lb { position: relative; max-height: min(52vh, 380px); overflow: auto; padding: 6px; }
.qf-o { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border-radius: 10px; cursor: pointer; animation: cbrow .4s var(--spring) both; animation-delay: calc(var(--i) * 25ms); }
.qf-ic { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; background: var(--soft); color: var(--navy); }
.qf-ic.page { background: color-mix(in srgb, var(--gold) 30%, #fff); }
.qf-t { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qf-m { flex: none; max-width: 38%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qf-ft { display: flex; gap: 14px; margin: 0; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
@media (max-width: 760px) { .qf-ft { display: none; } .qf-back { padding-top: 8vh; } }
@media (prefers-reduced-motion: reduce) {
  #toasts, .toast, .cb-tr, .cb-tr > svg, .cb-ck { transition-duration: .001ms !important; }
  .toast .tbar { display: none; }
  .cb-pop, .cb-o, .qf-back, .qf, .qf-o { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* ===== v1.8e: phone tidy (aligned grids, no stray gaps) ===== */
@media (max-width: 760px) {
  .ph-x { display: none !important; }
  .seg, .an-tabs { display: flex; width: 100%; }
  .an-tabs { overflow-x: visible; }
  .an-tabs button { flex: 1; padding-inline: 4px; white-space: nowrap; }
  .head .controls { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .head .controls > * { min-width: 0; }
  .head .controls .iconbtn { justify-self: start; padding: 5px 12px; font-size: 12.5px; }
  .tstory { font-size: 12.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .tstats.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tstats.five > div:last-child { grid-column: 1 / -1; }
  .tstats div { padding: 9px 12px; gap: 8px; min-width: 0; }
  .tstats b { font-size: 22px; }
  .tstats span { font-size: 12.5px; line-height: 1.25; }
  .kpi .lab { align-items: flex-start; gap: 6px; min-height: 2.5em; }
  .kpi .lab .chip { flex: none; font-size: 11px; padding: 2px 7px; }
  .kpi .vs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tptable th, .tptable td { padding: 7px 4px; font-size: 12px; white-space: normal; }
  .tptable th { font-size: 11.5px; }
  .tptable td:first-child, .tptable th:first-child { padding-left: 0; }
  .scroll { overflow-x: visible; }
  .attl { overflow-x: hidden; }
  .head > .seg { flex: 1 1 100%; order: 3; }
}

/* ===== v1.8f: even spacing, highlighted numbers, callouts, help button bottom-right ===== */
@media (max-width: 760px) {
  .main, .main.fit { display: flex; flex-direction: column; gap: var(--gap); }
  .main > * { margin-top: 0; margin-bottom: 0; }
  .tstory { display: block; -webkit-line-clamp: unset; overflow: visible; font-size: 14px; }
}
/* big-number tiles: tinted box, readable label (labels are read, so no muted grey) */
.tstats div, .crm-kpis .card { background: color-mix(in srgb, var(--navy) 6%, #fff); border-color: color-mix(in srgb, var(--navy) 14%, #fff); }
.tstats span, .crm-kpis .card span { color: var(--text); font-weight: 500; }
.tstats .bad, .tstats .bad { background: #FDECEC; border-color: #F5C6C6; }
.tstats .warnc { background: #FFF4DE; border-color: #F2D9A0; }
.crm-kpis .card { display: flex; flex-direction: column; gap: 2px; }
.crm-kpis .card span { font-size: 13px; }
.crm-kpis .card[data-k="late"] b { color: var(--red); }
.crm-kpis .card[data-k="new"] { background: #FFF4DE; border-color: #F2D9A0; }
.crm-kpis .card.on { outline: 2px solid var(--navy-2); }
/* one-line story: a callout, not loose text */
.tstory { background: color-mix(in srgb, var(--navy) 6%, #fff); border: 1px solid color-mix(in srgb, var(--navy) 14%, #fff); border-left: 4px solid var(--gold); border-radius: 12px; padding: 12px 16px; font-size: 14.5px; line-height: 1.55; }
/* funnel callout */
.an-callout { background: color-mix(in srgb, var(--navy) 6%, #fff); border: 1px solid color-mix(in srgb, var(--navy) 14%, #fff); border-left: 4px solid var(--gold); border-radius: 12px; padding: 12px 16px; display: grid; gap: 8px; }
.ac-k { font-size: 12px; font-weight: 500; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }
.ac-n { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ac-n b { font-size: 30px; font-weight: 500; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; }
.ac-n span { font-size: 13.5px; color: var(--text); }
.ac-t { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.ac-t b { font-weight: 500; color: var(--navy); }
/* help "?" sits bottom-right; back-to-top stacks above it */
#tour-help { top: auto; bottom: calc(22px + env(safe-area-inset-bottom)); right: 22px; width: 36px; height: 36px; box-shadow: 0 4px 14px rgba(39, 55, 120, .18); }
.ux-top { bottom: calc(70px + env(safe-area-inset-bottom)); right: 18px; }
@media (max-width: 760px) {
  #tour-help { bottom: calc(76px + env(safe-area-inset-bottom)); right: 16px; }
  .ux-top { bottom: calc(124px + env(safe-area-inset-bottom)); right: 12px; }
}

/* help button moved: no reserved space at top right */
.main .head, .main .rp-head, .main .rpt-hello, .main .head > :first-child, .main .rp-head > :first-child { padding-right: 0 !important; }
.an-card > .an-callout { margin-top: 18px; }
.an-card > .an-bars + .an-callout { margin-top: 18px; }
/* v1.8g: empty cards keep their title inside the card (no collapse) */
.tdash .col > .card { flex: 1 1 auto; min-height: 68px; }
.tdash .col > .card .ch { margin-bottom: 0; }
.tdash .col > .card .attl:not(:empty) { margin-top: 10px; }
/* v1.8g: iOS zooms in when focusing a field under 16px; keep 16px on phones and block text-size auto-zoom */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
@media (max-width: 760px) { input, select, textarea, .inp, .cb-tr { font-size: 16px; } }
.tdash .col > .card { flex: 0 1 auto; }
.tdash .col .attl { max-height: 320px; overflow: auto; }
.tptable td:last-child, .tptable th:last-child { padding-right: 0; }

/* ---------- v2.0 Content + Tài nguyên ---------- */
.form-g { display: grid; gap: 12px; }
.actions .grow { flex: 1; }
.danger-txt { color: var(--red); }
.ct-ctl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--gap); }
.ct-nav { display: inline-flex; align-items: center; gap: 10px; }
.ct-nav b { font-weight: 500; color: var(--navy); min-width: 118px; text-align: center; font-variant-numeric: tabular-nums; }
.ct-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.ct-k { padding: 12px 16px; }
.ct-k b { display: block; font-size: 26px; font-weight: 500; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.ct-k span { font-size: 12.5px; color: var(--muted); }
.ct-k.t { background: color-mix(in srgb, var(--navy) 6%, #fff); border-color: color-mix(in srgb, var(--navy) 14%, #fff); }
.ct-k.bad { background: color-mix(in srgb, var(--red) 9%, #fff); border-color: color-mix(in srgb, var(--red) 30%, #fff); }
.ct-k.bad b { color: var(--red); }
.ct-chart { margin-bottom: var(--gap); }
.ct-bars { display: grid; gap: 10px; }
.ct-br { display: grid; grid-template-columns: 110px minmax(0, 1fr) 56px; align-items: center; gap: 10px; font-size: 13px; }
.ct-br .tr { position: relative; height: 10px; }
.ct-br .tr i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.ct-br .tr .all { background: var(--soft); }
.ct-br .tr .done { background: var(--navy); }
.ct-br .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ct-more summary { cursor: pointer; color: var(--navy); }
.ct-more[open] summary { margin-bottom: 10px; }
.ct-t { display: block; font-weight: 500; color: var(--text); }
.ct-mats { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-mat { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: 12.5px; }
.ct-mat a { color: var(--navy); text-decoration: none; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-mat button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 6px; }
.ct-addlink { display: flex; gap: 8px; }
.ct-mt td.n { text-align: right; }
.ct-mt .mi { width: 120px; text-align: right; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-variant-numeric: tabular-nums; }
.ct-mt .mi:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; }
.rs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.rs-c { --kc: var(--purple); border-left: 4px solid var(--kc); display: grid; gap: 6px; align-content: start; }
.rs-c.k-cyan { --kc: var(--cyan); } .rs-c.k-lime { --kc: var(--lime); } .rs-c.k-orange { --kc: var(--orange); } .rs-c.k-navy { --kc: var(--navy); }
.rs-top { display: flex; align-items: center; gap: 8px; }
.rs-k { background: color-mix(in srgb, var(--kc) 14%, #fff); color: color-mix(in srgb, var(--kc) 70%, #000); }
.rs-g2 { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.rs-pin { color: var(--gold); }
.rs-n { font-weight: 500; color: var(--navy); text-decoration: none; font-size: 15px; overflow-wrap: anywhere; }
.rs-n:hover { text-decoration: underline; }
.rs-d { margin: 0; color: var(--muted); font-size: 13px; }
.rs-a { display: flex; gap: 14px; font-size: 12.5px; }
.rs-det { min-height: 16px; margin-top: -6px; }
@media (max-width: 1100px) { .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ct-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .rs-grid { grid-template-columns: 1fr; } .ct-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ct-br { grid-template-columns: 84px minmax(0, 1fr) 50px; } }

.fl[hidden] { display: none; }
.modal .ct-act { position: sticky; bottom: -22px; background: #fff; margin: 4px -22px -22px; padding: 12px 22px 16px; border-top: 1px solid var(--soft); }
.ct-save { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; margin-top: 0; }

/* ---------- v2.1 Muc tieu, nhom kenh, nhac viec ---------- */
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ct-alert { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--gap); padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--gold) 16%, #fff); border: 1px solid color-mix(in srgb, var(--gold) 45%, #fff); color: var(--navy); font-size: 13.5px; }
.ct-alert span { flex: 1; }
.ct-kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ct-nogoal { margin: 0 0 var(--gap); }
.ct-gl { display: grid; gap: 4px; }
.ct-g > summary { list-style: none; cursor: pointer; padding: 5px 0; }
.ct-g > summary::marker { content: ''; }
.ct-g summary::-webkit-details-marker { display: none; }
.ct-g summary .l { font-weight: 500; color: var(--navy); }
.ct-g[open] > summary { padding-bottom: 8px; }
.ct-gf { display: grid; gap: 8px; padding-bottom: 10px; }
.ct-gf .l { color: var(--muted); }
.ct-gl { padding-left: 18px; }
.ct-g > summary.ct-br, .ct-gf .ct-br { grid-template-columns: 210px minmax(0, 1fr) 56px; }
.ct-g > summary { position: relative; }
.ct-g > summary::before { position: absolute; left: -18px; top: 50%; margin: -4px 0 0; color: var(--muted); }
.ct-br .tr .sch { background: color-mix(in srgb, var(--navy) 22%, #fff); }
.ct-br .tr em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gold); border-radius: 2px; }
.ct-gaps { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.ct-gc { margin-bottom: var(--gap); }
.ct-gh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.ct-gh b { color: var(--navy); font-weight: 500; font-size: 15px; }
.ct-gg { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px 12px; }
.ct-gi { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.ct-gi .mi { width: 100%; text-align: right; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-variant-numeric: tabular-nums; }
.ct-gi .mi:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; }
.ct-gi small { min-height: 14px; text-align: right; }
.ct-cg { margin-bottom: var(--gap); padding-top: 12px; padding-bottom: 12px; }
.ct-cg summary { cursor: pointer; margin-bottom: 4px; }
.ct-cg[open] summary { margin-bottom: 8px; }
.actions .linkbtn + .linkbtn { margin-left: 14px; }
@media (max-width: 1100px) { .ct-kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .three { grid-template-columns: 1fr; } .ct-g > summary.ct-br, .ct-gf .ct-br { grid-template-columns: 110px minmax(0, 1fr) 50px; } }

.ct-cg table { table-layout: fixed; width: 100%; }
.ct-cg th:nth-child(1) { width: 150px; } .ct-cg th:nth-child(3) { width: 140px; } .ct-cg th:nth-child(4) { width: 200px; }

/* v2.2: Content trên điện thoại */
.ct-pc { margin-top: 12px; }
.ct-pcard { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left; padding: 12px 0; border: 0; border-top: 1px solid var(--line, #E3E7F0); background: none; font: inherit; color: inherit; cursor: pointer; }
.ct-pcard:first-of-type { border-top: 0; }
.ct-pcard b { font-weight: 600; line-height: 1.35; }

/* v2.3 đăng ký / quên mật khẩu / mật khẩu tạm */
.authlinks { margin-top: 16px; display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
.authlinks a, .authlinks .linkbtn { color: var(--navy); }
.nbadge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red, #EB3B3B); color: #fff; font-size: 11px; font-weight: 500; display: inline-grid; place-items: center; }
.todo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.todo-row > div:first-child { flex: 1 1 240px; }
.tempbox { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: #EEF1FA; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.tempbox code { font-size: 20px; letter-spacing: .06em; color: var(--navy); user-select: all; }
