/* ACG Affiliate Management System — giao diện fintech sáng/tối */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/inter-vietnamese-400-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/inter-vietnamese-500-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/inter-vietnamese-600-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/inter-vietnamese-700-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/inter-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/inter-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/inter-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/inter-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #eef2f7; --border: #e5e9f0; --border-strong: #d3d9e3;
  --text: #0f172a; --text-2: #475569; --muted: #5f6b7f;
  --primary: #3b5bdb; --primary-hover: #3049c4; --primary-weak: #edf1ff; --primary-ink: #ffffff; --ring: rgba(59,91,219,.22);
  --brand-grad: linear-gradient(135deg, #4c6ef5 0%, #7048e8 100%);
  --gain: #0e7a55; --gain-bg: #e7f6ef; --loss: #c9302c; --loss-bg: #fdeeed; --warn: #a15c00; --warn-bg: #fff5e1; --info: #3b5bdb; --info-bg: #eef2ff;
  --s-in: #2a78d6; --s-out: #eb6834; --s-cum: #6250d6; --s-cpc: #eda100; --s-ref: #1baf7a; --s-neg: #e34948;
  --chip-blue: #e8f0fe; --chip-blue-ink: #1d5bd8; --chip-orange: #fff0e8; --chip-orange-ink: #c4501a; --chip-green: #e6f6ef; --chip-green-ink: #0e7a55;
  --chip-violet: #f1edff; --chip-violet-ink: #5b3fd0; --chip-amber: #fff6e0; --chip-amber-ink: #a26300; --chip-teal: #e2f7f1; --chip-teal-ink: #0f7b62;
  --sidebar-bg: #0b1222; --sidebar-bg-2: #101a30; --sidebar-text: #aab4c8; --sidebar-muted: #8a97ae; --sidebar-active: rgba(108,140,255,.16); --sidebar-hover: rgba(255,255,255,.06);
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1a; --surface: #111827; --surface-2: #161f30; --surface-3: #1c2639; --border: #222c3e; --border-strong: #2e3a50;
    --text: #e8ecf4; --text-2: #a9b3c4; --muted: #8b96ab;
    --primary: #6d8bff; --primary-hover: #8099ff; --primary-weak: #1b2547; --primary-ink: #0a0f1a; --ring: rgba(109,139,255,.3);
    --gain: #3ccf91; --gain-bg: #0f2c22; --loss: #ff7a72; --loss-bg: #361719; --warn: #f3b94d; --warn-bg: #33270d; --info: #8ea6ff; --info-bg: #19213c;
    --s-in: #3987e5; --s-out: #d95926; --s-cum: #9085e9; --s-cpc: #c98500; --s-ref: #199e70; --s-neg: #e66767;
    --chip-blue: #172a4d; --chip-blue-ink: #8db8ff; --chip-orange: #3a2214; --chip-orange-ink: #ffab80; --chip-green: #10301f; --chip-green-ink: #5fd9a3;
    --chip-violet: #261f4a; --chip-violet-ink: #b6a8ff; --chip-amber: #352a0f; --chip-amber-ink: #f5c45e; --chip-teal: #0f2f2a; --chip-teal-ink: #5ad6bb;
    --sidebar-bg: #070b14; --sidebar-bg-2: #0b1120;
    --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1a; --surface: #111827; --surface-2: #161f30; --surface-3: #1c2639; --border: #222c3e; --border-strong: #2e3a50;
  --text: #e8ecf4; --text-2: #a9b3c4; --muted: #8b96ab;
  --primary: #6d8bff; --primary-hover: #8099ff; --primary-weak: #1b2547; --primary-ink: #0a0f1a; --ring: rgba(109,139,255,.3);
  --gain: #3ccf91; --gain-bg: #0f2c22; --loss: #ff7a72; --loss-bg: #361719; --warn: #f3b94d; --warn-bg: #33270d; --info: #8ea6ff; --info-bg: #19213c;
  --s-in: #3987e5; --s-out: #d95926; --s-cum: #9085e9; --s-cpc: #c98500; --s-ref: #199e70; --s-neg: #e66767;
  --chip-blue: #172a4d; --chip-blue-ink: #8db8ff; --chip-orange: #3a2214; --chip-orange-ink: #ffab80; --chip-green: #10301f; --chip-green-ink: #5fd9a3;
  --chip-violet: #261f4a; --chip-violet-ink: #b6a8ff; --chip-amber: #352a0f; --chip-amber-ink: #f5c45e; --chip-teal: #0f2f2a; --chip-teal-ink: #5ad6bb;
  --sidebar-bg: #070b14; --sidebar-bg-2: #0b1120;
  --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 18px 0 8px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.ico svg { display: block; }
::selection { background: var(--primary-weak); }

/* ------------------------------------------------ Layout */
.layout { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2)); color: var(--sidebar-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; color: #fff; font-weight: 700; font-size: 15px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); display: grid; place-items: center; font-size: 12.5px; letter-spacing: .02em; color: #fff; box-shadow: 0 6px 16px rgba(76,110,245,.35); }
.brand small { display: block; font-weight: 500; color: var(--sidebar-muted); font-size: 11.5px; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 14px 12px 6px; font-weight: 600; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px; color: var(--sidebar-text); margin: 1px 0; font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--sidebar-hover); text-decoration: none; color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #7d97ff; }
.nav a .ico { opacity: .85; }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; font-size: 11.5px; color: var(--sidebar-muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 0 24px; height: 64px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .search input { width: 100%; padding: 9px 12px 9px 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); outline: none; transition: border-color .15s, box-shadow .15s; }
.topbar .search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); background: var(--surface); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 440px; overflow: auto; z-index: 50; padding: 6px; }
.search-results .grp { padding: 8px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.search-results a { display: block; padding: 8px 10px; color: var(--text); border-radius: 8px; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .badge { position: absolute; top: -5px; right: -5px; }
.menu-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; position: relative; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.user-chip .who { line-height: 1.2; font-size: 12.5px; }
.user-chip .who b { display: block; font-weight: 600; font-size: 13px; }
.user-chip .who span { color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); text-align: left; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.content { padding: 24px; max-width: 1640px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }

/* ------------------------------------------------ Primitives */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 16px; }
.charts > .card, .grid > .card, .kpis > .card, .hero > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; min-height: 56px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-weight: 500; color: var(--text); transition: background .15s, border-color .15s, box-shadow .15s; line-height: 1.3; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgba(59,91,219,.25); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 45%, var(--border)); }
.btn.danger:hover { background: var(--loss-bg); }
.btn.success { color: var(--gain); border-color: color-mix(in srgb, var(--gain) 45%, var(--border)); }
.btn.success:hover { background: var(--gain-bg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 2px 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.st-draft { background: var(--surface-3); color: var(--text-2); }
.st-pending { background: var(--warn-bg); color: var(--warn); }
.st-approved, .st-confirmed { background: var(--gain-bg); color: var(--gain); }
.st-rejected { background: var(--loss-bg); color: var(--loss); }
.st-needs_edit { background: var(--chip-orange); color: var(--chip-orange-ink); }
.st-cancelled { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.st-submitted, .st-calculated { background: var(--info-bg); color: var(--info); }
.st-locked { background: var(--surface-3); color: var(--text); }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.info { background: var(--info-bg); color: var(--text-2); border-color: color-mix(in srgb, var(--info) 18%, transparent); }
.alert.error { background: var(--loss-bg); color: var(--loss); border-color: color-mix(in srgb, var(--loss) 25%, transparent); }

/* ------------------------------------------------ Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.field input, .field select, .field textarea, .inp { padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); min-width: 0; min-height: 38px; transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus, table.entry input:focus, table.entry select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.filters .field { width: 158px; }
.filters .field.date { width: 148px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; background: var(--surface-3); padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; scrollbar-width: thin; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ------------------------------------------------ KPI */
.hero { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 16px; }
.kpi-hero { padding: 18px 18px 12px; position: relative; overflow: hidden; }
.kpi-hero .top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.chip-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.chip-blue { background: var(--chip-blue); color: var(--chip-blue-ink); } .chip-orange { background: var(--chip-orange); color: var(--chip-orange-ink); }
.chip-green { background: var(--chip-green); color: var(--chip-green-ink); } .chip-violet { background: var(--chip-violet); color: var(--chip-violet-ink); }
.chip-amber { background: var(--chip-amber); color: var(--chip-amber-ink); } .chip-teal { background: var(--chip-teal); color: var(--chip-teal-ink); }
.chip-red { background: var(--loss-bg); color: var(--loss); }
.kpi-hero .val { font-size: 25px; font-weight: 700; margin-top: 12px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; word-break: break-word; line-height: 1.2; }
.kpi-hero .sub { font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 18px; }
.kpi-hero .spark { height: 42px; margin-top: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.kpi .chip-ico { width: 32px; height: 32px; border-radius: 9px; }
.kpi .lbl { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .val { font-size: 16.5px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; word-break: break-word; letter-spacing: -.01em; }
.kpi .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpi.hl { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }

/* ------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th, table.t td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
table.t th { background: var(--surface-2); font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; z-index: 1; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.wrap { white-space: normal; min-width: 180px; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong); }
table.t tr.clickable { cursor: pointer; }
.card-body > .table-wrap { margin: -16px -18px; }
.card-body > .table-wrap table.t th:first-child, .card-body > .table-wrap table.t td:first-child { padding-left: 18px; }
.card-body > .table-wrap table.t th:last-child, .card-body > .table-wrap table.t td:last-child { padding-right: 18px; }
table.pivot th:first-child, table.pivot td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 220px; font-weight: 600; }
table.pivot th:first-child { background: var(--surface-2); z-index: 3; }
table.pivot th.total, table.pivot td.total { position: sticky; right: 0; z-index: 2; background: color-mix(in srgb, var(--primary-weak) 85%, var(--surface)); font-weight: 700; border-left: 2px solid var(--primary); }
table.pivot th.total { color: var(--primary); }
table.pivot td.cell { cursor: pointer; }
table.pivot td.cell:hover { background: var(--primary-weak); }
table.pivot tr.key td { font-weight: 700; background: var(--surface-2); }
table.pivot tr.key td:first-child { background: var(--surface-2); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 14px 0 0; }

/* ------------------------------------------------ Charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-card .card-body { height: 300px; position: relative; }
.chart-card.tall .card-body { height: 350px; }
.chart-card canvas { max-width: 100%; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 10px; cursor: pointer; font-size: 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.rank-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.rank-line:last-child { border-bottom: 0; }
.rank-line .n { width: 22px; height: 22px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-2); flex: none; }

/* ------------------------------------------------ Modal / drawer / toast */
.overlay { position: fixed; inset: 0; background: rgba(8,12,22,.5); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 580px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .18s ease-out; }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-head .x { margin-left: auto; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); width: 34px; height: 34px; border-radius: 8px; }
.modal-head .x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 100%); background: var(--surface); z-index: 110; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease-out; }
.drawer .modal-body { overflow-y: auto; flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #111827; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 440px; font-weight: 500; animation: pop .2s ease-out; }
.toast.error { background: #b42318; }
.toast.ok { background: #0b6b47; }
dl.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 10px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }

/* ------------------------------------------------ Quick entry grid */
table.entry td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.entry input, table.entry select { width: 100%; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); min-width: 90px; min-height: 36px; }
table.entry td.amt input { text-align: right; min-width: 130px; font-variant-numeric: tabular-nums; }
table.entry select { min-width: 130px; }
table.entry td:nth-child(1) input { min-width: 140px; }
table.entry td:nth-child(2) select { min-width: 170px; }
table.entry td:nth-child(3) select { min-width: 150px; }
table.entry td:nth-child(4) select { min-width: 220px; }
table.entry td:nth-child(5) input { min-width: 190px; }

/* ------------------------------------------------ Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at -10% -20%, #5b7cfa 0%, transparent 60%), radial-gradient(900px 600px at 120% 120%, #7a4cf0 0%, transparent 55%), #0b1222; }
.auth-brand .brand { padding: 0; }
.auth-brand h2 { font-size: 34px; line-height: 1.2; margin: auto 0 14px; letter-spacing: -.02em; max-width: 520px; }
.auth-brand p { color: #c3cbe0; max-width: 480px; margin: 0 0 28px; font-size: 15px; }
.auth-feats { display: grid; gap: 14px; max-width: 480px; margin-bottom: auto; }
.auth-feats > div { display: flex; gap: 12px; align-items: flex-start; color: #dfe5f5; }
.auth-feats > div > div { display: block; }
.auth-feats .chip-ico { background: rgba(255,255,255,.1); color: #fff; }
.auth-feats b { display: block; color: #fff; }
.auth-feats span { font-size: 13px; color: #aeb8d0; }
.auth-brand .foot { font-size: 12px; color: #aab4cc; margin-top: 32px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth .box { width: 100%; max-width: 420px; }
.auth .box h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth .box .lead { color: var(--muted); margin: 0 0 22px; }
.auth .field { margin-top: 14px; }
.auth .field input { min-height: 44px; }
.auth .btn.primary { width: 100%; margin-top: 20px; padding: 12px; font-size: 15px; }
.auth .mobile-brand { display: none; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; width: fit-content; margin: 12px auto; border: 1px solid var(--border); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 12px; border-radius: 10px; }

/* ------------------------------------------------ Chat */
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 170px); min-height: 440px; overflow: hidden; }
.chat .list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat .list .conv { padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.chat .list .conv.active, .chat .list .conv:hover { background: var(--surface-2); }
.chat .pane { display: flex; flex-direction: column; min-width: 0; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface); border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.msg.me .meta { color: color-mix(in srgb, var(--primary-ink) 75%, transparent); }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg img { max-width: 240px; border-radius: 10px; display: block; margin-top: 6px; cursor: pointer; }
.chat .composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat .composer textarea { flex: 1; resize: none; height: 42px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); }
.notif { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--info-bg); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 8px; flex: none; }
.notif.read .dot { background: transparent; }

