/* ==============================================================
   Sentinel - restrained dark UI (Linear/Vercel-leaning).
   Flat surfaces, hairline borders, one muted accent, no glow.
   ============================================================== */

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

:root {
  --bg:        #08090a;
  --bg-elev:   #0e0f11;
  --bg-elev-2: #131517;
  --line:      rgba(255,255,255,0.08);
  --line-2:    rgba(255,255,255,0.06);
  --text:      #ededef;
  --text-2:    #a0a0a8;
  --text-3:    #6e6e78;
  --accent:    #6e8efb;   /* muted indigo, used sparingly */
  --accent-ink:#0a0c18;
  --danger:    #e5645f;
  --ok-c:      #5db389;
  --maxw:      1080px;
  --r:         8px;
  --r-lg:      12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(110,142,251,0.3); }

/* ==============================================================
   Motion - restrained, tasteful (entrance fades + reveal on scroll)
   ============================================================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Landing entrance: stagger the hero on load. */
.hero h1, .hero .lead, .hero-actions, .hero-meta, .hero .tag, .hero-eyebrow {
  animation: fadeUp .6s cubic-bezier(.22,.61,.36,1) both;
}
.hero .tag       { animation-delay: .02s; }
.hero h1         { animation-delay: .08s; }
.hero .lead      { animation-delay: .16s; }
.hero-actions    { animation-delay: .24s; }
.hero-meta       { animation-delay: .30s; }
.hero-visual, .panel { animation: fadeUp .7s cubic-bezier(.22,.61,.36,1) both; animation-delay: .18s; }

/* Scroll reveal: elements tagged [data-reveal] fade up when seen. */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s cubic-bezier(.22,.61,.36,1), transform .6s cubic-bezier(.22,.61,.36,1); }
[data-reveal].in { opacity: 1; transform: none; }

/* Respect users who prefer no motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* -- Layered ambient background (subtle, not neon) -------------------
   Applied globally via body pseudo-elements so EVERY page gets it
   (landing, auth, and the sidebar app shell alike). .bg-top is kept as
   a harmless no-op for pages that still include the element.            */
/* Layer 1 (html::before): soft dual-tone glow, top + bottom. */
html::before {
  content: ''; position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(900px 480px at 18% -8%, rgba(110,142,251,0.10), transparent 60%),
    radial-gradient(820px 460px at 88% -4%, rgba(93,179,137,0.06), transparent 62%),
    radial-gradient(1100px 700px at 50% 120%, rgba(110,142,251,0.05), transparent 60%);
}
/* Layer 2 (body::before): faint dot grid, masked to fade near the top. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(130% 80% at 50% -12%, #000 0%, transparent 68%);
          mask-image: radial-gradient(130% 80% at 50% -12%, #000 0%, transparent 68%);
}
/* Layer 3 (body::after): gentle top highlight + bottom vignette. */
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.022), transparent 16%),
    linear-gradient(to top, rgba(0,0,0,0.40), transparent 42%);
}
.bg-top { display: none; }

/* -- Navbar -- */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(8,9,10,0.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
.nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 0.95rem; letter-spacing: -0.02em; }
.brand-mark {
  width: 24px; height: 24px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.brand-mark svg { width: 24px; height: 24px; display: block; }
.nav-links { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.nav-links a { color: var(--text-2); font-size: 0.875rem; font-weight: 450; transition: color .14s; }
.nav-links a:hover { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 8px; }
@media (max-width: 720px) { .nav-links { display: none; } }

/* -- Buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-weight: 500; font-size: 0.875rem; line-height: 1; cursor: pointer;
  padding: 0 15px; height: 36px; border-radius: 7px; border: 1px solid transparent;
  transition: background .14s, border-color .14s, color .14s, transform .14s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #fff; }
.btn-lg:hover { transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.03); }
.btn-subtle { background: transparent; color: var(--text-2); }
.btn-subtle:hover { color: var(--text); }
.btn-discord { background: #5865F2; color: #fff; }
.btn-discord:hover { background: #4f5bd5; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 0.92rem; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border: 1px solid transparent; background: transparent; }
.btn-danger:hover { background: rgba(229,100,95,0.08); }
.btn .arr { transition: transform .14s; }
.btn:hover .arr { transform: translateX(2px); }

/* -- Eyebrow / labels -- */
.eyebrow { font-size: 0.78rem; font-weight: 500; color: var(--text-3); letter-spacing: 0.02em; text-transform: none; margin: 0 0 14px; }
.tag { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-elev); font-size: 0.76rem; color: var(--text-2); font-weight: 450; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok-c); }

