:root {
  --brand: #2c72af;
  --brand-dark: #1b5a91;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --bg: #f3f5f8;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #eef3f8 0%, #f8fafc 100%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .06);
}
.auth-card img.logo { height: 36px; }
.auth-card h1 { font-size: 22px; margin: 18px 0 6px; font-weight: 650; }
.auth-card p.sub { color: var(--muted); margin-bottom: 22px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand img { height: 20px; filter: brightness(0) invert(1); }
.sidebar .brand span { font-weight: 700; letter-spacing: .2px; }
.sidebar nav { padding: 14px 10px; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  font-size: 14px;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: var(--sidebar-2);
  color: #fff;
}
.sidebar .side-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: #94a3b8;
  font-size: 12px;
}
.main { flex: 1; min-width: 0; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar h2 { font-size: 18px; margin: 0; font-weight: 650; }
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--text);
}
.user-menu:hover, .user-menu:focus, .user-menu.show {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.user-menu::after { margin-left: 2px; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-meta { text-align: left; line-height: 1.15; }
.user-name { display: block; font-size: 13px; font-weight: 600; }
.user-role { display: block; font-size: 11px; color: var(--muted); }
.user-dropdown {
  min-width: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  margin-top: 8px !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}
.user-dropdown .dropdown-item {
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text);
}
.user-dropdown .dropdown-item:hover { background: #f1f5f9; }
.user-dropdown .dropdown-item.text-danger:hover { background: #fef2f2; }
.content { padding: 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 16px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.badge-soft {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.table { font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.form-label { font-size: 13px; font-weight: 600; color: #334155; }
.empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
}
.alert-lite {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.muted { color: var(--muted); }
code.url { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.password-toggle:hover { color: var(--text); }
.form-check-label { font-size: 14px; color: #334155; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}
.detail-grid .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.sub-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.sub-meta .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.sub-meta strong { font-size: 16px; }
.pkg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pkg-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .04);
}
.pkg-card.is-off { opacity: .65; }
.pkg-cycle { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.pkg-title { font-size: 22px; font-weight: 700; margin-top: 4px; }
.pkg-price { font-size: 32px; font-weight: 750; margin: 14px 0 4px; color: var(--brand); }
.pkg-price small { font-size: 14px; font-weight: 600; color: var(--muted); }
.profile-page { max-width: 980px; display: grid; gap: 16px; }
.profile-sheet {
  background: #fff;
  border: 1px solid #eceff3;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
  overflow: hidden;
}
.profile-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}
.profile-id-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-id-left img { height: 28px; }
.profile-id-name { font-size: 16px; font-weight: 700; }
.profile-id-sub { font-size: 13px; color: var(--muted); }
.profile-id-right { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.profile-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: #fff;
  border: 0;
  border-top: 1px solid #f1f5f9;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
.profile-row:first-child { border-top: 0; }
.profile-row span { display: inline-flex; align-items: center; gap: 10px; }
.profile-row i { color: #94a3b8; }
.profile-row span i { color: #64748b; font-size: 16px; }
.profile-row .bi-chevron-right { transition: transform .2s ease; }
.profile-row[aria-expanded="true"] .bi-chevron-right { transform: rotate(90deg); }
.profile-row-body { padding: 4px 22px 20px; border-top: 1px solid #f8fafc; }
.profile-billing {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
}
.profile-billing-title { font-size: 15px; font-weight: 600; color: #64748b; }
.profile-billing-box {
  min-width: 240px;
  border: 1px solid #eef2f6;
  border-radius: 10px;
  padding: 14px 16px;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}
.profile-billing-box strong { display: block; color: var(--text); }
.sub-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 12px;
  padding: 16px 22px;
  color: #fff;
}
.sub-banner-paid { background: linear-gradient(90deg, #1b5a91 0%, #2c72af 55%, #4f8fc4 100%); }
.sub-banner-trial { background: linear-gradient(90deg, #2c72af 0%, #5b9bd4 100%); }
.sub-banner-expired { background: linear-gradient(90deg, #64748b 0%, #94a3b8 100%); }
.sub-banner-label { font-size: 15px; font-weight: 600; }
.sub-banner-price { margin-top: 8px; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sub-banner-right { text-align: right; }
.sub-banner-status { font-size: 20px; font-weight: 700; }
.sub-banner-end { font-size: 12px; opacity: .92; margin-top: 2px; }
@media (max-width: 992px) {
  .stat-grid, .stat-grid-3 { grid-template-columns: 1fr 1fr; }
  .detail-grid, .sub-meta { grid-template-columns: 1fr 1fr; }
  .pkg-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .profile-id, .profile-billing { flex-direction: column; align-items: flex-start; }
  .profile-id-right { white-space: normal; }
  .sub-banner { flex-direction: column; align-items: flex-start; }
  .sub-banner-right { text-align: left; }
}
