/* PesaFlux – Light SaaS Theme v3 */
/* Tailwind CDN handles utilities; this file adds layout & custom components */

:root {
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --accent-hover: #4338ca;
  --green: #059669;
  --green-light: #ecfdf5;
  --red: #dc2626;
  --red-light: #fef2f2;
  --yellow: #d97706;
  --yellow-light: #fffbeb;
  --cyan: #0891b2;
  --border: #e5e7eb;
  --surface: #ffffff;
  --bg: #f8fafc;
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; }
code, pre, .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

/* ═══════════════════════════════════
   LAYOUT
═══════════════════════════════════ */
.layout { display: flex; min-height: 100vh; overflow-x: hidden; width: 100%; }

/* ═══════════════════════════════════
   SIDEBAR
═══════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  scrollbar-width: none;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.025em;
  color: var(--text);
}
.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}
.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background .15s;
  flex-shrink: 0;
}
.sidebar-close:hover { background: #f3f4f6; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .72rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .03em;
}
.user-info { min-width: 0; flex: 1; }
.user-name {
  font-weight: 600;
  font-size: .825rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-balance {
  font-size: .7rem;
  color: var(--green);
  font-weight: 600;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: .835rem;
  font-weight: 500;
  transition: all .15s;
  position: relative;
}
.nav-link:hover { background: #f9fafb; color: var(--text); }
.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-icon svg { width: 17px; height: 17px; }

.sidebar-footer {
  padding: 8px 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.nav-link-admin { color: var(--yellow) !important; }
.nav-link-admin:hover { background: var(--yellow-light) !important; }
.nav-link-logout:hover { background: var(--red-light) !important; color: var(--red) !important; }

/* ═══════════════════════════════════
   TOPBAR (mobile only)
═══════════════════════════════════ */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 150;
}
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background .15s;
}
.hamburger:hover { background: #f3f4f6; }
.hamburger span { width: 18px; height: 2px; background: var(--text-2); border-radius: 2px; display: block; }
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: -.02em;
  color: var(--text);
}
.topbar-logo .logo-mark { width: 26px; height: 26px; font-size: .75rem; border-radius: 6px; }
.topbar-right { margin-left: auto; }
.topbar-balance {
  font-size: .72rem;
  color: var(--green);
  font-weight: 700;
  background: var(--green-light);
  border: 1px solid #a7f3d0;
  padding: 4px 10px;
  border-radius: 20px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.4);
  z-index: 190;
}

