/* =============================================
   PREMIUM ADMIN PANEL — DESIGN SYSTEM
   ============================================= */
:root {
  --bg: #05070d;
  --bg2: #070b13;
  --sidebar-bg: #05070d;
  --sidebar-border: rgba(220, 38, 38, 0.18);
  --sidebar-width: 270px;
  --card-bg: #0f172a;
  --panel-bg: #111827;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --accent-soft: rgba(220, 38, 38, 0.10);
  --accent-glow: rgba(220, 38, 38, 0.35);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --border: rgba(148, 163, 184, 0.16);
  --border-focus: #dc2626;
  --success: #dc2626;
  --success-bg: rgba(220, 38, 38, 0.10);
  --success-border: rgba(220, 38, 38, 0.35);
  --danger: #f87171;
  --danger-bg: rgba(220, 38, 38, 0.12);
  --danger-border: rgba(248, 113, 113, 0.32);
  --info-bg: rgba(15, 23, 42, 0.88);
  --info-border: rgba(220, 38, 38, 0.25);
  --info-text: #fca5a5;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 20px 48px rgba(0, 0, 0, 0.34), 0 8px 20px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-accent: 0 12px 32px rgba(220, 38, 38, 0.26), 0 0 0 1px rgba(220, 38, 38, 0.18);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t: all 0.3s var(--ease);
  --t-fast: all 0.18s var(--ease);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ── Reset ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(220, 38, 38, 0.10) 0%, transparent 62%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(153, 27, 27, 0.10) 0%, transparent 62%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  display: flex;
  min-height: 100vh;
  color: var(--text-main);
  overflow-x: hidden;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  background-image: linear-gradient(160deg, #070b13 0%, #05070d 58%, #030407 100%);
  margin: 16px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 24px;
  border: 1px solid var(--sidebar-border);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.24);
  position: fixed;
  height: calc(100vh - 32px);
  z-index: 1000;
  overflow: hidden;
  flex-shrink: 0;
  transition: var(--t);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.72), transparent);
}

body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width) - 32px));
  opacity: 0;
  pointer-events: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-close {
  display: none;
}

/* — Logo — */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 28px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 20px;
  white-space: nowrap;
}

.logo i {
  color: var(--accent);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.logo span {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff 30%, rgba(255, 255, 255, 0.55));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* — Nav — */
.sidebar nav {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-section {
  display: grid;
  gap: 6px;
}

.nav-section-title {
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px 2px;
}

.sidebar nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar nav ul li a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  font-size: 14px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: var(--radius-sm);
  transition: var(--t-fast);
  white-space: nowrap;
  position: relative;
}

.sidebar nav ul li a i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: var(--t-fast);
}

.sidebar nav ul li.active a,
.sidebar nav ul li a:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #fff;
}

.sidebar nav ul li.active a {
  background: rgba(220, 38, 38, 0.16);
  color: #fff;
}

.sidebar nav ul li.active a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--accent);
}

/* — Sidebar Footer — */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--t-fast);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
}

.sidebar-action i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-action:hover {
  background: rgba(225, 29, 72, 0.1);
  color: #ff6b8a;
}

/* =============================================
   CONTENT AREA
   ============================================= */
.content {
  flex: 1;
  padding: 32px 36px;
  margin-left: calc(var(--sidebar-width) + 32px);
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  width: 100%;
  min-width: 0;
  transition: margin-left 0.3s var(--ease);
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInContent 0.7s forwards 0.15s var(--ease);
}

body.sidebar-collapsed .content {
  margin-left: 0;
}

@keyframes fadeInContent {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Header ── */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  position: sticky;
  top: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 0% 0%, rgba(225, 29, 72, 0.03) 0%, transparent 60%);
  padding: 12px 0;
  z-index: 100;
}

.header-top::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  opacity: 0.6;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

#sidebar-toggle {
  background: var(--card-bg);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--t-fast);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

#sidebar-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
  transform: scale(1.04);
}

header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  line-height: 1.1;
}

header p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 3px;
  font-weight: 400;
}

/* ── User Profile ── */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-profile div {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9f1239);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
}

/* =============================================
   STATS GRID / CARDS
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--t);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #f43f5e);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(225, 29, 72, 0.15);
}

.card:hover::after {
  opacity: 1;
}

.card-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 16px;
}

.card-icon i {
  width: 20px;
  height: 20px;
}

.card-title {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.card-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

/* =============================================
   PANELS
   ============================================= */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--t);
  max-width: 100%;
  min-width: 0;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  max-width: 100%;
}

.section-title {
  margin-bottom: 20px;
}

.section-title h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.section-title p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

.section-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.muted {
  color: var(--text-muted);
}

/* =============================================
   FORMS — PREMIUM
   ============================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.settings-form {
  display: grid;
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 11px 13px;
  background: #fafbfc;
  color: var(--text-main);
  font: inherit;
  font-size: 14px;
  transition: var(--t-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: auto;
  appearance: auto;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--accent);
  cursor: pointer;
  box-shadow: none;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--card-bg);
  color: var(--text-main);
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  transition: var(--t-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn i {
  width: 15px;
  height: 15px;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.18);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.btn.danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.inline-delete-form {
  display: inline-flex;
  margin: 0;
}

.inline-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-action-stack form {
  margin: 0;
}

/* =============================================
   ALERTS
   ============================================= */
.alert {
  border-radius: var(--radius-xs);
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  font-size: 14px;
  font-weight: 500;
}

.alert-success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

.alert-error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

/* =============================================
   DATA TABLES
   ============================================= */
.data-table-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  display: block;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.data-table thead {
  background: #f8f9fb;
}

