/* ==========================================================================
   arabinst-IG — Apple HIG Design System for the Web
   Fluid motion · Vibrancy materials · Optical typography · Spatial depth
   ========================================================================== */

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

:root {
  /* ── System Backgrounds (layered vibrancy) ── */
  --sys-bg:           #08080a;
  --sys-bg-elevated:  #0e0e10;
  --sys-card-bg:      rgba(26, 26, 28, 0.62);
  --sys-card-hover:   rgba(38, 38, 42, 0.72);
  --sys-sidebar-bg:   rgba(16, 16, 18, 0.78);
  --sys-overlay:      rgba(0, 0, 0, 0.55);

  /* ── Separator & Border (spatial hierarchy) ── */
  --sep-opaque:       rgba(255, 255, 255, 0.06);
  --sep-translucent:  rgba(255, 255, 255, 0.10);
  --sep-hover:        rgba(255, 255, 255, 0.17);

  /* Legacy aliases */
  --system-bg: var(--sys-bg);
  --system-card-bg: var(--sys-card-bg);
  --system-card-hover: var(--sys-card-hover);
  --system-sidebar-bg: var(--sys-sidebar-bg);
  --system-border: var(--sep-opaque);
  --system-border-hover: var(--sep-hover);

  /* ── Label hierarchy (optical legibility) ── */
  --label-primary:    rgba(255, 255, 255, 1.00);
  --label-secondary:  rgba(255, 255, 255, 0.60);
  --label-tertiary:   rgba(255, 255, 255, 0.36);
  --label-quaternary: rgba(255, 255, 255, 0.18);

  /* ── Apple System Colors (dark mode calibrated) ── */
  --apple-blue:    #0a84ff;
  --apple-green:   #30d158;
  --apple-orange:  #ff9f0a;
  --apple-red:     #ff453a;
  --apple-pink:    #ff375f;
  --apple-purple:  #bf5af2;
  --apple-cyan:    #64d2ff;
  --apple-indigo:  #5e5ce6;
  --apple-teal:    #40c8e0;
  --apple-yellow:  #ffd60a;

  /* ── Instagram brand gradient ── */
  --ig-gradient:      linear-gradient(135deg, #ff375f 0%, #bf5af2 50%, #ff9f0a 100%);
  --ig-gradient-text: linear-gradient(135deg, #ff375f 0%, #bf5af2 100%);
  --ig-glow:          0 0 40px rgba(191, 90, 242, 0.18), 0 0 80px rgba(255, 55, 95, 0.08);

  /* ── Typography (optical scale) ── */
  --font-arabic: 'Cairo', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-latin:  'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  --font-stack:  var(--font-arabic);

  /* Optical type scale (modular ratio 1.25) */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */

  /* Tracking & leading */
  --tracking-tight:  -0.025em;
  --tracking-snug:   -0.015em;
  --tracking-normal:  0em;
  --tracking-wide:    0.025em;
  --tracking-caps:    0.06em;
  --leading-tight:   1.2;
  --leading-snug:    1.4;
  --leading-normal:  1.6;
  --leading-relaxed: 1.8;

  /* ── Spatial Rhythm ── */
  --space-1:  0.25rem;   /*  4px */
  --space-2:  0.5rem;    /*  8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */

  /* ── Corner radii (squircle progression) ── */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* ── Layout ── */
  --sidebar-width: 270px;
  --header-height: 72px;

  /* ── Vibrancy Materials (backdrop-filter presets) ── */
  --material-thin:     blur(20px) saturate(180%);
  --material-regular:  blur(36px) saturate(220%);
  --material-thick:    blur(50px) saturate(260%);
  --material-chrome:   blur(60px) saturate(300%) brightness(0.92);

  /* ── Layered Shadows (depth system) ── */
  --shadow-near:  0 1px 3px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
  --shadow-mid:   0 6px 20px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
  --shadow-far:   0 20px 50px rgba(0,0,0,0.6), 0 8px 20px rgba(0,0,0,0.35);
  --shadow-float: 0 32px 80px rgba(0,0,0,0.75), 0 12px 30px rgba(0,0,0,0.4);

  /* Legacy aliases */
  --shadow-sm: var(--shadow-near);
  --shadow-md: var(--shadow-mid);
  --shadow-lg: var(--shadow-far);
  --shadow-glow: 0 0 35px rgba(191, 90, 242, 0.2);

  /* ── Spring Motion Curves ── */
  /* Critical: Apple uses overdamped springs, not CSS easing */
  /* These bezier curves approximate spring physics */
  --spring-gentle:   cubic-bezier(0.16, 1, 0.3, 1);      /* Default, slow settle */
  --spring-snappy:   cubic-bezier(0.34, 1.56, 0.64, 1);  /* Bouncy overshoot */
  --spring-bouncy:   cubic-bezier(0.25, 1.6, 0.5, 1);    /* Max bounce */
  --spring-stiff:    cubic-bezier(0.2, 0, 0, 1);         /* Fast, no overshoot */
  --spring-smooth:   cubic-bezier(0.45, 0, 0.55, 1);     /* Symmetric S-curve */

  --apple-ease: var(--spring-gentle);

  /* Durations */
  --dur-instant:   80ms;
  --dur-fast:      180ms;
  --dur-normal:    340ms;
  --dur-slow:      500ms;
  --dur-deliberate: 700ms;

  /* Transitions */
  --transition-quick:  all var(--dur-fast) var(--spring-gentle);
  --transition-fluid:  all var(--dur-normal) var(--spring-gentle);
  --transition-spring: all var(--dur-slow) var(--spring-snappy);
}

/* ==========================================================================
   1. Base & Reset — Optical rendering, reduced-motion, spatial foundation
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

body {
  font-family: var(--font-stack);
  background-color: var(--sys-bg);
  color: var(--label-primary);
  min-height: 100vh;
  overflow-x: hidden;
  direction: rtl;
  line-height: var(--leading-normal);
}

/* Reduced motion — respects user OS preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Ambient depth orbs — parallax-interactive */
.orb-parallax {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  transition: transform 0ms linear; /* JS-driven */
}

.orb-1 {
  top: -18%;
  right: -8%;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle at center, rgba(191, 90, 242, 0.09) 0%, rgba(191, 90, 242, 0.03) 45%, transparent 70%);
  filter: blur(1px);
}

.orb-2 {
  bottom: -18%;
  left: -8%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle at center, rgba(255, 55, 95, 0.07) 0%, rgba(255, 55, 95, 0.02) 45%, transparent 70%);
  filter: blur(1px);
}

