/* ===== Mimo Console — Premium Solid Design ===== */

:root {
  color-scheme: light;

  /* Accent — overridable via JS */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.08);
  --accent-line: rgba(99, 102, 241, 0.22);

  /* Surfaces */
  --bg: #f5f7fb;
  --bg-secondary: #eef2f7;
  --surface: #ffffff;
  --surface-hover: #f5f7fa;
  --surface-soft: #f7f8fa;
  --surface-inset: #eef1f5;
  --blur-intensity: 0px;
  --card-opacity: 92%;
  --control-opacity: 70%;
  --inset-opacity: 56%;
  --glass-panel: color-mix(in srgb, var(--surface) var(--card-opacity), transparent);
  --glass-control: color-mix(in srgb, var(--surface) var(--control-opacity), transparent);
  --glass-inset: color-mix(in srgb, var(--surface-soft) var(--inset-opacity), transparent);

  /* Text */
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;

  /* Borders */
  --line: #e3e7ee;
  --line-strong: #cfd6e1;

  /* Semantic colors */
  --color-blue: #3b82f6;
  --color-purple: #8b5cf6;
  --color-teal: #14b8a6;
  --color-pink: #ec4899;
  --color-green: #22c55e;
  --color-yellow: #f59e0b;
  --color-red: #ef4444;

  /* Shadows — subtle, no inset glass */
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);

  /* Layout */
  --sidebar-w: 256px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;

  /* Fonts */
  --font: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, "Cascadia Code", monospace;

  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  color-scheme: dark;

  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-line: rgba(99, 102, 241, 0.28);

  --bg: #0f1117;
  --bg-secondary: #151823;
  --surface: #1b1e29;
  --surface-hover: #242836;
  --surface-soft: #20232f;
  --surface-inset: #171a24;

  --text: #f0f1f4;
  --text-soft: #c8cad0;
  --muted: #8b8f9a;
  --muted-2: #5f6370;

  --line: #2b2f3d;
  --line-strong: #3a3f50;

  --color-blue: #60a5fa;
  --color-purple: #a78bfa;
  --color-teal: #2dd4bf;
  --color-pink: #f472b6;
  --color-green: #4ade80;
  --color-yellow: #fbbf24;
  --color-red: #f87171;

  --shadow: 0 1px 2px rgba(0,0,0,0.22);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.28);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.34);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html {
  min-height: 100%;
  overflow-y: scroll;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bg-layer {
  position: fixed;
  z-index: -10;
  inset: calc(var(--blur-intensity) * -1.5);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  filter: blur(var(--blur-intensity));
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(1.03);
  transition: opacity .25s ease, filter .2s ease;
  backface-visibility: hidden;
  will-change: transform, filter, opacity;
  pointer-events: none;
}

.has-custom-bg .bg-layer { opacity: 1; }
.has-custom-bg body { background: transparent; }

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }
.mb-md { margin-bottom: 16px; }
.min-w-0 { min-width: 0; }
.grow { flex: 1; }