.data-table th {
  text-align: left;
  padding: 11px 14px;
  color: var(--text-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: #fafbfd;
}

/* ── Status Pills ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 99px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* =============================================
   SETTINGS PAGES
   ============================================= */
.settings-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.settings-page-head .section-title {
  margin-bottom: 0;
}

.settings-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.settings-link-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  padding: 18px;
  color: var(--text-main);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: var(--t-fast);
  position: relative;
  overflow: hidden;
}

.settings-link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.02) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.settings-link-card:hover {
  border-color: rgba(225, 29, 72, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.settings-link-card:hover::before {
  opacity: 1;
}

.settings-link-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--t-fast);
}

.settings-link-icon i {
  width: 20px;
  height: 20px;
}

.settings-link-card:hover .settings-link-icon {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.settings-link-card strong,
.settings-link-card small {
  display: block;
}

.settings-link-card strong {
  font-size: 14px;
  font-weight: 700;
}

.settings-link-card small {
  color: var(--text-muted);
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 400;
}

.settings-link-card em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

/* — Check Grid — */
.settings-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 11px 13px;
  background: #fafbfc;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--t-fast);
}

.check-row:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 4px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* — Copy Grid — */
.settings-copy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

/* =============================================
   COPY BOX — PREMIUM (Copyable)
   ============================================= */
.copy-box {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: linear-gradient(135deg, #fafbfc 0%, #f4f6fa 100%);
  position: relative;
  transition: var(--t-fast);
}

.copy-box:hover {
  border-color: rgba(225, 29, 72, 0.3);
}

.copy-box strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.copy-box p {
  font-size: 13.5px;
  color: var(--text-main);
  word-break: break-all;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  line-height: 1.5;
}

.copy-box small {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 6px;
  line-height: 1.4;
}

/* Copyable field wrapping */
.copy-field-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 13px;
  margin-top: 8px;
  transition: var(--t-fast);
}

.copy-field-wrap:hover {
  border-color: var(--accent);
}

.copy-field-text {
  flex: 1;
  font-size: 14px;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  color: var(--text-main);
  word-break: break-all;
  line-height: 1.4;
  user-select: all;
}

.copy-trigger-btn {
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--t-fast);
  white-space: nowrap;
}

.copy-trigger-btn i {
  width: 13px;
  height: 13px;
}

.copy-trigger-btn:hover {
  background: var(--accent);
  color: #fff;
}

.copy-trigger-btn.copied {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* =============================================
   AUTH / LOGIN PAGE
   ============================================= */
.auth-page {
  display: block;
}

.auth-page .content {
  min-height: 100vh;
  margin-left: 0;
  max-width: none;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 24px;
}

.auth-shell {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 36px 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: slideUpAuth 0.5s var(--ease-spring) both;
}

@keyframes slideUpAuth {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-shell-wide {
  max-width: 640px;
}

.auth-shell h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.auth-reset-form {
  margin-top: 10px;
}

.auth-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.auth-steps span {
  min-height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  background: #f8fafc;
}

.auth-steps span i {
  width: 15px;
  height: 15px;
}

.auth-steps span.done {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

.auth-steps span.active {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
}

.auth-setup-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 16px;
  margin-bottom: 16px;
}

.auth-setup-card.compact {
  grid-template-columns: 1fr;
}

.auth-setup-card p {
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.45;
  font-size: 13.5px;
}

.auth-setup-card .copy-box {
  grid-column: 1/-1;
  background: #fff;
}

.auth-qr-wrap {
  display: flex;
  justify-content: center;
}

.auth-qr {
  width: 200px;
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  color: var(--text-muted);
  text-align: center;
}

.auth-qr canvas {
  width: 180px !important;
  height: 180px !important;
}

/* =============================================
   APPROVAL GATE (Modal)
   ============================================= */
.approval-gate {
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.approval-gate[hidden] {
  display: none;
}

body.approval-open {
  overflow: hidden;
}

.approval-panel {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: approvalSlideIn 0.4s var(--ease-spring) both;
}

@keyframes approvalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.approval-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.approval-head h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.approval-head span {
  white-space: nowrap;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 99px;
}

.approval-list {
  display: grid;
  gap: 12px;
}

.approval-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: grid;
  gap: 10px;
  transition: var(--t-fast);
}

.approval-card:hover {
  border-color: rgba(225, 29, 72, 0.2);
  box-shadow: var(--shadow-sm);
}

.approval-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.approval-card-top strong {
  font-size: 14px;
  font-weight: 700;
}

.approval-card-top p {
  color: var(--text-muted);
  margin-top: 3px;
  font-size: 12.5px;
}

.approval-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.approval-step {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 9px 10px;
  background: #f8fafc;
  transition: var(--t-fast);
}

.approval-step.done {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.approval-step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
  font-size: 11px;
}

.approval-step.done .approval-step-icon {
  background: var(--success);
  border-color: var(--success);
}

.approval-step strong {
  font-size: 13px;
  font-weight: 700;
}

.approval-step small {
  display: block;
  color: var(--text-muted);
  margin-top: 2px;
  font-size: 12px;
}

.approval-guidance {
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
  border-radius: var(--radius-xs);
  padding: 9px 11px;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.45;
}

.approval-message {
  margin-top: 12px;
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  color: var(--success);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
}

.approval-message.error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

/* =============================================
   PAYMENT PUBLIC PAGE
   ============================================= */
.auth-page.payment-page .content {
  background: linear-gradient(135deg, #0f172a 0%, #1a0a1e 50%, #0f172a 100%);
}

.payment-public {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.payment-hero {
  text-align: center;
  padding: 12px 0 28px;
}

.payment-hero .payment-logo {
  width: 60px;
  height: 60px;
  background: rgba(225, 29, 72, 0.12);
  border: 1.5px solid rgba(225, 29, 72, 0.3);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
}

.payment-hero .payment-logo i {
  width: 28px;
  height: 28px;
}

.payment-hero h1 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text-main);
  line-height: 1;
}

.payment-hero .merchant-name {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

.payment-status-box {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #f8fafc;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.payment-status-box strong {
  font-size: 14px;
  font-weight: 700;
}

.payment-status-box p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
  line-height: 1.4;
}

.payment-status-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.payment-status-icon i {
  width: 18px;
  height: 18px;
}

/* — Account Cards — */
.payment-account-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--t-fast);
}