.orb-3 {
  top: 35%;
  left: 20%;
  width: 30vw;
  height: 30vw;
  background: radial-gradient(circle at center, rgba(10, 132, 255, 0.04) 0%, transparent 65%);
}

/* App Container */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   2. Sidebar — iOS chrome material with vibrancy
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sys-sidebar-bg);
  backdrop-filter: var(--material-regular);
  -webkit-backdrop-filter: var(--material-regular);
  border-left: 1px solid var(--sep-opaque);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  overflow: hidden;
  transition: transform var(--dur-slow) var(--spring-gentle),
              backdrop-filter var(--dur-slow) var(--spring-gentle);
}

.sidebar-header {
  padding: 2rem 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--system-border);
}

.bot-logo {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(255, 55, 95, 0.4), 0 2px 6px rgba(0,0,0,0.3);
  transition: transform var(--dur-normal) var(--spring-snappy),
              box-shadow var(--dur-normal) var(--spring-gentle);
}

.bot-logo:hover {
  transform: rotate(5deg) scale(1.08);
  box-shadow: 0 10px 28px rgba(255, 55, 95, 0.55), 0 4px 10px rgba(0,0,0,0.35);
}

.bot-title h2 {
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: var(--tracking-snug);
  color: var(--label-primary);
  line-height: var(--leading-tight);
}

.bot-title span {
  font-size: var(--text-xs);
  color: var(--label-tertiary);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
}

.sidebar-menu {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  color: var(--label-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-normal);
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background var(--dur-fast) var(--spring-gentle),
    color var(--dur-fast) var(--spring-gentle),
    transform var(--dur-fast) var(--spring-snappy),
    border-color var(--dur-fast) var(--spring-gentle),
    box-shadow var(--dur-fast) var(--spring-gentle);
  position: relative;
  user-select: none;
}

.menu-item i {
  width: 22px;
  text-align: center;
  font-size: 1.05rem;
  transition: transform var(--dur-fast) var(--spring-snappy),
              color var(--dur-fast) var(--spring-gentle);
}

.menu-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--label-primary);
}

.menu-item:hover i {
  transform: scale(1.1);
}

.menu-item:active {
  transform: scale(0.965);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(255, 55, 95, 0.12), rgba(191, 90, 242, 0.08));
  color: #ffffff;
  border-color: rgba(255, 55, 95, 0.25);
  box-shadow: 0 0 0 1px rgba(191, 90, 242, 0.1) inset, var(--shadow-sm);
  position: relative;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--ig-gradient);
  border-radius: 0 3px 3px 0;
}

