:root {
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.35rem, 1.1rem + 0.8vw, 1.85rem);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.125rem;
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.1);
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 272px;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-2: #f8fafc;
  --color-border: rgba(15, 23, 42, 0.08);
  --color-divider: rgba(15, 23, 42, 0.06);
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-faint: #94a3b8;
  --color-primary: #0f766e;
  --color-primary-soft: rgba(15, 118, 110, 0.1);
  --color-primary-strong: #115e59;
  --color-success: #15803d;
  --color-warning: #ca8a04;
  --color-danger: #be123c;
  --color-info: #2563eb;
}
[data-theme="dark"] {
  --shadow-sm: 0 4px 14px rgba(0,0,0,0.24);
  --shadow-md: 0 16px 40px rgba(0,0,0,0.35);
  --color-bg: #0b1120;
  --color-surface: #111827;
  --color-surface-2: #172033;
  --color-border: rgba(255,255,255,0.08);
  --color-divider: rgba(255,255,255,0.06);
  --color-text: #e5edf8;
  --color-muted: #94a3b8;
  --color-faint: #64748b;
  --color-primary: #2dd4bf;
  --color-primary-soft: rgba(45, 212, 191, 0.14);
  --color-primary-strong: #14b8a6;
  --color-success: #22c55e;
  --color-warning: #facc15;
  --color-danger: #fb7185;
  --color-info: #60a5fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-base);
  background: var(--color-bg);
  color: var(--color-text);
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

/* ── App Shell ── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: var(--color-bg);
}
.sidebar {
  background: linear-gradient(180deg, rgba(15,23,42,0.98), rgba(17,24,39,0.96));
  color: #dbe4ee;
  padding: var(--space-6);
  border-right: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  z-index: 60;
}
.brand { display: flex; align-items: center; gap: 0.85rem; margin-bottom: var(--space-8); }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #2dd4bf, #2563eb);
  display: grid; place-items: center; color: white; font-weight: 800;
  box-shadow: 0 12px 30px rgba(45,212,191,0.16); flex-shrink: 0;
}
.brand h1 { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: .02em; }
.brand p  { margin: 0.15rem 0 0; color: rgba(219,228,238,0.68); font-size: 0.82rem; }
.nav-label {
  color: rgba(219,228,238,0.45); text-transform: uppercase;
  letter-spacing: 0.12em; font-size: 0.72rem; margin-bottom: var(--space-3);
}
.nav-list { display: grid; gap: 0.45rem; }
.nav-btn {
  width: 100%; border: 0; background: transparent; color: rgba(226,232,240,0.78);
  display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem;
  border-radius: 0.95rem; transition: all var(--transition); text-align: left; cursor: pointer;
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,0.08); color: #fff; transform: translateX(2px);
}
.nav-btn i { font-size: 1.05rem; }
.sidebar-footer {
  margin-top: var(--space-8); padding: var(--space-4);
  border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
}
.sidebar-footer .user-name { font-weight: 600; font-size: 0.9rem; }
.sidebar-footer .user-role { color: rgba(219,228,238,0.55); font-size: 0.78rem; }

/* ── Main Area ── */
.main-area { min-width: 0; height: 100vh; overflow: auto; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1rem;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--color-bg) 82%, transparent);
  border-bottom: 1px solid var(--color-divider);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.menu-toggle, .icon-btn {
  width: 40px; height: 40px; border-radius: 0.9rem;
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); display: grid; place-items: center;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.menu-toggle { display: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  color: white; display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 700;
}
.page-title { font-size: 0.98rem; font-weight: 700; }

.content-wrap { padding: 1rem 1rem 1.25rem; }

/* ── KPI Grid ── */
.grid-kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 0.75rem; margin-bottom: 0.9rem;
}
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 1rem; box-shadow: var(--shadow-sm);
}
.kpi-card { padding: 0.85rem 0.9rem; }
.kpi-top { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; }
.kpi-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--color-muted); }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 0.8rem; display: grid; place-items: center;
  background: var(--color-primary-soft); color: var(--color-primary);
}
.kpi-value { font-size: 1.4rem; font-weight: 800; margin-top: 0.45rem; }
.kpi-sub   { color: var(--color-muted); font-size: 0.78rem; margin-top: 0.2rem; }
.trend-positive { color: var(--color-success); }
.trend-warning  { color: var(--color-warning); }

