/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', system-ui, sans-serif; color: #1e293b; background: #f8fafc; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.5; }
a { color: #16a34a; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Layout ── */
.auth-layout { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f8fafc, #f0fdf4); padding: 20px; }
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.app-content { flex: 1; overflow-y: auto; padding: 24px; max-width: 1100px; }

/* ── Sidebar ── */
.sidebar { width: 220px; background: #fff; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 16px; border-bottom: 1px solid #f1f5f9; }
.sidebar-logo a { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon { width: 32px; height: 32px; border-radius: 8px; background: #16a34a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.logo-text { font-size: 14px; font-weight: 600; color: #1e293b; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.nav-section { margin-bottom: 20px; }
.nav-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: #94a3b8; padding: 0 12px; margin-bottom: 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: #64748b; font-size: 13px; transition: all 0.15s; text-decoration: none; }
.nav-link:hover { background: #f8fafc; color: #1e293b; text-decoration: none; }
.nav-link.active { background: #f0fdf4; color: #15803d; font-weight: 500; }
.nav-link svg { flex-shrink: 0; }
.sidebar-footer { border-top: 1px solid #f1f5f9; padding: 12px 8px; }
.logout-link:hover { background: #fef2f2; color: #dc2626; }

/* ── Header ── */
.app-header { height: 52px; border-bottom: 1px solid #f1f5f9; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-email { font-size: 13px; color: #64748b; }

/* ── Auth Card ── */
.auth-card { background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border: 1px solid #e2e8f0; padding: 32px; width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header .logo-icon { margin: 0 auto 12px; width: 40px; height: 40px; font-size: 14px; border-radius: 12px; }
.auth-header h1 { font-size: 20px; font-weight: 600; }
.auth-header p { font-size: 13px; color: #64748b; margin-top: 4px; }
.auth-footer { text-align: center; font-size: 13px; color: #64748b; margin-top: 16px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; height: 40px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 12px; font-size: 14px; font-family: inherit; background: #fff; transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.1); }
.form-group textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { flex: 1; min-width: 140px; }
.form-narrow { max-width: 360px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin-bottom: 4px; }
.checkbox input { width: auto; height: auto; }

/* Role Selector */
.role-selector { display: flex; gap: 8px; }
.role-option { flex: 1; cursor: pointer; }
.role-option input { display: none; }
.role-card { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; text-align: center; transition: all 0.15s; }
.role-card strong { display: block; font-size: 13px; }
.role-card small { display: block; font-size: 10px; color: #94a3b8; margin-top: 2px; }
.role-option input:checked + .role-card { border-color: #16a34a; background: #f0fdf4; box-shadow: 0 0 0 1px #16a34a; }
.role-option input:checked + .role-card strong { color: #15803d; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 20px; border-radius: 8px; font-size: 14px; font-weight: 500; font-family: inherit; border: none; cursor: pointer; transition: all 0.15s; text-decoration: none; gap: 6px; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: #16a34a; color: #fff; }
.btn-primary:hover { background: #15803d; }
.btn-outline { background: #fff; border: 1px solid #cbd5e1; color: #475569; }
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-ghost-light { background: rgba(255,255,255,0.15); color: #fff; }
.btn-ghost-light:hover { background: rgba(255,255,255,0.25); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }

/* ── Cards ── */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; padding: 10px 16px; border-bottom: 1px solid #f1f5f9; text-align: left; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f8fafc; font-size: 13px; }
.table tr:hover { background: #fafbfc; }
.text-right { text-align: right; }
.text-muted { color: #94a3b8; }
.text-green { color: #16a34a; }
.text-red { color: #dc2626; }
.text-amber { color: #d97706; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 2px 10px; border-radius: 99px; }
.badge-success { background: #f0fdf4; color: #15803d; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-info { background: #eff6ff; color: #1d4ed8; }

/* ── Balance Hero ── */
.balance-hero { background: linear-gradient(135deg, #1e293b, #0f172a); border-radius: 12px; padding: 24px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; color: #fff; }
.balance-label { display: block; font-size: 13px; color: #94a3b8; }
.balance-amount { display: block; font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin-top: 4px; }
.balance-frozen { display: block; font-size: 12px; color: #64748b; margin-top: 2px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; }
.stat-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }

/* ── Page Header ── */
.page-header { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-header p { font-size: 13px; color: #64748b; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: #1e293b; text-decoration: none; }
.tab.active { color: #16a34a; border-color: #16a34a; }
.tabs-inline { display: flex; gap: 4px; }

/* ── Misc ── */
.empty { color: #94a3b8; text-align: center; padding: 32px; font-size: 13px; }
.link { font-size: 13px; color: #16a34a; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.ml-2 { margin-left: 8px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; border-top: 1px solid #f1f5f9; font-size: 12px; color: #94a3b8; }

/* ── Ad Unit Code ── */
.unit-item { padding: 16px 0; border-bottom: 1px solid #f1f5f9; }
.unit-item:last-child { border-bottom: none; }
.unit-info { margin-bottom: 8px; }
.unit-code { margin-bottom: 8px; }
.unit-code label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; display: block; margin-bottom: 4px; }
.code-block { width: 100%; padding: 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; font-family: 'JetBrains Mono', monospace; font-size: 11px; resize: none; height: 50px; color: #334155; cursor: pointer; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
  .form-inline { flex-direction: column; align-items: stretch; }
}
