:root {
  --cc-bg: #f5f7fb;
  --cc-card: #ffffff;
  --cc-ink: #172033;
  --cc-muted: #64748b;
  --cc-accent: #0f766e;
  --cc-accent-2: #2563eb;
  --cc-border: #dbe3ef;
}

body {
  background: var(--cc-bg);
  color: var(--cc-ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 57px);
}

.sidebar {
  background: #101828;
  color: #fff;
  padding: 22px;
  flex-direction: column;
  gap: 6px;
}

.sidebar a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.sidebar a.active,
.sidebar a:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--cc-accent);
  font-weight: 800;
  margin-bottom: 18px;
}

.content {
  padding: 24px;
  max-width: 1440px;
  width: 100%;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.page-heading h1 {
  font-size: 1.75rem;
  margin: 0;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--cc-muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card,
.app-card {
  border: 1px solid var(--cc-border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15,23,42,.05);
}

.metric-card {
  background: var(--cc-card);
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--cc-muted);
  font-weight: 700;
  font-size: .85rem;
}

.metric-card strong {
  display: block;
  font-size: 1.7rem;
  margin-top: 8px;
}

.app-card h2 {
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f766e, #1d4ed8);
}

.auth-card {
  background: #fff;
  border-radius: 8px;
  width: min(100%, 460px);
  padding: 30px;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
}

.landing-page {
  background: #f8fafc;
}

.landing-hero {
  background: #101828;
  color: #fff;
  padding: 72px 0;
}

.landing-hero h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: 800;
}

.landing-preview {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 24px;
}

.preview-metric {
  background: rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 16px;
}

.preview-metric span {
  display: block;
  color: rgba(255,255,255,.72);
  font-size: .85rem;
}

.preview-metric strong {
  font-size: 1.5rem;
}

.featured-plan {
  border-color: var(--cc-accent-2);
  box-shadow: 0 16px 38px rgba(37,99,235,.14);
}

.launch-note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--cc-border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15,23,42,.05);
}

.launch-note h2 {
  margin-bottom: 6px;
}

.launch-note p {
  margin: 0;
  color: var(--cc-muted);
}

.admin-tabs {
  border-bottom-color: var(--cc-border);
}

.admin-tabs .nav-link {
  font-weight: 700;
  color: var(--cc-muted);
}

.admin-tabs .nav-link.active {
  color: var(--cc-ink);
}

.admin-tab-content {
  padding-top: 18px;
}

.package-matrix-wrap {
  max-height: 72vh;
}

.package-matrix {
  min-width: 980px;
}

.package-matrix th,
.package-matrix td {
  min-width: 210px;
  vertical-align: middle;
}

.package-matrix .feature-column,
.package-matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 190px;
  background: var(--cc-card);
  color: var(--cc-muted);
}

.package-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--cc-card);
}

.tenant-controls {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) auto;
  gap: 8px;
  min-width: 320px;
}

.debt-row {
  border-bottom: 1px solid var(--cc-border);
  padding: 14px 0;
}

.debt-row:last-child {
  border-bottom: 0;
}

.offline-indicator {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  background: #b91c1c;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  display: none;
}

.offline-indicator.show {
  display: block;
}

[data-bs-theme="dark"] body {
  --cc-bg: #111827;
  --cc-card: #1f2937;
  --cc-ink: #e5e7eb;
  --cc-muted: #9ca3af;
  --cc-border: #374151;
}

@media (max-width: 991px) {
  .app-shell {
    display: block;
  }
  .content {
    padding: 16px;
  }
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .page-heading {
    display: block;
  }
  .launch-note {
    display: block;
  }
  .launch-note .btn {
    margin-top: 16px;
  }
}