/* ===== Card — the core building block ===== */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.has-custom-bg .auth-screen { background: transparent; }
.has-custom-bg .sidebar,
.has-custom-bg .topbar {
  background: var(--glass-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.has-custom-bg .card,
.has-custom-bg .plugin-card,
.has-custom-bg .config-group,
.has-custom-bg .notice,
.has-custom-bg .page-header {
  background: var(--glass-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.has-custom-bg .page-header {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.has-custom-bg .config-group-head {
  background: var(--glass-control);
}

/* Fading an entire page also fades its backdrop-filter, briefly exposing the
   sharp background before glass cards are composited. Keep page swaps atomic
   while a custom background is active. */
.has-custom-bg .page {
  animation: none;
}

/* ===== Auth Screen ===== */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px);
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
}

.auth-container { width: 100%; }

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

.auth-logo {
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
  margin-bottom: 16px;
}

.auth-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.auth-card {
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.auth-card-head { margin-bottom: 24px; }

.auth-step {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.auth-card-head h2 {
  margin: 12px 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-card-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ===== Form Fields ===== */
.field { display: grid; gap: 8px; margin-top: 16px; }
.field > span { color: var(--text-soft); font-size: 13px; font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }

.field input,
.config-input,
.select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.field input:focus,
.config-input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::placeholder { color: var(--muted-2); }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }

.form-error {
  min-height: 18px;
  margin: 12px 0 0 !important;
  color: var(--color-red);
  font-size: 13px;
}

.field-group { margin-top: 14px; }

/* ===== Buttons ===== */
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-soft); color: var(--text); }

.eye-btn { position: absolute; top: 4px; right: 4px; }
.eye-btn::before {
  content: "";
  width: 15px; height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50% 50% 45% 45%;
}
.eye-btn::after {
  content: "";
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.btn:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:not(:disabled):hover { transform: translateY(-1px); }

.btn-primary {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:not(:disabled):hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text-soft);
}
.btn-secondary:not(:disabled):hover {
  border-color: var(--accent-line);
  background: var(--surface-hover);
  color: var(--text);
}
.btn-secondary.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn-ghost:hover {
  border-color: transparent;
  background: var(--surface-soft);
  color: var(--text);
}
.btn-ghost.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger {
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
  color: var(--color-red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.12); }

.btn-block { width: 100%; margin-top: 20px; height: 46px; font-size: 14px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }

.btn-link {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* ===== App Shell ===== */
.app { min-height: 100vh; }

/* -- Sidebar -- */
.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.sidebar-brand { display: grid; line-height: 1.15; min-width: 0; }
.sidebar-brand strong { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-brand span { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }

.sidebar-close { display: none; margin-left: auto; }

/* -- Nav -- */
.nav-list { display: grid; gap: 2px; padding: 12px 10px; }

.nav-item {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  font-weight: 450;
  transition: background .15s, color .15s;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--surface-soft); }
.nav-item:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: -2px;
}

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

.nav-item em {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 11px;
  font-style: normal;
  text-align: center;
  color: var(--muted);
}
.nav-item.active em {
  background: var(--accent-line);
  color: var(--accent);
}

.live-dot {
  margin-left: auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.06); }
}

/* -- Sidebar Footer -- */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.status-indicator,
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.status-indicator strong { display: block; font-size: 13px; font-weight: 600; }
.status-indicator small { color: var(--muted); font-size: 11px; }
.status-copy,
.profile-info {
  min-width: 0;
  flex: 1;
  display: grid;
  align-content: center;
}
.status-indicator > .status-dot {
  margin-right: 13px;
  margin-left: 13px;
}
.sidebar-footer :is(.status-indicator, .profile-row) > .icon-btn {
  width: 32px;
  height: 32px;
  margin-left: auto;
  flex: 0 0 auto;
}
.restart-icon-button:not(:disabled):hover {
  background: rgba(245, 158, 11, .12);
  color: var(--color-yellow);
}

.status-dot {
  width: 8px; height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-2);
}
.status-dot.online { background: var(--color-green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12); }

.profile-row {
  min-height: 58px;
}

