/* ==========================================================================
   Pintoo Admin — Premium Dark Theme (Obsidian & Loki Green)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Backgrounds */
  --bg-primary:    #000000;
  --bg-secondary:  #060606;
  --bg-tertiary:   #0d0d0d;

  /* Glass / Cards */
  --surface-glass:    rgba(255, 255, 255, 0.03);
  --card-bg:          rgba(255, 255, 255, 0.03);
  --card-border:      rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(74, 222, 128, 0.45);

  /* Loki Green */
  --green-primary:      #4ADE80;
  --green-secondary:    #22c55e;
  --green-dim:          rgba(74, 222, 128, 0.70);
  --green-glow:         rgba(74, 222, 128, 0.15);
  --green-glow-strong:  rgba(74, 222, 128, 0.35);
  --green-ultra:        rgba(74, 222, 128, 0.05);

  /* Neutrals */
  --white:        #FFFFFF;
  --white-dim:    rgba(255, 255, 255, 0.65);
  --white-glow:   rgba(255, 255, 255, 0.10);
  --gray-light:   #D4D4D4;
  --gray-mid:     #777777;
  --gray-dark:    #1a1a1a;
  --gray-darker:  #111111;

  /* Text */
  --text-primary:   #FFFFFF;
  --text-secondary: #B0B0B0;
  --text-muted:     #555555;
  --text-inverted:  #000000;

  /* Status */
  --color-error:   #ef4444;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-info:    #3b82f6;

  /* Typography */
  --font-sans:    'Inter', system-ui, sans-serif;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono:    'Fira Code', 'Cascadia Code', monospace;

  /* Layout */
  --sidebar-width:  268px;
  --header-height:  66px;

  /* Border Radii */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-pill: 999px;

  /* Transitions */
  --transition:      0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
  --transition-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: rgba(255,255,255,0.10); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: rgba(74,222,128,0.35); }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.025em;
  line-height: 1.2;
}
p   { color: var(--text-secondary); }
a   { text-decoration: none; color: inherit; transition: var(--transition-fast); }
ul  { list-style: none; }
img { display: block; max-width: 100%; }
.mono { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Keyframe Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn   { from { opacity: 0; }                      to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn  { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes shimmer  { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes glow-pulse { 0%,100% { box-shadow: 0 0 12px rgba(74,222,128,0.25); } 50% { box-shadow: 0 0 28px rgba(74,222,128,0.55); } }
@keyframes pulse-dot  { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.6; } }
@keyframes orb-float  { 0% { transform: translate(0,0) scale(1); } 33% { transform: translate(30px,-25px) scale(1.08); } 66% { transform: translate(-20px,15px) scale(0.95); } 100% { transform: translate(0,0) scale(1); } }
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes progress-bar { from { width: 0%; } to { width: 100%; } }
@keyframes modal-in  { from { opacity: 0; transform: scale(0.94) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* --------------------------------------------------------------------------
   Login Screen
   -------------------------------------------------------------------------- */
.login-page-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background: radial-gradient(ellipse 90% 80% at 50% 0%, #070f09 0%, #000000 65%);
}

/* Decorative floating orbs */
.login-page-wrapper::before,
.login-page-wrapper::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}
.login-page-wrapper::before {
  width: 520px; height: 520px;
  top: -120px; left: -80px;
  background: radial-gradient(circle, rgba(74,222,128,0.08) 0%, transparent 70%);
  animation: orb-float 14s ease-in-out infinite;
}
.login-page-wrapper::after {
  width: 400px; height: 400px;
  bottom: -80px; right: -60px;
  background: radial-gradient(circle, rgba(74,222,128,0.05) 0%, transparent 70%);
  animation: orb-float 20s ease-in-out infinite reverse;
}

/* Grid overlay */
.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(74,222,128,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,222,128,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
  z-index: 0;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  animation: slideUp 0.55s cubic-bezier(0.4,0,0.2,1) both;
}

/* Logo icon above card */
.login-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--green-glow);
  border: 1px solid rgba(74,222,128,0.25);
  font-size: 1.5rem;
  margin: 0 auto 20px;
}

.login-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(74,222,128,0.06) inset,
    0 24px 64px rgba(0,0,0,0.75),
    0 0 40px rgba(74,222,128,0.04);
}

.login-header { margin-bottom: 32px; text-align: center; }

.login-title {
  font-size: 1.9rem;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #FFFFFF 25%, var(--green-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Advanced / API URL toggle link */
.adv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  transition: color var(--transition-fast);
  user-select: none;
}
.adv-toggle:hover { color: var(--green-primary); }
.adv-panel { margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Form Controls
   -------------------------------------------------------------------------- */
.form-group { margin-bottom: 20px; text-align: left; }

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--white-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-control {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  border-color: var(--green-primary);
  background: rgba(74,222,128,0.025);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.10), 0 0 16px rgba(74,222,128,0.08);
}
textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* Custom Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.checkbox-input {
  appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  outline: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.checkbox-input:checked {
  background: var(--green-primary);
  border-color: var(--green-primary);
}
.checkbox-input:checked::before {
  content: '';
  width: 8px; height: 8px;
  background: #000;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast);
  gap: 8px;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Shimmer overlay for btn-primary */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.55s ease;
}
.btn-primary:hover::after { left: 130%; }

.btn-primary {
  background: linear-gradient(135deg, #4ADE80 0%, #22c55e 100%);
  color: #000;
  box-shadow: 0 4px 16px rgba(74,222,128,0.30);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(74,222,128,0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.10);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.2);
}

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--color-error);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.22);
  box-shadow: 0 4px 14px rgba(239,68,68,0.25);
  transform: translateY(-1px);
}