.payment-account-card:hover {
  border-color: rgba(225, 29, 72, 0.25);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.payment-account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #f8f9fb;
}

.payment-account-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 99px;
}

.payment-account-body {
  padding: 18px;
}

.payment-copy-field {
  margin-bottom: 12px;
}

.payment-copy-field label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
  display: block;
}

.payment-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f6fa;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  transition: var(--t-fast);
}

.payment-copy-row:hover {
  border-color: var(--accent);
  background: #fff;
}

.payment-copy-row .pcr-value {
  flex: 1;
  font-size: 14px;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
  line-height: 1.35;
  user-select: all;
}

.pcr-copy-btn {
  flex-shrink: 0;
  background: rgba(225, 29, 72, 0.07);
  color: var(--accent);
  border: none;
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--t-fast);
  font-family: inherit;
}

.pcr-copy-btn i {
  width: 13px;
  height: 13px;
}

.pcr-copy-btn:hover {
  background: var(--accent);
  color: #fff;
}

.pcr-copy-btn.copied {
  background: var(--success-bg);
  color: var(--success);
}

.payment-account-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.payment-account-actions {
  margin-top: 0;
}

/* =============================================
   DEBUG OUTPUT
   ============================================= */
.debug-output {
  margin-top: 16px;
  background: #0f172a;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* =============================================
   PRELOADER
   ============================================= */
#preloader {
  position: fixed;
  inset: 0;
  background: rgba(240, 242, 247, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}

#preloader.loaded {
  opacity: 0;
  visibility: hidden;
}

.loader-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent), #9f1239);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: pulseLoader 1.8s infinite var(--ease);
  box-shadow: 0 0 0 0 var(--accent-glow);
}

.loader-icon i {
  width: 36px;
  height: 36px;
}

@keyframes pulseLoader {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 20px rgba(225, 29, 72, 0);
    transform: scale(1.04);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
    transform: scale(1);
  }
}

/* =============================================
   INCOMING / APPROVED / WITHDRAWALS pages
   ============================================= */
.page-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-filters input,
.page-filters select {
  min-width: 0;
  flex: 1;
  max-width: 220px;
}

/* =============================================
   FOOTER
   ============================================= */
footer {
  margin-top: auto;
  padding: 32px 0 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-soft);
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* =============================================
   RESPONSIVE — TABLET (≤1140px)
   ============================================= */
@media (max-width: 1140px) {
  .content {
    padding: 24px 24px;
  }

  .stats-grid {
    gap: 16px;
  }
}

/* =============================================
   RESPONSIVE — MOBILE (≤1024px sidebar overlay)
   ============================================= */
@media (max-width: 1024px) {
  body {
    display: block;
  }

  .sidebar {
    width: min(290px, 88vw);
    height: 100dvh;
    margin: 0;
    padding: 24px 16px 24px;
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-110%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow-y: auto;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    z-index: 1200;
    transition: transform 0.36s var(--ease), opacity 0.36s var(--ease), visibility 0.36s;
  }

  .content {
    margin-left: 0;
    padding: 20px 16px;
    max-width: none;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(-110%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--t);
    z-index: 1100;
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 16px;
    transition: var(--t-fast);
  }

  .sidebar-close:hover {
    background: rgba(225, 29, 72, 0.2);
    color: #fff;
  }

  .logo {
    padding-right: 52px;
  }

  .settings-page-head,
  .approval-card-top {
    flex-direction: column;
  }

  .header-top {
    align-items: flex-start;
    padding: 12px 0 16px;
  }

  .header-left {
    min-width: 0;
  }

  .user-profile {
    flex-shrink: 0;
  }
}

/* =============================================
   RESPONSIVE — SMALL (≤760px)
   ============================================= */
@media (max-width: 760px) {
  .header-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
  }

  .user-profile {
    justify-content: flex-end;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel,
  .card,
  .auth-shell {
    padding: 16px;
  }

  .panel-grid,
  .form-grid,
  .form-grid.compact,
  .auth-setup-card,
  .settings-menu-grid,
  .settings-check-grid,
  .settings-copy-grid {
    grid-template-columns: 1fr;
  }

  .auth-qr-wrap {
    order: 2;
  }

  .data-table {
    min-width: 580px;
  }

  .btn {
    min-height: 42px;
    white-space: normal;
  }

  .payment-public {
    width: 100%;
  }
}

/* =============================================
   RESPONSIVE — XS (≤640px)
   ============================================= */