.menu-item.active i {
  background: var(--ig-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.menu-badge {
  margin-right: auto;
  background: var(--ig-gradient);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

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

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(48, 209, 88, 0.06);
  border: 1px solid rgba(48, 209, 88, 0.15);
  font-size: 0.85rem;
  color: var(--apple-green);
  font-weight: 600;
  transition: var(--transition-fluid);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 10px var(--apple-green);
  animation: pulse-apple 2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  flex-shrink: 0;
}

@keyframes pulse-apple {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 15px rgba(48, 209, 88, 0.8); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* ==========================================================================
   3. Main Content & Header — Chrome material with scroll-awareness
   ========================================================================== */
.main-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

.top-header {
  height: var(--header-height);
  padding: 0 var(--space-10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 8, 10, 0.6);
  backdrop-filter: var(--material-thick);
  -webkit-backdrop-filter: var(--material-thick);
  border-bottom: 1px solid var(--sep-opaque);
  position: sticky;
  top: 0;
  z-index: 50;
  transition:
    backdrop-filter var(--dur-slow) var(--spring-gentle),
    background var(--dur-slow) var(--spring-gentle),
    box-shadow var(--dur-normal) var(--spring-gentle);
}

.top-header.scrolled {
  background: rgba(8, 8, 10, 0.8);
  backdrop-filter: var(--material-chrome);
  box-shadow: var(--shadow-near);
}

.page-title h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  background: var(--ig-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: var(--leading-tight);
}

.btn-menu-toggle {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-2);
  background: var(--sys-card-bg);
  border: 1px solid var(--sep-opaque);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--spring-snappy),
    border-color var(--dur-fast) var(--spring-gentle),
    background var(--dur-fast) var(--spring-gentle),
    box-shadow var(--dur-fast) var(--spring-gentle);
}

.profile-pill:hover {
  border-color: var(--sep-translucent);
  background: var(--sys-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-near);
}

.profile-pill:active {
  transform: scale(0.96) translateY(0);
}

.profile-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #ffffff;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.profile-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-pill-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}

.content-body {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
}

/* ==========================================================================
   4. Tab Content — Spring-driven entry animation
   ========================================================================== */
.tab-content {
  display: none;
  opacity: 0;
}

.tab-content.active {
  display: block;
  animation: apple-spring-in var(--dur-slow) var(--spring-gentle) forwards;
}

@keyframes apple-spring-in {
  0%   { opacity: 0; transform: translateY(14px) scale(0.990); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.001); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Legacy keyframe fallback */
@keyframes apple-fade-up {
  0%   { opacity: 0; transform: translateY(20px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Glass Card — Translucent material with specular highlight */
.glass-card {
  background: var(--sys-card-bg);
  border: 1px solid var(--sep-opaque);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--material-regular);
  -webkit-backdrop-filter: var(--material-regular);
  padding: var(--space-8);
  box-shadow: var(--shadow-near);
  transition:
    transform var(--dur-normal) var(--spring-gentle),
    border-color var(--dur-normal) var(--spring-gentle),
    box-shadow var(--dur-normal) var(--spring-gentle);
  position: relative;
  overflow: hidden;
}

/* Top specular light edge — simulates glass catching light */
.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 5%,
    rgba(255,255,255,0.1) 30%,
    rgba(255,255,255,0.14) 50%,
    rgba(255,255,255,0.1) 70%,
    transparent 95%
  );
  pointer-events: none;
}

.glass-card:hover {
  border-color: var(--sep-translucent);
  box-shadow: var(--shadow-mid), 0 0 50px rgba(191, 90, 242, 0.04);
  transform: translateY(-2px);
}

/* ==========================================================================
   5. Stats & Dashboard Components
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--system-card-bg);
  border: 1px solid var(--system-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition-fluid);
  cursor: default;
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-5px) scale(1.025);
  box-shadow: var(--shadow-md), 0 0 30px rgba(191, 90, 242, 0.06);
}

.stat-card:active {
  transform: translateY(-2px) scale(1.01);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.ig-glow { background: rgba(255, 55, 95, 0.15); color: var(--apple-pink); }
.blue-glow { background: rgba(10, 132, 255, 0.15); color: var(--apple-blue); }
.green-glow { background: rgba(48, 209, 88, 0.15); color: var(--apple-green); }
.orange-glow { background: rgba(255, 159, 10, 0.15); color: var(--apple-orange); }
.pink-glow { background: rgba(255, 55, 95, 0.15); color: var(--apple-pink); }
.purple-glow { background: rgba(191, 90, 242, 0.15); color: var(--apple-purple); }

.stat-details h3 {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  margin-bottom: 0.35rem;
  letter-spacing: 0.05em;
}

.stat-details p {
  font-size: 1.7rem;
  font-weight: 800;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-details p.small-stat {
  font-size: 1.1rem;
}

/* Dashboard layouts */
.dashboard-layouts {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
}

@media (max-width: 1200px) {
  .dashboard-layouts {
    grid-template-columns: 1fr;
  }
}

.dashboard-main-card h3, .dashboard-side-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #ffffff;
  margin-bottom: 1rem;
}

.dashboard-main-card p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 2rem;
}

