/* ========================================
   Zephyr - Modern Dark Theme
   ======================================== */

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

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

:root {
  --blue-dark:   #0f172a;
  --blue-mid:    #1e293b;
  --blue-accent: #1d4ed8;
  --blue-bright: #2563eb;
  --blue-light:  #3b82f6;
  --blue-glow:   #60a5fa;
  --text-primary: #e2e8f0;
  --text-muted:   #94a3b8;
  --card-bg:      #1e293b;
  --card-border:  #334155;
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--blue-dark);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ========== NAVBAR ========== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--blue-glow);
  letter-spacing: 0.5px;
  text-decoration: none;
}

.nav-logo-icon {
  color: var(--blue-glow);
  flex-shrink: 0;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.btn-login {
  background: var(--blue-bright);
  color: #fff !important;
  padding: 0.42rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s !important;
}

.btn-login:hover {
  background: var(--blue-glow) !important;
  box-shadow: 0 0 18px rgba(96, 165, 250, 0.35) !important;
  transform: translateY(-1px);
}

/* Saving state for inline save buttons */
.btn-saving {
  opacity: 0.8;
  pointer-events: none;
  position: relative;
}
.btn-saving::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: btn-spin 0.8s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.settings-status.save-status-saving {
  color: var(--text-muted);
  font-style: italic;
}

/* navbar spacer so fixed navbar doesn't overlap content */
body:not(.panel-body) {
  padding-top: 64px;
}

/* ========== ERROR BANNER ========== */
.error-banner {
  background: #7f1d1d;
  color: #fca5a5;
  text-align: center;
  padding: 0.75rem;
  font-weight: 600;
}

/* ========== HERO ========== */
.hero {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse 900px 600px at 50% 0%, rgba(59, 130, 246, 0.18), transparent 70%),
    radial-gradient(ellipse 600px 400px at 80% 100%, rgba(37, 99, 235, 0.12), transparent 60%),
    var(--blue-dark);
  padding: 2rem;
}

.hero-content {
  max-width: 700px;
}

.hero-title {
  font-size: 3.8rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.75rem;
  letter-spacing: -1px;
  line-height: 1.1;
}

.hero-title span {
  background: linear-gradient(135deg, var(--blue-glow), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-weight: 400;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 2rem;
  background: var(--blue-bright);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 2rem;
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--card-border);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--blue-glow);
  transform: translateY(-2px);
}

/* ========== FEATURES ========== */
.features {
  padding: 6rem 2rem;
  text-align: center;
  background: var(--blue-dark);
  border-top: 1px solid var(--card-border);
}

.features h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.features-subtitle {
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-size: 1rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: left;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--blue-light);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ========== NOTICE ========== */
.notice {
  padding: 3rem 2rem;
  display: flex;
  justify-content: center;
  background: var(--blue-dark);
}
  justify-content: center;
}

.notice-box {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 14px;
  padding: 1.5rem 2rem;
  max-width: 560px;
  text-align: center;
}