@media (max-width: 640px) {
  .content {
    padding: 12px;
  }

  header h1 {
    font-size: 22px;
  }

  header p,
  .section-title p,
  .muted {
    font-size: 13px;
  }

  .section-title h2,
  .auth-shell h1 {
    font-size: 20px;
  }

  .card-value {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .card-icon {
    width: 38px;
    height: 38px;
  }

  .panel {
    margin-bottom: 12px;
  }

  .header-left {
    gap: 10px;
  }

  #sidebar-toggle {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .user-profile {
    font-size: 13px;
  }

  .user-profile div {
    width: 36px;
    height: 36px;
  }

  .approval-gate {
    padding: 8px;
  }

  .approval-panel {
    max-height: calc(100dvh - 16px);
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .approval-head,
  .approval-steps {
    grid-template-columns: 1fr;
  }

  .approval-head {
    display: grid;
  }

  .settings-link-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .settings-link-card em {
    grid-column: 2;
  }

  .settings-link-icon {
    width: 38px;
    height: 38px;
  }

  .settings-link-icon i {
    width: 18px;
    height: 18px;
  }

  .payment-hero h1 {
    font-size: 30px;
  }
}

/* =============================================
   RESPONSIVE — XXS (≤420px)
   ============================================= */
@media (max-width: 420px) {
  .content {
    padding: 8px;
  }

  .panel,
  .card,
  .auth-shell,
  .approval-card {
    padding: 13px;
  }

  .header-left {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .user-profile {
    justify-content: space-between;
    width: 100%;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .copy-field-wrap,
  .payment-copy-row {
    flex-wrap: wrap;
  }

  .copy-trigger-btn,
  .pcr-copy-btn {
    width: 100%;
    justify-content: center;
  }
}

/* =============================================
   PREMIUM REFRESH OVERRIDES
   ============================================= */
.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%),
    linear-gradient(160deg, #111827 0%, #09090f 52%, #111111 100%);
  border-radius: 24px;
  padding: 22px 14px;
}

.logo {
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
}

.logo .logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fb7185, #e11d48);
  color: #fff;
  box-shadow: 0 12px 28px rgba(225, 29, 72, 0.32);
  flex-shrink: 0;
}

.logo .logo-mark i {
  color: currentColor;
}

.logo span:last-child {
  display: grid;
  min-width: 0;
}

.logo strong {
  font-size: 18px;
  color: #fff;
  line-height: 1.1;
}

.logo small {
  color: rgba(255, 255, 255, 0.48);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

.sidebar nav ul {
  gap: 7px;
}

.sidebar nav ul li a {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
}

.sidebar nav ul li.has-attention a {
  color: #fff;
  border-color: rgba(225, 29, 72, 0.24);
  background: rgba(225, 29, 72, 0.13);
  box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.08), 0 0 22px rgba(225, 29, 72, 0.18);
  animation: navAttention 1.6s ease-in-out infinite;
}

@keyframes navAttention {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.08), 0 0 14px rgba(225, 29, 72, 0.12);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.18), 0 0 28px rgba(225, 29, 72, 0.30);
  }
}

.nav-badge {
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  font-style: normal;
}

.sidebar nav ul li.active a,
.sidebar nav ul li a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sidebar nav ul li.active a::before {
  left: auto;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.sidebar-user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  min-width: 0;
}

.sidebar-user-mini > span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(225, 29, 72, 0.18);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-user-mini div {
  min-width: 0;
  display: grid;
}

.sidebar-user-mini strong {
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-mini small {
  color: rgba(255, 255, 255, 0.42);
  font-size: 11.5px;
  margin-top: 2px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.form-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #f8fafc;
}

.account-editor {
  gap: 18px;
}

.account-type-grid {
  grid-template-columns: minmax(180px, 240px) minmax(240px, 1fr);
}

.table-subtext {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.table-subtext.inline {
  display: inline;
  margin-left: 4px;
}

.mini-copy-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  max-width: 320px;
}

.mini-copy-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Consolas, monospace;
  font-size: 12.5px;
}

.table-copy-stack {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.copy-trigger-btn.compact {
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 11.5px;
}

.copy-trigger-btn.compact i {
  width: 12px;
  height: 12px;
}

.status-pill.neutral {
  background: #f1f5f9;
  color: #475569;
}

.single-toggle {
  width: fit-content;
}

.approval-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.approval-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--t-fast);
}

.approval-close:hover {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.approval-close i {
  width: 16px;
  height: 16px;
}

@media (max-width: 760px) {
  .account-type-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    border-radius: 0 24px 24px 0;
    padding: 24px 16px;
  }
}

/* =============================================
   BYPAY-STYLE DARK RED THEME OVERRIDES
   ============================================= */
body {
  background-color: #05070d;
}

.header-top {
  background: rgba(5, 7, 13, 0.84);
  background-image: radial-gradient(ellipse 70% 50% at 10% 0%, rgba(220, 38, 38, 0.10) 0%, transparent 62%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(220, 38, 38, 0.10), transparent 26%),
    linear-gradient(160deg, #070b13 0%, #05070d 54%, #02040a 100%);
  border-color: rgba(220, 38, 38, 0.22);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(220, 38, 38, 0.05);
}

.logo .logo-mark,
.user-profile div,
.loader-icon {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 14px 34px rgba(220, 38, 38, 0.34);
}

.sidebar nav ul li.active a,
.sidebar nav ul li a:hover {
  background: rgba(220, 38, 38, 0.13);
  border-color: rgba(220, 38, 38, 0.26);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 28px rgba(220, 38, 38, 0.10);
}

.sidebar nav ul li.active a::before {
  background: #dc2626;
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.85);
}

.sidebar-action:hover,
.sidebar nav ul li.has-attention a {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.30);
  color: #fecaca;
}

.content {
  max-width: 1480px;
}

.card,
.panel,
.settings-link-card,
.payment-account-card,
.approval-panel,
.auth-shell {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.98));
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: var(--shadow-sm);
}

.card::after {
  background: linear-gradient(90deg, #dc2626, #991b1b);
}

.card:hover,
.panel:hover,
.settings-link-card:hover,
.payment-account-card:hover {
  border-color: rgba(220, 38, 38, 0.32);
  box-shadow: var(--shadow-md), 0 0 34px rgba(220, 38, 38, 0.08);
}

input,
select,
textarea,
.copy-field-wrap,
.payment-copy-row,
.check-row,
.form-block,
.auth-steps span,
.auth-setup-card,
.approval-step,
.payment-status-box {
  background: rgba(5, 7, 13, 0.52);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus,
.payment-copy-row:hover {
  background: rgba(7, 11, 19, 0.88);
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.btn {
  background: rgba(15, 23, 42, 0.86);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text-main);
}

.btn.primary {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: rgba(220, 38, 38, 0.72);
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.28);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #b91c1c, #7f1d1d);
}

.data-table-wrap {
  background: rgba(15, 23, 42, 0.82);
}

.data-table thead,
.data-table tbody tr:hover,
.payment-account-header {
  background: rgba(5, 7, 13, 0.56);
}

.data-table td,
.data-table th {
  border-color: rgba(148, 163, 184, 0.14);
}

.status-pill,
.status-pill.neutral,
.payment-account-type-badge,
.nav-badge {
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.24);
}