.btn-sm { padding: 6px 13px; font-size: 0.78rem; border-radius: 6px; }
.btn-xs { padding: 4px 10px; font-size: 0.72rem; border-radius: 5px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* --------------------------------------------------------------------------
   Dashboard Shell Layout
   -------------------------------------------------------------------------- */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: width var(--transition);
}

/* Sidebar brand */
.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--card-border);
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 32px; height: 32px;
  background: var(--green-glow);
  border: 1px solid rgba(74,222,128,0.20);
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand-dot { color: var(--green-primary); }

.sidebar-version {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: auto;
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.04);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

/* Sidebar navigation */
.sidebar-menu {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.sidebar-item {
  list-style: none;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}

.sidebar-item a:hover {
  background: rgba(255,255,255,0.04);
  color: var(--white);
}

.sidebar-item.active a {
  background: var(--green-ultra);
  color: var(--green-primary);
  position: relative;
}

.sidebar-item.active a::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--green-primary);
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  box-shadow: 0 0 8px rgba(74,222,128,0.5);
}

.nav-icon {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  border-radius: 7px;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.sidebar-item.active .nav-icon {
  background: rgba(74,222,128,0.12);
}

/* Sidebar Footer / User info */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4ADE80 0%, #16a34a 100%);
  color: #000;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}
.username {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

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

/* ── Header ── */
.dashboard-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--card-border);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-breadcrumb {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(74,222,128,0.06);
  border: 1px solid rgba(74,222,128,0.15);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.75rem;
  color: var(--green-primary);
  font-family: var(--font-mono);
}

.status-dot {
  width: 6px; height: 6px;
  background: var(--green-primary);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green-primary);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.header-clock {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Page body ── */
.page-body {
  padding: 36px 40px;
  flex-grow: 1;
  max-width: 1440px;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Stats Grid
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green-primary), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: rgba(74,222,128,0.25);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(74,222,128,0.06);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--green-ultra);
  border: 1px solid rgba(74,222,128,0.12);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--white);
  font-family: var(--font-display);
  line-height: 1;
}