/* -- Hero (left-aligned) -- */
.hero { padding: 96px 0 72px; border-bottom: 1px solid var(--line-2); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 64px; align-items: center; }
@media (max-width: 880px) { .hero { padding: 64px 0 48px; } .hero-grid { grid-template-columns: 1fr; gap: 44px; } }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.1rem); font-weight: 600; line-height: 1.08; letter-spacing: -0.035em; margin: 16px 0 18px; }
.hero .lead { font-size: 1.06rem; line-height: 1.6; color: var(--text-2); max-width: 480px; margin: 0 0 28px; font-weight: 450; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-meta { display: flex; gap: 20px; color: var(--text-3); font-size: 0.82rem; flex-wrap: wrap; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta .ck { color: var(--text-2); }

/* -- Code panel (flat, no glow) -- */
.panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev); overflow: hidden; }
.panel-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.panel-bar .fn { font-family: var(--mono); font-size: 0.76rem; color: var(--text-3); }
.panel-bar .right { margin-left: auto; font-size: 0.7rem; color: var(--text-3); }
.panel-body { padding: 16px 18px; font-family: var(--mono); font-size: 0.79rem; line-height: 1.9; overflow-x: auto; }
.cl { white-space: pre; color: var(--text-2); }
.cl .cm { color: var(--text-3); }
.cl .kw { color: #8aa0ff; }
.cl .st { color: #9db98f; }
.cl .gd { color: var(--text); }
.panel-foot { border-top: 1px solid var(--line-2); padding: 11px 16px; font-size: 0.78rem; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.panel-foot .ok { color: var(--ok-c); }

/* -- Sections (left-aligned heads) -- */
.section { padding: 80px 0; border-bottom: 1px solid var(--line-2); }
@media (max-width: 720px) { .section { padding: 56px 0; } }
.sec-head { max-width: 560px; margin: 0 0 44px; }
.sec-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.03em; margin: 12px 0 10px; }
.sec-head p { color: var(--text-2); font-size: 1rem; margin: 0; font-weight: 450; }

/* -- Feature rows (bordered grid, flat) -- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; }
@media (max-width: 820px) { .grid-3 { grid-template-columns: 1fr; } }
.cell { background: var(--bg); padding: 28px 26px; transition: background .18s; }
.cell:hover { background: var(--bg-elev); }
.cell h3 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }
.cell p { color: var(--text-2); font-size: 0.9rem; margin: 0; font-weight: 450; }
.cell .lbl { font-family: var(--mono); font-size: 0.74rem; color: var(--text-3); margin-bottom: 16px; }
.cell code { font-family: var(--mono); font-size: 0.82em; color: var(--text); background: var(--bg-elev); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); }

/* -- Steps -- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; gap: 22px; } }
.step { padding-top: 18px; border-top: 1px solid var(--line); }
.step .n { font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); margin-bottom: 12px; }
.step h3 { font-size: 0.98rem; font-weight: 600; margin: 0 0 6px; }
.step p { color: var(--text-2); font-size: 0.88rem; margin: 0; font-weight: 450; }

/* -- CTA (restrained) -- */
.cta { padding: 80px 0; }
.cta-inner { max-width: 560px; }
.cta h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.03em; margin: 0 0 12px; }
.cta p { color: var(--text-2); margin: 0 0 24px; }

/* -- Footer -- */
.footer { border-top: 1px solid var(--line-2); padding: 32px 0; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.footer-inner .muted { color: var(--text-3); font-size: 0.82rem; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--text-2); font-size: 0.82rem; transition: color .14s; }
.footer-links a:hover { color: var(--text); }

/* ==============================================================
   Auth (login / verify)
   ============================================================== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 380px; animation: fadeUp .5s cubic-bezier(.22,.61,.36,1) both; }
.auth-head { margin-bottom: 26px; }
.auth-head .brand { margin-bottom: 22px; }
.auth-head h1 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 6px; }
.auth-head p { color: var(--text-2); font-size: 0.9rem; margin: 0; font-weight: 450; }

.auth-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.auth-tab { padding: 0 2px 11px; margin-right: 22px; border: none; background: none; cursor: pointer; color: var(--text-3); font-weight: 500; font-size: 0.88rem; font-family: inherit; border-bottom: 1.5px solid transparent; margin-bottom: -1px; transition: color .14s, border-color .14s; }
.auth-tab.active { color: var(--text); border-bottom-color: var(--text); }

.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 0.76rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 0.8rem; font-weight: 500; color: var(--text-2); }
.field input { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; color: var(--text); font-size: 0.9rem; font-family: inherit; transition: border-color .14s; }
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: rgba(255,255,255,0.24); }
.form.hidden, .hidden { display: none; }
.fineprint { font-size: 0.76rem; color: var(--text-3); margin: 12px 0 0; font-weight: 450; }

.alert { border-radius: 7px; padding: 11px 13px; font-size: 0.84rem; margin-bottom: 16px; border: 1px solid; }
.alert-err { background: rgba(229,100,95,0.07); border-color: rgba(229,100,95,0.25); color: var(--danger); }
.alert a { text-decoration: underline; }

.verify-wrap { width: 100%; max-width: 400px; }
.verify-wrap .brand { margin-bottom: 26px; }
.verify-eyebrow { font-family: var(--mono); font-size: 0.76rem; margin-bottom: 12px; }
.verify-eyebrow.sent { color: var(--accent); }
.verify-eyebrow.ok { color: var(--ok-c); }
.verify-eyebrow.err { color: var(--danger); }
.verify-eyebrow.muted { color: var(--text-3); }
.verify-wrap h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 10px; }
.verify-wrap > p { color: var(--text-2); font-size: 0.92rem; margin: 0 0 24px; font-weight: 450; }

/* ==============================================================
   App shell (sidebar dashboard)
   ============================================================== */
:root { --sidebar-w: 248px; }

.app { min-height: 100vh; }
/* Children hold a non-wrapping loadstring; without min-width:0 they
   refuse to shrink and the page overflows horizontally on mobile. */
.app-main, .script-card, .script-top, .script-meta { min-width: 0; }

/* -- Fixed sidebar (desktop): pinned, never scrolls with the page -- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 60;
  border-right: 1px solid var(--line-2); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg); overflow-y: auto;
}
.sidebar .brand { padding: 8px 10px 18px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px;
  color: var(--text-2); font-size: 0.88rem; font-weight: 450; transition: background .14s, color .14s;
}
.side-link:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.side-link.active { background: var(--bg-elev-2); color: var(--text); font-weight: 500; }
.side-link .ic { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.side-spacer { flex: 1; }
.side-foot { padding: 10px 10px 4px; border-top: 1px solid var(--line-2); margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }

/* -- Content: offset by the sidebar, fills the rest with even padding -- */
.app-main {
  margin-left: var(--sidebar-w);
  padding: 44px clamp(28px, 4vw, 64px) 96px;
  width: auto; max-width: 1280px;
  animation: fadeIn .4s ease both;
}

/* -- Mobile top bar + hamburger (hidden on desktop) -- */
.topbar { display: none; }
.hamburger { display: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  /* Sidebar becomes an off-canvas drawer. */
  .sidebar {
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity .26s ease;
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }

  /* Top bar holds the hamburger + brand. */
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 40; height: 54px; padding: 0 16px;
    background: rgba(8,9,10,0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-2);
  }
  .hamburger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 38px; height: 38px; padding: 9px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg-elev); cursor: pointer;
  }
  .hamburger span { display: block; height: 1.5px; width: 100%; background: var(--text); border-radius: 2px;
    transition: transform .22s ease, opacity .18s ease; }
  body.nav-open .hamburger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  body.nav-open .hamburger span:nth-child(2) { opacity: 0; }
  body.nav-open .hamburger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

  .app-main { margin-left: 0; padding: 24px 18px 64px; max-width: 100%; }
}