/* ── Content Grid ── */
.content-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 0.75rem; margin-bottom: 0.9rem;
}
.two-col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 0.75rem; }
.section-card { padding: 0.9rem 0.9rem 0.85rem; }
.section-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.8rem;
}
.section-head h3 { margin: 0; font-size: 0.98rem; }
.section-head p  { margin: 0.2rem 0 0; color: var(--color-muted); font-size: 0.8rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.6rem; border-radius: 999px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  color: var(--color-muted); font-size: 0.72rem;
}

/* ── Progress Bars ── */
.bars { display: grid; gap: 0.65rem; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 48px; gap: 0.6rem; align-items: center; font-size: 0.85rem; }
.progress-track {
  height: 9px; border-radius: 999px; background: var(--color-surface-2);
  overflow: hidden; border: 1px solid var(--color-border);
}
.progress-fill {
  height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--color-info));
  transition: width 0.4s ease;
}

/* ── Sparkline ── */
.sparkline { display: flex; align-items: end; gap: 0.25rem; height: 100px; margin-top: 0.6rem; }
.sparkline span {
  flex: 1; border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--color-primary), var(--color-info));
  opacity: 0.95; min-height: 12px;
}

/* ── Tables ── */
.table-wrap { overflow: auto; max-height: 440px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.7rem 0.65rem; border-bottom: 1px solid var(--color-divider);
  font-size: 0.88rem; text-align: left; vertical-align: middle; white-space: nowrap;
}
th { color: var(--color-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:hover { background: var(--color-surface-2); cursor: pointer; }

/* ── Badges ── */
.status-badge, .package-badge {
  display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px;
  padding: 0.32rem 0.58rem; font-size: 0.72rem; font-weight: 600;
}
.status-active     { background: rgba(21,128,61,0.12);  color: var(--color-success); }
.status-trial      { background: rgba(37,99,235,0.12);  color: var(--color-info); }
.status-onboarding { background: rgba(202,138,4,0.15);  color: var(--color-warning); }
.status-suspended  { background: rgba(190,18,60,0.12);  color: var(--color-danger); }
.pkg-starter { background: rgba(100,116,139,0.12); color: var(--color-muted); }
.pkg-growth  { background: rgba(15,118,110,0.12);  color: var(--color-primary); }
.pkg-pro     { background: rgba(37,99,235,0.12);   color: var(--color-info); }

/* ── Toggle Switch ── */
/* Toggle switch — div-based (settings page) */
.switch {
  width: 44px; height: 26px; border-radius: 999px; background: var(--color-border);
  position: relative; flex: 0 0 auto; cursor: pointer; border: none; outline: none; padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: white; transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.switch.on { background: color-mix(in srgb, var(--color-primary) 68%, white 12%); }
.switch.on::after { left: 21px; }

/* Toggle switch — label+checkbox-based (mapper, editor, business detail) */
label.switch {
  width: auto; height: auto; background: none; border-radius: 0;
  position: static; display: inline-flex; align-items: center;
}
label.switch::after { display: none; }
label.switch input[type="checkbox"] {
  position: absolute; opacity: 0; width: 0; height: 0; margin: 0; pointer-events: none;
}
label.switch .track {
  width: 44px; height: 26px; border-radius: 999px; background: var(--color-border);
  position: relative; flex: 0 0 auto; display: block; transition: background var(--transition);
}
label.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: white; transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
label.switch input:checked ~ .track {
  background: color-mix(in srgb, var(--color-primary) 68%, white 12%);
}
label.switch input:checked ~ .track::after { left: 21px; }

/* Small variant */
label.switch-sm .track { width: 34px; height: 20px; }
label.switch-sm .track::after { width: 14px; height: 14px; top: 3px; left: 3px; }
label.switch-sm input:checked ~ .track::after { left: 17px; }

/* ── Toggle List (features / settings) ── */
.toggle-list { display: grid; gap: 0.75rem; }
.toggle-row {
  display: flex; justify-content: space-between; gap: 0.75rem; align-items: center;
  padding: 0.75rem 0.8rem; background: var(--color-surface-2);
  border-radius: 0.9rem; border: 1px solid var(--color-border);
}
.toggle-row-label { font-weight: 600; font-size: 0.9rem; }
.toggle-row-desc  { color: var(--color-muted); font-size: 0.8rem; margin-top: 0.15rem; }

/* ── Buttons ── */
.btn {
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  padding: 0.65rem 0.9rem; border-radius: 0.85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.45rem;
  box-shadow: var(--shadow-sm); font-size: 0.85rem; cursor: pointer; text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.btn:hover { background: var(--color-surface-2); text-decoration: none; }
.btn-primary { background: var(--color-primary); color: white; border-color: transparent; }
.btn-primary:hover { background: var(--color-primary-strong); color: white; }
.btn-danger  { background: var(--color-danger);  color: white; border-color: transparent; }
.btn-ghost   { background: transparent; box-shadow: none; border-color: transparent; }
.btn-sm { padding: 0.45rem 0.65rem; font-size: 0.8rem; }
.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ── Detail Grid ── */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.75rem; }
.detail-box {
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: 0.9rem; padding: 0.75rem;
}
.detail-box .meta { color: var(--color-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 0.25rem; }

/* ── Packages ── */
.packages-list {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: stretch;
}
.package-card { padding: 1rem; }
.package-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.6rem; }
.package-card-title { font-size: 1.05rem; font-weight: 700; }
.package-card-price { font-size: 1.3rem; font-weight: 800; color: var(--color-primary); }
.package-card-segment { color: var(--color-muted); font-size: 0.82rem; margin-bottom: 0.8rem; }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.feature-list li { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; }
.feature-list li::before { content: "✓"; color: var(--color-success); font-weight: 700; }

/* ── Accordion (modules) ── */
.accordion-item {
  border: 1px solid var(--color-border); border-radius: 0.9rem;
  overflow: hidden; margin-bottom: 0.5rem;
}
.accordion-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0.9rem; cursor: pointer; background: var(--color-surface-2);
  font-weight: 600; font-size: 0.9rem; user-select: none;
}
.accordion-head:hover { background: var(--color-surface); }
.accordion-body { padding: 0.6rem 0.9rem 0.75rem; display: none; }
.accordion-body.open { display: block; }
.submodule-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 0; border-bottom: 1px solid var(--color-divider); gap: 1rem;
}
.submodule-row:last-child { border-bottom: none; }
.submodule-name { font-size: 0.87rem; flex: 1; }
.submodule-attrs { display: flex; gap: 0.75rem; align-items: center; }
.attr-label { font-size: 0.74rem; color: var(--color-muted); }

/* ── Tabs ── */
.tabs { display: flex; gap: 0.35rem; border-bottom: 1px solid var(--color-divider); margin-bottom: 1rem; }
.tab-btn {
  padding: 0.55rem 0.85rem; border: none; background: transparent;
  color: var(--color-muted); font-weight: 600; font-size: 0.85rem;
  border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.35rem; margin-top: 0.4rem; font-size: 0.8rem; color: var(--color-muted);
}
.pagination a, .pagination span {
  border-radius: 999px; padding: 0.25rem 0.6rem;
  border: 1px solid var(--color-border); background: var(--color-surface);
  cursor: pointer; font-size: 0.8rem; text-decoration: none; color: var(--color-text);
}
.pagination a.active { background: var(--color-primary); color: white; border-color: transparent; }
.pagination span.disabled { opacity: 0.4; cursor: default; }

/* ── Forms ── */
.form-section-title {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--color-muted); font-weight: 600; margin-bottom: 0.4rem;
}
.form-block {
  background: var(--color-surface-2); border-radius: 0.9rem;
  padding: 0.7rem 0.7rem 0.8rem; border: 1px solid var(--color-border); margin-bottom: 0.7rem;
}
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.6rem 0.9rem; margin-top: 0.4rem;
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-group label { font-size: 0.78rem; color: var(--color-muted); display: block; margin-bottom: 0.25rem; }
.form-control {
  width: 100%; border-radius: 0.55rem; border: 1px solid var(--color-border);
  padding: 0.45rem 0.6rem; font-size: 0.85rem;
  background: var(--color-surface); color: var(--color-text);
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--color-primary); }
select.form-control { cursor: pointer; }
.form-actions { margin-top: 0.8rem; display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Filters ── */
.filter-bar {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.85rem;
}
.filter-bar select { padding: 0.45rem 0.65rem; border-radius: 0.65rem; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-size: 0.85rem; cursor: pointer; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 0.65rem; font-size: 0.8rem; color: var(--color-muted); pointer-events: none; }
.search-input { padding: 0.45rem 0.65rem 0.45rem 2rem; border-radius: 0.65rem; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-size: 0.85rem; min-width: 200px; }
.search-input:focus { outline: none; border-color: var(--color-primary); }
.date-input { padding: 0.43rem 0.65rem; border-radius: 0.65rem; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-size: 0.85rem; }
.table-meta { padding: 0.5rem 1rem 0; }
.sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.sort-link:hover { color: var(--color-primary); }
.sort-icon { font-size: 0.7rem; color: var(--color-faint); }
.sort-icon.active { color: var(--color-primary); }

/* ── Flash messages ── */
.flash {
  border-radius: var(--radius-md); padding: 0.75rem 1rem;
  margin-bottom: 0.85rem; font-size: 0.88rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.6rem;
}
.flash-success { background: rgba(21,128,61,0.1);  color: var(--color-success); border: 1px solid rgba(21,128,61,0.2); }
.flash-error   { background: rgba(190,18,60,0.1);  color: var(--color-danger);  border: 1px solid rgba(190,18,60,0.2); }
.flash-info    { background: rgba(37,99,235,0.1);  color: var(--color-info);    border: 1px solid rgba(37,99,235,0.2); }

/* ── Activity Log ── */
.log-list { display: grid; gap: 0.5rem; }
.log-item {
  padding: 0.6rem 0.75rem; background: var(--color-surface-2);
  border-radius: 0.75rem; border: 1px solid var(--color-border); font-size: 0.85rem;
}
.log-item .log-meta { color: var(--color-muted); font-size: 0.75rem; margin-top: 0.2rem; }

/* ── Login page ── */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top, #e0f2fe 0, #f5f7fb 40%, #e2e8f0 100%);
}
.login-card {
  background: var(--color-surface); border-radius: 1rem; border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md); padding: 2rem 2.25rem 2.25rem; max-width: 400px; width: 92vw;
}
.login-logo {
  display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.5rem;
}
.login-title { font-size: 1.35rem; font-weight: 800; margin: 0; }
.login-sub   { color: var(--color-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.login-form-group { margin-bottom: 1rem; }
.login-form-group label { display: block; font-size: 0.82rem; color: var(--color-muted); font-weight: 600; margin-bottom: 0.35rem; }

/* ── Mobile overlay ── */
.mobile-overlay {
  display: none; position: fixed; inset: 0; background: rgba(2,6,23,0.48); z-index: 40;
}

/* ── Muted helper ── */
.muted { color: var(--color-muted); }
.text-sm { font-size: var(--text-sm); }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: 0.25rem; }
.mb-1 { margin-bottom: 0.25rem; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .grid-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content-grid, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform var(--transition);
    z-index: 60; width: min(88vw, 320px);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-overlay.show { display: block; }
  .main-area { height: auto; min-height: 100vh; }
  .menu-toggle { display: grid; }
  .topbar { padding-inline: 0.75rem; }
}
@media (max-width: 768px) {
  .content-wrap { padding-inline: 0.75rem; }
  .grid-kpis { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  th, td { font-size: 0.82rem; padding-inline: 0.55rem; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid-kpis { grid-template-columns: 1fr; }
  .packages-list { grid-template-columns: 1fr; }
}

/* ── Page header ── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.page-header h2 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.page-header p  { margin: 0.2rem 0 0; color: var(--color-muted); font-size: 0.85rem; }

/* ── Tab bar ── */
.tab-bar {
  display: flex; gap: 0.25rem; border-bottom: 1px solid var(--color-divider);
  margin-bottom: 1rem; flex-wrap: wrap;
}

/* ── Form helpers ── */
.form-card { padding: 1.25rem 1.25rem 1rem; }
.form-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 0.6rem 0.9rem; margin-bottom: 0.65rem;
}
.form-group { display: flex; flex-direction: column; }
.form-group label {
  font-size: 0.78rem; color: var(--color-muted);
  font-weight: 600; margin-bottom: 0.25rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; border-radius: 0.55rem; border: 1px solid var(--color-border);
  padding: 0.48rem 0.65rem; font-size: 0.88rem;
  background: var(--color-surface); color: var(--color-text);
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--color-primary); }
.required { color: var(--color-danger); }

/* ── Package grid cards ── */
.pkg-grid {
  display: grid; gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(260px,1fr));
}
.pkg-card { padding: 1.1rem; display: flex; flex-direction: column; gap: 0.65rem; }
.pkg-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.pkg-name { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 700; }
.pkg-price { font-size: 1.35rem; font-weight: 800; color: var(--color-primary); white-space: nowrap; }
.pkg-price span { font-size: 0.8rem; font-weight: 500; color: var(--color-muted); }
.pkg-segment { margin: 0; font-size: 0.82rem; color: var(--color-muted); }
.pkg-stats { display: flex; gap: 1.25rem; }
.pkg-stats > div { text-align: center; }
.btn-block { display: flex; justify-content: center; width: 100%; margin-top: auto; }