.stat-footer {
  font-size: 0.75rem;
  color: var(--green-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --------------------------------------------------------------------------
   Panel / Data Tables
   -------------------------------------------------------------------------- */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.01);
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

.table-responsive { width: 100%; overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  background: rgba(255,255,255,0.015);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td {
  background: rgba(255,255,255,0.012);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-success { background: rgba(34,197,94,0.10);  color: var(--green-primary);  border: 1px solid rgba(34,197,94,0.18); }
.badge-warning { background: rgba(245,158,11,0.10); color: var(--color-warning);  border: 1px solid rgba(245,158,11,0.18); }
.badge-danger  { background: rgba(239,68,68,0.10);  color: var(--color-error);    border: 1px solid rgba(239,68,68,0.18); }
.badge-info    { background: rgba(59,130,246,0.10); color: var(--color-info);     border: 1px solid rgba(59,130,246,0.18); }
.badge-default { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid rgba(255,255,255,0.10); }

.action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Empty & Loading States
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 40px;
  gap: 12px;
  text-align: center;
}
.empty-icon  { font-size: 2.5rem; opacity: 0.35; }
.empty-title { font-size: 1.1rem; color: var(--white-dim); }
.empty-desc  { font-size: 0.85rem; color: var(--text-muted); }

.loading-state {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 24px;
}
.skeleton {
  height: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-xs);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-wide  { width: 70%; }
.skeleton-short { width: 40%; }

/* --------------------------------------------------------------------------
   Modal Overlays
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease both;
}

.modal-content {
  background: #080808;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(74,222,128,0.04) inset, 0 32px 80px rgba(0,0,0,0.95);
  animation: modal-in 0.28s cubic-bezier(0.4,0,0.2,1) both;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
  min-height: 0;
}

.modal-header {
  padding: 18px 26px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 { font-size: 1.05rem; }

.modal-body {
  padding: 26px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 14px 26px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(255,255,255,0.01);
  flex-shrink: 0;
}

.close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.close-modal:hover {
  color: var(--white);
  transform: rotate(90deg);
  background: rgba(255, 255, 255, 0.05);
}

/* --------------------------------------------------------------------------
   Markdown Editor & Preview
   -------------------------------------------------------------------------- */
.editor-layout {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
  margin-top: 8px;
}

.editor-toolbar {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--card-border);
  padding: 8px 14px;
  display: flex;
  gap: 8px;
}

.editor-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.editor-tab.active { background: rgba(74,222,128,0.10); color: var(--green-primary); }

.editor-textarea {
  border: none;
  background: transparent;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 16px;
  min-height: 340px;
  width: 100%;
  outline: none;
  resize: vertical;
  line-height: 1.7;
}

.preview-container {
  padding: 22px;
  min-height: 340px;
  background: rgba(255,255,255,0.01);
  overflow-y: auto;
  line-height: 1.7;
}
.preview-container h1,.preview-container h2,.preview-container h3 { margin: 16px 0 10px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.07); padding-bottom: 6px; }
.preview-container h1 { font-size: 1.5rem; }
.preview-container h2 { font-size: 1.25rem; }
.preview-container h3 { font-size: 1.05rem; }
.preview-container p  { margin-bottom: 12px; font-size: 0.9rem; }
.preview-container code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.82rem; }
.preview-container pre { background: #050505; border: 1px solid rgba(255,255,255,0.04); padding: 14px; border-radius: var(--radius-sm); margin-bottom: 14px; overflow-x: auto; }
.preview-container pre code { background: transparent; padding: 0; }
.preview-container ul,.preview-container ol { margin-left: 20px; margin-bottom: 12px; }
.preview-container li  { margin-bottom: 4px; }
.preview-container blockquote { border-left: 3px solid var(--green-primary); background: rgba(74,222,128,0.02); padding: 10px 18px; margin-bottom: 14px; border-radius: 0 4px 4px 0; }

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #101010;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  color: var(--white);
  padding: 14px 20px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  animation: slideIn 0.3s cubic-bezier(0.4,0,0.2,1) both;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--green-primary);
  animation: progress-bar 3s linear forwards;
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Welcome card on dashboard
   -------------------------------------------------------------------------- */