.dashboard-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.system-status-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.system-status-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.system-status-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.status-label {
  color: rgba(255, 255, 255, 0.6);
}

.status-val {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}

.success-text { color: var(--apple-green); }
.warning-text { color: var(--apple-orange); }
.error-text { color: var(--apple-red); }

/* Live activity list */
.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.activity-header h3 {
  font-size: 1.15rem;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.live-dot {
  width: 9px;
  height: 9px;
  background: var(--apple-red);
  border-radius: 50%;
  animation: pulse-apple-red 1.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes pulse-apple-red {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px rgba(255, 69, 58, 0.7); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 380px;
  overflow-y: auto;
  padding-left: 0.25rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--system-border);
  transition: var(--transition-fluid);
  animation: apple-slide-in 0.4s var(--apple-ease) forwards;
}

.activity-item:hover {
  border-color: var(--system-border-hover);
  background: rgba(255, 255, 255, 0.05);
}

@keyframes apple-slide-in {
  from { opacity: 0; transform: translateX(-15px); }
  to { opacity: 1; transform: translateX(0); }
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.activity-icon.comment { background: rgba(191, 90, 242, 0.15); color: var(--apple-purple); }
.activity-icon.dm { background: rgba(10, 132, 255, 0.15); color: var(--apple-blue); }
.activity-icon.reply { background: rgba(48, 209, 88, 0.15); color: var(--apple-green); }
.activity-icon.publish { background: rgba(255, 159, 10, 0.15); color: var(--apple-orange); }

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-body strong {
  font-size: 0.9rem;
  color: #ffffff;
  font-weight: 600;
}

.activity-body p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

/* ==========================================================================
   6. Profiles, Feeds, and Media Cards (Apple Squircle Grid)
   ========================================================================== */
.profile-hero {
  background: var(--system-card-bg);
  border: 1px solid var(--system-border);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--ig-gradient);
}

.profile-big-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  color: #ffffff;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 5px rgba(191, 90, 242, 0.25), var(--shadow-glow);
  transition: var(--transition-fluid);
}

.profile-big-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-big-info h2 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.022em;
  color: #ffffff;
}

.profile-big-info .handle {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.15rem;
  margin-bottom: 0.85rem;
}

.profile-big-info .bio {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.profile-stats-row {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.profile-stat {
  text-align: center;
}

.profile-stat .num {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

.profile-stat .lbl {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  margin-top: 0.25rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) { .media-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .media-grid { grid-template-columns: 1fr; } }

.media-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  border: 1px solid var(--system-border);
  background: var(--system-card-bg);
  transition: var(--transition-fluid);
}

.media-card:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: var(--system-border-hover);
  box-shadow: var(--shadow-md);
}

.media-card img, .media-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition-fluid);
  display: flex;
  align-items: flex-end;
  padding: 1.25rem;
}

.media-card:hover .media-card-overlay {
  opacity: 1;
}

.media-card-stats {
  display: flex;
  gap: 1.25rem;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
}

.media-card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.media-type-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
}

.media-placeholder i {
  font-size: 2.2rem;
}

/* ==========================================================================
   7. Form Controls & Buttons
   ========================================================================== */
.form-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-container .btn[type="submit"] {
  align-self: flex-start;
  min-width: 120px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  padding-right: 0.25rem;
}

.form-group input, .form-group textarea, .form-group select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--system-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: var(--font-stack);
  outline: none;
  transition: var(--transition-fluid);
  resize: vertical;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: rgba(191, 90, 242, 0.65);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px rgba(191, 90, 242, 0.15);
}

.form-group input::placeholder, .form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.form-help {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 0.15rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

@media (max-width: 600px) { .form-row { flex-direction: column; } }

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: var(--transition-fluid);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.95) translateY(1px);
}

.btn-primary {
  background: var(--ig-gradient);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(255, 55, 95, 0.3), 0 2px 6px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 55, 95, 0.5), 0 4px 12px rgba(191, 90, 242, 0.25);
}

.btn-primary:active::after {
  background: rgba(0, 0, 0, 0.12);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--system-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(255, 69, 58, 0.1);
  color: var(--apple-red);
  border: 1px solid rgba(255, 69, 58, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 69, 58, 0.2);
  border-color: rgba(255, 69, 58, 0.4);
  box-shadow: 0 4px 16px rgba(255, 69, 58, 0.2);
  transform: translateY(-1px);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border: 1px solid var(--system-border);
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon:hover {
  border-color: var(--system-border-hover);
  background: rgba(255, 255, 255, 0.08);
}

.btn-block { width: 100%; }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.85rem; }