/* ── Filter bar row ── */
.filter-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.filter-bar select {
  padding: 0.45rem 0.65rem; border-radius: 0.65rem;
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); font-size: 0.85rem; cursor: pointer;
}

/* ── Business detail grid ── */
.detail-grid { display: grid; gap: 0; }
.detail-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 0.6rem;
  padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--color-divider);
  font-size: 0.88rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row > span:first-child { color: var(--color-muted); font-weight: 600; font-size: 0.8rem; }
.detail-note > span:last-child { white-space: pre-wrap; }

/* ── Submodule table ── */
.submodule-table-wrap { overflow: auto; }
.submodule-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.submodule-table th, .submodule-table td {
  padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--color-divider); text-align: left;
}
.submodule-table th { color: var(--color-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; }
.submodule-table .center { text-align: center; }

/* ── Activity log ── */
/* ── Add-on tree view ── */
.addon-tree { display: flex; flex-direction: column; }
.addon-tree-group { border-bottom: 1px solid var(--color-border); }
.addon-tree-group:last-child { border-bottom: none; }
.addon-tree-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem; border-top: 1px solid var(--color-divider);
}
.addon-tree-group > .addon-tree-row:first-child { border-top: none; }
.addon-tree-mod  { background: var(--color-surface); font-weight: 600; }
.addon-tree-sub  { background: var(--color-surface); padding-left: 2.5rem; font-size: 0.875rem; }
.addon-tree-feat { background: var(--color-surface-2); padding-left: 4.5rem; font-size: 0.825rem; }
.addon-tree-mod .addon-tree-cell-icon i  { font-size: 1rem; color: var(--color-primary); }
.addon-tree-sub .addon-tree-cell-icon i  { font-size: 0.9rem; color: var(--color-muted); }
.addon-tree-feat .addon-tree-cell-icon i { font-size: 0.8rem; color: var(--color-faint); }
.addon-tree-cell-icon { flex: 0 0 1.25rem; }
.addon-tree-cell-name { flex: 1; display: flex; align-items: center; gap: 0.5rem; }
.addon-tree-cell-price { color: var(--color-muted); font-size: 0.8rem; white-space: nowrap; }
.addon-tree-cell-action { flex: 0 0 70px; text-align: right; }
.addon-tree-badge {
  font-size: 0.68rem; font-weight: 600; padding: 0.1rem 0.4rem;
  border-radius: 999px; background: var(--color-primary-soft); color: var(--color-primary);
  white-space: nowrap;
}