/* ------------------------------------------------ Trợ lý ACG (chatbot) */
.bot-fab { position: fixed; right: 24px; bottom: 24px; z-index: 90; width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer; background: var(--brand-grad); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 28px rgba(76,110,245,.45); transition: transform .15s; }
.bot-fab:hover { transform: translateY(-2px); }
.bot-fab .tip { position: absolute; right: 66px; white-space: nowrap; background: #111827; color: #fff; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.bot-fab:hover .tip { opacity: 1; }
.bot { position: fixed; right: 24px; bottom: 24px; z-index: 95; width: 410px; height: min(660px, calc(100vh - 48px)); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: pop .2s ease-out; }
.bot-head { display: flex; align-items: center; gap: 11px; padding: 14px 16px; background: var(--brand-grad); color: #fff; }
.bot-head .av { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.bot-head b { display: block; font-size: 14.5px; }
.bot-head small { color: rgba(255,255,255,.85); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.bot-head small::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.bot-head .x { margin-left: auto; display: flex; gap: 4px; }
.bot-head .x button { border: 0; background: rgba(255,255,255,.14); color: #fff; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.bot-head .x button:hover { background: rgba(255,255,255,.26); }
.bot-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.bmsg { display: flex; gap: 9px; align-items: flex-end; max-width: 92%; }
.bmsg .bubble { padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface); border: 1px solid var(--border); word-break: break-word; font-size: 13.5px; line-height: 1.55; }
.bmsg .bubble p { margin: 0 0 6px; } .bmsg .bubble p:last-child { margin: 0; }
.bmsg .bubble ul, .bmsg .bubble ol { margin: 4px 0 6px; padding-left: 18px; }
.bmsg .bubble li { margin: 2px 0; }
.bmsg .av { width: 28px; height: 28px; border-radius: 9px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; flex: none; }
.bmsg.me { align-self: flex-end; flex-direction: row-reverse; }
.bmsg.me .bubble { background: var(--primary); color: var(--primary-ink); border-color: transparent; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.bmsg .src { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.bmsg .links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bmsg .links a { font-size: 12px; padding: 4px 9px; border-radius: 8px; background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.bmsg .links a:hover { text-decoration: none; filter: brightness(.97); }
.bot-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px 0; background: var(--surface); }
.bot-chips button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.bot-chips button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-weak); }
.bot-input { display: flex; gap: 8px; padding: 12px 14px 14px; background: var(--surface); align-items: flex-end; }
.bot-input textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); outline: none; }
.bot-input textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); background: var(--surface); }
.bot-input .send { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--primary); color: var(--primary-ink); cursor: pointer; display: grid; place-items: center; flex: none; }
.bot-input .send:disabled { opacity: .5; }
.bot-foot { font-size: 11px; color: var(--muted); text-align: center; padding: 0 14px 10px; background: var(--surface); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ------------------------------------------------ Responsive */
@media (max-width: 1280px) { .hero { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 1100px) { .charts { grid-template-columns: 1fr; } .g3 { grid-template-columns: 1fr 1fr; } .auth { grid-template-columns: 1fr; } .auth-brand { display: none; } .auth .mobile-brand { display: flex; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-grid; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .search { max-width: none; min-width: 100px; }
  .user-chip .who { display: none; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat .list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat .msgs { height: 55vh; }
  .filters .field, .filters .field.date { width: calc(50% - 5px); }
  dl.kv { grid-template-columns: 1fr; }
  table.pivot th.total, table.pivot td.total { position: static; }
  table.pivot th:first-child, table.pivot td:first-child { min-width: 140px; max-width: 160px; white-space: normal; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .bot { right: 0; bottom: 0; width: 100%; height: 100%; border-radius: 0; }
  .bot-fab { right: 16px; bottom: 16px; }
}
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; } .kpis { grid-template-columns: 1fr 1fr; } .kpi .val { font-size: 15px; } .kpi .chip-ico { display: none; } }

/* ------------------------------------------------ Combobox (gõ để tìm) */
.combo { position: relative; display: flex; align-items: center; min-width: 0; }
.combo .combo-input { width: 100%; padding: 8px 54px 8px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); min-height: 38px; min-width: 0; text-overflow: ellipsis; transition: border-color .15s, box-shadow .15s; }
.combo .combo-input::placeholder { color: var(--text-2); opacity: .85; }
.combo .combo-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.combo .combo-input:focus::placeholder { color: var(--muted); }
.combo-chev { position: absolute; right: 10px; color: var(--muted); cursor: pointer; transition: transform .15s; }
.combo.open .combo-chev { transform: rotate(180deg); color: var(--primary); }
.combo-clear { position: absolute; right: 30px; display: none; border: 0; background: var(--surface-3); color: var(--text-2); width: 20px; height: 20px; border-radius: 6px; cursor: pointer; padding: 0; place-items: center; }
.combo-clear:hover { background: var(--loss-bg); color: var(--loss); }
.combo.has-value .combo-clear { display: grid; }
.combo:not(.has-value) .combo-input { padding-right: 34px; }
.combo-list { position: fixed; z-index: 400; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; animation: pop .12s ease-out; }
.combo-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 13.5px; }
.combo-opt .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-opt .sub { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.combo-opt .ico { color: var(--primary); }
.combo-opt.active { background: var(--primary-weak); }
.combo-opt.selected .lbl { font-weight: 600; }
.combo-opt.all { color: var(--text-2); border-bottom: 1px dashed var(--border); border-radius: 8px 8px 0 0; margin-bottom: 3px; }
.combo-opt.create { color: var(--primary); font-weight: 600; border-top: 1px dashed var(--border); border-radius: 0 0 8px 8px; margin-top: 3px; }
.combo-opt mark { background: color-mix(in srgb, var(--s-cpc) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.filters .field.f-wide { width: 210px; }
table.entry .combo { min-width: 180px; }
table.entry .combo .combo-input { min-height: 36px; padding-top: 7px; padding-bottom: 7px; border-radius: 8px; }
@media (max-width: 860px) { .filters .field.f-wide { width: calc(50% - 5px); } }
@media (max-width: 480px) { .filters .field.f-wide { width: 100%; } }

/* ------------------------------------------------ Hiệu suất quảng cáo */
:root { --st-good: #0ca30c; --st-warning: #fab219; --st-serious: #ec835a; --st-critical: #d03b3b; }
.ads-body { transition: opacity .15s; }
.ads-body.is-loading { opacity: .55; pointer-events: none; }
.form-sec { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--text); }
.form-sec .ico { color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.alert.ok { background: var(--gain-bg); color: var(--gain); border-color: color-mix(in srgb, var(--gain) 25%, transparent); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; text-decoration: none; }
.tag:hover { text-decoration: none; }
.tag + .tag { margin-left: 4px; }
.st-good { background: var(--gain-bg); color: var(--gain); }
.st-crit { background: var(--loss-bg); color: var(--loss); }
.st-warn { background: var(--warn-bg); color: var(--warn); }
.st-info { background: var(--info-bg); color: var(--info); }
.info-tip { position: relative; display: inline-flex; color: var(--muted); cursor: help; vertical-align: middle; margin-left: 4px; border-radius: 50%; }
.info-tip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.info-tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; background: var(--text); color: var(--surface); font-size: 12px; font-weight: 400; line-height: 1.45; padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; white-space: normal; text-align: left; text-transform: none; letter-spacing: 0; }
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; }

/* Ô chỉ số */
.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-grid.small { margin-bottom: 16px; }
.stat { text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px 10px; box-shadow: var(--shadow); cursor: pointer; min-width: 0; display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, box-shadow .15s; }
.stat:hover { border-color: var(--border-strong); }
.stat:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.stat.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.stat-top { display: flex; align-items: center; gap: 2px; min-width: 0; }
.stat-lbl { font-size: 12.5px; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-val { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; word-break: break-word; }
.stat.small .stat-val { font-size: 16px; }
.stat-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 20px; font-size: 12px; }
.stat-spark { margin-top: 4px; height: 34px; }
.stat-spark svg { display: block; width: 100%; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; padding: 1px 6px 1px 4px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up-good { color: var(--gain); background: var(--gain-bg); }
.delta.down-bad { color: var(--loss); background: var(--loss-bg); }
.delta.flat { color: var(--text-2); background: var(--surface-3); }
.spark-svg { overflow: visible; }
.spark-empty { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 3; }

/* Biểu đồ sóng */
.wave-card { margin-bottom: 16px; }
.wave-card > .card-body { padding-top: 6px; }
.wave-head { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px 4px; flex-wrap: wrap; }
.readout { min-width: 0; flex: 1 1 260px; }
.readout-lbl { font-size: 12.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; }
.readout-val { font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; margin-top: 2px; min-height: 36px; }
.readout-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.chart-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chart-tools .check { font-size: 12.5px; color: var(--text-2); }
.metric-chips { display: flex; gap: 6px; padding: 8px 18px 4px; overflow-x: auto; scrollbar-width: thin; }
.mchip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.mchip:hover { background: var(--surface-2); color: var(--text); }
.mchip.active { background: var(--primary-weak); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); color: var(--text); font-weight: 600; }
.mchip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.mchip-key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; flex: none; }
.wave-box { position: relative; height: 300px; }
.wave-box.tall { height: 340px; }
.wave-box.short { height: 170px; }
.chart-tip { position: absolute; pointer-events: none; opacity: 0; z-index: 20; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 9px 11px; min-width: 170px; max-width: 280px; font-size: 12px; transition: opacity .1s; }
.tip-title { font-weight: 600; color: var(--text-2); margin-bottom: 6px; font-size: 12px; }
.tip-row { display: flex; align-items: center; gap: 8px; line-height: 1.65; }
.tip-row strong { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.tip-lbl { color: var(--muted); margin-left: auto; padding-left: 10px; white-space: nowrap; }
.tip-row .tip-lbl:first-child { margin-left: 0; padding-left: 0; }
.tip-extra .tip-row { justify-content: space-between; }
.tip-extra .tip-row .tip-lbl { margin-left: 0; padding-left: 0; }
.tip-key { width: 12px; height: 2.5px; border-radius: 2px; flex: none; }
.tip-key.dash { background: none; border-top: 2px dashed var(--text-2); height: 0; }
.tip-extra { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 5px; }
.tip-row.warn strong { color: var(--warn); }
.tip-row.muted strong { color: var(--muted); font-weight: 500; }
.mini-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.mini-wave { padding: 10px 12px 6px; margin-top: 0 !important; }
.mini-wave.active { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 4px; }
.mini-read { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.mini-read strong { font-size: 14px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.link-btn:hover { color: var(--text); }
.ads-row { margin-bottom: 16px; }
.ads-row > .card { margin-top: 0; }
.ads-empty { text-align: center; padding: 36px 16px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ads-empty .ico { color: var(--primary); }
.ads-empty h2 { margin: 4px 0 0; font-size: 17px; color: var(--text); }
.ads-empty p { max-width: 560px; margin: 0 0 6px; }

/* Phát hiện tự động */
.insights { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; margin: -4px -6px; padding: 4px 6px; }
.insight { display: flex; gap: 10px; align-items: flex-start; text-align: left; font: inherit; color: inherit; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 9px 10px; width: 100%; }
button.insight { cursor: pointer; }
button.insight:hover { border-color: var(--border-strong); }
.insight > .ico:last-child { margin-left: auto; color: var(--muted); align-self: center; }
.ins-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.ins-txt { min-width: 0; }
.ins-title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.ins-detail { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* Phễu */
.funnel { display: flex; align-items: stretch; gap: 4px; flex-wrap: wrap; }
.fn-stage { flex: 1 1 90px; background: var(--surface-2); border-radius: 10px; padding: 10px; min-width: 0; }
.fn-lbl { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.fn-val { font-size: 16px; font-weight: 700; margin-top: 2px; word-break: break-word; }
.fn-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); padding: 0 2px; min-width: 52px; text-align: center; }
.fn-rate { font-weight: 700; font-size: 12px; color: var(--text); }
.fn-rl { font-size: 10.5px; color: var(--muted); }

/* Nhịp ngân sách */
.pacing { display: flex; flex-direction: column; gap: 14px; }
.pace-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.pace-sub { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.meter { position: relative; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--s-in) 16%, var(--surface-2)); overflow: visible; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--s-in); }
.meter.warn { background: color-mix(in srgb, var(--st-warning) 22%, var(--surface-2)); }
.meter.warn .meter-fill { background: var(--st-warning); }
.meter.crit { background: color-mix(in srgb, var(--st-critical) 18%, var(--surface-2)); }
.meter.crit .meter-fill { background: var(--st-critical); }
.meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; opacity: .55; }

/* Bảng chi tiết */
table.t.dense th, table.t.dense td { padding: 8px 10px; }
table.sortable-t th.sortable { cursor: pointer; user-select: none; }
table.sortable-t th.sortable:hover { color: var(--text); }
table.sortable-t th.sorted { color: var(--primary); }
.cell-name { font-weight: 600; }
td.spark-td { padding-top: 4px !important; padding-bottom: 4px !important; }
.cpa-cell { display: inline-flex; align-items: center; gap: 6px; }
.cpa-cell .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cpa-cell .dot.st-good { background: var(--st-good); }
.cpa-cell .dot.st-crit { background: var(--st-critical); }
.detail-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.detail-tools input[type=search] { flex: 1 1 220px; max-width: 360px; padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); min-height: 36px; }
.detail-tools input[type=search]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.fchip.active { background: var(--primary-weak); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); color: var(--text); font-weight: 600; }

/* Bản đồ nhiệt */
.heat-wrap { position: relative; }
.heat-scroll { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(22px, 1fr)); gap: 3px; min-width: 640px; }
.heat-hh, .heat-wd { font-size: 11px; color: var(--muted); display: flex; align-items: center; }
.heat-hh { justify-content: flex-start; height: 16px; }
.heat-c { height: 26px; border-radius: 5px; background: var(--surface-2); cursor: default; outline: none; transition: box-shadow .1s; }
.heat-c.none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--surface-3) 3px, var(--surface-3) 5px); }
.heat-c:hover, .heat-c:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-2); }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.heat-scale { width: 140px; height: 8px; border-radius: 999px; }
.heat-tip { position: absolute; pointer-events: none; opacity: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 9px 11px; min-width: 180px; font-size: 12px; transition: opacity .1s; }