.log-filter-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Inline Radio Groups */
.inline-radio-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.radio-label input {
  accent-color: var(--apple-purple);
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   8. iOS Bottom Sheet & Modal View
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: apple-fade-in 0.3s var(--apple-ease) forwards;
}

@keyframes apple-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: rgba(20, 20, 22, 0.85);
  backdrop-filter: blur(50px) saturate(210%);
  -webkit-backdrop-filter: blur(50px) saturate(210%);
  border: 1px solid var(--system-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 950px;
  max-height: 85vh;
  display: flex;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: apple-sheet-in 0.5s var(--apple-ease) forwards;
}

@keyframes apple-sheet-in {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-media-side {
  flex: 1.3;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 85vh;
  position: relative;
}

.modal-media-side img, .modal-media-side video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 85vh;
}

.modal-info-side {
  width: 380px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--system-border);
  max-height: 85vh;
  background: rgba(28, 28, 30, 0.45);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--system-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h4 {
  font-size: 0.95rem;
  font-weight: 750;
  color: #ffffff;
}

.modal-caption {
  padding: 1.25rem 1.5rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
  border-bottom: 1px solid var(--system-border);
  max-height: 140px;
  overflow-y: auto;
}

.modal-comments {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: apple-slide-in 0.4s var(--apple-ease) forwards;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #ffffff;
  flex-shrink: 0;
  font-weight: 700;
}

.comment-body {
  flex: 1;
}

.comment-username {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
}

.comment-text {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  margin-top: 0.15rem;
}

.comment-time {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.3rem;
  display: flex;
  gap: 0.75rem;
}

.comment-reply-btn {
  font-size: 0.75rem;
  color: var(--apple-blue);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fluid);
}

.comment-reply-btn:hover {
  color: var(--apple-pink);
}

.modal-reply-box {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--system-border);
  display: flex;
  gap: 0.75rem;
  background: rgba(9, 9, 11, 0.4);
}

.modal-reply-box input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--system-border);
  border-radius: 50px;
  padding: 0.65rem 1.15rem;
  color: #ffffff;
  font-size: 0.9rem;
  font-family: var(--font-stack);
  outline: none;
  transition: var(--transition-fluid);
}

.modal-reply-box input:focus {
  border-color: rgba(191, 90, 242, 0.65);
}

.modal-reply-box input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.btn-close-modal {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  transition: var(--transition-fluid);
}

.btn-close-modal:hover {
  color: #ffffff;
  transform: rotate(90deg);
}

/* ==========================================================================
   9. Custom Tab Components & Managers
   ========================================================================== */
.type-selector {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--system-border);
  border-radius: var(--radius-md);
  padding: 0.3rem;
}

.type-btn {
  flex: 1;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-stack);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fluid);
}

.type-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.publish-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .publish-layout { grid-template-columns: 1fr; } }

.publish-progress {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 220px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--system-border);
  animation: apple-slide-in 0.4s var(--apple-ease) forwards;
}

.progress-step .step-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.step-icon.pending { background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.35); }
.step-icon.loading { background: rgba(255, 159, 10, 0.15); color: var(--apple-orange); }
.step-icon.success { background: rgba(48, 209, 88, 0.15); color: var(--apple-green); }
.step-icon.error { background: rgba(255, 69, 58, 0.15); color: var(--apple-red); }

.progress-step .step-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  flex: 1;
}

.scheduler-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .scheduler-layout { grid-template-columns: 1fr; } }

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin-top: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: right;
  padding: 0.85rem 1.25rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--system-border);
}

.data-table td {
  padding: 1rem 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.empty-table-state {
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  padding: 3rem;
}

/* Auto Reply Switched */
.autoreply-switches {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex: 1;
  min-width: 280px;
}

.switch-info h3 {
  font-size: 1rem;
  font-weight: 750;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.switch-info p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition-fluid);
}

.slider:before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  right: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: var(--transition-fluid);
}

.toggle-switch input:checked + .slider {
  background: var(--ig-gradient);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(-22px);
}

.autoreply-layouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .autoreply-layouts { grid-template-columns: 1fr; } }

.rule-card {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition-fluid);
  margin-bottom: 0.85rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.rule-card:hover {
  border-color: rgba(191, 90, 242, 0.35);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.rule-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rule-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rule-keyword-badge {
  font-family: var(--font-stack);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  background: rgba(191, 90, 242, 0.12);
  color: var(--apple-purple);
  border: 1px solid rgba(191, 90, 242, 0.2);
  box-shadow: 0 2px 8px rgba(191, 90, 242, 0.1);
}

.rule-api-badge {
  font-family: var(--font-stack);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  background: rgba(10, 132, 255, 0.12);
  color: var(--apple-blue);
  border: 1px solid rgba(10, 132, 255, 0.2);
}

.rule-actions {
  display: flex;
  gap: 0.35rem;
}

.rule-action-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--system-border);
  color: rgba(255, 255, 255, 0.7);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-quick);
}

