/* admin.css - Admin Dashboard Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================
   Reset & Base
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary:   #f0f4f8;
  --bg-secondary: #e8edf2;
  --bg-card:      #ffffff;
  --bg-sidebar:   #ffffff;
  --border:       #e2e8f0;
  --border-hover: #3b82f6;
  --accent:       #3b82f6;
  --accent-soft:  #eff6ff;
  --accent2:      #2563eb;
  --green:        #10b981;
  --green-soft:   #ecfdf5;
  --red:          #ef4444;
  --orange:       #f97316;
  --orange-soft:  #fff7ed;
  --yellow:       #f59e0b;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted:   #64748b;
  --sidebar-w:    230px;
  --radius:       10px;
}

html, body {
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ============================
   LOGIN OVERLAY
   ============================ */
.admin-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #0c2340 100%);
  overflow: hidden;
}

/* Animated gradient blobs */
.login-bg { position: absolute; inset: 0; pointer-events: none; }

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: blobFloat 8s ease-in-out infinite;
}
.login-blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #3b82f6, #1d4ed8);
  top: -120px; left: -100px;
  animation-delay: 0s;
}
.login-blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #10b981, #059669);
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}
.login-blob-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #f97316, #ea580c);
  top: 50%; right: 15%;
  transform: translateY(-50%);
  animation-delay: -5s;
}

@keyframes blobFloat {
  0%, 100% { transform: scale(1) translate(0, 0); }
  33%       { transform: scale(1.08) translate(20px, -20px); }
  66%       { transform: scale(0.95) translate(-15px, 15px); }
}

/* Login card */
.admin-login-box {
  position: relative;
  z-index: 1;
  width: 420px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 40px 36px 32px;
  box-shadow:
    0 32px 64px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.05) inset;
  animation: loginCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brand row */
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}

.login-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.login-brand-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-top: 1px;
}

/* Divider */
.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  margin-bottom: 28px;
}

/* Title */
.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.login-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 28px;
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s;
}

.login-input {
  width: 100%;
  height: 48px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 0 16px 0 44px;
  font-size: 14px;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.2s ease;
}

.login-input::placeholder { color: rgba(255,255,255,0.28); }

.login-input:focus {
  border-color: rgba(59,130,246,0.7);
  background: rgba(59,130,246,0.1);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}

.login-input:focus + .login-input-icon,
.login-input-wrap:focus-within .login-input-icon {
  color: #60a5fa;
}

/* Error message */
.login-error {
  font-size: 12.5px;
  color: #fca5a5;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.25s ease;
}
.login-error:not(:empty) {
  padding: 10px 14px;
  max-height: 60px;
}

/* Submit button */
.login-btn {
  width: 100%;
  height: 50px;
  margin-top: 4px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(59,130,246,0.5);
}
.login-btn:hover::before { opacity: 1; }
.login-btn:active { transform: translateY(0); box-shadow: 0 2px 12px rgba(59,130,246,0.3); }

/* Footer tip */
.login-footer-tip {
  text-align: center;
  font-size: 11.5px;
  color: rgba(255,255,255,0.3);
  margin-top: 20px;
}


/* ============================
   Layout
   ============================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ============================
   Sidebar
   ============================ */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

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

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item svg { flex-shrink: 0; color: var(--text-muted); transition: color .15s; }

.nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item:hover svg { color: var(--accent); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

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

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 7px;
  transition: all .15s;
}

.back-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ============================
   Main Content
   ============================ */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.admin-topbar {
  height: 54px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.topbar-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-secondary);
  padding: 3px 10px;
  border-radius: 20px;
}

.admin-content {
  flex: 1;
  padding: 24px 28px;
  max-width: 1200px;
  width: 100%;
}

/* ============================
   Section
   ============================ */
.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ============================
   Stats Cards
   ============================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .2s;
  border-left: 4px solid transparent;
}

.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); }

.stat-card.purple { border-left-color: var(--accent); }
.stat-card.green  { border-left-color: var(--green); }
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.pink   { border-left-color: #f43f5e; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-card.purple .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-card.green .stat-icon  { background: var(--green-soft);  color: var(--green); }
.stat-card.orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.stat-card.pink .stat-icon   { background: #fff1f2; color: #f43f5e; }

.stat-icon svg { display: block; }

.stat-body { min-width: 0; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ============================
   Chart Section
   ============================ */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-area {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding-top: 16px;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: height .6s cubic-bezier(.4,0,.2,1), opacity .2s;
  cursor: pointer;
  position: relative;
  min-height: 4px;
}

.chart-bar:hover { opacity: .8; }

.chart-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.chart-bar-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Tooltip */
.chart-bar[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.chart-bar:hover::after { opacity: 1; }

/* ============================
   Frame Table
   ============================ */
.frame-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header-bar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

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

table.data-table thead tr {
  background: var(--bg-secondary);
}

table.data-table th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
  font-size: 13px;
}

table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--bg-secondary); }

.frame-preview-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.badge-cat {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.count-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--accent);
  transition: width .5s ease;
  min-width: 2px;
}