/* Nhập tay */
.entry-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.date-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.date-nav input[type=date] { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); min-height: 36px; }
.entry-foot { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
table.ads-entry td { vertical-align: top; }
table.ads-entry .num-in { width: 110px; text-align: right; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-variant-numeric: tabular-nums; }
table.ads-entry .num-in::placeholder { color: var(--muted); opacity: 1; font-size: 11.5px; }
table.ads-entry select { padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
table.ads-entry tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
table.ads-entry td.calc { color: var(--text-2); white-space: nowrap; padding-top: 16px; }
table.ads-entry .tag { margin-top: 4px; }

/* Nhập file */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 22px 16px; border: 2px dashed var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-weak); }
.dropzone .ico { color: var(--primary); }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0; }
.paste-in { width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; }
.paste-in:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.import-top { margin-bottom: 16px; }
.guide ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.chips-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.chips-info .ci { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.map-details { margin: 10px 0 4px; }
.map-details summary, .camp-details summary { cursor: pointer; color: var(--primary); font-weight: 500; font-size: 13px; padding: 4px 0; }
.map-details .table-wrap { margin: 8px 0; }
.map-t select { padding: 5px 6px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 12px; max-width: 150px; }
.groups { display: flex; flex-direction: column; gap: 10px; }
.grp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); gap: 8px 16px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.grp-info { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; min-width: 0; }
.camp-details { grid-column: 1 / -1; }
.camp-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.camp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); gap: 10px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--border); }

