/* ===== CreditIQ Vietnam design system ===== */
:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6ebf3;
  --bg: #f5f7fc;
  --surface: #ffffff;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --cyan: #06b6d4;
  --good: #059669;
  --good-bg: #ecfdf5;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --nav: #0b1120;
  --nav-2: #131c31;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 16px rgba(15, 23, 42, .07), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 .35rem; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 .6rem; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .86em; }
[hidden] { display: none !important; }

/* ---------- boot ---------- */
.boot {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 12px;
  background: var(--nav); color: #cbd5e1; text-align: center; z-index: 90;
}
.boot-logo { font-size: 30px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.boot-logo span { color: var(--cyan); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--nav); }
.auth-hero { color: #e2e8f0; padding: 46px 56px; position: relative; overflow: hidden; display: flex; align-items: center; }
.auth-hero::before {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, .55), transparent 65%);
  top: -220px; left: -180px;
}
.auth-hero::after {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, .32), transparent 65%);
  bottom: -240px; right: -140px;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 560px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-lg { font-size: 22px; color: #fff; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--cyan)); color: #fff; font-size: 15px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .45);
}
.brand-text em { font-style: normal; color: var(--cyan); }
.brand-text small { font-size: 11px; font-weight: 600; color: #94a3b8; letter-spacing: .12em; text-transform: uppercase; }
.auth-hero h1 { font-size: 38px; margin: 26px 0 14px; color: #fff; line-height: 1.18; letter-spacing: -.025em; }
.lede { color: #94a3b8; font-size: 15px; max-width: 480px; }
.hero-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 11px; }
.hero-points li { display: flex; align-items: center; gap: 11px; color: #cbd5e1; font-size: 14px; }
.hero-points i { color: var(--cyan); width: 18px; text-align: center; }
.hero-art { margin-top: 28px; width: 100%; max-width: 470px; border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); border: 1px solid rgba(148, 163, 184, .2); }
.auth-card-wrap { display: flex; flex-direction: column; justify-content: center; padding: 40px 44px; background: var(--bg); }
.auth-card { background: var(--surface); border-radius: 20px; padding: 26px; box-shadow: var(--shadow-lg); max-width: 460px; width: 100%; margin: 0 auto; }
.auth-tabs { display: flex; gap: 6px; background: #eef2f9; padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 9px;
  font-weight: 600; color: var(--muted); cursor: pointer; font-size: 13.5px;
}
.auth-tab.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.auth-form { display: grid; gap: 6px; }
.auth-form label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fbfcfe; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .13); background: #fff; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-2 label { display: block; }
.form-error { margin-top: 12px; background: var(--bad-bg); color: #991b1b; border: 1px solid #fecaca; padding: 9px 12px; border-radius: 10px; font-size: 13px; }
.demo-box { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.demo-title { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.demo-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  margin-bottom: 6px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); text-align: left;
}
.demo-row:hover { border-color: var(--brand); background: #eef2ff; }
.demo-row code { color: var(--muted); font-size: 11.5px; }
.legal { max-width: 460px; margin: 16px auto 0; font-size: 11.5px; color: var(--muted-2); text-align: center; line-height: 1.6; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--nav); color: #cbd5e1; padding: 20px 16px; display: flex; flex-direction: column;
  gap: 18px; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar .brand { color: #fff; padding: 4px 8px 10px; font-size: 17px; }
.nav { display: grid; gap: 3px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: #93a1b8; font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s;
}
.nav a i { width: 17px; text-align: center; font-size: 13.5px; }
.nav a:hover { background: var(--nav-2); color: #e2e8f0; }
.nav a.is-active { background: linear-gradient(90deg, rgba(79, 70, 229, .9), rgba(79, 70, 229, .55)); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.nav .pill { margin-left: auto; background: rgba(148, 163, 184, .22); color: #e2e8f0; border-radius: 20px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.sidebar-foot { border-top: 1px solid rgba(148, 163, 184, .16); padding-top: 14px; display: grid; gap: 10px; }
.sidebar-user { display: flex; gap: 9px; align-items: center; padding: 0 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--cyan)); color: #fff; font-size: 13px; flex: none;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.sidebar-user-role { font-size: 11px; color: #7c8aa0; text-transform: uppercase; letter-spacing: .06em; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px; background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(9px);
}
.topbar h2 { font-size: 17px; margin: 0; }
.page-sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search-hint { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); width: 38px; height: 38px; border-radius: 10px;
  display: none; place-items: center; cursor: pointer; color: var(--ink-2);
}
.view { padding: 24px 26px 60px; max-width: 1500px; width: 100%; }

/* ---------- generic ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-soft { background: #eef2ff; color: var(--brand); }
.btn-soft:hover { background: #e0e7ff; }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: #fecaca; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
}
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-1px); transition: all .16s; }
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h3 { font-size: 15.5px; margin: 0; }
.section-head .sub { font-size: 12.5px; color: var(--muted); margin: 0; }
.section-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; background: #eef2ff; color: var(--brand); letter-spacing: .01em;
}
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.neutral { background: #f1f5f9; color: var(--muted); }

/* KPI */
.kpi { display: grid; gap: 4px; }
.kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.kpi-note { font-size: 11.5px; color: var(--muted-2); }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #eef2ff; color: var(--brand); }

/* ---------- credit card visual ---------- */
.cc {
  position: relative; border-radius: 14px; padding: 14px; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, var(--c, #334155) 0%, color-mix(in srgb, var(--c, #334155) 62%, #000) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .22); min-height: 132px; display: flex; flex-direction: column;
}
.cc::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 88% 6%, rgba(255, 255, 255, .28), transparent 55%);
}
.cc::after {
  content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  border: 22px solid rgba(255, 255, 255, .07); right: -70px; bottom: -110px;
}
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; position: relative; z-index: 1; }
.cc-bank { font-weight: 800; font-size: 12.5px; letter-spacing: .02em; text-transform: uppercase; opacity: .96; }
.cc-chip { width: 26px; height: 19px; border-radius: 4px; background: linear-gradient(135deg, #fde68a, #d4a72c); opacity: .92; }
.cc-name { margin-top: auto; font-size: 13px; font-weight: 700; position: relative; z-index: 1; line-height: 1.3; }
.cc-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 8px; position: relative; z-index: 1; }
.cc-num { font-size: 11.5px; letter-spacing: .16em; opacity: .82; font-weight: 600; }
.cc-net { font-size: 11px; font-weight: 800; font-style: italic; opacity: .95; }

.card-item { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); transition: box-shadow .16s, border-color .16s; }
.card-item:hover { box-shadow: var(--shadow); border-color: #cdd7e8; }
.card-item h4 { font-size: 13.5px; margin: 2px 0 0; line-height: 1.35; }
.metric-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed #eff3f9; }
.metric-row:last-child { border-bottom: 0; }
.metric-row span:first-child { color: var(--muted); }
.metric-row span:last-child { font-weight: 600; text-align: right; }
.card-actions { display: flex; gap: 6px; margin-top: 4px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chk input { width: auto; }

/* ---------- filters ---------- */
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; }
.filters > div { display: grid; gap: 4px; }
.filters label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filter-wide { grid-column: span 2; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
thead th {
  text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 700;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
td.best { background: var(--good-bg); font-weight: 700; color: var(--good); }
td.num, th.num { text-align: right; }
.cmp-head-card { display: grid; gap: 6px; min-width: 150px; }

/* ---------- misc blocks ---------- */
.bar { height: 7px; background: #eef2f8; border-radius: 20px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--brand), var(--cyan)); }
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.bar.good > i { background: linear-gradient(90deg, #10b981, #06b6d4); }
.stat-line { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px dashed #eff3f9; font-size: 13px; }
.stat-line:last-child { border-bottom: 0; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty i { font-size: 26px; color: var(--muted-2); display: block; margin-bottom: 10px; }
.skeleton-wrap { display: grid; gap: 14px; }
.skeleton { height: 92px; border-radius: var(--radius); background: linear-gradient(90deg, #eef2f8, #f8fafc, #eef2f8); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; align-items: flex-start; }
.notice.info { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }
.notice.warn { background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a; }
.notice.bad { background: var(--bad-bg); color: #991b1b; border: 1px solid #fecaca; }
.notice.good { background: var(--good-bg); color: #065f46; border: 1px solid #a7f3d0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center;
  padding: 20px; z-index: 100; backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface); border-radius: 18px; max-width: 720px; width: 100%; max-height: 88vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); padding: 22px;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; margin: 0; }
.modal-close { margin-left: auto; border: 0; background: #f1f5f9; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; color: var(--ink-2); }

/* ---------- toast ---------- */
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 9px; z-index: 200; max-width: 340px; }
.toast {
  background: var(--ink); color: #f8fafc; padding: 11px 14px; border-radius: 11px; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: toastIn .18s ease-out; display: flex; gap: 9px; align-items: flex-start;
}
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- misc responsive ---------- */
.slider-row { display: grid; grid-template-columns: 130px 1fr 76px; gap: 10px; align-items: center; font-size: 13px; }
.slider-row input[type=range] { accent-color: var(--brand); padding: 0; }
.slider-val { text-align: right; font-weight: 700; font-size: 12.5px; color: var(--brand); }
.badge-count { background: var(--bad); color: #fff; border-radius: 20px; font-size: 10.5px; padding: 0 6px; font-weight: 700; }

@media (max-width: 1180px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card-wrap { padding: 28px 20px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%);
    transition: transform .2s ease; height: 100vh; box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .icon-btn { display: grid; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .view { padding: 18px 14px 60px; }
  .search-hint { display: none; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-wide { grid-column: span 2; }
}
@media (max-width: 620px) {
  .g-4 { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 15px; }
  .page-sub { display: none; }
  .auth-hero h1 { font-size: 27px; }
  .kpi-value { font-size: 20px; }
  .slider-row { grid-template-columns: 100px 1fr 64px; }
  .modal { padding: 16px; }
  .card { padding: 14px; }
  .topbar-right .btn span { display: none; }
}
@media (min-width: 1500px) {
  .filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