/* ═══════════════════════════════════
   MAIN
═══════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}
.content {
  flex: 1;
  padding: 28px 28px;
  width: 100%;
  max-width: 1300px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.page-header p { font-size: .825rem; color: var(--text-2); margin-top: 3px; }

/* ═══════════════════════════════════
   CARDS
═══════════════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.card-title { font-size: .9rem; font-weight: 650; color: var(--text); letter-spacing: -.01em; }
.card-subtitle { font-size: .78rem; color: var(--text-2); margin-top: 3px; }
.card-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.07); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--accent));
  border-radius: 12px 12px 0 0;
}
.stat-label {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1.1;
}
.stat-sub { font-size: .72rem; color: var(--text-2); margin-top: 5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }

/* ═══════════════════════════════════
   BUTTONS
═══════════════════════════════════ */
.btn-primary, .btn-ghost, .btn-danger, .btn-warn, .btn-success {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .825rem;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f9fafb; color: var(--text); border-color: #d1d5db; }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-warn { background: var(--yellow-light); color: var(--yellow); border: 1px solid #fde68a; }
.btn-warn:hover { background: #fef3c7; }
.btn-success { background: var(--green-light); color: var(--green); border: 1px solid #a7f3d0; }
.btn-success:hover { background: #d1fae5; }
.btn-sm { padding: 5px 11px; font-size: .775rem; }
.btn-xs { padding: 3px 8px; font-size: .72rem; border-radius: 5px; }
.btn-lg { padding: 11px 22px; font-size: .9rem; border-radius: 9px; }
.w-100 { width: 100%; justify-content: center; }
button:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ═══════════════════════════════════
   FORMS
═══════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-label { font-size: .75rem; font-weight: 600; color: var(--text-2); }
.field-label .req { color: var(--red); margin-left: 2px; }
.field input,
.field select,
.field textarea {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: .875rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.field select option { background: #fff; }
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: .72rem; color: var(--text-3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background .15s;
}
.password-toggle:hover { background: #f3f4f6; color: var(--text); }

/* ═══════════════════════════════════
   BADGES
═══════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-success, .badge-active { background: #dcfce7; color: #15803d; }
.badge-failed  { background: #fee2e2; color: #b91c1c; }
.badge-pending { background: #fef9c3; color: #a16207; }
.badge-cancelled { background: #f3f4f6; color: var(--text-2); }
.badge-inactive { background: #f3f4f6; color: var(--text-3); }
.badge-info { background: #e0f2fe; color: #0369a1; }

/* ═══════════════════════════════════
   TABLE
═══════════════════════════════════ */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .825rem; min-width: 480px; }
.tbl thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
  white-space: nowrap;
}
.tbl tbody tr { border-bottom: 1px solid #f3f4f6; transition: background .1s; }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: #f9fafb; }
.tbl tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }

/* ═══════════════════════════════════
   ALERTS
═══════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: .825rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-success { background: var(--green-light); border: 1px solid #a7f3d0; color: #065f46; }
.alert-error   { background: var(--red-light);   border: 1px solid #fecaca; color: #991b1b; }
.alert-warn    { background: var(--yellow-light); border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: var(--accent-light); border: 1px solid #c7d2fe; color: #3730a3; }

/* ═══════════════════════════════════
   EMPTY STATE
═══════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 8px;
}
.empty-icon { font-size: 2rem; opacity: .25; margin-bottom: 4px; }
.empty-state h3 { font-size: .9rem; font-weight: 600; color: var(--text); }
.empty-state p  { font-size: .8rem; color: var(--text-2); max-width: 260px; }

/* ═══════════════════════════════════
   MODAL
═══════════════════════════════════ */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.modal h2 { font-size: 1rem; font-weight: 700; margin-bottom: 18px; letter-spacing: -.02em; }
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: #f3f4f6;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: .85rem;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: #e5e7eb; color: var(--text); }

/* ═══════════════════════════════════
   NOTIFICATIONS (top-right)
═══════════════════════════════════ */
#notif-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 320px;
  max-width: calc(100vw - 32px);
}
.notif {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: .825rem;
  pointer-events: all;
  animation: notif-in .2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
}
.notif-success { background: #fff; border: 1px solid #a7f3d0; color: #065f46; }
.notif-error   { background: #fff; border: 1px solid #fca5a5; color: #991b1b; }
.notif-info    { background: #fff; border: 1px solid #c7d2fe; color: #3730a3; }
.notif-warn    { background: #fff; border: 1px solid #fde68a; color: #92400e; }
.notif-body    { flex: 1; min-width: 0; }
.notif-title   { font-weight: 700; font-size: .825rem; }
.notif-msg     { font-size: .775rem; color: var(--text-2); margin-top: 1px; }
@keyframes notif-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════
   SPINNER
═══════════════════════════════════ */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════
   API KEY / CODE
═══════════════════════════════════ */
.api-key-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  flex-wrap: wrap;
}
.api-key-val {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.code-block {
  background: #1e1e2e;
  border: 1px solid #2d2d3a;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: .775rem;
  color: #cdd6f4;
  line-height: 1.75;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════
   TABS
═══════════════════════════════════ */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
  max-width: 100%;
}
.tab-btn {
  padding: 5px 14px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: .775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tab-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════
   ITEM CARDS
═══════════════════════════════════ */
.items-grid { display: grid; gap: 10px; }
.item-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: box-shadow .15s;
}
.item-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.item-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: .875rem; color: var(--text); }
.item-meta { font-size: .775rem; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════
   PLAN CARDS
═══════════════════════════════════ */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.plan-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all .2s;
}
.plan-card:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(79,70,229,.1); }
.plan-card.featured { border-color: var(--accent); }
.plan-name  { font-size: .875rem; font-weight: 700; color: var(--text); }
.plan-price { font-size: 1.75rem; font-weight: 800; color: var(--accent); letter-spacing: -.03em; line-height: 1; }
.plan-price span { font-size: .78rem; font-weight: 400; color: var(--text-2); }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.plan-features li { font-size: .8rem; color: var(--text-2); display: flex; align-items: flex-start; gap: 7px; }
.plan-features li::before { content: '✓'; color: var(--green); font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.plan-card .btn-primary { width: 100%; justify-content: center; margin-top: auto; }

/* ═══════════════════════════════════
   INTEGRATION
═══════════════════════════════════ */
.endpoint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.method-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.method-post { background: #dcfce7; color: #15803d; }
.method-get  { background: #e0f2fe; color: #0369a1; }

/* ═══════════════════════════════════
   PLAN BANNER
═══════════════════════════════════ */
.plan-banner {
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #c7d2fe;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.plan-banner-name { font-weight: 700; font-size: 1rem; color: var(--accent); }
.plan-banner-meta { font-size: .78rem; color: var(--text-2); margin-top: 2px; }

/* ═══════════════════════════════════
   AUTH PAGES
═══════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-mark {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 14px;
}
.auth-logo h1 { font-size: 1.35rem; font-weight: 800; color: var(--text); letter-spacing: -.025em; }
.auth-logo p  { font-size: .825rem; color: var(--text-2); margin-top: 5px; }
.auth-footer  { text-align: center; margin-top: 20px; font-size: .8rem; color: var(--text-2); }

/* ═══════════════════════════════════
   PAY PAGE
═══════════════════════════════════ */
.pay-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pay-card {
  max-width: 400px; width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.pay-logo   { font-size: 2.2rem; margin-bottom: 8px; }
.pay-title  { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -.02em; }
.pay-desc   { font-size: .825rem; color: var(--text-2); margin-bottom: 22px; line-height: 1.6; }
.pay-amount { font-size: 2rem; font-weight: 800; color: var(--accent); margin-bottom: 20px; letter-spacing: -.03em; }

/* ═══════════════════════════════════
   MISC
═══════════════════════════════════ */
.text-muted   { color: var(--text-2); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-accent  { color: var(--accent); }
.text-sm  { font-size: .78rem; }
.text-xs  { font-size: .7rem; }
.fw-600   { font-weight: 600; }
.fw-700   { font-weight: 700; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 14px; }
.mb-2 { margin-bottom: 14px; }
.section-title { font-size: .875rem; font-weight: 700; margin-bottom: 12px; color: var(--text); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar input,
.filter-bar select {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: var(--text);
  padding: 7px 11px;
  font-size: .825rem;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
}
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.filter-bar input::placeholder { color: var(--text-3); }

.quick-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick-btn {
  padding: 5px 12px;
  border-radius: 7px;
  background: #f9fafb;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: .775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.quick-btn:hover, .quick-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 1024px) {
  .content { padding: 24px 20px; }
}
@media (max-width: 900px) {
  .grid-2  { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .grid-3  { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  /* Sidebar off-canvas */
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.12); }
  .sidebar-close { display: flex !important; }
  .sidebar-overlay.open { display: block; }
  /* Show mobile bar */
  .topbar { display: flex !important; }
  /* Reset main — no sidebar offset on mobile */
  .main { margin-left: 0 !important; padding-top: var(--topbar-h); overflow-x: hidden; }
  .content { padding: 16px 14px; overflow-x: hidden; }
  /* Grids stack */
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .plans-grid { grid-template-columns: 1fr; }
  /* Headers */
  .page-header { flex-direction: column; gap: 10px; }
  .page-header > a, .page-header > button { align-self: flex-start; }
  /* Item cards */
  .item-card { flex-wrap: wrap; }
  .item-actions { width: 100%; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; flex-wrap: wrap; }
  /* Plan banner */
  .plan-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  /* Tables — reduce min-width so they fit on mobile with scroll */
  .tbl { min-width: 380px; font-size: .78rem; }
  /* Notifs */
  #notif-stack { right: 10px; top: 10px; width: calc(100vw - 20px); }
  /* Modal */
  .modal { padding: 20px 16px; max-height: calc(100dvh - 24px); width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; }
  /* Api key wrap */
  .api-key-wrap { flex-wrap: wrap; }
  .api-key-val { min-width: 100%; }
  /* Filter bars */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { width: 100%; }
}
@media (max-width: 480px) {
  .main { padding-top: calc(var(--topbar-h) + 2px); }
  .content { padding: 12px 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .auth-card  { padding: 24px 18px; }
  .card       { padding: 14px 12px; }
  .stat-value { font-size: 1.2rem; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .tabs { width: 100%; }
  .tab-btn { flex: 1; text-align: center; }
  .field-row { grid-template-columns: 1fr; }
  .tbl { min-width: 320px; font-size: .74rem; }
  .tbl thead th { font-size: .62rem; padding: 8px 6px; }
  .tbl td { padding: 8px 6px; }
  .page-header h1 { font-size: 1.2rem; }
}
@media (max-width: 360px) {
  .content { padding: 10px 10px; }
  .page-header h1 { font-size: 1.1rem; }
  .tbl { min-width: 280px; font-size: .7rem; }
}