@media (max-width: 1280px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .wave-box.tall { height: 280px; } .wave-box { height: 250px; }
  .readout-val { font-size: 24px; }
  .chart-tools { justify-content: flex-start; }
  .grp, .camp-row { grid-template-columns: 1fr; }
  .metric-chips { padding-left: 12px; padding-right: 12px; }
  .wave-head { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-val { font-size: 18px; } .mini-grid { grid-template-columns: 1fr; } .fn-arrow { min-width: 44px; } }

/* ------------------------------------------------ Trung tâm điều khiển */
.cmd { transition: opacity .15s; }
.cmd.is-loading { opacity: .55; pointer-events: none; }
.form-stack { display: flex; flex-direction: column; gap: 12px; min-width: min(520px, 80vw); }
.form-stack .row > .field { flex: 1 1 180px; }
.form-stack textarea { width: 100%; }

/* Khung chờ dạng skeleton */
.sk { border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-bar { height: 54px; margin-bottom: 12px; }
.sk-tile { height: 128px; }
.sk-chart { height: 470px; }
.sk-side { height: 470px; }
.sk-card { height: 380px; }

/* Bản tin */
.brief { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.brief-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--s-cpc) 16%, var(--surface)); color: color-mix(in srgb, var(--s-cpc) 75%, var(--text)); flex: none; }
.brief-head { display: flex; flex-direction: column; line-height: 1.25; min-width: 120px; }
.brief-head strong { font-size: 13.5px; }
.brief-items { display: flex; gap: 6px 20px; flex-wrap: wrap; flex: 1; align-items: center; }
.brief-i { display: flex; align-items: baseline; gap: 6px; font-size: 13px; white-space: nowrap; }
.brief-l { color: var(--text-2); font-size: 12px; }
.brief-i strong { font-variant-numeric: tabular-nums; font-size: 14px; }
.brief.empty-day .brief-txt { flex: 1; font-size: 13px; }

/* Ô KPI chính */
.stat.hero { background: linear-gradient(160deg, color-mix(in srgb, var(--s-cum) 7%, var(--surface)) 0%, var(--surface) 70%); }
.stat.hero .stat-val { font-size: 23px; }
.stat-note { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Dải dòng tiền */
.fin-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: -2px 0 14px; }
.fin-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); text-decoration: none; }
a.fin-chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.fin-chip strong { color: var(--text); font-variant-numeric: tabular-nums; }
.fin-chip strong.warn-txt { color: var(--warn); }

/* Bố cục */
.cmd-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.cmd-main > .card { margin: 0; }
.cmd-row2 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; margin-bottom: 16px; }
.cmd-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.cmd-row2 > .card, .cmd-row3 > .card { margin: 0; }
.cmd-chart { margin-bottom: 0; display: flex; flex-direction: column; }
.cmd-chart .card-body { flex: 1; }
.check.disabled { opacity: .45; cursor: not-allowed; }
.fc-note { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.tip-row.note strong { font-weight: 500; color: var(--s-cum); white-space: normal; text-align: right; }
.tip-sub { color: var(--muted); font-size: 11.5px; margin: -4px 0 6px; }
.tip-foot { margin-top: 6px; }
.tip-extra .tip-row.note { align-items: flex-start; gap: 10px; }

/* Thanh điều hướng thời gian */
.navi-wrap { margin-top: 10px; }
.navi { position: relative; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; touch-action: none; user-select: none; cursor: crosshair; }
.navi .spark-svg { position: absolute; inset: 2px 0; width: 100%; height: 40px; }
.navi-shade { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--surface-3) 70%, transparent); pointer-events: none; }
.navi-win { position: absolute; top: 0; bottom: 0; border: 1.5px solid var(--primary); border-radius: 6px; background: color-mix(in srgb, var(--primary) 7%, transparent); cursor: grab; outline: none; }
.navi-win:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.navi-win:active { cursor: grabbing; }
.navi-h { position: absolute; top: 50%; width: 8px; height: 22px; margin-top: -11px; border-radius: 3px; background: var(--primary); cursor: ew-resize; }
.navi-h.l { left: -5px; } .navi-h.r { right: -5px; }
.navi-h::before { content: ''; position: absolute; left: -8px; right: -8px; top: -10px; bottom: -10px; }
.navi-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* Việc cần làm */
.todo-card { display: flex; flex-direction: column; }
.todo-card .card-body { flex: 1; overflow: hidden; }
.todo { display: flex; flex-direction: column; gap: 8px; max-height: 470px; overflow-y: auto; margin: -4px -6px; padding: 4px 6px; }
.todo-i { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid transparent; }
.todo-i.bad { border-left-color: var(--st-critical); }
.todo-i.warn { border-left-color: var(--st-warning); }
.todo-i.good { border-left-color: var(--st-good); }
.todo-i.info { border-left-color: var(--info); }
.todo-cta { margin-top: 7px; gap: 4px; }
.todo-ok { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 10px; text-align: center; }
.todo-ok .ico { color: var(--st-good); }
.count-pill { min-width: 24px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

/* Ma trận ngân sách */
.quad-box { height: 330px; }
.quad-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12.5px; color: var(--text-2); }
.ql { display: inline-flex; align-items: center; gap: 5px; }
.ql b { color: var(--text); font-variant-numeric: tabular-nums; }
.ql.zero { opacity: .5; }
.ql-dot { width: 9px; height: 9px; border-radius: 50%; }

/* Mục tiêu */
.goals { display: flex; flex-direction: column; gap: 16px; }
.goal-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.goal-sub { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; margin-top: 6px; color: var(--text-2); }
.goal-sub strong { font-variant-numeric: tabular-nums; }