.avatar {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.profile-info strong {
  max-width: 120px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-info span { color: var(--muted); font-size: 11px; }
.sidebar-version {
  padding: 6px 4px 0;
  color: var(--muted-2);
  font-size: 11px;
}

/* -- Sidebar Backdrop (mobile) -- */
.sidebar-backdrop { display: none; }

/* ===== Main Content ===== */
.main { min-height: 100vh; margin-left: var(--sidebar-w); }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.menu-btn { display: none; }

.breadcrumb { display: flex; align-items: baseline; gap: 8px; }
.breadcrumb > span { color: var(--muted); font-size: 13px; }
.breadcrumb-sep { color: var(--muted-2); font-size: 12px; }
.breadcrumb strong { font-size: 15px; font-weight: 600; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.clock {
  margin-right: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.content {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 20px 28px 72px;
}

.page { display: none; animation: page-in .25s var(--ease); }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Dashboard ===== */
.page-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 3%, var(--surface)) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.welcome-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.welcome-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}
.welcome-version {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.welcome-update-button {
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.welcome-update-button:hover { background: var(--accent-soft); }
.welcome-update-button:disabled { opacity: .55; cursor: wait; }
.welcome-kicker-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

.page-welcome h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
}
.page-welcome h1 b { color: var(--accent); font-weight: 700; }
.page-welcome .text-muted { margin: 8px 0 0; font-size: 14px; }

/* -- Dashboard Grid -- */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 12px;
  margin-bottom: 16px;
}
.dashboard-grid > .card { padding: 22px; }
.dashboard-section-card {
  margin-bottom: 16px;
  padding: 22px;
}
#page-dashboard > .dashboard-section-card:last-child { margin-bottom: 0; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* -- Resource Rings -- */
.rings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.ring-item { display: grid; place-items: center; padding: 8px; text-align: center; }

.ring {
  --color: var(--color-blue);
  --value: 0;
  position: relative;
  width: 96px; height: 96px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--color) calc(var(--value) * 1%), var(--surface-inset) 0);
}
.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
}
.ring span {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.ring-item > strong { margin-top: 12px; font-size: 13px; font-weight: 600; }
.ring-item > small { margin-top: 2px; color: var(--muted); font-size: 11px; }

/* -- Network Stats -- */
.network-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.net-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.net-badge {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.net-badge.up   { color: var(--color-green); background: rgba(34, 197, 94, 0.1); }
.net-badge.down { color: var(--color-blue); background: rgba(59, 130, 246, 0.1); }
.net-badge.host { color: var(--accent); background: var(--accent-soft); }

.net-item small { display: block; color: var(--muted); font-size: 11px; }
.net-item strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -- Info List (run info) -- */
.info-list { display: grid; }
.info-list > div {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.info-list > div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); font-size: 13px; }
.info-list strong {
  max-width: 55%;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.empty-text {
  min-height: 64px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

/* -- Recent Logs (dashboard) -- */
.recent-logs {
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.recent-line {
  min-height: 44px;
  display: grid;
  grid-template-columns: 72px 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.recent-line time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.recent-line p {
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
}
.level.SUCCESS  { color: var(--color-green);  background: rgba(34, 197, 94, 0.1); }
.level.WARNING  { color: var(--color-yellow); background: rgba(245, 158, 11, 0.1); }
.level.ERROR,
.level.CRITICAL { color: var(--color-red);    background: rgba(239, 68, 68, 0.1); }
.level.INFO     { color: var(--color-blue);   background: rgba(59, 130, 246, 0.1); }
.level.DEBUG    { color: var(--muted); }

/* ===== Page Shared ===== */
.page-stack-card {
  overflow: hidden;
  margin-bottom: 16px;
}

.page-stack-card > .page-header {
  margin: 0;
  padding: 22px 24px;
}

.page-intro-card > :is(.tabs-bar, .notice) {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.page-intro-card > .tabs-bar {
  padding: 8px 10px;
}

.page-intro-card > .notice {
  min-height: 52px;
  padding: 11px 18px;
}

.dependency-tools-card > .dependency-install-card,
.dependency-tools-card > .toolbar,
.config-workspace-card > .toolbar {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.dependency-tools-card > .toolbar,
.config-workspace-card > .config-groups {
  border-top: 1px solid var(--line);
}

.config-workspace-card > .config-groups {
  gap: 0;
}

.config-workspace-card .config-group {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.config-workspace-card .config-group + .config-group {
  border-top: 1px solid var(--line);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 4px 0;
}
.page-header h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-header .text-muted { margin: 4px 0 0; font-size: 14px; }

.stat-badge {
  min-width: 72px;
  padding-left: 18px;
  border-left: 2px solid var(--accent-line);
  text-align: right;
}
.stat-badge strong { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.stat-badge span { color: var(--muted); font-size: 12px; }

.badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.loaded {
  border: 1px solid rgba(34, 197, 94, 0.2);
  background: rgba(34, 197, 94, 0.08);
  color: var(--color-green);
}
.badge.disabled {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}
.badge.official {
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.08);
  color: var(--color-blue);
}
.badge.installed {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-outline {
  max-width: min(48vw, 520px);
  overflow: hidden;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
}

.search-box {
  flex: 1;
  min-width: 240px;
  max-width: none;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.search-box.grow { max-width: none; }
.search-box svg { flex-shrink: 0; color: var(--muted); }
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent !important;
  color: var(--text);
  font-size: 13px;
}
.search-box input::placeholder { color: var(--muted-2); }

/* ===== View Toggle ===== */
.view-toggle {
  margin-left: auto;
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.view-toggle button {
  min-width: 34px;
  min-height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}
.view-toggle button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ===== Tabs ===== */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  padding: 6px;
}

.tab {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-soft); color: var(--text-soft); }

.tab em {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-inset);
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.tab.active em {
  background: var(--accent-line);
  color: var(--accent);
}

.tabs-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.tabs-actions .btn {
  flex: 0 0 auto;
}

.tab-link {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}
.tab-link:hover { color: var(--accent); }

.result-meta {
  min-height: 28px;
  padding: 0 2px 10px;
  color: var(--muted);
  font-size: 13px;
}

/* ===== Plugin Cards ===== */
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.plugin-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
  text-align: left;
}
.plugin-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
}
.plugin-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.plugin-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.plugin-state-button {
  min-width: 64px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .15s;
}
.plugin-state-button.enabled {
  border-color: rgba(34, 197, 94, .24);
  background: rgba(34, 197, 94, .08);
  color: var(--color-green);
}
.plugin-state-button.disabled {
  border-color: rgba(239, 68, 68, .24);
  background: rgba(239, 68, 68, .07);
  color: var(--color-red);
}
.plugin-state-button.unloaded {
  border-color: rgba(245, 158, 11, .28);
  background: rgba(245, 158, 11, .09);
  color: #b56900;
}
.plugin-state-button:not(:disabled):hover {
  transform: translateY(-1px);
  filter: saturate(1.25);
}
.plugin-state-button:disabled { opacity: .72; cursor: not-allowed; }

.plugin-avatar {
  position: relative;
  overflow: hidden;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}
.plugin-avatar > span { position: relative; z-index: 0; }
.plugin-avatar-image {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: var(--surface-soft);
}
.plugin-avatar.lg { width: 52px; height: 52px; font-size: 20px; border-radius: 14px; }

.plugin-title { min-width: 0; flex: 1; }
.plugin-title h3 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plugin-title .module {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-card .desc {
  min-height: 44px;
  margin: 14px 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.plugin-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.plugin-meta > span,
.meta-chip {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}
.plugin-meta .detail-hint {
  margin-left: auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

/* Plugin list view */
.plugin-grid.list { grid-template-columns: 1fr; }
.plugin-grid.list .plugin-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(240px, 1.4fr) auto;
  align-items: center;
  gap: 18px;
}
.plugin-grid.list .plugin-card .desc {
  min-height: 0;
  margin: 0;
  -webkit-line-clamp: 2;
}
.plugin-grid.list .plugin-meta { margin-top: 0; }

/* Store tags & footer */
.store-tags {
  min-height: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.store-tag {
  max-width: 120px;
  overflow: hidden;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-tag.muted { background: var(--surface-soft); color: var(--muted); }

.store-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.store-card-footer strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-card-footer span { color: var(--muted); font-size: 11px; }

.store-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.store-actions .btn { min-height: 32px; padding: 0 12px; font-size: 12px; }

.plugin-card.busy { opacity: 0.6; pointer-events: none; }

.store-loading, .store-error { grid-column: 1 / -1; }
.store-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.store-loading i {
  width: 24px; height: 24px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.store-error strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 15px; }
.store-error a { color: var(--accent); }

/* -- Pagination -- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}
.pagination span {
  min-width: 100px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }

/* -- Switch -- */
.switch-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.switch-label input { position: absolute; opacity: 0; }
.switch-track {
  position: relative;
  width: 34px; height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: .18s var(--ease);
}
.switch-label input:checked + .switch-track {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.switch-label input:checked + .switch-track::after {
  left: 16px;
  background: var(--accent);
}

/* ===== Detail Overlay (centered modal) ===== */
.detail-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.detail-overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: fade-in .2s ease;
}

.detail-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: dialog-in .25s var(--ease);
  overflow: hidden;
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.detail-title-row {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.detail-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  word-break: break-word;
}
.detail-header .mono { margin: 4px 0 0; }

.detail-body {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 24px;
  scrollbar-color: var(--line-strong) transparent;
}

.detail-section { margin-bottom: 22px; }
.detail-section h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.detail-desc {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-cell {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.detail-cell span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.detail-cell strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-tag {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}

.detail-adapters { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-adapters span {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.detail-links { display: grid; gap: 8px; }
.detail-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 13px;
  transition: border-color .15s, color .15s;
}
.detail-links a:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

.detail-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  flex-shrink: 0;
}
.detail-footer .btn { flex: 1; min-width: 110px; }

.detail-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-section-head h3 { margin-bottom: 2px; }
.detail-section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.detail-config-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.detail-config-item {
  display: grid;
  gap: 9px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.detail-config-item:last-child { border-bottom: 0; }
.detail-config-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

/* ===== Dependency Management ===== */
.dependency-install-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
  padding: 20px;
}
.dependency-install-card h2 { margin: 0; font-size: 16px; font-weight: 650; }
.dependency-install-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.dependency-install-controls {
  width: min(480px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dependency-install-controls .config-input { flex: 1; min-width: 0; }
.dependency-list { display: grid; gap: 8px; }
.dependency-item {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 104px 132px 220px;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
}
.dependency-main { min-width: 0; display: flex; align-items: center; gap: 12px; }
.dependency-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.dependency-main h3 {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dependency-main p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dependency-version { display: grid; justify-items: start; }
.dependency-version span { color: var(--muted); font-size: 11px; }
.dependency-version strong { font-family: var(--mono); font-size: 12px; }
.dependency-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}
.dependency-readonly { color: var(--muted); font-size: 12px; text-align: right; }

@media (max-width: 1120px) and (min-width: 901px) {
  .dependency-item {
    grid-template-columns: minmax(220px, 1fr) 90px 116px 170px;
    gap: 12px;
  }
}

/* ===== Markdown Content (README in drawer) ===== */
.markdown-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
  word-break: break-word;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 20px 0 10px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
}
.markdown-body h1 { font-size: 22px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.markdown-body h2 { font-size: 18px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.markdown-body h3 { font-size: 16px; }
.markdown-body h4 { font-size: 14px; }
.markdown-body p { margin: 10px 0; }
.markdown-body a { color: var(--accent); }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); }
.markdown-body code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-inset);
  font-family: var(--mono);
  font-size: 0.9em;
}
.markdown-body pre {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent-line);
  color: var(--muted);
}
.markdown-body ul, .markdown-body ol { margin: 10px 0; padding-left: 24px; }
.markdown-body li { margin: 4px 0; }
.markdown-body li > :is(ul, ol) { margin: 4px 0; }
.markdown-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow-x: auto;
  font-size: 13px;
}
.markdown-body th,
.markdown-body td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.markdown-body th { background: var(--surface-soft); font-weight: 600; }
.markdown-body s,
.markdown-body del { color: var(--muted); }
.markdown-body kbd {
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-soft);
  box-shadow: 0 1px 0 var(--line-strong);
  font-family: var(--mono);
  font-size: .86em;
}
.markdown-body details {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.markdown-body summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}
.markdown-body .readme-align-left { text-align: left; }
.markdown-body .readme-align-center { text-align: center; }
.markdown-body .readme-align-right { text-align: right; }
.markdown-body hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ===== Config ===== */
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.notice.warning {
  border: 1px solid rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.06);
  color: var(--color-yellow);
}
.notice.info {
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.06);
  color: var(--color-blue);
}
.has-custom-bg .notice.warning,
.has-custom-bg .notice.info {
  background: var(--glass-panel);
}
.notice svg { flex-shrink: 0; }

.config-groups { display: grid; gap: 12px; }

.config-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.config-group-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.config-group-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.config-group-head span { color: var(--muted); font-size: 12px; }

.config-item {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1.3fr);
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.config-item:last-child { border-bottom: 0; }
.config-key strong {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.config-key span { color: var(--muted); font-size: 11px; }

.config-input-wrap { display: flex; gap: 8px; }
.config-input { height: 40px; font-size: 13px; font-family: var(--mono); }

.secret-toggle {
  flex: 0 0 56px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.save-bar {
  position: fixed;
  z-index: 30;
  right: 28px;
  bottom: 18px;
  left: calc(var(--sidebar-w) + 28px);
  max-width: 1220px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: auto;
  padding: 8px 10px 8px 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(80px);
  transition: .22s var(--ease);
}
.save-bar.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.save-bar > div {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 13px;
}
.save-bar-actions { display: flex; gap: 8px; }

/* ===== Logs ===== */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-green);
  font-size: 13px;
}

.log-toolbar .search-box { max-width: none; }

.custom-select {
  position: relative;
  width: 140px;
  flex: 0 0 140px;
}

.custom-select-trigger {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.custom-select-trigger:hover { background: var(--surface-hover); }
.custom-select.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.custom-select-trigger svg {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform .18s var(--ease);
}
.custom-select.open .custom-select-trigger svg { transform: rotate(180deg); }

.custom-select-menu {
  position: absolute;
  z-index: 85;
  top: calc(100% + 7px);
  right: 0;
  width: 172px;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: select-menu-in .15s var(--ease);
}
@keyframes select-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
}

.custom-select-option {
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border-radius: 7px;
  outline: 0;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  transition: color .12s, background .12s;
}
.custom-select-option:hover,
.custom-select-option:focus-visible { background: var(--surface-hover); color: var(--text); }
.custom-select-option.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.custom-select-option.active::after {
  content: "✓";
  margin-left: auto;
  font-family: var(--font);
}

.level-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--muted-2);
}
.level-dot.INFO { background: var(--color-blue); }
.level-dot.SUCCESS { background: var(--color-green); }
.level-dot.WARNING { background: var(--color-yellow); }
.level-dot.ERROR,
.level-dot.CRITICAL { background: var(--color-red); }
.level-dot.DEBUG { background: var(--muted); }

.terminal {
  overflow: hidden;
}

.terminal-header {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.terminal-dots { display: flex; gap: 6px; }
.terminal-dots i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-red);
}
.terminal-dots i:nth-child(2) { background: var(--color-yellow); }
.terminal-dots i:nth-child(3) { background: var(--color-green); }

.terminal-header > span {
  margin: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.terminal-header > em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.log-lines {
  height: calc(100vh - 280px);
  min-height: 400px;
  overflow: auto;
  padding: 8px 0 20px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  scrollbar-color: var(--line-strong) transparent;
}

.log-line {
  min-height: 32px;
  display: grid;
  grid-template-columns: 72px 68px 130px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 6px 14px;
  border-left: 2px solid transparent;
}
.log-line:hover { background: var(--surface-soft); }
.log-line.ERROR,
.log-line.CRITICAL {
  border-left-color: var(--color-red);
  background: rgba(239, 68, 68, 0.04);
}
.log-line time, .log-line .module {
  overflow: hidden;
  color: var(--muted-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-line p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.empty-state.compact { min-height: 72px; }

/* ===== Modal ===== */
.modal {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
}

.modal-card {
  width: min(440px, 100%);
  padding: 24px;
  border-radius: var(--radius-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 700; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.page-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.github-install-card { width: min(560px, 100%); }
.github-install-card .modal-head { align-items: flex-start; }
.github-install-card .modal-head p { margin: 6px 24px 0 0; }
.github-advanced {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.github-advanced summary {
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
}
.github-advanced[open] summary { margin-bottom: 12px; }
.github-install-hint {
  min-height: 20px;
  margin: 12px 0 0;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .page-head-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* ===== Toast ===== */
.toast-stack {
  position: fixed;
  z-index: 200;
  top: 72px;
  right: 20px;
  display: grid;
  gap: 8px;
}

.toast {
  width: min(340px, calc(100vw - 40px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: toast-in .22s ease;
  font-size: 13px;
}
.toast::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-green);
  flex: 0 0 auto;
}
.toast.error::before { background: var(--color-red); }
.toast.warning::before { background: var(--color-yellow); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } }

/* ===== Appearance Page ===== */
.appearance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
}
.appearance-grid > .card { padding: 22px; }

/* -- Radio Group -- */
.radio-group { display: grid; gap: 8px; }
.radio-group.compact { grid-template-columns: repeat(3, 1fr); }

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.radio-option:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.radio-option:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.radio-option input[type="radio"] {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: 0 0 14px;
  accent-color: var(--accent);
}
.radio-option div { display: grid; gap: 2px; }
.radio-option strong { font-size: 14px; font-weight: 600; color: var(--text); }
.radio-option small { color: var(--muted); font-size: 12px; }

.field-status {
  display: block;
  min-height: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.field-status[data-tone="success"] { color: var(--color-green); }
.field-status[data-tone="error"] { color: var(--color-red); }

.action-row { display: flex; gap: 10px; margin-top: 16px; align-items: center; }

.visual-settings {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.range-setting { display: grid; gap: 8px; }
.range-setting > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.range-setting strong { font-size: 13px; font-weight: 600; }
.range-setting output { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.range-setting input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.visual-settings-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }

.file-upload-btn {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 20px;
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
}
.file-upload-btn:hover { border-color: var(--accent); }
.file-upload-btn strong { font-size: 14px; color: var(--text); }
.file-upload-btn small { color: var(--muted); font-size: 12px; }

/* -- Theme Settings -- */
.theme-card { padding: 22px; }
.theme-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}
.appearance-grid .theme-settings { grid-template-columns: 1fr; }

.theme-section:not(.theme-footer) {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.section-label {
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
}
.section-label span {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}
.section-label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.theme-card .radio-group.compact {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
}
.theme-card .radio-group.compact .radio-option {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-color: transparent;
  background: transparent;
}
.theme-card .radio-group.compact .radio-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-card .radio-group.compact .radio-option:has(input:checked) {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.theme-footer {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.theme-footer .action-row {
  margin-top: 0;
}

.accent-swatches { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform .15s var(--ease), border-color .15s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active {
  border-color: var(--surface);
  outline: 2px solid var(--text);
  outline-offset: 2px;
  transform: scale(1.04);
}
.swatch.custom {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: conic-gradient(#e06b6b, #e0b45e, #7cc47f, #5ea8d8, #9a7fd0, #e06b6b);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.swatch.custom input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

/* ===== GitHub Proxy Section ===== */
.card > .radio-group { margin-bottom: 12px; }
.proxy-option {
  position: relative;
  padding-right: 88px;
}
.proxy-option > div { min-width: 0; }
.proxy-option strong {
  overflow-wrap: anywhere;
}
.proxy-latency {
  position: absolute;
  top: 12px;
  right: 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.4;
  pointer-events: none;
  white-space: nowrap;
}
.proxy-latency[data-status="testing"] { color: var(--accent); }
.proxy-latency[data-status="success"] { color: var(--color-green); }
.proxy-latency[data-status="timeout"] { color: var(--color-yellow); }
.proxy-latency[data-status="failed"] { color: var(--color-red); }

/* ===== Responsive ===== */
@media (max-width: 1180px) {
  .plugin-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .appearance-grid { grid-template-columns: 1fr; }
  .theme-settings { grid-template-columns: 1fr; }
  .radio-group.compact { grid-template-columns: 1fr; }
  .theme-card .radio-group.compact { grid-template-columns: repeat(3, 1fr); }
  .dependency-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .dependency-version { text-align: right; }
  .dependency-item > .badge { justify-self: start; }
}

@media (max-width: 820px) {
  .auth-screen { grid-template-columns: 1fr; padding: 28px 18px; }

  .sidebar {
    width: 260px;
    left: 0;
    transform: translateX(-100%);
    transition: transform .22s var(--ease);
    z-index: 45;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }

  .sidebar-backdrop {
    position: fixed;
    z-index: 42;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
  }
  .sidebar-backdrop.show { display: block; }

  .main { margin-left: 0; }
  .topbar { height: 54px; padding: 0 16px; }
  .menu-btn { display: grid; }
  .content { padding: 16px 16px 72px; }
  .page-welcome { padding: 22px; }
  .dependency-install-card { align-items: stretch; flex-direction: column; gap: 14px; }
  .dependency-install-controls { width: 100%; }

  .plugin-grid { grid-template-columns: 1fr; }
  .plugin-grid.list .plugin-card { display: flex; flex-direction: column; }
  .tabs-bar { overflow-x: auto; }
  .tabs-actions { margin-left: auto; }
  .tab-link { display: none; }
  .tab { flex: 0 0 auto; }
  .toolbar, .log-toolbar { flex-wrap: wrap; }
  .toolbar .search-box, .log-toolbar .search-box {
    flex-basis: 100%;
    min-width: 100%;
    max-width: none;
  }
  .config-item { grid-template-columns: 1fr; gap: 8px; }
  .save-bar { right: 16px; left: 16px; }
  .badge-outline { display: none; }
  .log-lines { height: calc(100vh - 320px); }
  .log-line { grid-template-columns: 64px 58px minmax(0, 1fr); }
  .log-line .module { display: none; }
  .detail-dialog { width: 100%; max-height: calc(100vh - 32px); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .clock, .stat-badge, .live-indicator { display: none; }
  .view-toggle { display: none; }
  .rings-grid { grid-template-columns: 1fr 1fr; }
  .rings-grid .ring-item:last-child { grid-column: 1 / -1; }
  .network-stats { grid-template-columns: 1fr; }
  .recent-line { grid-template-columns: 58px 58px minmax(0, 1fr); }
  .store-card-footer { flex-direction: column; align-items: stretch; }
  .store-actions { justify-content: flex-start; }
  .page-welcome { align-items: stretch; flex-direction: column; gap: 16px; }
  .welcome-kicker { flex-wrap: wrap; }
  .dependency-install-controls { align-items: stretch; flex-direction: column; }
  .dependency-item { grid-template-columns: 1fr; gap: 9px; }
  .dependency-version { text-align: left; }
  .dependency-actions { justify-content: flex-start; }
  .dependency-readonly { text-align: left; }
  .detail-config-actions { align-items: stretch; flex-direction: column; }
  .theme-card { padding: 18px; }
  .theme-card .radio-group.compact { grid-template-columns: 1fr; }
}
.hero-version .version-label { font-size: 12px; color: var(--muted); }
.hero-version strong { font-size: 14px; color: var(--text); }
.hero-status { display: flex; align-items: center; gap: 8px; }

/* Docker deployment operations */
.deployment-panel { margin-bottom: 16px; padding: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.deployment-panel .panel-head { align-items: flex-start; }
.deployment-panel .panel-head p { margin: 5px 0 0; }
.deployment-operations { display: grid; gap: 9px; margin-top: 14px; }
.deployment-operation {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(110px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.deployment-operation strong { display: block; font-size: 13px; }
.deployment-operation small { color: var(--muted); font-family: var(--mono); }
.operation-status { color: var(--text-soft); font-size: 13px; }
.operation-status.failed, .operation-status.rolled_back { color: var(--color-red); }
.operation-status.succeeded { color: var(--color-green); }
.status-note {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}
.status-note:empty { display: none; }
@media (max-width: 700px) {
  .deployment-operation { grid-template-columns: 1fr auto; }
  .deployment-operation .operation-status { grid-column: 1; }
}

/* ===== Unified custom-background glass surfaces =====
   Panels use the configured card opacity. Nested controls step down to
   lighter glass layers so a custom background remains visible consistently. */
.has-custom-bg :is(.auth-card, .modal-card, .save-bar, .toast) {
  background: var(--glass-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.has-custom-bg :is(
  .status-indicator,
  .profile-row,
  .search-box,
  .field input,
  .config-input,
  .select,
  .custom-select-trigger,
  .custom-select-menu,
  .view-toggle,
  .net-item,
  .radio-option,
  .theme-section:not(.theme-footer),
  .theme-card .radio-group.compact,
  .file-upload-btn,
  .config-group-head,
  .secret-toggle,
  .detail-cell,
  .detail-links a,
  .detail-footer,
  .detail-config-item,
  .terminal-header,
  .github-advanced,
  .deployment-operation
) {
  background: var(--glass-control);
}

.has-custom-bg :is(
  .status-indicator,
  .profile-row,
  .search-box,
  .field input,
  .config-input,
  .select,
  .custom-select-trigger,
  .custom-select-menu,
  .net-item,
  .radio-option,
  .file-upload-btn,
  .detail-cell,
  .detail-links a
) {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.has-custom-bg .btn:not(.btn-primary):not(.btn-danger) {
  background: var(--glass-control);
}
.has-custom-bg .btn:not(.btn-primary):not(.btn-danger):not(:disabled):hover,
.has-custom-bg .radio-option:hover {
  background: var(--glass-panel);
}

.has-custom-bg :is(.icon-btn:hover, .nav-item:hover, .log-line:hover) {
  background: var(--glass-inset);
}

.has-custom-bg :is(
  .badge:not(.loaded):not(.disabled):not(.official):not(.installed),
  .badge-outline,
  .plugin-meta > span,
  .meta-chip,
  .store-tag.muted,
  .detail-adapters span,
  .progress,
  .switch-track,
  .level.DEBUG,
  .status-note,
  .tab em
) {
  background: var(--glass-inset);
}

.has-custom-bg .view-toggle button.active,
.has-custom-bg .theme-card .radio-group.compact .radio-option:has(input:checked) {
  background: var(--glass-control);
}

.has-custom-bg .radio-option:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 12%, var(--glass-control));
}

.has-custom-bg .ring {
  background: conic-gradient(
    var(--color) calc(var(--value) * 1%),
    var(--glass-inset) 0
  );
}
.has-custom-bg .ring::before {
  background: var(--glass-control);
}

.has-custom-bg :is(.field input, .config-input, .select, .search-box):focus,
.has-custom-bg .search-box:focus-within {
  background: var(--glass-panel);
}

.has-custom-bg .page-stack-card > .page-header {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.has-custom-bg .page-stack-card > :is(.tabs-bar, .notice, .toolbar),
.has-custom-bg .config-workspace-card .config-group-head {
  background: var(--glass-inset);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.has-custom-bg .config-workspace-card .config-group {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.has-custom-bg .detail-overlay-bg {
  background: rgba(15, 23, 42, .2);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.has-custom-bg .detail-dialog {
  background: var(--glass-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.has-custom-bg .detail-header {
  background: var(--glass-control);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.has-custom-bg .detail-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass-inset);
}
.has-custom-bg .detail-section:last-child {
  margin-bottom: 0;
}
.has-custom-bg .detail-config-list,
.has-custom-bg #detail-readme {
  background: var(--glass-control);
}
.has-custom-bg #detail-readme {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.has-custom-bg .markdown-body :is(code, pre, th) {
  background: var(--glass-inset);
}

.markdown-body img {
  display: block;
  height: auto;
  margin: 14px auto;
}
.markdown-body > :first-child {
  margin-top: 0;
}
.markdown-body > :last-child {
  margin-bottom: 0;
}