.welcome-card {
  background: linear-gradient(135deg, rgba(74,222,128,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(74,222,128,0.12);
  border-radius: var(--radius-md);
  padding: 24px 30px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.welcome-text h3 { font-size: 1.15rem; margin-bottom: 4px; }
.welcome-text p  { font-size: 0.85rem; max-width: 540px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.active { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.8); }
  .main-content { margin-left: 0; }
  .dashboard-header { padding: 0 20px; }
  .page-body { padding: 20px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal-content { max-height: 95vh; }
}

/* ── Admin Footer ── */
.admin-footer {
  border-top: 1px solid var(--card-border);
  padding: 24px 40px;
  background: rgba(0, 0, 0, 0.2);
  margin-top: auto;
}

.admin-footer .footer-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1440px;
  width: 100%;
}

@media (min-width: 768px) {
  .admin-footer .footer-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.admin-footer .bottom-left,
.admin-footer .bottom-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
}

.admin-footer .footer-copy {
  color: var(--text-muted);
  letter-spacing: 0.5px;
  font-weight: 500;
}

.admin-footer .version-label {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.admin-footer .footer-tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.admin-footer .tech-badge-ico {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-footer .tech-badge-sep {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.85rem;
  margin: 0 2px;
}

/* Hover interactions */
.admin-footer .flutter-badge:hover {
  background: rgba(1, 117, 194, 0.08);
  border-color: rgba(1, 117, 194, 0.3);
  color: #4fc3f7;
  box-shadow: 0 0 10px rgba(1, 117, 194, 0.15);
}

.admin-footer .flutter-badge:hover .tech-badge-ico {
  transform: translateY(-1px) scale(1.05);
}

.admin-footer .jaspr-badge:hover {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--green-primary);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.15);
}

.admin-footer .jaspr-badge:hover .tech-badge-ico {
  transform: translateY(-1px) scale(1.05);
}

/* ==========================================================================
   Media Manager & Cloudflare R2 Uploads
   ========================================================================== */
.media-page-wrapper {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Dropzone Panel Card */
.dropzone-card {
  border: 2px dashed rgba(255, 255, 255, 0.08);
  background: var(--card-bg);
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  padding: 40px 24px;
}

.dropzone-card.dragover {
  border-color: var(--green-primary);
  background: rgba(74, 222, 128, 0.03);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.06);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.dropzone-icon {
  font-size: 2.8rem;
  line-height: 1;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.dropzone-card:hover .dropzone-icon {
  transform: scale(1.1);
  color: var(--green-primary);
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
}

.dropzone-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-upload-browse {
  margin-top: 6px;
  padding: 8px 20px;
}

/* Gallery Header */
.media-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
  margin-top: 10px;
}

.gallery-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
}

/* Loading state */
.media-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 16px;
  color: var(--text-muted);
}

.media-loading-container .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--green-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State Card */
.empty-gallery-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
}

.empty-icon {
  font-size: 3rem;
  line-height: 1;
  opacity: 0.35;
}

.empty-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--white);
}

.empty-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 380px;
}

/* Cinematic Gallery Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.media-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.media-card:hover {
  transform: translateY(-4px);
  border-color: rgba(74, 222, 128, 0.25);
  box-shadow: 0 12px 30px rgba(74, 222, 128, 0.08);
}

.media-preview {
  height: 170px;
  background: #090909;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.media-card:hover .preview-image {
  transform: scale(1.03);
}

.preview-fallback-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.doc-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.doc-ext {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  color: var(--white);
  letter-spacing: 0.05em;
}

.media-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.media-filename {
  font-size: 0.82rem;
  color: var(--white);
  font-weight: 600;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  height: 2.8em;
}

.media-metadata {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: auto;
}

.media-meta-divider {
  opacity: 0.25;
}

.media-actions {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.005);
}

.btn-action-copy {
  flex-grow: 2;
}

.btn-action-delete {
  flex-grow: 1;
}

/* ── AI Visitor Chat Logs Styles ───────────────────────────────────────── */
.ai-logs-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-bar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
}

.search-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--white);
  font-size: 0.85rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--green-primary);
}

.logs-count-pill {
  font-size: 0.78rem;
  color: var(--green-primary);
  background: rgba(74, 222, 128, 0.1);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.25);
  white-space: nowrap;
}

.ai-logs-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-log-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color var(--transition-fast);
}

.ai-log-card:hover {
  border-color: rgba(74, 222, 128, 0.3);
}

.log-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

.meta-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-pill {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.model-badge {
  color: var(--green-primary);
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.08);
}

.log-delete-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.log-delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
}

.log-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-query-wrap, .log-response-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-role-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.user-tag {
  color: rgba(255, 255, 255, 0.6);
}

.ai-tag {
  color: var(--green-primary);
}

.log-text-query {
  font-size: 0.88rem;
  color: var(--white);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.log-text-response {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(74, 222, 128, 0.04);
  border: 1px solid rgba(74, 222, 128, 0.15);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
  white-space: pre-wrap;
}