/* Biến động, xếp hạng, nhật ký */
.movers, .board, .journal { display: flex; flex-direction: column; gap: 2px; }
.mover, .brd { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; text-align: left; font: inherit; color: inherit; background: none; border: 0; width: 100%; }
button.mover { cursor: pointer; }
button.mover:hover { background: var(--surface-2); }
.mv-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.mv-txt, .brd-txt { min-width: 0; flex: 1; }
.mv-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.mv-val strong { font-size: 13.5px; }
.rank { width: 24px; text-align: center; font-weight: 700; color: var(--muted); font-size: 12.5px; flex: none; display: grid; place-items: center; }
.rank.r1 { color: #d4a017; } .rank.r2 { color: #8a96a8; } .rank.r3 { color: #b8743c; }
.jr { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.jr:last-child { border-bottom: 0; }
.jr-date { font-weight: 700; font-size: 12px; color: var(--s-cum); background: color-mix(in srgb, var(--s-cum) 12%, var(--surface)); border-radius: 7px; padding: 3px 7px; flex: none; font-variant-numeric: tabular-nums; }
.jr-txt { flex: 1; min-width: 0; }
.jr-title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.jchgs { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; align-items: center; }
.jchg { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.jchg.good { background: var(--gain-bg); color: var(--gain); }
.jchg.bad { background: var(--loss-bg); color: var(--loss); }
.jchg.flat { background: var(--surface-3); color: var(--text-2); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; flex: none; }

/* Bảng tài khoản */
.acc-card { margin-bottom: 16px; }
.heat-cell { display: inline-block; min-width: 64px; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
table.acc-t td { vertical-align: middle; }

@media (max-width: 1280px) {
  .cmd-main { grid-template-columns: minmax(0, 1fr); }
  .todo { max-height: none; }
  .cmd-row3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmd-row3 > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 960px) { .cmd-row2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .cmd-row3 { grid-template-columns: minmax(0, 1fr); }
  .brief-items { gap: 6px 14px; }
  .quad-box { height: 280px; }
  .navi-hint { display: none; }
}
@media (max-width: 560px) {
  .stat.hero { grid-column: 1 / -1; }
  .stat.hero .stat-val { font-size: 22px; }
  .brief { gap: 10px; }
  .brief-head { min-width: 0; }
  .form-stack { min-width: 0; }
}
.stat-val .unit { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat.hero .stat-val .unit { font-size: 12.5px; }
.gmeter { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); }
.gmeter-fc { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: color-mix(in srgb, var(--s-ref) 22%, transparent); }
.gmeter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--s-ref); z-index: 1; }
.gmeter.risk .gmeter-fill { background: var(--st-warning); }
.gmeter.risk .gmeter-fc { background: color-mix(in srgb, var(--st-warning) 25%, transparent); }
.gmeter .meter-mark { z-index: 2; }
.detail-tools .btn { margin-left: auto; }
/* Chú thích ⓘ: chỉ tạo hộp khi hiện để không gây cuộn ngang trên điện thoại */
.info-tip::after { display: none; max-width: min(260px, 78vw); }
.info-tip:hover::after, .info-tip:focus::after { display: block; }
.card-head .right .info-tip::after { left: auto; right: -6px; transform: none; }
.stat-top .info-tip::after { left: -60px; right: auto; transform: none; top: calc(100% + 8px); bottom: auto; }
.cmd .stat-grid { grid-template-columns: minmax(0, 1.35fr) repeat(5, minmax(0, 1fr)); }
.cmd-main > .todo-card { position: relative; min-height: 360px; }
.cmd-main > .todo-card > .card-body { position: absolute; top: 56px; left: 0; right: 0; bottom: 0; overflow-y: auto; }
.cmd-main > .todo-card .todo { max-height: none; overflow: visible; }
@media (max-width: 1280px) {
  .cmd .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cmd-main > .todo-card { min-height: 0; }
  .cmd-main > .todo-card > .card-body { position: static; overflow: visible; }
}
@media (max-width: 560px) { .cmd .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cmd .stat-val { font-size: 19.5px; }
.cmd .stat.hero .stat-val { font-size: 23px; }
.stat-val .unit { display: inline-block; }
@media (max-width: 700px) { .cmd-main > .todo-card { order: -1; } }

/* ------------------------------------------------ Thanh lọc gọn + chế độ xem */
.filters { display: block; padding: 12px 16px; }
.filters-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters-tools { display: flex; gap: 8px; align-items: flex-end; margin-left: auto; }
.filters-head { display: none; }
.views { position: relative; }
.views-menu { right: 0; left: auto; min-width: 280px; }
.view-i { display: flex; align-items: center; gap: 2px; }
.view-i .view-go { flex: 1; min-width: 0; }
.view-i .view-x { width: 32px !important; flex: none; justify-content: center; color: var(--muted) !important; }
@media (max-width: 700px) {
  .filters { padding: 0; }
  .filters-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
  .filters-head .fsum-txt { flex: 1; min-width: 0; color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .filters-head > .ico:last-child { transition: transform .15s; color: var(--muted); }
  .filters.open .filters-head > .ico:last-child { transform: rotate(180deg); }
  .filters:not(.open) .filters-fields { display: none; }
  .filters.open .filters-fields { padding: 0 14px 14px; border-top: 1px solid var(--border); padding-top: 12px; }
  .filters-tools { margin-left: 0; width: 100%; }
}

/* ------------------------------------------------ Thanh lệnh nhanh Ctrl+K */
.topbar .cmdk-trigger { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 520px; height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.topbar .cmdk-trigger:hover { border-color: var(--border-strong); background: var(--surface); }
.topbar .cmdk-trigger:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); border-color: var(--primary); }
.cmdk-ph { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { display: inline-block; font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-2); white-space: nowrap; }
.cmdk-ov { padding-top: 10vh; }
.cmdk { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; }
.cmdk-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.cmdk-in { flex: 1; border: 0; outline: none; background: none; font: inherit; font-size: 16px; color: var(--text); min-width: 0; }
.cmdk-list { overflow-y: auto; padding: 6px; flex: 1; }
.cmdk-grp { padding: 10px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.cmdk-i { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; min-width: 0; }
.cmdk-i.sel { background: var(--primary-weak); }
.cmdk-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.cmdk-i.sel .cmdk-ic { background: var(--surface); color: var(--primary); }
.cmdk-l { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cmdk-l mark { background: color-mix(in srgb, var(--s-cpc) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.cmdk-s { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.cmdk-enter { margin-left: auto; color: var(--primary); opacity: 0; flex: none; }
.cmdk-i.sel .cmdk-enter { opacity: 1; }
.cmdk-empty { padding: 26px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.cmdk-foot kbd { margin-right: 2px; }

/* ------------------------------------------------ Điều hướng dưới (điện thoại) */
.bottom-nav { display: none; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: min(460px, 80vw); }
.quick-i { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.quick-i:hover { border-color: var(--primary); }
.quick-i .ico { color: var(--primary); }
.quick-i span { font-size: 12px; color: var(--muted); }
@media (max-width: 700px) {
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(62px + env(safe-area-inset-bottom)); padding: 4px 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(160%) blur(10px); border-top: 1px solid var(--border); align-items: center; justify-content: space-around; }
  .bn-i { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; padding: 6px 0; color: var(--muted); font-size: 10.5px; font-weight: 600; border: 0; background: none; text-decoration: none; cursor: pointer; font-family: inherit; }
  .bn-i.active { color: var(--primary); }
  .bn-i:hover { text-decoration: none; }
  .bn-add { width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent); margin: 0 6px; cursor: pointer; flex: none; }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .topbar .cmdk-trigger kbd { display: none; }
  .bot-fab { bottom: calc(76px + env(safe-area-inset-bottom)); right: 14px; width: 48px; height: 48px; border-radius: 15px; }
  .quick-grid { grid-template-columns: 1fr 1fr; min-width: 0; }
}

/* ------------------------------------------------ Quy tắc cảnh báo */
.rules { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rule { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.rule.off { opacity: .6; }
.rule-txt { flex: 1; min-width: 220px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch .slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--ring); }
.topbar .cmdk-trigger .ico { position: static; transform: none; color: var(--muted); }
@media (max-width: 700px) { .page-head .actions.cmd-actions { display: none; } }

/* ------------------------------------------------ Nhập file Google Ads */
.dropzone.big { padding: 34px 18px; gap: 8px; border-radius: 16px; }
.dz-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-weak); color: var(--primary); margin-bottom: 4px; }
.dropzone.big strong { font-size: 15.5px; }
.dropzone.big u { color: var(--primary); text-underline-offset: 3px; }
.dz-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.paste-details { margin-top: 12px; }
.paste-details summary { cursor: pointer; color: var(--text-2); font-size: 13px; padding: 4px 0; }
.paste-details[open] summary { margin-bottom: 8px; }
.guide .tip { display: flex; gap: 8px; align-items: flex-start; background: color-mix(in srgb, var(--s-cpc) 12%, var(--surface)); border-radius: 10px; padding: 10px 12px; margin: 12px 0 8px; font-size: 13px; }
.guide .tip .ico { color: color-mix(in srgb, var(--s-cpc) 75%, var(--text)); flex: none; margin-top: 1px; }
.imp-loading { display: flex; align-items: center; gap: 10px; padding: 18px 4px; color: var(--text-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--primary); animation: spin .7s linear infinite; display: inline-block; flex: none; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; border-color: color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.imp-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.imp-stats .ci { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.imp-stats .ci strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-meta { margin-bottom: 12px; }
.grp.need { border-color: color-mix(in srgb, var(--st-warning) 55%, var(--border)); background: color-mix(in srgb, var(--st-warning) 5%, var(--surface)); }
.btn.lg { padding: 10px 18px; font-size: 14.5px; border-radius: 12px; }
.need-date .alert { margin-bottom: 12px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.choice.best { background: var(--gain-bg); border-color: color-mix(in srgb, var(--gain) 30%, transparent); }
.choice-h { display: flex; gap: 8px; align-items: center; }
.choice p { margin: 0; }
.choice .row .field { flex: 1 1 130px; }
.imp-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--gain-bg); border: 1px solid color-mix(in srgb, var(--gain) 25%, transparent); }
.imp-banner .ins-txt { flex: 1; }
.imp-banner ul { margin: 6px 0 0; padding-left: 18px; }
.drop-ov { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: color-mix(in srgb, var(--primary) 14%, rgba(8,12,22,.45)); backdrop-filter: blur(3px); pointer-events: none; }
.drop-ov.on { display: flex; }
.drop-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 48px; border-radius: 22px; background: var(--surface); border: 2px dashed var(--primary); color: var(--text); box-shadow: var(--shadow-lg); text-align: center; }
.drop-box .ico { color: var(--primary); }
.drop-box strong { font-size: 17px; }
.drop-box span { color: var(--muted); font-size: 13px; }
@media (max-width: 960px) { .imp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .choices { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .imp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .imp-stats .ci:first-child, .imp-stats .ci:nth-child(2) { grid-column: 1 / -1; } }

/* ============================================================ MCC */
.acc-filter { width: 220px; max-width: 100%; }
.mcc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.mcc-head .small { max-width: 640px; }
.mcc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.mcc-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm, none); transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.mcc-card:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 6px 20px rgba(20, 30, 60, .08); }
.mcc-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mcc-card.none { background: var(--surface-2); border-style: dashed; }
.mcc-card.closed { opacity: .65; }
.mcc-card-h { display: flex; gap: 10px; align-items: center; min-width: 0; }
.mcc-card-t { flex: 1; min-width: 0; }
.mcc-card-t strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.mcc-card-t .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcc-ic { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); flex: none; }
.mcc-count { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.mcc-nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mcc-num { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcc-card.none .mcc-num { background: var(--surface); }
.mcc-num strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcc-card-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mcc-tag { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.mcc-tag.st-warn { background: var(--warn-bg, #fff4e0); color: var(--warn, #b26b00); }
.mcc-move { margin-top: 12px; align-items: center; justify-content: flex-end; }
.mcc-move select { max-width: 260px; }
/* Thanh MCC khi nhập file */
.mcc-bar { display: grid; grid-template-columns: auto minmax(0, 420px) minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 10px; }
.mcc-bar.auto { border-color: color-mix(in srgb, var(--gain) 35%, var(--border)); background: color-mix(in srgb, var(--gain) 6%, var(--surface)); }
.mcc-bar-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mcc-lbl { font-size: 12px; font-weight: 600; color: var(--text-2); }
.mcc-bar select { width: 100%; }
.mcc-hint { color: var(--text-2); line-height: 1.5; }
.mcc-hint .tag { margin-right: 4px; }
.mcc-unknown { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mcc-unknown .btn { margin-left: auto; }
.mcc-conflict { display: flex; gap: 8px; align-items: flex-start; }
.bulk-new { border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.bulk-new-h { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
.bulk-new-h > svg { color: var(--primary); flex: none; margin-top: 2px; }
.bulk-new-f { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.bulk-new-f .field { flex: 1 1 200px; margin: 0; }
.bulk-new-f .btn { flex: none; }
.grp-info .tag + .tag { margin-left: 6px; }
@media (max-width: 760px) {
  .mcc-bar { grid-template-columns: auto minmax(0, 1fr); }
  .mcc-hint { grid-column: 1 / -1; }
  .acc-filter { width: 100%; }
  .mcc-move select { max-width: none; flex: 1 1 100%; }
}

/* ============================================================ Tổng quan chủ · Lương · Của tôi */
.own-kpis .stat { cursor: default; }
.own-kpis .stat-val small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.own-card { margin-bottom: 16px; }
.own-card .card-head .right { font-size: 12px; color: var(--muted); }
.own-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.own-chart { height: 220px; position: relative; }
.legend { display: inline-flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: #fff; flex: none; }
.run-t td, .run-t th { white-space: nowrap; }
.run-t tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); }
/* Số dự án / lãi / lỗ bấm được → xếp hạng dự án */
.pc-btn { border: 0; background: var(--surface-3); color: var(--text); font: inherit; font-weight: 700; padding: 2px 4px 2px 8px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.pc-btn:hover, .pc-btn:focus-visible { background: var(--primary-weak); color: var(--primary); }
.pc-btn svg { opacity: .6; }
.pc-k { border: 0; background: none; padding: 0 1px; font: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.pc-k.gain { color: var(--gain); } .pc-k.loss { color: var(--loss); }
.pc-k:hover { text-decoration-style: solid; }
.rank-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rank-bar > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rank-t td { vertical-align: middle; }
.rank-n { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 5px; border-radius: 7px; background: var(--surface-3); font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.rank-t tr.pl-win .rank-n.top { background: var(--gain-bg); color: var(--gain); }
.rank-t tr.pl-loss .rank-n.top { background: var(--loss-bg); color: var(--loss); }
.rank-t .rk-sub { display: none; font-weight: 400; }
@media (max-width: 640px) { .rank-bar { flex-direction: column; align-items: stretch; } .rank-bar .seg { flex-wrap: wrap; }
  .rank-t .rk-opt { display: none; } .rank-t .rk-sub { display: block; margin-top: 2px; } .rank-t td.wrap { min-width: 0; } }
.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-x { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.todo-x:hover { text-decoration: none; background: var(--surface-3); }
.todo-x .ic { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.todo-x .ic.crit { background: var(--loss-bg); color: var(--loss); }
.todo-x .ic.warn { background: var(--warn-bg); color: var(--warn); }
.todo-x .ic.info { background: var(--info-bg); color: var(--info); }
.todo-x b { display: block; font-size: 13.5px; }
.todo-x span { font-size: 12.5px; color: var(--text-2); }
.formula { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--primary-weak); color: var(--text); font-size: 13.5px; margin-bottom: 16px; }
.formula .chip { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px 9px; font-weight: 600; }
.pay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.card.pay { padding: 16px 18px; }
.pay-grid > .card { margin: 0; }
.pay-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pay-h .av { width: 34px; height: 34px; }
.pay-h b { font-size: 15px; }
.pay-h .tag { margin-left: auto; }
.pl { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pl .l { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 6px; }
.pl.sub { padding-left: 14px; font-size: 13px; }
.pl.sum { border-top: 1px dashed var(--border-strong); margin-top: 4px; padding-top: 9px; font-weight: 700; }
.pl.sum .l { color: var(--text); }
.pl.big { border-top: 2px solid var(--border-strong); margin-top: 6px; padding-top: 10px; font-size: 16px; font-weight: 800; }
.pl.carry { color: var(--warn); font-weight: 600; }
.pay-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.x-mini { border: 0; background: var(--surface-3); color: var(--muted); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; line-height: 16px; padding: 0; font-size: 13px; }
.x-mini:hover { background: var(--loss-bg); color: var(--loss); }
.handover { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.handover .row .field { flex: 1 1 180px; margin: 0; }
.hist { display: flex; flex-direction: column; gap: 8px; }
.hist .hi { display: flex; gap: 10px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.hist .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; }
.hist .dot.now { background: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.me-hero { padding: 18px 20px; border-radius: 16px; background: var(--brand-grad); color: #fff; margin-bottom: 14px; }
.me-hero .k { font-size: 12.5px; opacity: .85; }
.me-hero .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.me-hero .s { font-size: 12.5px; opacity: .9; }
.me-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.me-proj { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); text-decoration: none; }
.me-proj:hover { text-decoration: none; background: var(--surface-2); }
.me-proj:last-child { border-bottom: 0; }
.mods { display: flex; flex-direction: column; gap: 12px; }
.mod-i { align-items: flex-start; gap: 12px; }
@media (max-width: 960px) { .own-row, .pay-grid { grid-template-columns: minmax(0, 1fr); } .me-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Hoa hồng mạng */
.stat-subs { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.est-l { font-size: 12px; color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--border-strong); }
.est-l:hover { color: var(--primary); }
.me-hero .s.est { opacity: .92; margin-top: 2px; }
.net-upd { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: -4px 0 12px; }
.net-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; max-width: 340px; }
.net-flags .tag { white-space: normal; text-align: left; line-height: 1.3; }
.net-t td.wrap { min-width: 220px; }
.warn-t { color: var(--warn, #b7791f); font-weight: 600; }
.net-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 10px; }
.net-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.net-sum > div span { font-size: 12px; }
.net-pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.net-pick select { min-width: 200px; max-width: 280px; }
.net-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
.sec-t { font-size: 14px; margin: 16px 0 8px; }
.danger-t { color: var(--loss); }
@media (max-width: 640px) { .net-pick select { min-width: 0; max-width: 100%; width: 100%; } .net-flags { max-width: none; } }

/* Sức khỏe tài khoản & chi phí cố định */
.health-bar { align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.health-bar select { width: auto; }
.hist-i { display: flex; flex-direction: column; gap: 2px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; position: relative; padding-right: 36px; }
.hist-i:last-child { border-bottom: 0; }
.hist-i > button { position: absolute; right: 0; top: 8px; }
.reason-l, .fixed-l { display: flex; flex-direction: column; }
.reason-l > div, .fixed-l > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.reason-l > div:last-child, .fixed-l > div:last-child { border-bottom: 0; }
.fixed-l .fixed-t { font-weight: 700; }
.health-sus { border-color: var(--warn-bg, #fde68a); }
.grid.g-top { align-items: start; }
.tg-steps { margin: 6px 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.tg-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.script-ta { width: 100%; font-size: 12px; line-height: 1.45; white-space: pre; }
.recon-state { display: flex; gap: 10px; align-items: flex-start; }
.recon-state > svg { flex: none; margin-top: 2px; }
.range-lbl { font-weight: 600; color: var(--text-2); }
.formulas { margin: -4px 0 14px; font-size: 13px; color: var(--text-2); }
.formulas summary { cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.formulas ul { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
/* Tình trạng số liệu */
.dstatus { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.dstatus:empty { display: none; }
.dchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.dchip .btn.sm { padding: 2px 8px; font-size: 12px; border-radius: 999px; }
.dchip.ok svg { color: var(--gain); }
.dchip.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-bg); color: var(--warn); }
.dchip.info svg { color: var(--primary); }

/* ------------------------------------------------ v1.9 · Đăng nhập (mục 19–20) */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 46px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: none; border-radius: 8px; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.pw-eye:hover { background: var(--surface-3); color: var(--text); }
.pw-eye:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.caps-hint { min-height: 0; font-size: 12.5px; color: var(--warn); display: flex; align-items: center; gap: 5px; font-weight: 600; }
.caps-hint:empty { display: none; }
.login-help { margin-top: 18px; font-size: 13.5px; color: var(--text-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--surface); }
.login-help summary { cursor: pointer; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; list-style: none; }
.login-help summary::-webkit-details-marker { display: none; }
.login-help ul { margin: 10px 0 2px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.login-help b { color: var(--text); }
.login-help a { color: var(--primary); font-weight: 600; }
.auth .box .lead { color: var(--text-2); }
/* ------------------------------------------------ v1.9 · Lương (mục 06–12) */
.pay-lines { margin: 2px 0 4px; padding: 6px 0 2px; border-top: 1px dashed var(--border); }
.pl.line { align-items: flex-start; padding: 5px 0; }
.pl.line > .l { display: block; white-space: normal; }
.pl .fx { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.pl.late .l { color: var(--warn); }
.pl .carry-link { background: none; border: 0; padding: 0; font: inherit; color: var(--warn); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.pl .carry-link:hover { color: var(--text); }
.alert.snap { display: flex; gap: 8px; align-items: flex-start; }
.strike { text-decoration: line-through; color: var(--muted); }
.empty-x { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hist-t td.num, .hist-t th.num { white-space: nowrap; }
/* ------------------------------------------------ v1.9 · Nhập theo việc · liên kết · checklist (mục 03, 17, 18) */
.task-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.task-c { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; min-width: 0; }
.task-c:hover { border-color: var(--primary); background: var(--primary-weak); }
.task-c:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); border-color: var(--primary); }
.task-c > .ico:last-child { margin-left: auto; color: var(--text-2); flex: none; }
.task-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; flex: none; }
.task-t { display: flex; flex-direction: column; min-width: 0; }
.task-t b { font-size: 14px; }
.task-t span { font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.task-card { margin-bottom: 14px; }
@media (max-width: 1100px) { .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .task-grid { grid-template-columns: minmax(0, 1fr); } }
.entry-wrap { max-height: min(62vh, 640px); overflow: auto; border-radius: 10px; }
.entry-wrap table.t th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border); }
table.entry .sub-sel { margin-top: 4px; font-size: 12px; max-width: 260px; }
.link-f { margin: 0; padding: 0; }
.link-box { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; }
.link-card { padding: 12px 14px; margin-top: 12px; }
.role-tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); vertical-align: 1px; }
.recv-kpis { margin-bottom: 14px; }
.setup-card { margin-bottom: 16px; }
.setup-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.setup-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.setup-bar i { display: block; height: 100%; background: var(--gain); border-radius: 99px; }
.setup-l { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.setup-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.setup-i.done { background: transparent; }
.setup-i.done .setup-t b { color: var(--text-2); }
.setup-ic { color: var(--text-2); flex: none; display: inline-flex; }
.setup-i.done .setup-ic { color: var(--gain); }
.setup-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.setup-t span { font-size: 12.5px; color: var(--text-2); }
.setup-i .btn { flex: none; }
.setup-mini { font-size: 13px; color: var(--text-2); margin-bottom: 12px; display: flex; align-items: center; gap: 4px; }
@media (max-width: 760px) { .setup-l { grid-template-columns: minmax(0, 1fr); } }
.setup-done { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.setup-done summary { cursor: pointer; display: flex; align-items: flex-start; gap: 6px; list-style: none; line-height: 1.45; }
.setup-done summary::-webkit-details-marker { display: none; }
.setup-done summary .ico { color: var(--gain); flex: none; }
.setup-done[open] summary { margin-bottom: 8px; }
/* ------------------------------------------------ v1.10 · Phân tích hiệu quả */
.perf-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.perf-sort { display: inline-flex; align-items: center; gap: 6px; }
.perf-sort select { min-height: 36px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 6px 10px; background: var(--surface); }
.perf-q { min-width: 200px; flex: 1; max-width: 320px; }
.perf-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.perf-tile { cursor: default; }
.perf-tile .stat-lbl { overflow: visible; white-space: normal; display: flex; align-items: center; gap: 2px; }
.perf-tile .stat-note { white-space: normal; }
.perf-check { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; margin: 0 0 10px; color: var(--text-2); }
.perf-check.ok .ico:first-child { color: var(--gain); }
.perf-check.bad { color: var(--loss); font-weight: 600; }
.perf-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip-btn:hover { border-color: var(--primary); color: var(--text); }
.chip-btn.on { background: var(--primary-weak); border-color: var(--primary); color: var(--primary); }
.chip-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.perf-t th .info-tip::after { text-transform: none; }
.perf-t th { white-space: nowrap; }
.perf-name { min-width: 180px; max-width: 320px; }
.perf-name .cell-name { white-space: normal; }
.perf-t tbody tr:has(.warn-t .ico) { background: var(--warn-bg); }
.perf-assign { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.perf-assign select { max-width: 320px; min-height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 8px; background: var(--surface); }
.perf-kv { grid-template-columns: max-content 1fr; }
.perf-parts { padding: 10px 14px; margin: 8px 0; }
.perf-parts ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.drawer table.t select { max-width: 240px; min-height: 32px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 3px 6px; background: var(--surface); font-size: 12.5px; }
.drawer .btn.link { background: none; border: 0; color: var(--primary); padding: 2px 0; font-size: 12px; text-decoration: underline; cursor: pointer; }
/* ------------------------------------------------ v1.10 · Thử nghiệm & thư viện kinh nghiệm */
.exp-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.exp-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0; margin: 4px 0 12px; }
.exp-steps li { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); padding: 6px 8px; border-radius: 8px; background: var(--surface-2); min-width: 0; }
.exp-steps li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-3); flex: none; }
.exp-steps li.past { color: var(--gain); }
.exp-steps li.past span { background: var(--gain-bg); color: var(--gain); }
.exp-steps li.on { background: var(--primary-weak); color: var(--primary); font-weight: 700; }
.exp-steps li.on span { background: var(--primary); color: var(--primary-ink); }
.exp-acts { gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.exp-sec { margin: 10px 0; }
.exp-sec h4 { margin: 0 0 4px; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.exp-sec p { margin: 0; white-space: pre-wrap; }
.exp-user { padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.exp-user textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.exp-conc { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.exp-eval { margin: 6px 0 10px; }
.exp-lim ul { margin: 6px 0 0; padding-left: 18px; }
.exp-wins { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.exp-wins input { min-height: 32px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 3px 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; }
.exp-win summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.lesson-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.lesson-filters .field { min-width: 160px; flex: 1; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.lesson-c { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.lesson-c:hover { border-color: var(--primary); }
.lesson-c:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.lesson-c p { margin: 0; color: var(--text-2); }
.lesson-tags { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 560px) { .exp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* ------------------------------------------------ v1.10 · Trợ lý đề xuất */
.bot-badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--loss); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.bot-tabs { display: flex; gap: 4px; padding: 8px 12px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.bot-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; }
.bot-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.bot-tabs button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.sg-views { padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sg-views .seg { width: 100%; }
.sg-views .seg button { flex: 1; }
.sg-body { display: flex; flex-direction: column; gap: 10px; }
.sg-loading { padding: 20px; text-align: center; color: var(--text-2); font-size: 13px; }
.sg-meta { padding: 0 2px; }
.sg-list { display: flex; flex-direction: column; gap: 10px; }
.sg-card { border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 12px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.sg-card.warn { border-left-color: var(--warn); }
.sg-card.focus { box-shadow: 0 0 0 3px var(--ring); }
.sg-top { display: flex; gap: 8px; align-items: flex-start; }
.sg-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--info-bg); color: var(--info); flex: none; }
.sg-card.warn .sg-ic { background: var(--warn-bg); color: var(--warn); }
.sg-rule { color: var(--text-2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sg-title { display: block; font-size: 13.5px; line-height: 1.35; margin: 2px 0; }
.sg-reason { margin: 0; font-size: 12.5px; color: var(--text-2); }
.sg-ev { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.sg-ev th { text-align: left; font-weight: 600; color: var(--text-2); padding: 3px 4px; border-bottom: 1px solid var(--border); font-size: 11px; }
.sg-ev td { padding: 3px 4px; border-bottom: 1px dashed var(--border); }
.sg-ev .num { text-align: right; }
.sg-items { margin: 0; padding-left: 16px; }
.sg-missing { color: var(--warn); }
.sg-action { padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.sg-links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; }
.sg-links a { display: inline-flex; align-items: center; gap: 3px; color: var(--primary); }
.sg-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sg-btns .btn.sm { padding: 4px 8px; font-size: 12px; }
.sg-fb { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.sg-fb .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.sg-fb .icon-btn.on { background: var(--primary-weak); color: var(--primary); border-color: var(--primary); }
.sg-ai { font-size: 12.5px; }
.sg-ai:empty { display: none; }
.sg-ai p { margin: 4px 0; }
.sg-mini { margin-top: 10px; }
.sg-mini:empty { display: none; }
.bot.no-anim { animation: none; }

/* ---- Lãi/lỗ quảng cáo (thu vs chi + cộng dồn) ---- */
.pl-card .card-body { display: flex; flex-direction: column; gap: 12px; }
.pl-head { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; justify-content: space-between; }
.pl-verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pl-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.pl-big { font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pl-reads { display: grid; grid-template-columns: repeat(4, minmax(104px, auto)); gap: 2px 22px; align-items: end; }
.pl-when { grid-column: 1 / -1; min-height: 18px; }
.pl-read { display: flex; flex-direction: column; min-width: 0; }
.pl-read strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-rl { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pl-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pl-key.in { background: var(--s-ref); } .pl-key.out { background: var(--s-out); }
.pl-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.pl-note svg { flex: none; margin-top: 2px; }
.pl-sub { font-size: 12.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.dchip.jump { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
@media (max-width: 720px) { .pl-reads { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; } .pl-big { font-size: 24px; } }

/* ---- Hoàn tiền chờ về ---- */
.nbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.nbadge.crit { background: var(--loss); color: #fff; }
.t tr.row-crit td { background: color-mix(in srgb, var(--loss) 7%, transparent); }
.t tr.row-crit td:first-child { box-shadow: inset 3px 0 0 var(--loss); }
.notif.crit .dot { background: var(--loss); }
.notif.crit.unread { background: color-mix(in srgb, var(--loss) 9%, var(--surface)); }
.notif.crit > div > div:first-child { color: var(--loss); }

/* Xóa dữ liệu để bắt đầu lại */
.card.danger-zone { border-color: color-mix(in srgb, var(--loss) 45%, var(--border)); }
.card.danger-zone .card-head h2 { color: var(--loss); }
.reset-body { display: flex; flex-direction: column; gap: 10px; }
.reset-opt { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.reset-opt input { margin-top: 3px; }
.reset-opt:has(input:checked) { border-color: color-mix(in srgb, var(--loss) 55%, var(--border)); background: color-mix(in srgb, var(--loss) 5%, var(--surface)); }
.reset-act { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.reset-act .field { flex: 1 1 220px; margin: 0; }

/* Tạo tài khoản mới từ file: chọn dự án theo từng tài khoản */
.bulk-rows { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; padding-right: 2px; }
.bulk-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 240px); gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.bulk-row .nm { min-width: 0; }
.bulk-row .nm strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-row .nm .tag { margin-top: 4px; }
.bulk-row select { width: 100%; }
.bulk-row.skip { opacity: .6; }
.bulk-sum { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 560px) { .bulk-row { grid-template-columns: 1fr; } }

/* Nhập thu chi từ bảng tính */
.tc-src { gap: 8px; flex-wrap: wrap; align-items: center; }
.tc-src .grow { flex: 1 1 320px; min-width: 0; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); min-height: 38px; }
.tc-tabs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tc-tab { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.tc-tab input { margin-top: 3px; }
.tc-proj td { vertical-align: top; }
.tc-proj select, .tc-proj input { width: 100%; min-width: 180px; }
.tc-proj input { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }

/* Nhóm trả lương (dự án thường / casino) */
.pay-groupbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;margin:0 0 12px}
.tag-casino{margin-left:6px;font-size:11px;vertical-align:middle}
.own-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 14px}
.own-groups .og{display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:left;padding:10px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text);cursor:pointer;font:inherit;min-width:0}
.own-groups .og:hover{border-color:var(--primary)}
.own-groups .og.active{border-color:var(--primary);background:var(--primary-weak);box-shadow:0 0 0 2px var(--ring)}
.own-groups .og-t{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.own-groups .og-p{color:var(--muted);font-size:13px}
.own-groups .og-s{color:var(--muted);font-size:12px}
@media (max-width:640px){.own-groups{grid-template-columns:1fr}}

.tc-new{display:flex;gap:6px;flex-wrap:wrap}
.tc-new input{flex:1 1 180px;min-width:0}

/* Của tôi: 2 nhóm trả lương */
.me-group{margin-top:18px}
.me-group:first-of-type{margin-top:0}
.me-group + .me-group{padding-top:18px;border-top:1px dashed var(--border)}
/* Form nhập nhanh: chọn nhập vào dự án thường hay casino */
.q-group .seg { align-self: flex-start; max-width: 100%; flex-wrap: wrap; }
.q-group .seg button { padding: 7px 14px; font-size: 13px; }
.q-group.is-casino .seg button.active { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 640px) { .q-group .seg { display: flex; width: 100%; flex-wrap: nowrap; } .q-group .seg button { flex: 1; padding: 7px 8px; line-height: 1.3; } }
/* Link kiểm tra tiền về ví */
.chk-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; vertical-align: middle; }
.chk-link:hover { text-decoration: underline; }
.chk-link.icon-only { padding: 2px 6px; }
.chk-row .chk-link, dd > .chk-link, .chk-link:first-child { margin-left: 0; }
.chk-row { margin-top: 4px; }
.chk-in { display: flex; gap: 8px; align-items: stretch; }
.chk-in input { flex: 1; min-width: 0; }
.chk-in .btn { white-space: nowrap; }
.chk-url { word-break: break-all; margin-top: 4px; }
.req-mark { color: var(--loss); }
.chk-sub { margin-top: 4px; display: block; width: 100%; min-width: 180px; }
/* Trang Dự án: 2 bảng theo nhóm trả lương */
.proj-group + .proj-group { margin-top: 16px; }
.proj-g-note { font-weight: 500; }
.card.proj-casino { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.card.proj-casino .card-head h2 { color: var(--warn); }
/* ============ Khám phá dự án */
.disc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.disc-bar input[type=search] { flex: 1 1 220px; min-width: 0; }
.disc-bar select.inp { width: auto; max-width: 100%; }
.disc-kpis { margin-bottom: 14px; }
.ext-a { display: inline-flex; align-items: center; gap: 2px; }
.disc-dom { font-weight: 600; }
.test-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.test-chip { white-space: nowrap; font-size: 11px; }
.disc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.disc-stats .ds { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.disc-stats .ds span { font-size: 11px; color: var(--text-2); }
.disc-stats .ds b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-stats .ds.gain b { color: var(--gain); } .disc-stats .ds.loss b { color: var(--loss); }
.alert.good { background: var(--gain-bg); color: var(--gain); border-color: color-mix(in srgb, var(--gain) 25%, transparent); }
.btn.icon-only { padding: 8px; }
.feed { display: flex; flex-direction: column; gap: 14px; max-width: 920px; }
.feed-post { padding: 16px; }
.feed-h { display: flex; gap: 10px; align-items: flex-start; }
.feed-h > div { flex: 1; min-width: 0; }
.feed-body { white-space: pre-wrap; margin: 6px 0 10px; line-height: 1.55; }
.feed-act { gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.feed-cms { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.feed-cm { font-size: 13px; }
.feed-cm.want { color: var(--info); }
.feed-cm .x-mini { margin-left: 6px; }
.feed-cm-in { gap: 8px; flex-wrap: nowrap; }
.feed-cm-in input { flex: 1; min-width: 0; }
.tag.niche-casino { background: var(--warn-bg); color: var(--warn); }
.tag.niche-trading { background: var(--info-bg); color: var(--info); }
@media (max-width: 640px) { .disc-bar > * { flex: 1 1 100%; } .disc-bar .seg { justify-content: space-between; } }

/* Thanh báo có bản mới */
.ver-bar{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:9999;display:flex;align-items:center;gap:10px;max-width:calc(100vw - 32px);
  padding:10px 12px 10px 16px;border-radius:12px;background:var(--surface);color:var(--text);border:1px solid var(--primary);box-shadow:0 10px 30px rgba(0,0,0,.35);font-size:14px}
/* Chọn người chạy khi trưởng nhóm nhập giao dịch */
.entry-runner{align-items:flex-end;gap:12px;flex-wrap:wrap;margin:4px 0 10px}
.entry-runner .field{min-width:220px;margin:0}
.entry-runner .small{flex:1;min-width:220px;padding-bottom:8px}
/* 1.18 Ví nhận hoa hồng */
.wl-cell { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.wl-cell .tag { font-size: 11px; padding: 0 6px; line-height: 18px; }
.rank-t select.inp.sm { min-width: 0; padding: 2px 24px 2px 6px; height: 28px; font-size: 12px; }
/* 1.18.2 Sửa tên MCC */
.mcc-card .mcc-edit { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.mcc-bar-main .btn.sm { white-space: nowrap; }
.mcc-rename { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
.mcc-bar-main .btn.sm { align-self: flex-start; }
/* 1.19 Tài khoản đổi dự án */
.grp-switch { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 7%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--primary) 35%, var(--border)); margin-top: 6px; }
.grp-switch .check { display: flex; gap: 6px; align-items: center; }
/* 1.19.4 Xếp hạng dự án cả đội */
.run-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.run-chips .tag { font-size: 11px; white-space: nowrap; }
/* 1.19.5 Ref khách theo ngày */
.ref-date { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ref-date input[type=date] { width: auto; }
.ref-days { display: flex; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; }
.ref-day { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 54px; padding: 6px 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; font: inherit; line-height: 1.2; }
.ref-day span { font-size: 10.5px; color: var(--muted); }
.ref-day b { font-size: 12.5px; color: var(--text); }
.ref-day small { font-size: 11px; font-weight: 600; }
.ref-day.full { background: var(--gain-bg); border-color: color-mix(in srgb, var(--gain) 30%, var(--border)); }
.ref-day.full small { color: var(--gain); }
.ref-day.part { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.ref-day.part small { color: var(--warn); }
.ref-day.miss { background: var(--loss-bg); border-color: color-mix(in srgb, var(--loss) 30%, var(--border)); }
.ref-day.miss small { color: var(--loss); }
.ref-day.on { outline: 2px solid var(--primary); outline-offset: 1px; }
.ref-t .ref-num { width: 76px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ref-t .ref-note { min-width: 200px; }
.ref-t .ref-note input { width: 100%; }
.ref-t tr.ref-miss td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.ref-foot { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 12px 0 6px; }
@media (max-width: 640px) { .ref-t .ref-num { width: 60px; } .ref-t .ref-note { min-width: 150px; } }