.rule-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: var(--system-border-hover);
  transform: translateY(-1px);
}

.rule-action-btn.btn-delete:hover {
  background: rgba(255, 69, 58, 0.15);
  color: var(--apple-red);
  border-color: rgba(255, 69, 58, 0.3);
}

.rule-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  font-weight: 400;
  word-break: break-word;
}

.rule-api-url {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  word-break: break-all;
}

.rule-api-url i {
  color: var(--apple-blue);
}

.rule-add-form {
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: var(--transition-fluid);
}

.rule-add-form h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.85rem;
}

/* Comments Manager Selector */
.cm-post-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.cm-post-btn {
  padding: 0.5rem 1.15rem;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--system-border);
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-fluid);
  font-family: var(--font-stack);
}

.cm-post-btn:hover {
  border-color: var(--system-border-hover);
  color: #ffffff;
}

.cm-post-btn.active {
  background: rgba(191, 90, 242, 0.15);
  border-color: rgba(191, 90, 242, 0.35);
  color: var(--apple-purple);
  font-weight: 600;
}

.cm-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-left: 0.25rem;
}

.cm-comment-card {
  display: flex;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--system-border);
  border-radius: var(--radius-md);
  transition: var(--transition-fluid);
}

.cm-comment-card:hover {
  border-color: var(--system-border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.cm-comment-info {
  flex: 1;
  min-width: 0;
}

.cm-comment-user {
  font-size: 0.88rem;
  font-weight: 750;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.cm-comment-text {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.cm-comment-time {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.45rem;
}

.cm-reply-input {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.cm-reply-input input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--system-border);
  border-radius: 50px;
  padding: 0.5rem 1.15rem;
  color: #ffffff;
  font-size: 0.88rem;
  font-family: var(--font-stack);
  outline: none;
  transition: var(--transition-fluid);
}

.cm-reply-input input:focus {
  border-color: rgba(191, 90, 242, 0.65);
}

.cm-reply-input input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   10. System Terminal & Logs
   ========================================================================== */
.logs-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.logs-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.log-filter-bar::-webkit-scrollbar {
  display: none;
}

.terminal-container {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  border: 1px solid var(--system-border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #09090b;
}

.terminal-header-bar {
  background: rgba(24, 24, 27, 0.95);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--system-border);
  direction: ltr;
}

.terminal-dots {
  display: flex;
  gap: 0.35rem;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.terminal-dots .dot-red { background: #ff453a; }
.terminal-dots .dot-yellow { background: #ff9f0a; }
.terminal-dots .dot-green { background: #30d158; }

.terminal-title-text {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  margin-left: 0.5rem;
}

.terminal-body {
  background: #09090b;
  padding: 1rem;
  min-height: 380px;
  max-height: 65vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  direction: ltr;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.log-line {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

.log-line:last-child {
  border-bottom: none;
}

.log-time {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.76rem;
  flex-shrink: 0;
  font-family: inherit;
}

.log-level {
  flex-shrink: 0;
  font-weight: 700;
  min-width: 65px;
  text-align: center;
  border-radius: 4px;
  font-size: 0.7rem;
  padding: 1px 6px;
  letter-spacing: 0.03em;
}

.log-level.INFO { background: rgba(10, 132, 255, 0.15); color: var(--apple-blue); }
.log-level.SUCCESS { background: rgba(48, 209, 88, 0.15); color: var(--apple-green); }
.log-level.WARNING { background: rgba(255, 159, 10, 0.15); color: var(--apple-orange); }
.log-level.ERROR { background: rgba(255, 69, 58, 0.15); color: var(--apple-red); }

.log-msg {
  color: rgba(255, 255, 255, 0.9);
  word-break: break-word;
  overflow-wrap: anywhere;
  flex: 1;
}

/* Terminal Syntax Highlighting & Visual Accents */
.terminal-url {
  color: #64d2ff;
  text-decoration: underline;
  word-break: break-all;
}

.terminal-id {
  color: #ffd60a;
  font-weight: 600;
}

.terminal-user {
  color: #ff77e9;
  font-weight: 600;
}

.terminal-key {
  color: #bf90f2;
}

.terminal-str {
  color: #30d158;
}

.terminal-bool {
  color: #ff9f0a;
  font-weight: 700;
}

.terminal-tag {
  color: #0a84ff;
  font-weight: 700;
}

.terminal-live-tag {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--apple-green);
  font-weight: 600;
  font-family: var(--font-stack);
}

.terminal-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 8px var(--apple-green);
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0.3; transform: scale(0.9); }
}

.terminal-cursor-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.terminal-prompt {
  color: var(--apple-green);
  font-weight: 700;
}

.terminal-blinking-cursor {
  color: var(--apple-blue);
  animation: blinkCursor 1s steps(2, start) infinite;
}

@keyframes blinkCursor {
  to { opacity: 0; }
}

.log-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 768px) {
  .terminal-body {
    padding: 0.75rem 0.6rem;
    font-size: 0.78rem;
    max-height: 70vh;
    min-height: 300px;
  }
  
  .log-line {
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    padding: 0.4rem 0;
  }

  .log-msg {
    width: 100%;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.95);
  }
  
  .terminal-title-text {
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ==========================================================================
   11. Micro-Feedback Toasts & Scrolls
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(28, 28, 30, 0.9);
  border: 1px solid var(--system-border);
  border-radius: 50px;
  padding: 0.85rem 1.85rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 9999;
  transition: transform 0.45s var(--apple-ease), opacity 0.4s var(--apple-ease);
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { border-color: rgba(48, 209, 88, 0.4); color: var(--apple-green); }
.toast.error { border-color: rgba(255, 69, 58, 0.4); color: var(--apple-red); }
.toast.info { border-color: rgba(10, 132, 255, 0.4); color: var(--apple-blue); }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 5rem 2rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.95rem;
  grid-column: 1 / -1;
}

.loading-state i {
  font-size: 2.2rem;
  color: var(--apple-purple);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.gradient-text {
  background: var(--ig-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.section-title h3 {
  font-size: 1.15rem;
  font-weight: 750;
  color: #ffffff;
}

.comment-manager-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   11.5. Mobile Sidebar Overlay Backdrop
   ========================================================================== */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-normal) var(--spring-gentle);
}

.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   12. Mobile Responsive Adapters (RTL Phone Layouts)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 270px;
  }
  
  /* Sidebar Drawer Transition */
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(100%);
    box-shadow: none;
    z-index: 1000;
    transition: transform 0.4s var(--apple-ease);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  }
  
  /* Main Content Layout Adjustments */
  .main-content {
    margin-right: 0 !important;
    width: 100% !important;
  }
  
  /* Header Adjustments */
  .top-header {
    padding: 0 1.25rem !important;
    height: 70px !important;
  }
  
  .page-title h1 {
    font-size: 1.25rem !important;
  }
  
  /* Hamburger Menu Toggle Button (Visible only on mobile) */
  .btn-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--system-border);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 1.15rem;
    width: 38px;
    height: 38px;
    cursor: pointer;
    transition: var(--transition-quick);
  }
  
  .btn-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .btn-menu-toggle:active {
    transform: scale(0.95);
  }
  
  /* Content Padding */
  .content-body {
    padding: 1.25rem !important;
  }

  /* IOS Auto-zoom on focus prevention */
  .form-group input, 
  .form-group textarea, 
  .form-group select,
  .cm-reply-input input,
  .modal-reply-box input,
  #log-search-input {
    font-size: 16px !important;
  }
  
  /* Profile Hero Component Responsiveness */
  .profile-hero {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 2.25rem 1.25rem !important;
    gap: 1.5rem !important;
  }
  
  .profile-stats-row {
    justify-content: center !important;
    gap: 1.75rem !important;
  }
  
  /* Grid & Columns Stacking */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .scheduler-layout {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
  
  .form-row {
    flex-direction: column !important;
    gap: 0.85rem !important;
  }
  
  .form-row .form-group {
    width: 100% !important;
  }
  
  /* Modal Overlay Mobile Optimization */
  .modal-content {
    width: 95% !important;
    max-width: 100% !important;
    margin: auto !important;
    padding: 1.25rem !important;
    border-radius: var(--radius-lg) !important;
  }

  /* Post Viewer Modal Vertical Stacking */
  #post-modal .modal-content {
    flex-direction: column !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }
  #post-modal .modal-media-side {
    width: 100% !important;
    height: auto !important;
    max-height: 40vh !important;
    flex: none !important;
  }
  #post-modal .modal-info-side {
    width: 100% !important;
    border-right: none !important;
    border-top: 1px solid var(--system-border) !important;
    flex: 1 !important;
    max-height: none !important;
  }
  #post-modal .modal-comments {
    max-height: 250px !important;
    padding: 1rem 1.25rem !important;
  }
  
  /* Stacking Tables as Cards on Mobile */
  .table-responsive {
    border: none !important;
    margin-top: 0.75rem !important;
  }

  .data-table, 
  .data-table thead, 
  .data-table tbody, 
  .data-table th, 
  .data-table td, 
  .data-table tr {
    display: block !important;
    width: 100% !important;
  }
  
  .data-table thead {
    display: none !important;
  }
  
  .data-table tr {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--system-border) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 0.85rem !important;
    padding: 0.85rem 1rem !important;
    box-shadow: var(--shadow-sm);
  }
  
  .data-table td {
    border-bottom: none !important;
    padding: 0.45rem 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: left !important;
    font-size: 0.85rem !important;
    gap: 1rem;
  }
  
  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    margin-left: auto;
    text-align: right;
  }

  .data-table td:last-child {
    margin-top: 0.5rem;
    padding-top: 0.75rem !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.06) !important;
  }
  
  /* Auto Reply Table Row Optimization */
  .rule-card {
    padding: 0.85rem 1rem !important;
  }
  
  /* System Stats and Status Badges */
  .dashboard-actions {
    flex-direction: column !important;
    width: 100% !important;
  }
  
  .dashboard-actions .btn {
    width: 100% !important;
    justify-content: center;
  }
}