.dash-user { display: inline-flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 450; color: var(--text-2); }
.dash-user img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-fallback { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 0.7rem; }
/* Clickable user chip -> account page */
.dash-user-link { text-decoration: none; padding: 7px 8px; border-radius: 7px; transition: background .14s, color .14s; }
.dash-user-link:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.dash-user-link.active { background: var(--bg-elev-2); color: var(--text); }

/* Account page avatar */
.avatar-lg { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex-shrink: 0; }
.avatar-lg-fb { display: grid; place-items: center; background: var(--bg-elev-2); color: var(--text); font-weight: 600; font-size: 1.3rem; }
.avatar-input { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; color: var(--text-2); font-size: 0.82rem; font-family: inherit; }
.avatar-input::file-selector-button { background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text); font-weight: 500; padding: 6px 11px; border-radius: 6px; margin-right: 10px; cursor: pointer; font-family: inherit; font-size: 0.8rem; }

/* Public profile (/u/{name}) */
.profile-wrap { max-width: 520px; margin: 0 auto; padding: 64px 24px; }
.profile-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 40px 32px; text-align: center; animation: fadeUp .5s cubic-bezier(.22,.61,.36,1) both; }
.profile-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); margin: 0 auto 18px; display: block; }
.profile-avatar-fb { display: grid; place-items: center; background: var(--bg-elev-2); color: var(--text); font-weight: 600; font-size: 2rem; }
.profile-name { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.profile-meta { color: var(--text-3); font-size: 0.85rem; margin: 0 0 24px; }
.profile-stats { display: flex; justify-content: center; gap: 32px; }
.profile-stat .n { font-size: 1.4rem; font-weight: 600; }
.profile-stat .l { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

.dash-head { margin-bottom: 28px; }
.dash-head h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 5px; }
.dash-head p { color: var(--text-2); font-size: 0.92rem; margin: 0; font-weight: 450; }
.dash-head .quota { margin-top: 8px; font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); }