/* ============================
   Frames Management
   ============================ */
.frames-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.frame-manage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color .2s, box-shadow .2s;
}

.frame-manage-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 12px rgba(59,130,246,.08);
}
.frame-manage-card.hidden-frame { opacity: .45; }

.frame-manage-preview {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.frame-manage-info {
  flex: 1;
  min-width: 0;
}

.frame-manage-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.frame-manage-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-manage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ============================
   Toggle Switch
   ============================ */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-track {
  width: 34px; height: 19px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 13px; height: 13px;
  top: 3px; left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}

.toggle input:checked ~ .toggle-track {
  background: var(--green);
}
.toggle input:checked ~ .toggle-track::after {
  transform: translateX(15px);
}

.toggle-label { font-size: 12px; color: var(--text-muted); }

/* ============================
   Forms
   ============================ */
.form-section {
  max-width: 680px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .2s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-group input[type="color"] {
  width: 48px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  padding: 2px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-row .form-group { flex: 1; }

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

/* ============================
   Buttons
   ============================ */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  font-family: inherit;
}

.btn-admin.primary {
  background: var(--accent);
  color: #fff;
}
.btn-admin.primary:hover { background: #4f46e5; transform: translateY(-1px); }

.btn-admin.secondary {
  background: rgba(255,255,255,.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-admin.secondary:hover { background: rgba(255,255,255,.1); color: var(--text-primary); }

.btn-admin.danger {
  background: rgba(244,63,94,.12);
  color: #f43f5e;
  border: 1px solid rgba(244,63,94,.25);
}
.btn-admin.danger:hover { background: rgba(244,63,94,.22); }

.btn-admin.success {
  background: rgba(16,217,168,.12);
  color: #10d9a8;
  border: 1px solid rgba(16,217,168,.25);
}
.btn-admin.success:hover { background: rgba(16,217,168,.22); }

.btn-admin.sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ============================
   Form Card
   ============================ */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
}

.form-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================
   Step editor
   ============================ */
.step-editor {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.step-num-badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(99,102,241,.3);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 8px;
}

/* ============================
   Toast
   ============================ */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(18,21,31,.95);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 9999;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.admin-toast.show { transform: translateX(-50%) translateY(0); }
.admin-toast.success { border-color: rgba(16,217,168,.4); color: #10d9a8; }
.admin-toast.error   { border-color: rgba(244,63,94,.4);  color: #f43f5e; }

/* ============================
   Edit modal (inline)
   ============================ */
.inline-edit {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  gap: 8px;
  flex-direction: column;
}
.inline-edit.open { display: flex; }

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

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============================
   Divider
   ============================ */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ============================
   Logo preview
   ============================ */
.logo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 16px;
}

.logo-preview-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.logo-preview-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 640px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 16px; }
}

/* ============================
   Modal Overlay
   ============================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,.06);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: all .15s;
}

.modal-close:hover {
  background: rgba(244,63,94,.15);
  color: var(--red);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================
   Image Upload Zone
   ============================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  background: rgba(99,102,241,.03);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-zone-icon {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.upload-zone-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-zone-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Upload with preview */
.upload-preview-wrap {
  position: relative;
}

.upload-preview-img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #1a1f2e;
}

.upload-preview-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(244,63,94,.85);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all .15s;
}

.upload-preview-remove:hover { background: var(--red); transform: scale(1.1); }

/* Frame canvas preview in modal */
.frame-modal-preview {
  width: 120px; height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1f2e;
  border: 1px solid var(--border);
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Logo upload section */
.logo-upload-current {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.logo-upload-img {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.logo-upload-info {
  flex: 1;
  min-width: 0;
}

.logo-upload-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-upload-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* Built-in frame badge */
.badge-builtin {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16,217,168,.12);
  color: #10d9a8;
  font-weight: 600;
  border: 1px solid rgba(16,217,168,.2);
}

.badge-custom {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99,102,241,.12);
  color: #a5b4fc;
  font-weight: 600;
  border: 1px solid rgba(99,102,241,.2);
}

/* Image has override indicator */
.badge-img {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(251,146,60,.12);
  color: #fb923c;
  font-weight: 600;
  border: 1px solid rgba(251,146,60,.2);
}

