/* ─────────────────────────────────────────────
   DASHBOARD BASE CSS
   top + nav + layout + ui shared
───────────────────────────────────────────── */

/* RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* VARIABLES */
:root {
  --bg: #07060f;
  --surface: #0f0e1a;
  --surface2: #151323;
  --border: rgba(109,84,255,0.13);
  --border-md: rgba(109,84,255,0.24);
  --text: #f0f0ee;
  --muted: #8880aa;
  --subtle: #2e2b44;
  --accent: #6d54ff;
  --accent2: #5a3fff;
  --accent-dim: rgba(109,84,255,0.10);
  --danger: #e05c5c;
  --success: #4caf82;
  --warning: #e0a035;
  --radius: 10px;
  --radius-sm: 7px;
  --top-h: 58px;
  --nav-w: 220px;
}

html[data-theme="light"] {
  --bg: #f4f3ff;
  --surface: #ffffff;
  --surface2: #f8f7ff;
  --border: rgba(90,63,255,0.11);
  --border-md: rgba(90,63,255,0.22);
  --text: #0f0e1a;
  --muted: #5f5a78;
  --subtle: #b9b4d1;
  --accent: #5a3fff;
  --accent2: #6d54ff;
  --accent-dim: rgba(90,63,255,0.08);
  --danger: #c84155;
  --success: #198c5e;
  --warning: #b77716;
}

/* BASE */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .28s, color .28s;
}

body {
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* TOPBAR */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  min-width: var(--nav-w);
  height: 100%;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  flex-shrink: 0;
}

.hamburger:hover {
  color: var(--text);
  background: var(--accent-dim);
}

.logo-box {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0.5px solid var(--border-md);
  box-shadow: 0 5px 16px rgba(69,48,190,0.18);
}

.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.18);
}

.logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.logo-box.logo-img-error img {
  display: none;
}

.logo-box.logo-img-error .logo-fallback {
  display: flex;
}

.logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.logo-text em {
  color: var(--accent);
  font-style: normal;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.theme-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-md);
  background: var(--accent-dim);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}

.theme-btn:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109,84,255,0.14);
}

.theme-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ic-sun {
  display: none;
}

.ic-moon {
  display: block;
}

html[data-theme="light"] .ic-sun {
  display: block;
}

html[data-theme="light"] .ic-moon {
  display: none;
}

.topbar-env {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--success);
  background: rgba(76,175,130,0.10);
  border: 0.5px solid rgba(76,175,130,0.25);
  flex-shrink: 0;
  margin-left: 5px;
}

.topbar-env-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.topbar-env-text {
  display: inline;
}


.topbar-credit-inline {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.topbar-credit-label {
  font-size: 10px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

.topbar-credit-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}



.topbar-user {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.topbar-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.topbar-email {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--border-md);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  line-height: 1;
}


.topbar-avatar-link {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s, opacity .15s;
}

.topbar-avatar-link:hover {
  transform: translateY(-1px);
  border-color: rgba(109,84,255,0.42);
  box-shadow: 0 6px 18px rgba(109,84,255,0.24);
}

.topbar-avatar-link:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(109,84,255,0.16),
    0 6px 18px rgba(109,84,255,0.24);
}




.topbar-logout {
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-md);
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.topbar-logout:hover {
  color: var(--danger);
  border-color: rgba(224,92,92,0.3);
  background: rgba(224,92,92,0.05);
}

/* OVERLAY */
.sidebar-overlay {
  display: none;
}

/* LAYOUT */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--top-h);
}

.sidebar {
  position: fixed;
  top: var(--top-h);
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  z-index: 1002;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  overflow-y: auto;
}

.nav-section-label {
  padding: 0 10px;
  margin: 8px 0 6px;
  font-family: ui-monospace, monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-dim);
  color: var(--text);
}

.nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active svg {
  stroke: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 0.5px solid var(--border);
}

.sidebar-app-name,
.sidebar-slug {
  font-family: ui-monospace, monospace;
  font-size: 10px;
}

.sidebar-app-name {
  color: var(--muted);
  opacity: .5;
  line-height: 1.5;
}

.sidebar-slug {
  color: var(--accent);
  opacity: .6;
}

