:root {
  --primary: #0f9f6e;
  --primary-dark: #0b7a55;
  --primary-soft: #e8f8f1;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --background: #f3f6f9;
  --background-accent: linear-gradient(160deg, #eef6ff 0%, #f3f6f9 42%, #eaf8f2 100%);
  --card: #ffffff;
  --border: #e5ebf1;
  --text: #142033;
  --muted: #6b7a90;
  --shadow: 0 10px 30px rgba(20, 32, 51, 0.06);
  --radius: 16px;
  --sidebar-width: 280px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--background);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
}

/* Auth */
.auth-body {
  min-height: 100vh;
  background: var(--background-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-shell { width: 100%; max-width: 460px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(145deg, var(--primary), #1dbf8a);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.35rem; box-shadow: var(--shadow);
}
.auth-brand .brand-mark { margin: 0 auto 12px; }
.brand-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.brand-sub { color: var(--muted); margin: 4px 0 0; font-size: .92rem; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-heading { font-size: 1.35rem; font-weight: 700; margin: 0 0 6px; }
.auth-lead { color: var(--muted); margin-bottom: 22px; }
.auth-foot { color: var(--muted); font-size: .85rem; }

/* App shell */
.app-body { background: var(--background-accent); min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
}
.sidebar-brand {
  display: flex; gap: 12px; align-items: center;
  padding: 20px 18px; border-bottom: 1px solid var(--border);
  position: relative;
}
.sidebar-brand .brand-title { font-size: 1.05rem; }
.sidebar-brand .brand-sub {
  max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav { padding: 14px 12px; overflow: auto; flex: 1; }
.sidebar-nav .nav-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 12px 12px 6px; margin-top: 4px;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); padding: 10px 12px; border-radius: 12px;
  margin-bottom: 4px; font-weight: 500;
}
.sidebar-nav .nav-link i { width: 18px; color: var(--muted); }
.sidebar-nav .nav-link:hover { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-nav .nav-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-nav .nav-link.active i { color: var(--primary); }
.sidebar-nav .nav-link.disabled { opacity: .55; cursor: default; }
.sidebar-nav .soon {
  margin-left: auto; font-size: .68rem; color: var(--muted);
  background: #f1f4f8; padding: 2px 6px; border-radius: 999px;
}
.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid var(--border); }
.badge-dev {
  display: inline-block; background: #fff7ed; color: #c2410c;
  border: 1px solid #fed7aa; border-radius: 999px;
  font-size: .72rem; font-weight: 700; padding: 3px 8px; margin-bottom: 10px;
}
.user-chip strong { display: block; font-size: .92rem; }
.user-chip small { color: var(--muted); }
.sidebar-close {
  position: absolute; right: 10px; top: 16px;
  border: 0; background: transparent; font-size: 1.1rem;
}
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 1035;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; background: rgba(255,255,255,.78);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.app-content { padding: 24px; }

.page-intro {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  margin-bottom: 22px; flex-wrap: wrap;
}
.page-title { font-size: 1.45rem; margin: 0 0 4px; font-weight: 700; }
.page-lead { margin: 0; color: var(--muted); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.stat-card, .panel-card, .step-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat-card { padding: 18px 20px; }
.stat-label { display: block; color: var(--muted); font-size: .88rem; margin-bottom: 8px; }
.stat-value { font-size: 1.7rem; font-weight: 700; }

.panel-card { padding: 20px 22px; }
.panel-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 10px;
}
.panel-card h3 { font-size: 1.05rem; margin: 0 0 12px; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--muted);
}
.checklist li:last-child { border-bottom: 0; }
.checklist li.done { color: var(--text); }
.checklist li.done i { color: var(--primary); }

.detail-list { margin: 0; }
.detail-list > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); margin: 0; }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; }

.step-card {
  display: flex; gap: 14px; align-items: center; padding: 16px;
}
.step-card .step-num {
  width: 36px; height: 36px; border-radius: 10px;
  background: #f1f4f8; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.step-card.current { border-color: #b7ebd4; background: var(--primary-soft); }
.step-card.done .step-num { background: var(--primary); color: #fff; }
.onboarding-progress { height: 8px; border-radius: 999px; background: #e8eef5; }
.onboarding-progress .progress-bar { background: var(--primary); }

.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 4rem; color: var(--primary); }

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .app-content { padding: 18px; }
}
@media (max-width: 576px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 22px 18px; }
}
