:root {
  --bg: #dfe9fb;
  --surface: #f8fafc;
  --card: #ffffff;
  --ink: #111832;
  --muted: #7b8299;
  --muted-2: #a2a9b8;
  --line: #e7eaf0;
  --line-strong: #d9dee8;
  --primary: #4f46e5;
  --primary2: #22c55e;
  --primary-soft: #eef0ff;
  --sidebar: #070a35;
  --sidebar-hover: #171b4e;
  --danger: #ef4444;
  --danger-soft: #fff0f1;
  --warn: #f59e0b;
  --warn-soft: #fff7e7;
  --success: #16a56a;
  --success-soft: #eafaf2;
  --info: #2684ff;
  --info-soft: #eaf3ff;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-shell: 0 24px 70px rgba(39, 58, 111, .18);
  --shadow-card: 0 8px 24px rgba(20, 29, 62, .035);
}

html { scroll-behavior: smooth; }
body { min-width: 320px; }
.spin-saas,
.spin-login {
  margin: 0;
  color: var(--ink);
  font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.spin-saas { background: var(--bg); }
.spin-saas *, .spin-login * { box-sizing: border-box; }
.spin-saas button,
.spin-saas input,
.spin-saas select,
.spin-saas textarea,
.spin-login button,
.spin-login input { font: inherit; }
a { color: inherit; }

/* App frame */
.saas-shell {
  min-height: calc(100vh - 36px);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-shell);
  position: relative;
}
.saas-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  overflow: hidden;
  color: #fff;
  background: var(--sidebar);
  border-radius: 0;
}
.saas-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  padding: 4px 8px 22px;
  color: #fff;
  text-decoration: none;
}
.saas-brand .brand-mark,
.saas-brand > span {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 21px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(145deg, #7c73ff, var(--primary));
  box-shadow: 0 8px 18px rgba(79, 70, 229, .3);
}
.saas-brand img.saas-brand-logo {
  display: block;
  width: min(100%, 218px);
  height: auto;
  max-height: 72px;
  flex: 0 1 auto;
  padding: 0;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.saas-sidebar nav {
  min-height: 0;
  flex: 1;
  display: block;
  overflow: auto;
  padding: 0 2px 20px;
  scrollbar-width: thin;
  scrollbar-color: #2f3568 transparent;
}
.nav-group {
  display: block;
  padding: 15px 10px 7px;
  color: #8e95b8;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: none;
}
.saas-sidebar nav a {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 3px 0;
  padding: 10px 11px;
  color: #d8daf0;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 560;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.saas-sidebar nav a i {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  color: #b9bdd9;
}
.saas-sidebar nav a i svg,
.saas-sidebar-foot svg { width: 18px; height: 18px; }
.saas-sidebar nav a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saas-sidebar nav a:hover { color: #fff; background: var(--sidebar-hover); transform: translateX(1px); }
.saas-sidebar nav a.active {
  color: var(--sidebar);
  background: #fff;
  box-shadow: 0 7px 18px rgba(0,0,0,.12);
}
.saas-sidebar nav a.active i { color: var(--sidebar); }
.saas-sidebar-foot {
  padding: 13px 8px 2px;
  border-top: 1px solid rgba(255,255,255,.11);
}
.saas-sidebar-foot .version-pill {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 8px;
  color: #aeb4d2;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  font-size: 10px;
}
.saas-sidebar-foot a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 4px;
  color: #d7daf0;
  text-decoration: none;
}

.saas-main {
  min-height: 100vh;
  margin-left: 260px;
  background: #f8f9fb;
}
.saas-topbar {
  min-height: 80px;
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 26px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; color: #111832; font-size: 22px; line-height: 1.25; letter-spacing: -.025em; }
.page-heading p { max-width: 680px; margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.saas-menu { display: none; }
.icon-button { border: 0; background: transparent; cursor: pointer; }
.saas-top-actions { min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 11px; }
.global-search { width: min(330px, 25vw); height: 40px; position: relative; display: flex; align-items: center; color: #9aa1b2; }
.global-search-icon {
  width: 18px;
  height: 18px;
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  pointer-events: none;
}
.global-search-icon svg { width: 18px; height: 18px; display: block; }
.global-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 48px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.global-search input:focus { background: #fff; border-color: #a7a4ff; box-shadow: 0 0 0 3px rgba(79,70,229,.09); }
.global-search-results {
  width: 100%;
  max-height: 320px;
  position: absolute;
  top: 47px;
  left: 0;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(18,25,55,.16);
}
.global-search-results[hidden] { display: none; }
.global-search-results a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 7px; text-decoration: none; }
.global-search-results a:hover { background: var(--primary-soft); color: var(--primary); }
.global-search-results small { color: var(--muted); }
.quick-create,
.saas-bell {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  position: relative;
  display: grid;
  place-items: center;
  color: #535a70;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, color .15s ease;
}
.quick-create:hover, .saas-bell:hover { color: var(--primary); border-color: #b9b6ff; transform: translateY(-1px); }
.quick-create svg, .saas-bell svg { width: 18px; height: 18px; }
.saas-bell b {
  min-width: 18px;
  height: 18px;
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  color: #fff;
  background: var(--danger);
  border: 2px solid #fff;
  border-radius: 999px;
  font-size: 9px;
}
.live-status { display: inline-flex; align-items: center; gap: 7px; color: #687086; font-size: 11px; white-space: nowrap; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22,165,106,.11); }
.saas-user { min-width: 0; display: flex; align-items: center; gap: 9px; padding-left: 4px; }
.saas-user > span { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: #3730a3; background: #e8e8ff; border-radius: 50%; font-weight: 800; }
.saas-user b, .saas-user small { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saas-user b { font-size: 12px; }
.saas-user small { color: var(--muted); font-size: 10px; }
.saas-content { width: 100%; max-width: 1780px; padding: 25px 26px 32px; }
.saas-overlay { display: none; }

/* Generic layout */
.grid { display: grid; gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card,
.stat-card {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card { margin-bottom: 18px; padding: 20px; }
.card h2, .card h3 { margin: 0; color: #151b36; letter-spacing: -.015em; }
.card h2 { font-size: 16px; }
.card h3 { font-size: 14px; }
.card > p:last-child { margin-bottom: 0; }
.card-head { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head > div { min-width: 0; }
.card-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.stat-card { min-height: 145px; position: relative; overflow: hidden; padding: 20px; }
.stat-card::after { content: ""; width: 80px; height: 80px; position: absolute; right: -26px; bottom: -36px; border-radius: 50%; background: rgba(79,70,229,.045); }
.stat-card small { position: relative; z-index: 1; color: #747b91; font-size: 12px; font-weight: 600; }
.stat-card strong { position: relative; z-index: 1; display: block; margin: 10px 0 6px; color: #111832; font-size: clamp(25px, 2vw, 34px); line-height: 1; letter-spacing: -.035em; }
.stat-card > span { position: relative; z-index: 1; display: block; max-width: 70%; color: var(--muted); font-size: 11px; }
.stat-card.accent { border-color: #e5e5ff; background: linear-gradient(145deg,#fff,#fbfbff); }
.stat-card .stat-trend { color: var(--success); font-weight: 700; }
.stat-sparkline { width: 42%; height: 58px; position: absolute; right: 14px; bottom: 18px; opacity: .95; }
.stat-sparkline svg { width: 100%; height: 100%; overflow: visible; }
.stat-sparkline .area { fill: url(#sparkGradient); opacity: .34; }
.stat-sparkline .line { fill: none; stroke: var(--spark, #7068ff); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.btn {
  min-height: 38px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  color: #333b52;
  background: #f0f2f6;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(24,32,68,.08); }
.btn:active { transform: translateY(0); }
.btn.primary { color: #fff; background: var(--primary); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn.secondary { color: #4b43d3; background: var(--primary-soft); border-color: #dedcff; }
.btn.ghost { color: #51596f; background: #f5f6f8; border-color: var(--line); }
.btn.danger { color: #fff; background: var(--danger); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; width: 16px; height: 16px; position: absolute; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin-loader .7s linear infinite; }
@keyframes spin-loader { to { transform: rotate(360deg); } }

/* Forms – stable input layout */
label, .field { min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 14px; }
.form-grid > label,
.form-stack > label,
.filters > label,
.field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  color: #3c445b;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
  overflow: visible;
}
.form-grid > label > span,
.form-stack > label > span,
.filters > label > span { min-width: 0; display: block; }
.spin-saas input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.spin-saas select,
.spin-saas textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  padding: 9px 11px;
  color: #20273d;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.spin-saas input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.spin-saas select {
  min-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spin-saas textarea {
  min-height: 108px;
  resize: vertical;
  white-space: pre-wrap;
}

/* Global search must override the generic form input rule declared later. */
.spin-saas .global-search input[type="search"] {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 42px 0 46px;
  line-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spin-saas .global-search input[type="search"]::-webkit-search-decoration,
.spin-saas .global-search input[type="search"]::-webkit-search-cancel-button,
.spin-saas .global-search input[type="search"]::-webkit-search-results-button,
.spin-saas .global-search input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}
.spin-saas .global-search-icon { left: 15px; }

/* textarea continuation marker */
.spin-saas textarea {
  overflow-wrap: anywhere;
}
.spin-saas input:focus,
.spin-saas select:focus,
.spin-saas textarea:focus { border-color: #a7a4ff; box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.spin-saas input::placeholder, .spin-saas textarea::placeholder { color: #a5abb9; }
.spin-saas input[type="color"] { width: 100%; height: 42px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.spin-saas input[type="file"] { padding: 8px; background: #fbfcfe; }
.check-field, .check-row {
  min-width: 0;
  display: flex !important;
  align-items: flex-start !important;
  gap: 9px !important;
  padding: 9px 0;
  line-height: 1.45;
}
.check-field input[type="checkbox"], .check-field input[type="radio"],
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: 18px !important; min-width: 18px !important; height: 18px; flex: 0 0 18px; margin: 1px 0 0; }
.check-field span, .check-row span { min-width: 0; overflow-wrap: anywhere; }
.filters {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  align-items: end;
  gap: 11px;
}
.filters > .btn, .filters > .export-buttons { align-self: end; }
.filters > .btn { width: 100%; }
.compact-form { padding: 16px; background: #fafbfc; border: 1px solid var(--line); border-radius: 11px; }
.inline-actions { min-width: 0; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.inline-actions input, .inline-actions select { width: auto; min-width: 120px; flex: 1 1 140px; }
.inline-actions .btn { flex: 0 0 auto; }
.inline-edit { display: contents; }
.inline-edit input, .inline-edit select { min-width: 125px; margin: 2px; }

/* Tables */
.table-wrap { width: 100%; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.data-table { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; }
.data-table th,
.data-table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid #edf0f4; }
.data-table th { position: sticky; top: 0; z-index: 2; color: #4f576e; background: #f8f9fb; font-size: 11px; font-weight: 700; white-space: nowrap; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: #fbfbfe; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td { color: #343c52; font-size: 12px; }
.data-table td b { color: #161d37; }
.data-table td small { color: var(--muted); }
.data-table a { color: var(--primary); font-weight: 680; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.data-table td code { white-space: nowrap; }
.data-table.compact { min-width: 650px; }
.cell-wrap { max-width: 380px; white-space: normal; overflow-wrap: anywhere; color: #525a70; }
.secret-copy { max-width: 100%; }
.secret-copy code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }

.badge, .pill {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  color: #60677a;
  background: #eff1f5;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.badge.ok { color: #16854f; background: #e8f8ee; }
.badge.warn { color: #c67800; background: #fff1d9; }
.badge.bad { color: #d53545; background: #ffe7ea; }
.badge.info { color: #3268d8; background: #e5edff; }


/* v2.5.2 · task lifecycle colors — each step has a distinct visual identity */
.badge.status-created { color:#596273; background:#eef1f5; border:1px solid #dde2e9; }
.badge.status-assigned { color:#4338ca; background:#eeecff; border:1px solid #d8d3ff; }
.badge.status-search-started { color:#087a92; background:#e6f8fb; border:1px solid #bdebf3; }
.badge.status-target-opened { color:#1769aa; background:#e9f4ff; border:1px solid #c9e4fb; }
.badge.status-countdown-started { color:#b25d00; background:#fff3dc; border:1px solid #ffdfaa; }
.badge.status-code-unlocked { color:#7c3aed; background:#f2eaff; border:1px solid #dfccff; }
.badge.status-verified { color:#087f73; background:#e4f8f4; border:1px solid #bfece3; }
.badge.status-completed { color:#137a45; background:#e7f8ee; border:1px solid #bfe9cf; }
.badge.status-consumed { color:#17613b; background:#ddf4e7; border:1px solid #adddc0; }
.badge.status-replaced { color:#a14f00; background:#fff0df; border:1px solid #ffd2a1; }
.badge.status-expired { color:#7b4b55; background:#f5eaed; border:1px solid #e8cfd5; }
.badge.status-rejected { color:#c6283a; background:#ffe8ec; border:1px solid #ffc6cf; }
.badge.status-fraud { color:#a30d24; background:#ffe1e6; border:1px solid #ffb7c2; }
.badge.status-cancelled { color:#5f6674; background:#eceff3; border:1px solid #d8dde4; }

.task-status-current{display:inline-flex;align-items:center;gap:7px;margin-left:6px;vertical-align:middle}
.task-timeline-item{--task-step:#8b94a7;position:relative;margin:0 0 5px;padding:0 0 18px 20px;border-left:3px solid var(--task-step)}
.task-timeline-item::before{content:"";position:absolute;left:-7px;top:2px;width:11px;height:11px;border-radius:50%;background:var(--task-step);box-shadow:0 0 0 3px #fff}
.task-timeline-item.status-created{--task-step:#7b8495}
.task-timeline-item.status-assigned{--task-step:#6657e8}
.task-timeline-item.status-search-started{--task-step:#1599b2}
.task-timeline-item.status-target-opened{--task-step:#2b83c6}
.task-timeline-item.status-countdown-started{--task-step:#df8a18}
.task-timeline-item.status-code-unlocked{--task-step:#8b5cf6}
.task-timeline-item.status-verified{--task-step:#17a393}
.task-timeline-item.status-completed{--task-step:#24a866}
.task-timeline-item.status-consumed{--task-step:#24794f}
.task-timeline-item.status-replaced{--task-step:#d87518}
.task-timeline-item.status-expired{--task-step:#9a6973}
.task-timeline-item.status-rejected,.task-timeline-item.status-fraud{--task-step:#dc3545}
.task-timeline-item.status-cancelled{--task-step:#7d8490}

/* Charts / dashboard */
.dashboard-tabs, .tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin: 0 0 20px;
  padding: 0;
  scrollbar-width: none;
}
.dashboard-tabs::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.dashboard-tabs a,
.tabs button {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 8px 14px;
  color: #747b91;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.dashboard-tabs a.active,
.tabs button.active { color: #fff; background: var(--sidebar); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.dashboard-main, .dashboard-side { min-width: 0; }
.dashboard-side .card { padding: 18px; }
.chart-bars { display: grid; gap: 11px; }
.chart-row { display: grid; grid-template-columns: 76px 1fr 68px; gap: 10px; align-items: center; color: #687086; font-size: 11px; }
.chart-row-wide { grid-template-columns: 76px 1fr 72px; }
.chart-track, .bar-track { height: 9px; overflow: hidden; background: #eef0f7; border-radius: 999px; }
.chart-track i, .bar-fill { display: block; height: 100%; background: linear-gradient(90deg,#7b73ff,var(--primary)); border-radius: 999px; }
.dashboard-progress { min-width: 120px; display: flex; align-items: center; gap: 7px; }
.dashboard-progress span { flex: 1; height: 7px; overflow: hidden; background: #e4e6fb; border-radius: 999px; }
.dashboard-progress i { display: block; height: 100%; background: #7c7ff1; border-radius: 999px; }
.dashboard-progress b { width: 35px; font-size: 10px; }
.table-check { width: 16px; height: 16px; border: 1px solid #d6d9e2; border-radius: 50%; display: inline-block; }
.recap-list { display: grid; gap: 16px; margin: 18px 0 4px; }
.recap-item { display: grid; grid-template-columns: 4px 1fr; gap: 10px; align-items: center; }
.recap-item > i { width: 3px; height: 28px; border-radius: 99px; background: var(--recap-color,#7c73ff); }
.recap-item small, .recap-item strong { display: block; }
.recap-item small { color: var(--muted); font-size: 10px; }
.recap-item strong { margin-top: 1px; font-size: 22px; line-height: 1; }
.activity-list { display: grid; gap: 0; margin-top: 12px; }
.activity-item { position: relative; display: grid; grid-template-columns: 54px 32px 1fr; gap: 9px; align-items: start; padding: 10px 0; }
.activity-item::after { content: ""; position: absolute; left: 69px; top: 42px; bottom: -10px; border-left: 1px dashed #d9dce5; }
.activity-item:last-child::after { display: none; }
.activity-time { color: #9aa1b2; font-size: 10px; }
.activity-icon { width: 30px; height: 30px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 50%; font-size: 11px; font-weight: 800; }
.activity-copy { min-width: 0; padding: 8px 10px; color: #687086; background: #f6f7fa; border-radius: 8px; font-size: 10px; }
.activity-copy b { color: #222a45; }
.system-ring { width: 145px; height: 145px; margin: 14px auto 6px; position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#7c73ff 0 34%,#60c6ff 34% 61%,#75e6b4 61% 84%,#edf0f6 84%); }
.system-ring::before { content: ""; position: absolute; inset: 16px; border-radius: 50%; background: #fff; }
.system-ring > div { position: relative; text-align: center; }
.system-ring strong { display: block; font-size: 24px; }
.system-ring small { color: var(--muted); font-size: 9px; }

/* Wizard */
.wizard { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.wizard-nav { position: sticky; top: 122px; display: grid; gap: 6px; align-content: start; }
.wizard-nav button { min-width: 0; padding: 11px 12px; color: #646c82; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: left; font-weight: 650; cursor: pointer; }
.wizard-nav button.active { color: #fff; background: var(--sidebar); border-color: var(--sidebar); box-shadow: 0 8px 20px rgba(7,10,53,.14); }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.preview-img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }

/* Commercial modules */
.plan-grid, .media-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.plan-card, .media-card { min-width: 0; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.plan-card h3, .media-card-title { margin: 0 0 7px; }
.plan-card > span { color: var(--muted); }
.plan-card > strong { display: block; margin: 10px 0; font-size: 28px; }
.plan-card > strong small { color: var(--muted); font-size: 11px; }
.plan-card p { color: var(--muted); }
.payment-card { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: center; }
.qr-image { width: 180px; max-width: 100%; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; }
.payment-amount { margin: 8px 0; font-size: 32px; font-weight: 850; }
.payment-card code { display: inline-block; max-width: 100%; padding: 7px 9px; white-space: normal; word-break: break-all; background: #f4f5f8; border-radius: 6px; }
.budget-summary { display: flex; gap: 12px; flex-wrap: wrap; }
.budget-summary span { padding: 9px 12px; background: #f6f7fa; border-radius: 8px; }
.color-dot { width: 12px; height: 12px; display: inline-block; margin-right: 6px; border-radius: 50%; vertical-align: middle; }
.quality-score { position: relative; overflow: hidden; border-radius: 8px; background: #eef0f5; }
.quality-score::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--score,0%); background: #c9f1dc; }
.quality-score > * { position: relative; }
.metric-ring { width: 132px; height: 132px; display: grid; place-items: center; position: relative; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--value)*1%),#e8ebf1 0); }
.metric-ring::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: #fff; }
.metric-ring span { position: relative; color: var(--primary); font-size: 24px; font-weight: 850; }
.export-buttons { display: flex; gap: 7px; flex-wrap: wrap; }
.media-card img, .img-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 9px; background: #f2f3f6; }
.media-picker-modal, .modal-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(9,13,42,.62); }
.media-picker-modal[hidden], .modal-backdrop[hidden] { display: none; }
.modal-box { width: min(980px,100%); max-height: 90vh; overflow: auto; padding: 20px; background: #fff; border-radius: 14px; }
.modal-head, .media-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.selected-media-preview { max-width: 100%; border-radius: 10px; }

/* Feedback */
.alert, .notice { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #dbe7ff; border-radius: 9px; color: #335eaa; background: #f0f6ff; }
.alert.success, .notice.ok { color: #147a49; background: var(--success-soft); border-color: #cbeedb; }
.alert.danger { color: #c83342; background: var(--danger-soft); border-color: #ffd1d6; }
.collapsible { margin-bottom: 15px; padding: 15px; background: var(--warn-soft); border: 1px solid #ffe4b2; border-radius: 10px; }
.collapsible[hidden] { display: none; }
.empty-state { padding: 44px 20px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 17px; }
.skeleton { height: 15px; background: linear-gradient(90deg,#edf0f5,#fafbfc,#edf0f5); background-size: 200% 100%; border-radius: 5px; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.saas-toast { min-width: 280px; max-width: min(430px,calc(100vw - 30px)); position: fixed; right: 24px; bottom: 24px; z-index: 150; display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; color: #fff; background: #131936; border-radius: 10px; box-shadow: 0 18px 50px rgba(7,10,53,.26); }
.saas-toast[hidden] { display: none; }
.saas-toast .toast-icon { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; color: #fff; background: var(--success); border-radius: 50%; }
.saas-toast b, .saas-toast [data-toast-message] { display: block; }
.saas-toast [data-toast-message] { margin-top: 2px; color: #ccd0e4; font-size: 11px; }
.saas-modal { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; padding: 20px; background: rgba(7,10,53,.58); backdrop-filter: blur(3px); }
.saas-modal[hidden] { display: none; }
.modal-card { width: min(410px,100%); position: relative; padding: 27px; text-align: center; background: #fff; border-radius: 15px; box-shadow: 0 30px 80px rgba(7,10,53,.3); }
.modal-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: #969daf; font-size: 23px; cursor: pointer; }
.modal-symbol { width: 45px; height: 45px; display: grid; place-items: center; margin: 0 auto 13px; color: #c67700; background: var(--warn-soft); border-radius: 50%; font-size: 21px; font-weight: 850; }
.modal-card h3 { margin: 0; }
.modal-card p { color: var(--muted); }
.modal-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }

/* Login */
.spin-login { min-height: 100vh; color: var(--ink); background: linear-gradient(135deg,#dce8ff,#f1f5ff); }
.spin-login main { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr) 430px; align-items: center; gap: 70px; max-width: 1120px; margin: auto; padding: 36px; }
.login-brand { color: var(--sidebar); }
.login-brand-logo-only { display: flex; align-items: center; justify-content: center; min-height: 220px; }
.login-brand-logo-only .login-brand-logo {
  display: block;
  width: min(100%, 470px);
  height: auto;
  max-height: 190px;
  object-fit: contain;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.login-brand > span { width: 78px; height: 78px; display: grid; place-items: center; color: #fff; background: var(--sidebar); border-radius: 20px; font-size: 36px; font-weight: 850; }
.login-card { padding: 30px; background: #fff; border: 1px solid rgba(255,255,255,.8); border-radius: 18px; box-shadow: 0 26px 70px rgba(39,58,111,.18); }
.login-card h2 { margin: 0 0 6px; font-size: 24px; }
.login-card > p, .login-card small { color: var(--muted); }
.login-card form, .login-card label { display: grid; gap: 12px; }
.login-card label { gap: 6px; font-weight: 650; }
.login-card input { width: 100%; min-height: 43px; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 8px; }

/* Legacy utility classes used by migrated pages */
.wrap { max-width: 1450px; margin: auto; padding: 20px; }
.top, .report-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.muted { color: var(--muted); }
.two-code { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.codebox { min-height: 100px !important; font: 11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace !important; }
.col-1{grid-column:span 1}.col-2{grid-column:span 2}.col-3{grid-column:span 3}.col-4{grid-column:span 4}.col-5{grid-column:span 5}.col-6{grid-column:span 6}.col-8{grid-column:span 8}.col-12{grid-column:span 12}

/* Responsive */
@media (max-width: 1260px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-side { display: block; }
  .global-search { width: 230px; }
  .plan-grid, .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .saas-shell { min-height: 100vh; }
  .saas-sidebar { left: 0; top: 0; bottom: 0; transform: translateX(-100%); border-radius: 0 18px 18px 0; transition: transform .2s ease; }
  .saas-sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(7,10,53,.32); }
  .saas-main { min-height: 100vh; margin-left: 0; }
  .saas-topbar { top: 0; }
  .saas-menu { width: 40px; height: 40px; display: grid; place-items: center; color: #454d65; background: #f2f3f7; border-radius: 8px; }
  .saas-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(7,10,53,.55); }
  .saas-overlay.show { display: block; }
  .wizard { grid-template-columns: 1fr; }
  .wizard-nav { position: static; display: flex; overflow-x: auto; }
  .wizard-nav button { min-width: 155px; }
}
@media (max-width: 760px) {
  .saas-topbar { min-height: 68px; padding: 10px 13px; gap: 9px; }
  .page-heading h1 { font-size: 18px; }
  .page-heading p, .saas-user > div, .live-status, .global-search { display: none; }
  .saas-top-actions { gap: 7px; }
  .quick-create, .saas-bell { width: 37px; height: 37px; flex-basis: 37px; }
  .saas-content { padding: 14px 13px 24px; }
  .stats-grid, .form-grid, .split, .dashboard-side, .plan-grid, .media-grid, .two-code, .payment-card { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .stat-card { min-height: 132px; }
  .filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .inline-actions { display: grid; grid-template-columns: 1fr; }
  .inline-actions input, .inline-actions select, .inline-actions .btn { width: 100%; }
  .data-table th, .data-table td { padding: 10px 11px; }
  .payment-card .qr-image { margin: auto; }
  .saas-toast { right: 12px; bottom: 12px; }
}
@media (max-width: 480px) {
  .stats-grid, .filters { grid-template-columns: 1fr; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .card-head .btn { width: 100%; }
  .dashboard-tabs a, .tabs button { padding: 8px 11px; }
  .stat-card > span { max-width: 62%; }
  .saas-content { padding: 11px; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
  .modal-actions .btn { width: 100%; }
}

/* Website partner cards */
.site-card-list{display:grid;gap:14px}.site-card{min-width:0;padding:17px;background:#fbfcfe;border:1px solid var(--line);border-radius:11px}.site-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:13px}.site-card-head h3{margin:0}.site-card-head p{margin:6px 0 0}.secret-copy{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:9px;margin-bottom:14px;padding:10px 11px;background:#fff;border:1px solid var(--line);border-radius:8px}.secret-copy small{color:var(--muted);font-weight:650}.secret-copy code{min-width:0;color:#343b56;font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace}.site-card .two-code label{display:grid;gap:7px;color:#3c445b;font-size:12px;font-weight:650}
@media(max-width:760px){.site-card-head{display:grid}.site-card-head .inline-actions{grid-template-columns:repeat(3,1fr)}.secret-copy{grid-template-columns:1fr}.secret-copy .btn{width:100%}}


/* v2.1.7 · logo-only branding */
@media (max-width: 760px) {
  .saas-brand { min-height: 68px; padding-bottom: 16px; }
  .saas-brand img.saas-brand-logo { width: min(100%, 190px); max-height: 60px; }
  .spin-login main { grid-template-columns: 1fr; gap: 22px; }
  .login-brand-logo-only { min-height: auto; padding: 10px 0; }
  .login-brand-logo-only .login-brand-logo { width: min(82vw, 360px); max-height: 125px; }
}


/* v2.2.3 · definitive global-search alignment fix */
.spin-saas .saas-topbar .global-search {
  position: relative;
  width: min(330px, 25vw);
  height: 40px;
  display: block;
}
.spin-saas .saas-topbar .global-search > .global-search-icon {
  position: absolute !important;
  left: 16px !important;
  top: 50% !important;
  z-index: 3 !important;
  width: 18px !important;
  height: 18px !important;
  display: grid !important;
  place-items: center !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
}
.spin-saas .saas-topbar .global-search > .global-search-icon svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
}
.spin-saas .saas-topbar .global-search > input.global-search-input[type="search"] {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  height: 40px !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 15px 0 50px !important;
  text-indent: 0 !important;
  color: var(--ink) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  background: #fbfcfe !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 9px !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
.spin-saas .saas-topbar .global-search > input.global-search-input[type="search"]::placeholder {
  color: #98a2b3 !important;
  opacity: 1 !important;
}

/* v3.2.6 · customer mobile report shell */
.customer-account .global-search,
.customer-account .live-status { display:none !important; }
.customer-account .saas-content { width:100%; max-width:1180px; margin:0 auto; }
.customer-account .saas-top-actions { margin-left:auto; }
@media (max-width:760px){
  .customer-account .saas-topbar{min-height:62px;padding:9px 11px;box-shadow:0 8px 24px rgba(22,27,54,.06)}
  .customer-account .page-heading{min-width:0;flex:1}
  .customer-account .page-heading h1{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .customer-account .saas-user{width:36px;height:36px;padding:0;border:0;background:transparent}
  .customer-account .saas-user>span{width:36px;height:36px;flex:0 0 36px}
  .customer-account .saas-content{padding:10px 10px 24px}
  .customer-account .card{box-shadow:0 8px 24px rgba(31,37,72,.045)}
}

/* v3.5.8.130 · Số dư ví ngay cạnh tên khách hàng (topbar + sidebar). */
.customer-sidebar-account{display:grid;gap:7px;margin:0 0 12px;padding:12px 11px;border-radius:12px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);color:#fff}
.customer-sidebar-account-label{font-size:11px;color:#b4badc}
.customer-sidebar-account-name{font-size:13px;font-weight:750;overflow-wrap:anywhere}
.customer-sidebar-account-balance{display:flex;flex-wrap:wrap;align-items:baseline;gap:5px;font-size:11px;color:#c5c9e6}
.customer-sidebar-account-balance b{color:#9ef0c6;font-size:13px;overflow-wrap:anywhere}
.saas-sidebar-foot .customer-sidebar-topup{display:inline-flex;align-items:center;justify-content:center;width:max-content;padding:5px 11px;border-radius:7px;background:#4f46e5;color:#fff;font-weight:750;font-size:11px}
.saas-sidebar-foot .customer-sidebar-topup:hover{background:#655df1;color:#fff}
.customer-account .saas-user-details{min-width:0}
.customer-account .saas-user-name-row{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.customer-account .saas-user-name-row>b{max-width:190px}
.customer-account .saas-user-name-row .customer-topbar-balance{display:inline-flex;align-items:center;padding:5px 9px;border-radius:99px;background:#e8f9f0;color:#087446;font-size:11px;font-weight:800;text-decoration:none;white-space:nowrap}
.customer-account .saas-user-name-row .customer-topbar-balance:hover{background:#c9f2dc}
@media(max-width:760px){.customer-account .saas-user-details{display:none}}