.notice-box h3 {
  color: var(--warning);
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.notice-box p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.notice-box ul {
  list-style: none;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.notice-box ul li::before {
  content: '• ';
  color: var(--warning);
}

/* ========== FOOTER ========== */
.footer {
  background: var(--blue-mid);
  border-top: 1px solid var(--card-border);
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ========== SERVICES PAGE ========== */
.services-hero {
  text-align: center;
  padding: 5rem 2rem 2.5rem;
  background:
    radial-gradient(ellipse 800px 400px at 50% 0%, rgba(59, 130, 246, 0.15), transparent 70%),
    var(--blue-dark);
}

.services-hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.services-hero p {
  color: var(--text-muted);
  font-size: 1rem;
}

.plans {
  padding: 3rem 2rem 5rem;
  background: var(--blue-dark);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1140px;
  margin: 0 auto;
}

.plan-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.plan-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.plan-free:hover  { border-color: #5D8A34; box-shadow: 0 10px 40px rgba(93, 138, 52, 0.15); }
.plan-stone:hover { border-color: #9ca3af; box-shadow: 0 10px 40px rgba(156, 163, 175, 0.15); }
.plan-iron:hover  { border-color: #C0C0C0; box-shadow: 0 10px 40px rgba(192, 192, 192, 0.15); }
.plan-diamond:hover { border-color: #4FC3F7; box-shadow: 0 10px 40px rgba(79, 195, 247, 0.2); }

.plan-diamond {
  border-color: rgba(79, 195, 247, 0.3);
}

/* Most Powerful badge */
.plan-badge {
  position: absolute;
  top: -1px;
  right: 1.5rem;
  background: linear-gradient(135deg, #0284c7, #4FC3F7);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 0 0 10px 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.plan-name {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
}

.plan-specs {
  list-style: none;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid rgba(255,255,255,0.06);
}

.plan-specs li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.plan-specs li:last-child {
  border-bottom: none;
}

.spec-label {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.spec-value {
  color: var(--blue-glow);
  font-weight: 600;
  font-size: 0.88rem;
}

.plan-desc {
  color: var(--text-primary);
  font-size: 0.92rem;
}

.plan-footnote {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.plan-priority {
  color: var(--warning);
  font-size: 0.88rem;
  font-weight: 600;
}

.plan-limit {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn-plan {
  display: block;
  text-align: center;
  padding: 0.7rem 1rem;
  background: var(--blue-bright);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  margin-top: auto;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-plan:hover         { background: var(--blue-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,0.35); }
.btn-plan-stone         { background: #4b5563; }
.btn-plan-stone:hover   { background: #6b7280; }
.btn-plan-iron          { background: #4b5563; }
.btn-plan-iron:hover    { background: #6b7280; }
.btn-plan-diamond       { background: #0284c7; box-shadow: 0 4px 20px rgba(2, 132, 199, 0.4); }
.btn-plan-diamond:hover { background: #0369a1; box-shadow: 0 6px 24px rgba(2, 132, 199, 0.5); }

.plan-expiry {
  color: var(--warning, #f59e0b);
  font-size: 0.85rem;
  font-weight: 600;
}

.plan-no-expiry {
  color: #4ade80;
  font-size: 0.85rem;
  font-weight: 600;
}

.iron-queue-notice {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--warning, #f59e0b);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ========== TERMS / PRIVACY CONTAINER ========== */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.container h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.container > p:first-of-type {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.container h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue-glow);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--card-border);
}

.container p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.container ul {
  list-style: none;
  padding: 0.5rem 0;
}

.container ul li {
  color: var(--text-muted);
  font-size: 0.93rem;
  padding: 0.25rem 0 0.25rem 1.4rem;
  position: relative;
}

.container ul li::before {
  content: '→';
  color: var(--blue-glow);
  position: absolute;
  left: 0;
  font-size: 0.8rem;
  top: 0.35rem;
}

.container strong {
  color: var(--text-primary);
}

/* ========== PANEL LAYOUT ========== */
.panel-body {
  display: flex;
  min-height: 100vh;
  background: var(--blue-dark);
}

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--blue-mid);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
}

.sidebar-brand {
  padding: 1.2rem 1.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--blue-glow);
  border-bottom: 1px solid var(--card-border);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  gap: 0.2rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-radius: 0 10px 10px 0;
  margin-right: 0.75rem;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text-primary);
}

.sidebar-link.active {
  color: var(--blue-glow);
  font-weight: 600;
}

.sidebar-icon {
  font-size: 1.1rem;
}

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

.btn-logout {
  display: block;
  text-align: center;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.07);
}

.panel-main {
  margin-left: 240px;
  flex: 1;
  padding: 0;
  overflow-y: auto;
  animation: mainReveal 380ms ease;
}

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: var(--blue-mid);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.panel-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  display: none;
}

.topbar-username {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-plan {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 0.15rem 0.65rem;
  font-weight: 500;
}

.panel-content {
  padding: 2rem 2.5rem;
}

@keyframes mainReveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-section {
  display: none;
}

.panel-section.active {
  display: block;
  animation: sectionFade 300ms ease;
}

@keyframes sectionFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

/* ========== OVERVIEW ========== */
.user-info {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--blue-light);
}

.user-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-plan {
  color: var(--blue-glow);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: capitalize;
}

.user-runtime {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.resource-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.resource-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.25rem;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.resource-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue-light);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.1);
}

.resource-card h3 {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.resource-bar-wrap {
  background: rgba(255,255,255,0.07);
  border-radius: 6px;
  height: 6px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.resource-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--blue-bright), var(--blue-glow));
  border-radius: 6px;
  transition: width 0.6s ease;
}

.resource-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bot-status-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.bot-status-card h3 {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.resource-updated {
  margin-top: 0.7rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.startup-command-text {
  color: var(--blue-glow);
  font-family: 'Courier New', monospace;
  font-size: 0.83rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  margin-top: 0.45rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-running { background: rgba(34, 197, 94, 0.15); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.status-stopped { background: rgba(239, 68, 68, 0.12); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.25); }

/* ========== CONSOLE ========== */
.console-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.console-controls label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.console-select {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.42rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
}

.btn-console {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 1.1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-console:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-console:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-start   { background: var(--success); color: #fff; box-shadow: 0 2px 12px rgba(34,197,94,0.3); }
.btn-stop    { background: var(--danger);  color: #fff; box-shadow: 0 2px 12px rgba(239,68,68,0.3); }
.btn-restart { background: var(--warning); color: #000; box-shadow: 0 2px 12px rgba(245,158,11,0.3); }
.btn-npm     { background: #0369a1; color: #fff; }
.btn-npm:hover { opacity: 0.9; }
.btn-npm:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-pip     { background: #065f46; color: #fff; }
.btn-pip:hover { opacity: 0.9; }
.btn-pip:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-toggle-stop {
  background: var(--danger) !important;
  color: #fff !important;
}

.console-output {
  background: #020817;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.25rem;
  height: 440px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.84rem;
  color: #86efac;
  white-space: pre-wrap;
  word-break: break-all;
}

.console-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.log-stdout { color: #86efac; }
.log-stderr { color: #fca5a5; }

/* ========== FILE MANAGER ========== */

.btn-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1;
}

.btn-file:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--blue-glow);
}

.btn-file:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-file .btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-cancel {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-cancel:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #fca5a5;
}

/* ---- NEW FILE MANAGER LAYOUT ---- */

.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.fm-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  flex: 1;
  min-width: 120px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
}

.fm-bc-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
  padding: 0.1rem 0.15rem;
  border-radius: 4px;
}

.fm-bc-item:hover { color: var(--blue-glow); }

.fm-bc-item.fm-bc-active { color: var(--text-primary); cursor: default; pointer-events: none; }

.fm-bc-sep {
  color: var(--card-border);
  padding: 0 0.2rem;
  user-select: none;
}

.fm-toolbar-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fm-upload-group {
  position: relative;
}

.fm-upload-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.25rem;
  z-index: 50;
  min-width: 148px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.fm-upload-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  transition: background 0.12s;
  user-select: none;
}

.fm-upload-opt:hover {
  background: rgba(255,255,255,0.07);
}

.upload-toggle-arrow {
  margin-left: 2px;
  flex-shrink: 0;
}

/* List wrapper + drop overlay */
.fm-list-wrapper {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 220px;
}

.fm-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(37, 99, 235, 0.18);
  border: 2px dashed var(--blue-bright);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 10;
  color: var(--blue-glow);
  font-size: 1rem;
  font-weight: 600;
  pointer-events: none;
}

.fm-drop-overlay.hidden { display: none; }

.fm-list-wrapper.drag-over { border-color: var(--blue-bright); }

/* Column header row */
.fm-row {
  display: grid;
  grid-template-columns: 28px 1fr 80px 140px 100px;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.13s;
  gap: 0.25rem;
}

.fm-row-head {
  background: rgba(0,0,0,0.18);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  cursor: default;
}

.fm-row:not(.fm-row-head):hover { background: rgba(59, 130, 246, 0.07); }
.fm-row:last-child { border-bottom: none; }

.fm-col-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
}

.fm-col-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.fm-col-size {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}

.fm-col-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 0.25rem;
}

.fm-col-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
}

/* File/folder name clickable */
.fm-entry-name {
  cursor: pointer;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

.fm-entry-name:hover { color: var(--blue-glow); }

/* File type icon colours */
.fm-icon-dir  { color: #f59e0b; }
.fm-icon-js   { color: #f7df1e; }
.fm-icon-ts   { color: #3178c6; }
.fm-icon-py   { color: #3b82f6; }
.fm-icon-json { color: #f97316; }
.fm-icon-md   { color: #94a3b8; }
.fm-icon-env  { color: #22c55e; }
.fm-icon-txt  { color: #94a3b8; }
.fm-icon-img  { color: #a855f7; }
.fm-icon-zip  { color: #ec4899; }
.fm-icon-file { color: #64748b; }

/* Icon-only action buttons */
.fm-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.fm-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.fm-action-btn.fm-btn-edit:hover   { background: rgba(59,130,246,0.15); color: var(--blue-glow); }
.fm-action-btn.fm-btn-rename:hover { background: rgba(245,158,11,0.15); color: #f59e0b; }
.fm-action-btn.fm-btn-dl:hover     { background: rgba(34,197,94,0.12); color: var(--success); }
.fm-action-btn.fm-btn-delete:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

/* Back nav row */
.fm-back-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.13s, color 0.13s;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.fm-back-row:hover { background: rgba(59, 130, 246, 0.07); color: var(--blue-glow); }

/* ---- LEGACY file-list kept for non-file-manager uses ---- */
.file-list {
  min-height: 60px;
}

.file-placeholder {
  color: var(--text-muted);
  padding: 2.5rem;
  text-align: center;
  font-style: italic;
  font-size: 0.9rem;
}

/* ========== FULL-PANEL EDITOR ========== */
.file-editor {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 520px;
}

.file-editor.hidden { display: none; }

.file-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
}

.editor-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.editor-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.fe-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--card-border);
  border-radius: 7px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.fe-back-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }

.editor-filename {
  font-family: monospace;
  font-size: 0.88rem;
  color: var(--blue-glow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.editor-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Editor body: line numbers + textarea side by side */
.editor-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 460px;
}

.editor-line-nums {
  width: 48px;
  background: rgba(0,0,0,0.25);
  border-right: 1px solid var(--card-border);
  padding: 1rem 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: #475569;
  text-align: right;
  line-height: 1.55;
  user-select: none;
  overflow: hidden;
  white-space: pre;
  flex-shrink: 0;
}

.editor-textarea {
  flex: 1;
  background: #050a1a;
  color: #e2e8f0;
  border: none;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  resize: none;
  outline: none;
  tab-size: 2;
  line-height: 1.55;
  overflow-y: auto;
}

/* Save status indicator */
.editor-save-status {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  white-space: nowrap;
  transition: opacity 0.3s;
}

.save-status-saving {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  animation: fm-pulse 1s ease-in-out infinite;
}

.save-status-ok {
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
}

.save-status-error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

@keyframes fm-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ========== FILE MANAGER MODAL ========== */
.fm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.fm-modal-overlay.hidden { display: none; }

.fm-modal {
  background: var(--blue-mid);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  min-width: 320px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.fm-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
  color: var(--text-primary);
}

.fm-modal-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.fm-modal-type-btns {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
}

.fm-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.fm-type-btn:hover {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
  transform: translateY(-2px);
}

.fm-name-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.fm-name-input:focus {
  border-color: var(--blue-bright);
}

.fm-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ========== SETTINGS ========== */
.settings-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.5rem;
  max-width: 560px;
  margin-bottom: 1rem;
}

.settings-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.settings-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.settings-runtime-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.settings-status {
  margin-top: 0.9rem;
  margin-bottom: 0;
  color: var(--blue-glow);
}

.module-config-footer .settings-status {
  margin-top: 0;
  font-size: 0.88rem;
}

.module-input {
  background: #0a1335;
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  min-width: 260px;
  flex: 1;
}

.module-input:focus {
  outline: none;
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Module card grid */
.module-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.module-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.2rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.module-card:hover {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.module-card--installed {
  border-color: rgba(34, 197, 94, 0.4);
}

.module-card--installed:hover {
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.module-card-icon {
  width: 28px;
  height: 28px;
  color: var(--blue-glow);
}

.module-card--installed .module-card-icon {
  color: var(--success);
}

.module-card-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
}

.module-card-name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
}

.module-card-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0;
  flex: 1;
  line-height: 1.4;
}

.module-card-btn {
  margin-top: 0.65rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--blue-light);
  background: rgba(37, 99, 235, 0.15);
  color: var(--blue-glow);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.module-card-btn:hover {
  background: var(--blue-bright);
  color: #fff;
  border-color: var(--blue-bright);
}

.module-card-btn--remove {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

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

/* Module config card */
.module-config-card {
  max-width: 700px;
}

/* Available modules wrapper card */
.module-available-card {
  margin-bottom: 1.25rem;
}

.module-available-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  margin-bottom: 0.9rem;
  color: var(--text-primary);
}

/* Remove the extra bottom margin from the grid when it's inside a card */
.module-available-card .module-cards-grid {
  margin-bottom: 0;
}

.module-config-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  margin-bottom: 0.9rem;
  color: var(--text-primary);
}

.module-config-subheader {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.settings-section-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--blue-glow);
}

.module-config-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.module-config-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.module-config-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 180px;
}

.module-config-field--full {
  flex-basis: 100%;
  min-width: 100%;
}

.module-field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.module-field-hint {
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.7;
}

.module-config-hint-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.module-config-section--disabled {
  opacity: 0.38;
  pointer-events: none;
  filter: blur(1px);
  user-select: none;
}

.module-config-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.module-input {
  background: #0a1335;
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  width: 100%;
}

.module-input:focus {
  outline: none;
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.module-name {
  color: var(--text-primary);
  font-weight: 600;
}

.module-version {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.module-textarea {
  min-height: 90px;
  resize: vertical;
}

.module-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.module-toggle input[type="checkbox"] {
  accent-color: #4f9bff;
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.35);
}

.danger-zone h3 {
  color: var(--danger);
}

.btn-danger {
  padding: 0.55rem 1.3rem;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-danger:hover { opacity: 0.85; }

/* ========== UTILITY ========== */
.hidden { display: none !important; }

/* ========== RUNTIME SELECTION PAGE ========== */
.runtime-card--disabled {
  position: relative;
  overflow: hidden;
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.ribbon-coming-soon {
  position: absolute;
  top: 18px;
  right: -26px;
  transform: rotate(45deg);
  background: #f59e0b;
  color: #0d1b33;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 5px 32px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  .navbar {
    height: auto;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .hero {
    min-height: auto;
    padding: 3rem 1rem;
  }

  .hero-title {
    font-size: 2.6rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .services-hero h1 {
    font-size: 2rem;
  }

  .plans {
    padding: 2rem 1rem 4rem;
  }

  .plan-card {
    padding: 1.5rem 1rem;
  }

  .sidebar {
    width: 100%;
    min-height: unset;
    height: auto;
    position: sticky;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.6rem;
  }

  .sidebar-link {
    margin-right: 0;
    border-radius: 8px;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .panel-body {
    display: block;
  }

  .panel-main {
    margin-left: 0;
  }

  .panel-content {
    padding: 1rem;
  }

  .panel-topbar {
    padding: 0.65rem 1rem;
  }

  .console-controls {
    align-items: stretch;
  }

  .console-controls .console-select,
  .console-controls .btn-console {
    width: 100%;
    justify-content: center;
  }

  .settings-runtime-row .module-input,
  .settings-runtime-row .console-select,
  .settings-runtime-row .btn-file {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .sidebar-brand,
  .sidebar-footer {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    border-top: 1px solid var(--card-border);
    border-bottom: none;
    background: rgba(30, 41, 59, 0.97);
    backdrop-filter: blur(12px);
    min-height: auto;
    width: 100%;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.2rem;
    padding: 0.45rem;
  }

  .sidebar-link {
    font-size: 0.72rem;
    padding: 0.45rem 0.3rem;
    margin: 0;
    border-radius: 10px;
    justify-content: center;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
  }

  .panel-main {
    padding-bottom: 5.2rem;
  }

  .panel-topbar {
    display: none;
  }

  .navbar {
    align-items: stretch;
  }

  .nav-brand {
    text-align: center;
    width: 100%;
  }

  .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 0.5rem;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.45rem 0.5rem;
  }

  .nav-links .btn-login {
    grid-column: span 2;
  }

  .features {
    padding: 3rem 1rem;
  }

  .notice {
    padding: 2rem 1rem;
  }

  .resource-cards {
    grid-template-columns: 1fr;
  }

  /* Removed on mobile because the fixed navbar is stacked into a non-fixed layout
     on very small screens, so content no longer needs to clear it. */
  body:not(.panel-body) {
    padding-top: 0;
  }
}

/* Explicit device-mode panel layout switching.
   This keeps desktop interactions stable even if width-based media rules apply. */

/* On large viewports, device-desktop restores the classic left-sidebar layout */
@media (min-width: 901px) {
  html.device-desktop .panel-body {
    display: flex;
  }

  html.device-desktop .sidebar {
    width: 240px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--card-border);
    border-bottom: none;
    z-index: 50;
  }

  html.device-desktop .sidebar-brand {
    display: block;
  }

  html.device-desktop .sidebar-nav {
    flex-direction: column;
    overflow-x: unset;
    padding: 1rem 0;
    gap: 0.2rem;
  }

  html.device-desktop .sidebar-link {
    margin-right: 0.75rem;
    border-radius: 0 10px 10px 0;
    white-space: normal;
  }

  html.device-desktop .sidebar-footer {
    display: block;
  }

  html.device-desktop .panel-main {
    margin-left: 240px;
    max-width: unset;
    margin-right: unset;
  }

  html.device-desktop .panel-content {
    padding: 2rem 2.5rem;
  }

  html.device-desktop .panel-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
  }
}

/* On narrow viewports with a desktop browser, use the compact horizontal nav */
@media (max-width: 900px) {
  html.device-desktop .panel-body {
    display: block;
  }

  html.device-desktop .sidebar {
    width: 100%;
    min-height: unset;
    height: auto;
    position: sticky;
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    z-index: 30;
  }

  html.device-desktop .sidebar-brand {
    display: none;
  }

  html.device-desktop .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.6rem;
  }

  html.device-desktop .sidebar-link {
    margin-right: 0;
    border-radius: 8px;
    white-space: nowrap;
  }

  html.device-desktop .sidebar-footer {
    display: none;
  }

  html.device-desktop .panel-main {
    margin-left: 0;
    max-width: 1200px;
    margin-right: auto;
  }

  html.device-desktop .panel-content {
    padding: 1rem;
  }
}

html.device-mobile .panel-body {
  display: block;
}

html.device-mobile .sidebar {
  width: 100%;
  min-height: unset;
  height: auto;
  position: sticky;
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: 1px solid var(--card-border);
}

html.device-mobile .sidebar-nav {
  flex-direction: row;
  overflow-x: auto;
  padding: 0.6rem;
}

html.device-mobile .sidebar-link {
  margin-right: 0;
  border-radius: 8px;
  white-space: nowrap;
}

html.device-mobile .sidebar-footer {
  display: none;
}

html.device-mobile .panel-main {
  margin-left: 0;
}

html.device-mobile .panel-content {
  padding: 1rem;
}

html.device-mobile .console-controls {
  align-items: stretch;
}

html.device-mobile .console-controls .console-select,
html.device-mobile .console-controls .btn-console {
  width: 100%;
  justify-content: center;
}

html.device-mobile .settings-runtime-row .module-input,
html.device-mobile .settings-runtime-row .console-select,
html.device-mobile .settings-runtime-row .btn-file {
  width: 100%;
}

html.device-mobile .module-cards-grid {
  grid-template-columns: 1fr 1fr;
}

/* ---- File Manager: mobile responsiveness ---- */
@media (max-width: 700px) {
  .fm-row {
    grid-template-columns: 28px 1fr 64px 80px;
  }
  .fm-col-date {
    display: none;
  }
  .fm-toolbar-btns {
    gap: 0.35rem;
  }
  .btn-file {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
  }
  .editor-hint { display: none; }
}

@media (max-width: 500px) {
  .fm-row {
    grid-template-columns: 24px 1fr 60px;
  }
  .fm-col-size { display: none; }
}

html.device-mobile .fm-row {
  /* Same as max-width:700px rule: hide date column */
  grid-template-columns: 28px 1fr 64px 100px;
}
html.device-mobile .fm-col-date { display: none; }
html.device-mobile .editor-hint { display: none; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--blue-accent); border-radius: 3px; }