.upload-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 30px; display: flex; flex-direction: column; gap: 16px; }
.upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .upload-row { grid-template-columns: 1fr; } }
.upload-card .field { margin-bottom: 0; }
.upload-card input[type=file] { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; color: var(--text-2); font-size: 0.84rem; font-family: inherit; }
.upload-card input[type=file]::file-selector-button { background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text); font-weight: 500; padding: 6px 12px; border-radius: 6px; margin-right: 11px; cursor: pointer; font-family: inherit; font-size: 0.8rem; }

.list-label { font-size: 0.78rem; color: var(--text-3); font-weight: 500; margin: 0 0 12px; }
.script-list { display: flex; flex-direction: column; gap: 10px; }
.script-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev); padding: 15px 18px; }
.script-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
@media (max-width: 620px) { .script-top { flex-direction: column; align-items: flex-start; } }
.script-name { font-weight: 500; font-size: 0.92rem; }
.script-sub { font-size: 0.76rem; color: var(--text-3); margin-top: 3px; font-family: var(--mono); }
.script-error { font-size: 0.78rem; color: var(--danger); margin-top: 6px; }
.script-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

/* Published loadstring box */
.loadstring-box { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); }
.loadstring-box code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.78rem; color: var(--text-2); white-space: nowrap; overflow-x: auto; }
.loadstring-box .copy-btn { flex-shrink: 0; }
@media (max-width: 560px) {
  .loadstring-box { flex-direction: column; align-items: stretch; }
  .loadstring-box .copy-btn { width: 100%; }
}