/* ── Addon Toggle Tree (att) ── */
.att-tree { display: flex; flex-direction: column; }
.att-group { border-bottom: 1px solid var(--color-border); }
.att-group:last-child { border-bottom: none; }
.att-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem; border-top: 1px solid var(--color-divider);
}
.att-group > .att-row:first-child { border-top: none; }
.att-mod  { background: var(--color-surface); font-weight: 600; }
.att-sub  { background: var(--color-surface); padding-left: 2.5rem; font-size: 0.875rem; }
.att-feat { background: var(--color-surface-2); padding-left: 4.5rem; font-size: 0.825rem; }
.att-mod .att-icon  { font-size: 1rem; color: var(--color-primary); }
.att-sub .att-icon  { font-size: 0.9rem; color: var(--color-muted); }
.att-feat .att-icon { font-size: 0.8rem; color: var(--color-faint); }
.att-sw   { flex: 0 0 auto; }
.att-name { flex: 1; }
.att-price { color: var(--color-muted); font-size: 0.8rem; white-space: nowrap; }
.att-price-dim { color: var(--color-faint); }
.att-locked { opacity: 0.55; }
.att-badge {
  font-size: 0.68rem; font-weight: 600; padding: 0.1rem 0.45rem;
  border-radius: 999px; white-space: nowrap;
}
.att-badge-pkg     { background: var(--color-primary-soft); color: var(--color-primary); }
.att-badge-addon   { background: rgba(16,185,129,0.12); color: #059669; }
.att-badge-covered { background: var(--color-surface-2); color: var(--color-muted); border: 1px solid var(--color-border); }

.activity-log { display: grid; gap: 0.5rem; }

/* ── System Log ── */
.sysinfo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 0; }
.sysinfo-card { padding: 0; overflow: hidden; }
.sysinfo-card-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; font-weight: 600; font-size: 0.88rem; border-bottom: 1px solid var(--color-border); background: var(--color-surface-2); }
.sysinfo-card-head i { font-size: 1rem; color: var(--color-primary); }
.sysinfo-rows { display: flex; flex-direction: column; }
.sysinfo-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.45rem 1rem; border-bottom: 1px solid var(--color-divider); font-size: 0.8rem; }
.sysinfo-row:last-child { border-bottom: none; }
.sysinfo-row span { color: var(--color-muted); flex-shrink: 0; }
.sysinfo-row strong { text-align: right; font-size: 0.8rem; }
.disk-bar-wrap { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 1rem; }
.disk-bar { flex: 1; height: 6px; background: var(--color-border); border-radius: 999px; overflow: hidden; }
.disk-bar-fill { height: 100%; border-radius: 999px; background: var(--color-primary); transition: width 0.3s; }
.disk-bar-warn { background: #f59e0b; }
.disk-bar-danger { background: var(--color-danger); }
.disk-pct { font-size: 0.75rem; color: var(--color-muted); white-space: nowrap; }
.sysinfo-ext { padding: 0.6rem 1rem; border-top: 1px solid var(--color-border); }
.sysinfo-ext-label { font-size: 0.72rem; font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 0.3rem; }
.sysinfo-ext-list { font-size: 0.72rem; color: var(--color-muted); line-height: 1.5; }
.syslog-actor { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; }
.log-entry {
  padding: 0.65rem 0.8rem; background: var(--color-surface-2);
  border-radius: 0.75rem; border: 1px solid var(--color-border);
}
.log-meta { display: flex; gap: 0.75rem; margin-bottom: 0.2rem; }
.log-who  { font-weight: 600; font-size: 0.8rem; color: var(--color-primary); }
.log-when { color: var(--color-muted); font-size: 0.78rem; }
.log-msg  { font-size: 0.85rem; }

/* ── KPI inline ── */
.kpi-inline { padding: 0.9rem 1rem; display: inline-flex; flex-direction: column; }

/* ── Text helpers ── */
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.center { text-align: center; }

/* ── Mapper ── */
.mapper-module {
  border-bottom: 1px solid var(--color-border);
}
.mapper-module:last-child { border-bottom: none; }
.mapper-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  gap: 1rem;
}
.mapper-subs {
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-divider);
}
.price-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
  width: 90px;
}
.price-input-wrap.price-input-sm { width: 72px; }
.price-prefix {
  padding: 0 0.4rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  background: var(--color-surface-2);
  border-right: 1px solid var(--color-border);
  user-select: none;
}
.price-input-wrap input[type=number] {
  border: none;
  outline: none;
  background: transparent;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  width: 100%;
  color: var(--color-text);
}
.price-input-wrap input[type=number]::-webkit-inner-spin-button { display: none; }

/* ── Data table ── */
.data-table th {
  padding: 0.6rem 1rem;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}
.data-table td { border-bottom: 1px solid var(--color-divider); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.row-link { cursor: pointer; transition: background 0.12s; }
.data-table tr.row-link:hover { background: var(--color-surface-2); }

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--color-muted); }
.text-danger { color: var(--color-danger); }

.code-chip {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--color-muted);
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem;
  color: var(--color-muted);
}
.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--color-faint);
  margin-top: 0.2rem;
}
.badge-info { background: rgba(37,99,235,0.1); color: var(--color-info); }