.content-area {
  flex: 1;
  min-width: 0;
  min-height: calc(100vh - var(--top-h));
  margin-left: var(--nav-w);
  padding: 28px 32px;
  background: var(--bg);
}

/* SHARED PAGE UI */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  margin-bottom: 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
}

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: inset 0 1px 0 rgba(109,84,255,0.15);
}

.stat-label {
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  letter-spacing: .04em;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
}

.stat-delta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--success);
}

.stat-delta.down {
  color: var(--danger);
}

/* TABLES */
.table-card {
  margin-bottom: 22px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
}

.table-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.table-action {
  background: none;
  border: none;
  cursor: pointer;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity .15s;
}

.table-action:hover {
  opacity: .7;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--subtle) transparent;
}

.table-scroll::-webkit-scrollbar {
  height: 4px;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: var(--subtle);
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 10px 20px;
  text-align: left;
  font-size: 10px;
  font-weight: 400;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 0.5px solid var(--border);
}

td {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 0.5px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--accent-dim);
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-ok {
  background: rgba(76,175,130,0.12);
  color: var(--success);
  border: 0.5px solid rgba(76,175,130,0.25);
}

.badge-err {
  background: rgba(224,92,92,0.12);
  color: var(--danger);
  border: 0.5px solid rgba(224,92,92,0.25);
}

.badge-warn {
  background: rgba(224,160,53,0.12);
  color: var(--warning);
  border: 0.5px solid rgba(224,160,53,0.25);
}

.badge-purple {
  background: rgba(109,84,255,0.12);
  color: var(--accent);
  border: 0.5px solid rgba(109,84,255,0.25);
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* BUTTONS */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(109,84,255,0.28);
  transition: opacity .15s;
}

.btn-primary:hover {
  opacity: .88;
}

.btn-ghost {
  padding: 7px 14px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn-danger {
  padding: 7px 14px;
  border: 0.5px solid rgba(224,92,92,0.3);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--danger);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.btn-danger:hover {
  background: rgba(224,92,92,0.08);
}

/* FORMS */
.panel-form {
  max-width: 520px;
}

.form-field {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: ui-monospace, monospace;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  background: var(--surface2);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109,84,255,0.12);
}

.form-input::placeholder {
  color: var(--subtle);
}

.form-hint {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

/* EMPTY / CODE */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  margin-bottom: 12px;
  font-size: 32px;
  opacity: .4;
}

.empty p {
  margin-bottom: 16px;
  font-size: 13px;
}

.code-block {
  margin: 10px 0;
  padding: 16px 18px;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

/* MOBILE */
@media (max-width: 700px) {
  .topbar {
    padding: 0 12px 0 0;
  }

  .hamburger {
    display: flex !important;
  }

   .topbar-user {
      display: none;
    }
    
    .topbar-env {
      display: flex;
    }

  .topbar-left {
    width: auto;
    min-width: 0;
    border-right: none;
    padding: 0 12px;
    gap: 8px;
  }

  .logo-text {
    font-size: 13px;
  }

  .topbar-right {
    gap: 8px;
  }

  .topbar-avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.22,1,.36,1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(7,6,15,0.65);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }

  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: all;
  }

  .content-area {
    margin-left: 0 !important;
    padding: 16px !important;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-header .btn-primary {
    width: 100%;
  }
  
  
  .topbar-env {
      display: flex;
      padding: 0;
      min-width: 10px;
      min-height: 10px;
      border: none;
      background: transparent;
      gap: 0;
    }
    
    .topbar-env-text {
      display: none;
    }
    
    .topbar-env-dot {
      width: 8px;
      height: 8px;
    }
    .topbar-credit-value {
      font-size: 11px;
    }
    
    .topbar-credit-label {
      font-size: 9px;
    }



}
@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding-right: 10px;
  }

  .topbar-left {
    padding: 0 10px;
    gap: 7px;
  }

  .logo-text {
    font-size: 12px;
  }

  .topbar-right {
    gap: 6px;
  }

  .topbar-avatar {
    display: inline-flex;
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
    .topbar-env-dot {
      width: 7px;
      height: 7px;
    }

.topbar-credit-value {
  font-size: 10px;
}

.topbar-credit-label {
  font-size: 8px;
}
}