/* ==========================================================================
   STYLISH NEON TERMINAL & OPERATIONS LOG DISPLAY
   ========================================================================== */
.terminal-container {
  background: #090a0f !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(112, 0, 255, 0.05) !important;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace !important;
}

.terminal-header-bar {
  background: rgba(18, 20, 29, 0.95) !important;
  padding: 0.65rem 1rem !important;
  display: flex !important;
  align-items: center !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.terminal-dots {
  display: flex;
  gap: 6px;
  margin-right: 0.75rem;
}
.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-red { background: #ff5f56; box-shadow: 0 0 6px rgba(255, 95, 86, 0.5); }
.dot-yellow { background: #ffbd2e; box-shadow: 0 0 6px rgba(255, 189, 46, 0.5); }
.dot-green { background: #27c93f; box-shadow: 0 0 6px rgba(39, 201, 63, 0.5); }

.terminal-title-text {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.terminal-live-tag {
  background: rgba(39, 201, 63, 0.15);
  color: #30d158;
  border: 1px solid rgba(39, 201, 63, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}
.terminal-live-dot {
  width: 6px;
  height: 6px;
  background: #30d158;
  border-radius: 50%;
  display: inline-block;
  animation: pulseDot 1.5s infinite;
}
@keyframes pulseDot {
  0% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.3; transform: scale(0.9); }
}

.terminal-body {
  background: #090a0f !important;
  color: #e2e8f0 !important;
  padding: 1rem 1.2rem !important;
  height: 420px !important;
  overflow-y: auto !important;
  font-size: 0.83rem !important;
  line-height: 1.6 !important;
}

.log-line {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  padding: 3px 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02) !important;
  font-family: inherit !important;
  word-break: break-word !important;
}
.log-line:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

.log-time {
  color: rgba(255, 255, 255, 0.38) !important;
  font-size: 0.76rem !important;
  flex-shrink: 0 !important;
}

.log-level {
  padding: 1px 7px !important;
  border-radius: 5px !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  flex-shrink: 0 !important;
  letter-spacing: 0.5px !important;
}
.log-level.INFO { background: rgba(56, 189, 248, 0.15) !important; color: #38bdf8 !important; border: 1px solid rgba(56, 189, 248, 0.3) !important; }
.log-level.SUCCESS { background: rgba(52, 211, 153, 0.15) !important; color: #34d399 !important; border: 1px solid rgba(52, 211, 153, 0.3) !important; }
.log-level.WARNING { background: rgba(251, 191, 36, 0.15) !important; color: #fbbf24 !important; border: 1px solid rgba(251, 191, 36, 0.3) !important; }
.log-level.ERROR { background: rgba(248, 113, 113, 0.15) !important; color: #f87171 !important; border: 1px solid rgba(248, 113, 113, 0.3) !important; }

.terminal-url { color: #38bdf8 !important; text-decoration: underline !important; }
.terminal-ip { color: #a78bfa !important; font-weight: 600 !important; }
.terminal-id { color: #f59e0b !important; font-weight: 600 !important; }
.terminal-user { color: #ec4899 !important; font-weight: 600 !important; }
.terminal-key { color: #34d399 !important; }
.terminal-str { color: #e879f9 !important; }
.terminal-bool { color: #f43f5e !important; font-weight: 700 !important; }
.terminal-tag { color: #c084fc !important; font-weight: 700 !important; }

.terminal-cursor-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  color: #34d399;
}
.terminal-blinking-cursor {
  animation: blinkCursor 1s step-start infinite;
}
@keyframes blinkCursor {
  50% { opacity: 0; }
}