/* Service select + tag */
.select {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 7px;
  padding: 10px 12px; color: var(--text); font-size: 0.9rem; font-family: inherit;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa6b2' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.select:focus { outline: none; border-color: rgba(255,255,255,0.24); }
.svc-tag { font-family: var(--mono); font-size: 0.74rem; color: var(--accent); background: rgba(110,142,251,0.1); border: 1px solid rgba(110,142,251,0.22); border-radius: 5px; padding: 1px 7px; margin-left: 6px; font-weight: 400; vertical-align: middle; }

/* Admin reveal */
.admin-reveal { margin-top: 14px; border: 1px solid rgba(110,142,251,0.3); border-radius: var(--r); overflow: hidden; }
.admin-reveal-label { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); padding: 8px 12px; border-bottom: 1px solid var(--line-2); background: rgba(110,142,251,0.06); }
.admin-reveal pre { margin: 0; padding: 12px 14px; font-family: var(--mono); font-size: 0.72rem; color: var(--text-2); max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

.status { font-size: 0.72rem; font-weight: 500; padding: 3px 9px; border-radius: 5px; border: 1px solid var(--line); }
.status-ready { color: var(--ok-c); border-color: rgba(93,179,137,0.3); }
.status-protecting, .status-obfuscating { color: var(--accent); border-color: rgba(110,142,251,0.3); }
.status-uploaded { color: var(--text-2); }
.status-failed { color: var(--danger); border-color: rgba(229,100,95,0.3); }

.flash { border-radius: 7px; padding: 12px 14px; font-size: 0.86rem; margin-bottom: 22px; border: 1px solid; }
.flash-ok  { background: rgba(93,179,137,0.07); border-color: rgba(93,179,137,0.25); color: var(--ok-c); }
.flash-err { background: rgba(229,100,95,0.07); border-color: rgba(229,100,95,0.25); color: var(--danger); }

.empty { padding: 56px 24px; text-align: center; color: var(--text-3); border: 1px dashed var(--line); border-radius: var(--r-lg); font-size: 0.9rem; }

/* ==============================================================
   Settings
   ============================================================== */
.settings-section { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev); margin-bottom: 22px; overflow: hidden; }
.settings-section > .sec-title { padding: 18px 20px 4px; }
.settings-section .sec-title h2 { font-size: 1rem; font-weight: 600; margin: 0 0 3px; letter-spacing: -0.01em; }
.settings-section .sec-title p { font-size: 0.82rem; color: var(--text-3); margin: 0; font-weight: 450; }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; }
.setting-row + .setting-row { border-top: 1px solid var(--line-2); }
/* Guard rows while Luraph is disabled (passthrough): labels mildly dimmed,
   toggle visibly darker than a normal "off" - but keeps its on/off position. */
.setting-row.is-disabled .setting-info { opacity: 0.5; transition: opacity .2s ease; }
.setting-row.is-disabled .toggle { cursor: not-allowed; }
.setting-info { min-width: 0; }
.setting-info .t { font-size: 0.9rem; font-weight: 500; }
.setting-info .d { font-size: 0.82rem; color: var(--text-3); margin-top: 3px; font-weight: 450; }
.setting-info code { font-family: var(--mono); font-size: 0.82em; color: var(--text-2); background: var(--bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); }
.setting-action { flex-shrink: 0; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; cursor: pointer; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 100px; transition: background .16s, border-color .16s; }
.toggle .track::before { content: ''; position: absolute; height: 17px; width: 17px; left: 2px; top: 2px; background: var(--text-2); border-radius: 50%; transition: transform .16s, background .16s; }
.toggle input:checked + .track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .track::before { transform: translateX(17px); background: #fff; }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(110,142,251,0.3); }

/* Disabled toggle: keeps its position, but rendered distinctly darker
   than a normal off-state so it clearly reads as unavailable.
   These override the on/off colours and transition smoothly. */
.toggle input:disabled + .track { background: #0b0c0d; border-color: rgba(255,255,255,0.05); cursor: not-allowed; }
.toggle input:disabled + .track::before { background: #3a3c40; }

.inline-form { display: contents; }
.settings-form-foot { padding: 0 20px 18px; }

/* small change-password form inside a section */
.stack { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 20px; max-width: 360px; }
.badge-on  { font-size: 0.74rem; color: var(--ok-c); border: 1px solid rgba(93,179,137,0.3); border-radius: 5px; padding: 3px 9px; }
.badge-off { font-size: 0.74rem; color: var(--text-3); border: 1px solid var(--line); border-radius: 5px; padding: 3px 9px; }

/* ==============================================================
   Confirm modal (replaces native confirm())
   ============================================================== */
.modal-scrim {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(4,5,6,0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-scrim.open { display: flex; animation: fadeIn .16s ease both; }
.modal {
  width: 100%; max-width: 380px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px; box-shadow: 0 24px 70px rgba(0,0,0,0.6);
  animation: fadeUp .22s cubic-bezier(.22,.61,.36,1) both;
}
.modal h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }
.modal p { font-size: 0.88rem; color: var(--text-2); margin: 0 0 22px; line-height: 1.55; font-weight: 450; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Toast notifications (slide in, auto-dismiss) */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 240px; max-width: 360px;
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 13px 16px; font-size: 0.86rem; color: var(--text);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: toastIn .26s cubic-bezier(.22,.61,.36,1) both;
}
.toast.ok  { border-left-color: var(--ok-c); }
.toast.err { border-left-color: var(--danger); }
.toast.hide { animation: toastOut .22s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) {
  .toast, .modal, .modal-scrim.open { animation: none; }
}