.copy-box {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(17, 24, 39, 0.94));
  border-color: rgba(148, 163, 184, 0.18);
}

.auth-page .content,
.auth-page.payment-page .content {
  background:
    radial-gradient(ellipse 65% 44% at 50% 0%, rgba(220, 38, 38, 0.20), transparent 68%),
    linear-gradient(135deg, #05070d 0%, #070b13 52%, #05070d 100%);
}

.auth-shell {
  border-color: rgba(220, 38, 38, 0.18);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.approval-gate,
#preloader {
  background: rgba(5, 7, 13, 0.84);
}

.debug-output {
  background: #05070d;
  border-color: rgba(220, 38, 38, 0.18);
}

@keyframes navAttention {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.10), 0 0 14px rgba(220, 38, 38, 0.14);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.22), 0 0 30px rgba(220, 38, 38, 0.32);
  }
}

/* =============================================
   BYPAY PARTNER PANEL FULL SHELL
   ============================================= */
:root {
  --sidebar-width: 256px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
}

body {
  background:
    radial-gradient(ellipse 70% 42% at 24% -10%, rgba(220, 38, 38, 0.14), transparent 62%),
    linear-gradient(180deg, #070b13 0%, #05070d 100%);
}

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  margin: 0;
  padding: 0;
  border-radius: 0;
  border-width: 0 1px 0 0;
  background: rgba(5, 7, 13, 0.88);
  background-image:
    linear-gradient(180deg, rgba(220, 38, 38, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(5, 7, 13, 0.96));
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.sidebar::before {
  display: none;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

.logo {
  height: 60px;
  margin: 0;
  padding: 0 14px;
  gap: 10px;
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

.logo .logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.logo strong {
  font-size: 15px;
  letter-spacing: 0;
}

.logo small {
  font-size: 10px;
  letter-spacing: 0.12em;
}

.sidebar-close {
  top: 10px;
  right: 10px;
}

.sidebar nav {
  gap: 16px;
  padding: 16px 10px;
}

.nav-section {
  gap: 4px;
}

.nav-section-title {
  padding: 8px 10px 4px;
  color: rgba(148, 163, 184, 0.72);
  font-size: 10px;
  line-height: 1;
}

.sidebar nav ul {
  gap: 2px;
}

.sidebar nav ul li a {
  min-height: 36px;
  padding: 8px 10px;
  gap: 9px;
  border-radius: 8px;
  color: rgba(148, 163, 184, 0.86);
  font-size: 12px;
  font-weight: 600;
  border-left: 2px solid transparent;
}

.sidebar nav ul li a i {
  width: 16px;
  height: 16px;
}

.sidebar nav ul li.active a {
  background: rgba(220, 38, 38, 0.12);
  border-color: #dc2626;
  border-left-color: #dc2626;
  color: #fca5a5;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: none;
}

.sidebar nav ul li a:hover {
  background: rgba(220, 38, 38, 0.10);
  border-color: rgba(220, 38, 38, 0.26);
  color: #fff;
  box-shadow: none;
}

.sidebar nav ul li.active a::before {
  display: none;
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
}

.sidebar-footer {
  padding: 12px 10px 14px;
  border-top-color: rgba(148, 163, 184, 0.12);
}

.sidebar-user-mini {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.64);
}

.sidebar-user-mini > span {
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.sidebar-action {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.content {
  margin-left: var(--sidebar-width);
  max-width: none;
  padding: 0 20px 28px;
  animation-delay: 0s;
}

.header-top {
  min-height: 60px;
  margin: 0 -20px 22px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(5, 7, 13, 0.74);
  background-image: none;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.header-top::after {
  display: none;
}

.header-left {
  gap: 9px;
  min-width: 0;
  flex: 1;
}

#sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
}

header h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

header p {
  display: none;
}

.user-profile {
  gap: 8px;
  max-width: 58%;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.56);
  color: #e5e7eb;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.header-chip.muted-chip {
  color: #94a3b8;
  background: rgba(5, 7, 13, 0.42);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.header-action-btn,
.header-icon-btn,
.header-search,
.rate-chip {
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.76);
  color: #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.header-action-btn {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.header-action-btn:hover,
.header-icon-btn:hover,
.rate-chip:hover {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.11);
}

.header-icon-btn {
  width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-icon-btn i {
  width: 16px;
  height: 16px;
}

.theme-toggle {
  position: relative;
  cursor: pointer;
}

.theme-toggle [data-theme-icon="sun"] {
  display: none;
}

:is(html[data-theme="light"], body.theme-light) .theme-toggle [data-theme-icon="moon"] {
  display: none;
}

:is(html[data-theme="light"], body.theme-light) .theme-toggle [data-theme-icon="sun"] {
  display: block;
}

.alert-icon {
  color: #ef4444;
  background: transparent;
  border-color: transparent;
}

.header-search {
  width: min(140px, 11vw);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  color: #94a3b8;
  overflow: hidden;
}

.header-search i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.header-search span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-search kbd {
  display: none;
  margin-left: auto;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 5px;
  padding: 1px 5px;
  color: #94a3b8;
  font: 700 10px/1.4 'JetBrains Mono', Consolas, monospace;
}

.rate-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  text-decoration: none;
  white-space: nowrap;
}

.rate-chip span {
  color: #94a3b8;
  font-weight: 700;
}

.rate-chip strong {
  color: #f8fafc;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.header-actions > span:not(.header-icon-btn):not(.header-search),
.user-profile > span:not(.header-chip) {
  color: #cbd5e1;
  font-size: 12px;
  white-space: nowrap;
}

.header-actions div,
.user-profile div {
  width: 32px;
  height: 32px;
  font-size: 13px;
  border-radius: 999px;
  box-shadow: none;
}

.stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card {
  min-height: 132px;
  padding: 18px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.76);
  box-shadow: var(--shadow-xs);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card::after {
  opacity: 0;
}

.card:hover {
  transform: translateY(-2px);
}

.card-icon {
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 0;
  background: transparent !important;
  color: var(--text-muted) !important;
}

.card-icon i {
  width: 18px;
  height: 18px;
}

.card-title {
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.25;
}

.card-value {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.panel {
  padding: 0;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  overflow: hidden;
}

.section-title {
  margin: 0;
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.section-kicker {
  display: none;
}

.section-title h2 {
  font-size: 18px;
  font-weight: 700;
}

.section-title p {
  font-size: 13px;
}

.data-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.data-table {
  min-width: 760px;
}

.data-table thead {
  background: rgba(5, 7, 13, 0.42);
}

.data-table th {
  padding: 11px 18px;
  color: rgba(148, 163, 184, 0.84);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.data-table td {
  padding: 14px 18px;
  font-size: 13px;
}

.data-table tbody tr:hover {
  background: rgba(220, 38, 38, 0.06);
}

.btn {
  min-height: 36px;
  border-radius: 8px;
  font-size: 12px;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
}

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .header-search,
  .header-left .muted-chip {
    display: none;
  }

  .header-action-btn {
    padding: 0 8px;
    font-size: 11px;
  }
}

@media (max-width: 1180px) {
  .header-action-btn,
  .header-actions > span:not(.header-icon-btn):not(.header-search) {
    display: none;
  }
}

@media (max-width: 1080px) {
  .rate-chip span,
  .header-icon-btn[aria-label="Tema"],
  .header-icon-btn[aria-label="Dil"] {
    display: none;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: min(290px, 88vw);
    border-radius: 0;
    padding: 0;
  }

  .content {
    margin-left: 0;
    padding: 0 14px 24px;
  }

  .header-top {
    margin: 0 -14px 18px;
    padding: 0 14px;
  }
}

@media (max-width: 760px) {
  .header-top {
    min-height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .user-profile {
    max-width: none;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .header-top {
    align-items: center;
  }

  .header-left .header-chip {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions > span:not(.header-icon-btn):not(.header-search),
  .rate-chip span,
  .header-icon-btn[aria-label="Tema"],
  .header-icon-btn[aria-label="Dil"] {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    min-height: 118px;
  }
}

/* =============================================
   LIGHT THEME
   ============================================= */
:is(html[data-theme="light"], body.theme-light) {
  --bg: #eef2f7;
  --bg2: #f8fafc;
  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(148, 163, 184, 0.28);
  --card-bg: #ffffff;
  --panel-bg: #ffffff;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --accent-soft: rgba(220, 38, 38, 0.10);
  --accent-glow: rgba(220, 38, 38, 0.22);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --border: rgba(15, 23, 42, 0.12);
  --success-bg: rgba(220, 38, 38, 0.09);
  --success-border: rgba(220, 38, 38, 0.24);
  --danger-bg: rgba(220, 38, 38, 0.08);
  --info-bg: #fff7f7;
  --info-border: rgba(220, 38, 38, 0.20);
  --info-text: #991b1b;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 12px 30px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 20px 48px rgba(15, 23, 42, 0.10), 0 8px 20px rgba(15, 23, 42, 0.06);
}

:is(html[data-theme="light"], body.theme-light) body {
  background:
    radial-gradient(ellipse 70% 42% at 24% -10%, rgba(220, 38, 38, 0.10), transparent 62%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: var(--text-main);
}

:is(html[data-theme="light"], body.theme-light) .sidebar {
  background:
    linear-gradient(180deg, rgba(220, 38, 38, 0.06), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.22);
}

:is(html[data-theme="light"], body.theme-light) .logo,
:is(html[data-theme="light"], body.theme-light) .sidebar-footer,
:is(html[data-theme="light"], body.theme-light) .header-top,
:is(html[data-theme="light"], body.theme-light) .section-title,
:is(html[data-theme="light"], body.theme-light) .data-table td,
:is(html[data-theme="light"], body.theme-light) .data-table th {
  border-color: rgba(15, 23, 42, 0.10);
}

:is(html[data-theme="light"], body.theme-light) .logo strong,
:is(html[data-theme="light"], body.theme-light) header h1,
:is(html[data-theme="light"], body.theme-light) .card-title,
:is(html[data-theme="light"], body.theme-light) .section-title h2,
:is(html[data-theme="light"], body.theme-light) .data-table td,
:is(html[data-theme="light"], body.theme-light) .copy-field-text,
:is(html[data-theme="light"], body.theme-light) .payment-copy-row .pcr-value {
  color: #0f172a;
}

:is(html[data-theme="light"], body.theme-light) .logo small,
:is(html[data-theme="light"], body.theme-light) .nav-section-title,
:is(html[data-theme="light"], body.theme-light) .sidebar-user-mini small,
:is(html[data-theme="light"], body.theme-light) .card-icon,
:is(html[data-theme="light"], body.theme-light) .data-table th,
:is(html[data-theme="light"], body.theme-light) .table-subtext,
:is(html[data-theme="light"], body.theme-light) .section-title p {
  color: #64748b !important;
}

:is(html[data-theme="light"], body.theme-light) .sidebar nav ul li a,
:is(html[data-theme="light"], body.theme-light) .sidebar-action,
:is(html[data-theme="light"], body.theme-light) .sidebar-user-mini strong {
  color: #475569;
}

:is(html[data-theme="light"], body.theme-light) .sidebar nav ul li.active a {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.10);
}

:is(html[data-theme="light"], body.theme-light) .sidebar nav ul li a:hover,
:is(html[data-theme="light"], body.theme-light) .sidebar-action:hover {
  color: #991b1b;
  background: rgba(220, 38, 38, 0.08);
}

:is(html[data-theme="light"], body.theme-light) .header-top {
  background: rgba(248, 250, 252, 0.82);
}

:is(html[data-theme="light"], body.theme-light) .card,
:is(html[data-theme="light"], body.theme-light) .panel,
:is(html[data-theme="light"], body.theme-light) .settings-link-card,
:is(html[data-theme="light"], body.theme-light) .payment-account-card,
:is(html[data-theme="light"], body.theme-light) .approval-panel,
:is(html[data-theme="light"], body.theme-light) .auth-shell,
:is(html[data-theme="light"], body.theme-light) .header-action-btn,
:is(html[data-theme="light"], body.theme-light) .header-icon-btn,
:is(html[data-theme="light"], body.theme-light) .header-search,
:is(html[data-theme="light"], body.theme-light) .rate-chip,
:is(html[data-theme="light"], body.theme-light) .header-chip,
:is(html[data-theme="light"], body.theme-light) .sidebar-user-mini,
:is(html[data-theme="light"], body.theme-light) .copy-field-wrap,
:is(html[data-theme="light"], body.theme-light) .payment-copy-row,
:is(html[data-theme="light"], body.theme-light) .check-row,
:is(html[data-theme="light"], body.theme-light) .form-block,
:is(html[data-theme="light"], body.theme-light) input,
:is(html[data-theme="light"], body.theme-light) select,
:is(html[data-theme="light"], body.theme-light) textarea {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

:is(html[data-theme="light"], body.theme-light) .data-table thead,
:is(html[data-theme="light"], body.theme-light) .data-table tbody tr:hover,
:is(html[data-theme="light"], body.theme-light) .payment-account-header {
  background: rgba(241, 245, 249, 0.92);
}

:is(html[data-theme="light"], body.theme-light) .rate-chip span,
:is(html[data-theme="light"], body.theme-light) .header-search,
:is(html[data-theme="light"], body.theme-light) .header-search kbd,
:is(html[data-theme="light"], body.theme-light) .header-chip.muted-chip,
:is(html[data-theme="light"], body.theme-light) .header-actions > span:not(.header-icon-btn):not(.header-search) {
  color: #64748b;
}

:is(html[data-theme="light"], body.theme-light) .rate-chip strong {
  color: #0f172a;
}

:is(html[data-theme="light"], body.theme-light) .debug-output {
  background: #f8fafc;
  color: #334155;
  border-color: rgba(15, 23, 42, 0.12);
}

/* =============================================
   MOBILE FLUIDITY OVERRIDES
   ============================================= */
@media (max-width: 1024px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    width: min(320px, 86vw);
    max-width: 86vw;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 0 14px 14px 0;
  }

  .sidebar nav ul li a,
  .sidebar-action {
    min-height: 44px;
    font-size: 13px;
  }

  .sidebar-close {
    width: 42px;
    height: 42px;
  }

  .content {
    width: 100%;
    max-width: 100%;
    padding: 0 12px 22px;
  }

  .header-top {
    margin: 0 -12px 16px;
    padding: 8px 12px;
    gap: 8px;
  }

  .header-left,
  .header-actions {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .header-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    min-height: auto;
    position: sticky;
    top: 0;
  }

  .header-left {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }

  .header-left > div {
    min-width: 0;
  }

  #sidebar-toggle {
    width: 40px;
    height: 40px;
  }

  header h1 {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    line-height: 40px;
  }

  .header-left .header-chip,
  .header-search,
  .header-action-btn,
  .header-icon-btn[aria-label="Dil"],
  .header-actions > span:not(.header-icon-btn):not(.header-search) {
    display: none !important;
  }

  .header-actions {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-icon-btn,
  .header-icon-btn[aria-label="Tema"] {
    display: inline-flex !important;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .rate-chip {
    min-height: 38px;
    min-width: max-content;
    padding: 0 10px;
  }

  .rate-chip span {
    display: inline !important;
    font-size: 11px;
  }

  .rate-chip strong {
    font-size: 14px;
  }

  .header-actions div,
  .user-profile div {
    display: flex;
    width: 38px;
    min-width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.76);
    color: #fca5a5;
    border-radius: 999px;
    font-weight: 800;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card {
    min-height: 104px;
    padding: 14px;
  }

  .card-title {
    font-size: 12px;
  }

  .card-value {
    font-size: clamp(18px, 6vw, 22px);
  }

  .panel {
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .section-title {
    padding: 14px 14px 11px;
  }

  .section-title h2 {
    font-size: 16px;
  }

  .section-title p {
    font-size: 12.5px;
    line-height: 1.45;
  }

  .form-grid,
  .form-grid.compact,
  .panel-grid,
  .settings-menu-grid,
  .settings-check-grid,
  .settings-copy-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .btn {
    min-height: 42px;
    padding: 0 13px;
  }

  .settings-form > div:last-child .btn,
  .settings-form .btn[style] {
    width: 100%;
    max-width: none !important;
  }

  .inline-action-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .inline-action-stack form,
  .inline-action-stack .btn {
    width: 100%;
  }

  .data-table-wrap {
    margin: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    box-shadow: inset -20px 0 18px -24px rgba(248, 250, 252, 0.65);
  }

  .data-table {
    min-width: 700px;
  }

  .data-table th,
  .data-table td {
    padding: 11px 12px;
    font-size: 12.5px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: rgba(15, 23, 42, 0.96);
  }

  .data-table th:first-child {
    z-index: 2;
  }

  :is(html[data-theme="light"], body.theme-light) .data-table th:first-child,
  :is(html[data-theme="light"], body.theme-light) .data-table td:first-child {
    background: rgba(255, 255, 255, 0.96);
  }

  :is(html[data-theme="light"], body.theme-light) .header-actions div,
  :is(html[data-theme="light"], body.theme-light) .user-profile div {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 23, 42, 0.12);
    color: #b91c1c;
  }
}

@media (max-width: 420px) {
  .content {
    padding: 0 8px 18px;
  }

  .header-top {
    margin: 0 -8px 12px;
    padding: 7px 8px;
  }

  .stats-grid {
    gap: 8px;
  }

  .card {
    min-height: 96px;
    padding: 12px;
  }

  .panel,
  .card,
  .auth-shell,
  .approval-card {
    padding: 0;
  }

  .card {
    padding: 12px;
  }

  .section-title {
    padding: 13px 12px 10px;
  }

  .rate-chip span {
    display: none !important;
  }

  .data-table {
    min-width: 660px;
  }
}

@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =============================================
   MOBILE PAGE QA REPAIR
   ============================================= */
.panel > .settings-form,
.panel > form.settings-form,
.panel > .settings-copy-grid,
.panel > .settings-menu-grid,
.panel > .settings-check-grid {
  padding: 18px 22px 22px;
}

.settings-page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.settings-page-head .section-title {
  border-bottom: 0;
}

.settings-page-head > .btn {
  margin-right: 22px;
}

.settings-form label {
  min-width: 0;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
  display: block;
}

.copy-field-wrap {
  min-width: 0;
}

.copy-field-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-trigger-btn {
  min-height: 34px;
}

.debug-output .copy-field-wrap,
.copy-box .copy-field-wrap {
  align-items: stretch;
}

.debug-output .copy-trigger-btn,
.copy-box .copy-trigger-btn {
  justify-content: center;
}

@media (max-width: 760px) {
  .panel > .settings-form,
  .panel > form.settings-form,
  .panel > .settings-copy-grid,
  .panel > .settings-menu-grid,
  .panel > .settings-check-grid {
    padding: 14px;
  }

  .settings-page-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .settings-page-head > .btn {
    width: calc(100% - 28px);
    margin: 0 14px 14px;
  }

  .settings-form {
    gap: 14px;
  }

  .settings-form label {
    gap: 8px;
    line-height: 1.35;
  }

  .settings-form .form-grid {
    margin-bottom: 0;
  }

  .check-row {
    min-height: 72px;
    justify-content: flex-start;
    text-align: left;
  }

  .settings-check-grid .check-row {
    align-items: center;
  }

  .copy-box {
    padding: 14px;
  }

  .copy-field-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .copy-trigger-btn {
    width: 100%;
    min-height: 38px;
    justify-content: center;
  }

  .settings-link-card {
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
  }

  .settings-link-card em {
    grid-column: 2;
    justify-self: start;
  }

  .payment-account-card,
  .copy-box,
  .debug-output,
  .auth-setup-card {
    border-radius: 8px;
  }

  .settings-copy-grid .copy-box,
  .debug-output {
    background: rgba(15, 23, 42, 0.92);
  }

  .stats-grid .card-value span {
    display: inline-block;
    margin-left: 2px;
  }

  .data-table-wrap {
    max-width: 100%;
  }

  .data-table th,
  .data-table td {
    vertical-align: middle;
  }
}

@media (max-width: 520px) {
  .header-actions {
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-title {
    overflow-wrap: anywhere;
  }

  .card-value {
    line-height: 1.1;
  }

  .inline-action-stack {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-table {
    min-width: 620px;
  }

  .data-table td,
  .data-table th {
    padding: 10px;
  }

  .table-copy-stack {
    gap: 6px;
  }

  .table-copy-stack .copy-trigger-btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .panel > .settings-form,
  .panel > form.settings-form,
  .panel > .settings-copy-grid,
  .panel > .settings-menu-grid,
  .panel > .settings-check-grid {
    padding: 12px;
  }

  .settings-page-head > .btn {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
  }

  .settings-form input,
  .settings-form select,
  .settings-form textarea {
    padding: 12px;
  }

  .settings-check-grid .check-row {
    min-height: 64px;
  }

  .auth-page .content {
    padding: 16px;
  }

  .auth-shell {
    padding: 24px 20px !important;
    border-radius: 12px;
  }

  .auth-shell h1,
  .auth-shell p,
  .auth-form label {
    min-width: 0;
  }
}

:is(html[data-theme="light"], body.theme-light) .settings-copy-grid .copy-box,
:is(html[data-theme="light"], body.theme-light) .debug-output {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

:is(html[data-theme="light"], body.theme-light) .settings-copy-grid .copy-box strong,
:is(html[data-theme="light"], body.theme-light) .debug-output strong {
  color: #64748b;
}

:is(html[data-theme="light"], body.theme-light) .settings-copy-grid .copy-box small,
:is(html[data-theme="light"], body.theme-light) .debug-output small {
  color: #64748b;
}

.event-payload-cell {
  max-width: 320px;
  max-height: 116px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.38);
  color: var(--text-muted);
  font: 12px/1.45 Consolas, 'JetBrains Mono', monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

:is(html[data-theme="light"], body.theme-light) .event-payload-cell {
  background: rgba(248, 250, 252, 0.92);
  border-color: rgba(15, 23, 42, 0.10);
  color: #475569;
}

@media (max-width: 760px) {
  .event-payload-cell {
    max-width: 240px;
    max-height: 96px;
    font-size: 11.5px;
  }
}
