/* Cloud Panel overrides on Gentelella */

.hidden { display: none !important; }

/* Gentelella ships dark sidebar tokens in :root only — tie sidebar + topbar to data-theme */
[data-theme="light"] {
  --sidebar-bg: #ffffff;
  --sidebar-hover: rgba(15, 38, 51, 0.05);
  --sidebar-active: rgba(26, 187, 156, 0.12);
  --sidebar-text: #626d7d;
  --sidebar-text-hover: #1e2633;
  --sidebar-text-active: #1e2633;
  --sidebar-border: #e6e7eb;
  --bg-muted: #f3f4f6;
}

[data-theme="dark"] {
  --sidebar-bg: #1a2332;
  --sidebar-hover: rgba(255, 255, 255, 0.04);
  --sidebar-active: rgba(26, 187, 156, 0.08);
  --sidebar-text: #7b8fa3;
  --sidebar-text-hover: #c5d0dc;
  --sidebar-text-active: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --bg-muted: #141d2b;
}

[data-theme="light"] .sidebar .brand-name,
[data-theme="light"] .sidebar-user-info .name {
  color: var(--text);
}

[data-theme="dark"] .sidebar .brand-name,
[data-theme="dark"] .sidebar-user-info .name {
  color: #fff;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .topbar {
  background: rgba(20, 29, 43, 0.85);
}

[data-theme="light"] .sidebar-toggle {
  color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-toggle {
  color: var(--text-secondary);
}

/*
 * Button system (Cloud Panel)
 * Use these classes only — avoid one-off button styling in feature CSS.
 *
 * Primary CTA:        btn btn-primary [btn-sm]
 * Secondary:          btn btn-outline [btn-sm]
 * Destructive:        btn btn-danger [btn-sm]
 * Destructive subtle: btn btn-outline-danger [btn-sm]
 * Low emphasis:       btn btn-ghost [btn-sm]
 * External link CTA:  a.btn.btn-primary [btn-sm]  (never raw styled <a>)
 * Tab / segment pick: btn-tabs > btn btn-outline btn-sm [.active]
 * Modal footer:       btn-outline (cancel) + btn-primary (confirm) — via showModal()
 * Icon toggle group:  view-btn (Gentelella fm-view-toggle)
 * Page method tabs:   deploy-method-tab (deploy page only)
 * Card selectors:     deploy-app-card (deploy page only)
 */

/* Base: anchors styled as buttons must not inherit link underlines/colors */
a.btn,
a.btn:hover,
a.btn:focus,
a.btn:focus-visible,
a.btn:active,
a.btn:visited {
  text-decoration: none;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
  vertical-align: middle;
}

.btn:disabled,
.btn[disabled],
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary,
a.btn-primary,
a.btn-primary:visited {
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible,
a.btn-primary:hover,
a.btn-primary:focus-visible {
  color: #fff;
  text-decoration: none;
}

/* Outline — theme-safe surface + readable text in light and dark */
.btn-outline,
a.btn-outline,
a.btn-outline:visited {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.btn-outline:hover,
.btn-outline:focus-visible,
a.btn-outline:hover,
a.btn-outline:focus-visible {
  background: var(--bg-surface-secondary);
  color: var(--text);
  border-color: var(--border-color);
  text-decoration: none;
}

/* Danger solid */
.btn-danger,
a.btn-danger,
a.btn-danger:visited {
  color: #fff;
}
.btn-danger:hover,
.btn-danger:focus-visible,
a.btn-danger:hover,
a.btn-danger:focus-visible {
  color: #fff;
  text-decoration: none;
}

/* Destructive outline (prefer over btn-outline + btn-danger) */
.btn-outline-danger,
a.btn-outline-danger,
a.btn-outline-danger:visited {
  background: var(--bg-surface);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, var(--border-color));
}
.btn-outline-danger:hover,
.btn-outline-danger:focus-visible,
a.btn-outline-danger:hover,
a.btn-outline-danger:focus-visible {
  background: var(--red-lt);
  color: var(--red);
  border-color: var(--red);
  text-decoration: none;
}

/* Ghost */
.btn-ghost,
a.btn-ghost,
a.btn-ghost:visited {
  color: var(--text-secondary);
}
.btn-ghost:hover,
.btn-ghost:focus-visible,
a.btn-ghost:hover,
a.btn-ghost:focus-visible {
  color: var(--text);
  text-decoration: none;
}

/* Segmented tab buttons (SSL provider, etc.) */
.btn-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.btn-tabs .btn.active {
  background: var(--primary-lt);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* Gentelella uses select.form-control; panel markup uses .form-select — align both */
select.form-select,
select.form-control {
  width: 100%;
  height: 36px;
  font: inherit;
  color: var(--text);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  padding: 0 32px 0 12px;
  display: block;
  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 12 12' fill='none' stroke='%239ba5b1' stroke-width='1.5'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.form-select:focus,
select.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
select.form-select:disabled,
select.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
select.form-select[style*="width:auto"],
select.form-control[style*="width:auto"] {
  width: auto;
  min-width: 8rem;
}

.sidebar-brand .brand-icon {
  padding: 0;
  background: transparent;
  overflow: hidden;
}
.sidebar-brand .brand-icon img {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.search-dropdown-wrap { position: relative; flex: 1; max-width: 420px; }
.search-dropdown-wrap .search-box { width: 100%; }
.search-dropdown-wrap .search-box input { width: 100%; }
.search-dropdown-wrap .search-box kbd { display: none; }

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.search-dropdown.open { display: block; }
.search-group-title {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.search-item {
  display: block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid var(--border-color-light);
}
.search-item:hover { background: var(--bg-surface-secondary); }
.search-item small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.search-empty { padding: 1rem; color: var(--text-muted); font-size: 0.875rem; }

.user-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem 0;
  z-index: 200;
}
.user-menu-popover .user-menu-header {
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color-light);
}
.user-menu-popover button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.85rem;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.user-menu-popover button:hover { background: var(--bg-surface-secondary); }

.topbar-right { position: relative; }

.code-block {
  display: block;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8125rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.metrics-chart-wrap { padding: 0.5rem 0; }
#file-content { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.8125rem; }

.auth-brand .brand-icon {
  padding: 0;
  background: transparent;
  width: auto;
  height: auto;
}
.auth-brand .brand-icon img { width: 48px; height: 48px; border-radius: 10px; }

.login-theme-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

/* Email 2FA verification */
.twofa-card { max-width: 420px; }
.twofa-form { margin-top: 1.5rem; }
.twofa-inputs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.twofa-digit {
  width: 2.75rem;
  height: 3.25rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  caret-color: transparent;
}
.twofa-digit:focus {
  outline: none;
  border-color: var(--accent, #14b8a6);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}
.twofa-digit-error {
  border-color: var(--red, #ef4444);
  animation: twofa-shake 0.35s ease;
}
@keyframes twofa-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.twofa-error {
  min-height: 1.25rem;
  font-size: 0.875rem;
  color: var(--red, #ef4444);
  text-align: center;
  margin-bottom: 0.25rem;
}
.twofa-status {
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.25rem;
}
.twofa-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.twofa-resend-line { margin: 0 0 0.75rem; }
.twofa-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent, #0d9488);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.twofa-link-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}
.twofa-countdown { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.twofa-cancel {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
}
.twofa-cancel:hover { color: var(--text); text-decoration: underline; }

/* Server IP addresses (primary + floating) */
.server-addresses { display: flex; flex-direction: column; gap: 0.25rem; }
.server-ips-cell .server-addresses { align-items: flex-start; }
.server-ip-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
}
.server-ip-label {
  flex: 0 0 4.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.server-ip-value {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.8125rem;
  background: none;
  padding: 0;
  color: var(--text);
}
.server-nav-ip.server-addresses .server-ip-line { font-size: 0.75rem; }
.server-nav-ip.server-addresses .server-ip-label { flex-basis: 3.5rem; }
.server-ip-muted { color: var(--text-muted); }
.form-optional { font-weight: 400; color: var(--text-muted); font-size: 0.8125rem; }

/* Web app environment variables */
.env-panel-body { padding: 1rem 1.25rem 1.25rem; }
.env-hint { color: var(--text-muted); margin: 0 0 1rem; }
.env-table .form-control-sm { font-size: 0.8125rem; }
.env-key-input { font-family: var(--font-mono, ui-monospace, monospace); text-transform: uppercase; }
.env-value-cell { display: flex; gap: 0.35rem; align-items: center; }
.env-value-cell .form-control { flex: 1; }
.env-reveal-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--accent, #0d9488);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
}
.env-preview-card {
  margin-top: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.env-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8125rem;
}
.env-preview-title { font-weight: 600; }
.env-preview-meta { color: var(--text-muted); font-size: 0.75rem; }
.env-preview-block { margin: 0; border: none; border-radius: 0; max-height: 220px; }
.env-sync-chip.env-chip-green { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.env-sync-chip.env-chip-yellow { background: rgba(234, 179, 8, 0.12); color: #ca8a04; }
.env-sync-chip.env-chip-blue { background: rgba(59, 130, 246, 0.12); color: #2563eb; }

.redis-panel-body { padding: 1rem 1.25rem 1.25rem; }
.redis-hint { color: var(--text-muted); margin: 0 0 1rem; }
.redis-password-row { display: flex; gap: 0.5rem; align-items: center; }
.redis-password-row .form-control { flex: 1; }
.redis-stats-row { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--text-muted); font-size: 0.8125rem; margin: 0.75rem 0 1rem; }
.redis-app-panel-body { padding: 1rem 1.25rem 1.25rem; }
.redis-enable-row { margin-bottom: 1rem; }
.redis-use-fieldset { border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; padding: 0.75rem 1rem; margin: 0 0 1rem; }
.redis-use-fieldset legend { font-size: 0.8125rem; font-weight: 600; padding: 0 0.25rem; }
.redis-use-fieldset .form-check { display: flex; margin-bottom: 0.35rem; }
.redis-conn-preview { background: var(--bg-muted, #f8fafc); border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.8125rem; }
.redis-conn-label { display: block; color: var(--text-muted); margin-bottom: 0.25rem; }
.redis-cache-card { margin-bottom: 1rem; padding: 0.875rem 1rem; border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; background: var(--bg-muted, #f8fafc); }
.redis-cache-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.redis-cache-title { font-weight: 600; font-size: 0.9375rem; }
.redis-cache-meta { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.15rem; }

.deploy-panel-body { padding: 1rem 1.25rem 1.25rem; }
.deploy-health-fieldset { border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; padding: 0.75rem 1rem; margin: 0 0 1rem; }
.deploy-health-fieldset legend { font-size: 0.8125rem; font-weight: 600; padding: 0 0.25rem; }
.deploy-health-fieldset .form-check { display: flex; margin-bottom: 0.35rem; }
.deploy-webhook-block { margin-top: 1.25rem; }
.deploy-webhook-label { color: var(--text-muted); font-size: 0.8125rem; margin: 0 0 0.35rem; }
.deploy-history-block { margin-top: 1.5rem; }
.deploy-history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.deploy-history-title { font-weight: 600; font-size: 0.9375rem; }
.deploy-auth-fieldset { border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; padding: 0.75rem 1rem; margin: 0 0 1rem; }
.deploy-auth-fieldset legend { font-size: 0.8125rem; font-weight: 600; padding: 0 0.25rem; }
.deploy-auth-options .form-check { display: flex; margin-bottom: 0.35rem; }
.deploy-key-panel { margin-top: 0.75rem; }
.deploy-key-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.deploy-key-hint { color: var(--text-muted); font-size: 0.8125rem; margin: 0 0 0.35rem; }
.deploy-key-pre { font-size: 0.75rem; word-break: break-all; white-space: pre-wrap; margin: 0 0 0.5rem; }
.deploy-key-copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.deploy-key-fingerprint { font-size: 0.8125rem; color: var(--text-muted); font-family: var(--font-mono, monospace); }
.deploy-key-warn { color: #ca8a04; font-size: 0.8125rem; margin: 0.75rem 0 0; }
.deploy-status-chip.deploy-chip-green { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.deploy-status-chip.deploy-chip-yellow { background: rgba(234, 179, 8, 0.12); color: #ca8a04; }
.deploy-status-chip.deploy-chip-red { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.deploy-status-chip.deploy-chip-blue { background: rgba(59, 130, 246, 0.12); color: #2563eb; }

/* Hide main until shell is injected (prevents layout flash on navigation) */
body[data-shell="admin"]:not(.shell-ready) .main {
  visibility: hidden;
}

.tab-panel.hidden { display: none !important; }
.server-view.hidden { display: none !important; }

/* Server detail: dual-sidebar layout (RunCloud-style) */
body.server-detail.sidebar-rail .main {
  /* Keep topbar offset from Gentelella (.main { padding-top: 56px }) */
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  max-width: none;
}

body.server-detail .main {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  max-width: none;
}

body.webapp-detail .main {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  max-width: none;
}

/* Collapsed primary sidebar: separate from adjacent panels */
body.sidebar-rail .sidebar {
  border-right: 1px solid var(--sidebar-border);
}

/* Locked icon rail: no expand, no pseudo-tooltip scroll bleed */
body.sidebar-rail-locked.sidebar-rail .sidebar,
body.sidebar-rail-locked.sidebar-rail .sidebar-nav {
  overflow: hidden !important;
}

body.sidebar-rail-locked.sidebar-rail .nav-link[data-rail-label]::after {
  display: none !important;
}

body.sidebar-rail-locked .sidebar-toggle {
  pointer-events: none;
  opacity: 0.4;
  cursor: default;
}

@media (min-width: 769px) {
  body.sidebar-rail-locked .sidebar-toggle {
    display: none;
  }
}

.server-layout {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: calc(100vh - 56px);
}

.server-nav {
  width: 220px;
  flex-shrink: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background: var(--bg-surface);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  overflow: hidden;
}

.server-nav-card {
  flex-shrink: 0;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-color-light);
}

.server-nav-back {
  display: inline-block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 0.65rem;
}
.server-nav-back:hover { color: var(--primary); }

.server-nav-title {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.3;
  word-break: break-word;
}

.server-nav-ip {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.server-nav-card .status {
  margin-top: 0.5rem;
  display: inline-block;
}

.webapp-nav-server {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color-light);
}

.webapp-nav-server-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.webapp-nav-server-name {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
}
.webapp-nav-server-name:hover { color: var(--primary); }

.webapp-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stack-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border-color-light);
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
}

.stack-chip-php { color: #777bb4; border-color: #777bb433; background: #777bb414; }
.stack-chip-python { color: #306998; border-color: #30699833; background: #30699814; }
.stack-chip-node { color: #68a063; border-color: #68a06333; background: #68a06314; }
.stack-chip-static { color: var(--text-muted); }
.stack-chip-nginx { color: #009639; border-color: #00963933; background: #00963914; }
.stack-chip-type { color: #21759b; border-color: #21759b33; background: #21759b14; }
.stack-chip-mode { text-transform: capitalize; }

body.webapp-loading #app-name,
body.webapp-loading #webapp-nav-name {
  opacity: 0.55;
}

.server-nav-links {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.5rem 0.65rem 1rem;
  gap: 0.15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.server-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: var(--radius-md, 6px);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.server-nav-link:hover {
  background: var(--bg-surface-secondary);
  color: var(--text);
}
.server-nav-link.active {
  background: var(--primary-lt, #1abb9c0f);
  color: var(--primary, #1abb9c);
  font-weight: 500;
}
.server-nav-icon {
  display: flex;
  flex-shrink: 0;
  opacity: 0.85;
}
.server-nav-link.active .server-nav-icon { opacity: 1; }

.ssh-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}
.ssh-subnav-link {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.ssh-subnav-link:hover { color: var(--text); border-color: var(--text-muted); }
.ssh-subnav-link.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.server-nav-group {
  padding: 0.35rem 0.65rem 0.15rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.webapp-coming-soon {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.webapp-coming-soon strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.server-workspace {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem 2rem;
}

@media (max-width: 768px) {
  .server-layout { flex-direction: column; }
  .server-nav {
    width: 100%;
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .server-nav-links {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    flex: none;
    min-height: auto;
    padding-bottom: 0.65rem;
  }
  .server-nav-link {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .server-workspace { padding: 1rem; }
}

.server-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.server-meta li { display: flex; align-items: center; gap: 0.35rem; }
.server-meta-agent { flex-wrap: wrap; gap: 0.5rem; }
.server-meta-icon { opacity: 0.7; font-size: 0.9rem; }
.server-load-hint {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--primary, #3b82f6) 12%, transparent);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.server-load-hint.hidden { display: none; }
.table-loading td {
  color: var(--text-muted);
  padding: 1rem 1.25rem !important;
  font-size: 0.875rem;
}
.agent-update-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.stat-with-detail .stat-content { flex: 1; min-width: 0; }
.stat-detail {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.stat-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-surface-secondary);
  margin-top: 0.5rem;
  overflow: hidden;
}
.stat-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: #14b8a6;
  width: 0;
  transition: width 0.3s ease;
}
.stat-progress-bar.disk { background: #eab308; }

.server-counts {
  display: flex;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.85rem 1.25rem;
  gap: 0;
}
.server-count-item {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 1rem;
  border-right: 1px solid var(--border-color-light);
}
.server-count-item:last-child { border-right: none; }
.server-count-label { color: var(--text-muted); font-size: 0.875rem; }
.server-count-value { font-weight: 600; font-size: 1rem; }

.agent-target-callout {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #f59e0b55;
  background: #f59e0b14;
  font-size: 0.875rem;
}
.agent-target-callout strong { display: block; margin-bottom: 0.35rem; }
.agent-target-callout p { margin: 0; color: var(--text-muted); }

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  justify-content: flex-end;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.apps-empty { grid-column: 1 / -1; }

.apps-list-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.apps-table td .cell-actions {
  white-space: nowrap;
}

/* Web apps list/card view toggle (Gentelella uses fm-view-toggle) */
.fm-view-toggle {
  display: inline-flex;
  flex-direction: row;
  flex-shrink: 0;
}

.is-loading {
  opacity: 0.65;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Deploy web app page (RunCloud-style) */
.deploy-workspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 2rem);
  padding-bottom: 5rem;
}
.deploy-form { max-width: 920px; }
.deploy-method-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
}
.deploy-method-tab {
  appearance: none;
  border: none;
  background: none;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.deploy-method-tab:hover { color: var(--text); }
.deploy-method-tab.active {
  color: var(--primary, #14b8a6);
  border-bottom-color: var(--primary, #14b8a6);
}
.deploy-oneclick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.deploy-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.deploy-app-card:hover {
  border-color: var(--primary, #14b8a6);
  box-shadow: var(--shadow-sm);
}
.deploy-app-card.active {
  border-color: var(--primary, #14b8a6);
  background: color-mix(in srgb, var(--primary, #14b8a6) 8%, var(--bg-surface));
}
.deploy-app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  background: var(--bg-surface-secondary);
  color: var(--text);
}
.deploy-app-icon-wp { background: #21759b; color: #fff; }
.deploy-app-icon-pma { background: #f59200; color: #fff; font-size: 0.75rem; }
.deploy-app-icon-py { background: #306998; color: #ffd43b; font-size: 0.7rem; font-weight: 700; }
.deploy-app-icon-node { background: #333; color: #68a063; font-size: 0.7rem; font-weight: 700; }

.runtime-install-banner {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.runtime-install-banner.hidden { display: none; }
.runtime-install-banner span { color: var(--text-muted); font-size: 0.875rem; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}
.pagination-bar.hidden { display: none; }
.pagination-summary {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.pagination-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.pagination-page {
  color: var(--text-muted);
  font-size: 0.875rem;
  min-width: 6rem;
  text-align: center;
}
.deploy-app-name { font-weight: 600; font-size: 0.9375rem; }
.deploy-app-desc { font-size: 0.75rem; color: var(--text-muted); }
.deploy-section {
  margin-bottom: 1rem;
  overflow: hidden;
}
.deploy-section-head {
  padding: 1rem 1.25rem 0;
}
.deploy-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.deploy-section-sub {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.15rem;
}
.deploy-section-body { padding: 0.75rem 1.25rem 1.25rem; }
.deploy-accordion > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
}
.deploy-accordion > summary::-webkit-details-marker { display: none; }
.deploy-accordion-trigger {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.deploy-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary, #14b8a6);
  margin-left: 0.35rem;
}
.deploy-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.deploy-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
}
.deploy-subheading {
  margin: 1.25rem 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}
.deploy-subheading:first-of-type { margin-top: 0; }
.deploy-warning {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, #eab308 12%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, #eab308 35%, transparent);
  font-size: 0.8125rem;
  margin: 0 0 1rem;
}
.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}
.deploy-form .form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
}
.deploy-form .form-check input { margin-top: 0.2rem; }
.deploy-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}
@media (min-width: 992px) {
  body.server-detail .deploy-footer,
  body.webapp-detail .deploy-footer {
    left: calc(var(--sidebar-w, 64px) + 220px);
  }
}
.server-nav-links a.server-nav-link {
  text-decoration: none;
  color: inherit;
}

/* Loading state (see shared.js setButtonLoading) */
.btn[aria-busy="true"] {
  min-width: 6.5rem;
}

/* SSL / TLS */
.ssl-panel-card {
  display: flex;
  flex-direction: column;
  min-height: min(520px, calc(100vh - 10rem));
}
.ssl-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1.25rem;
  padding: 1rem 1.25rem 1.25rem;
}
.ssl-renewal-notice {
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--primary, #2563eb) 25%, var(--border-color));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary, #2563eb) 6%, var(--bg-muted, rgba(0,0,0,0.02)));
}
.ssl-renewal-notice-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.ssl-renewal-notice-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}
.ssl-auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-muted, rgba(0,0,0,0.02));
}
.ssl-auto-title { font-weight: 600; margin-bottom: 0.15rem; }
.ssl-auto-desc { color: var(--text-muted); font-size: 0.875rem; }
.domain-www-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}
.domain-www-inherited {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.domain-www-select {
  min-width: 11rem;
}
.domain-name-cell {
  font-weight: 600;
}
.domain-www-paired-row td {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-muted, #f6f7f9) 70%, transparent);
}
.domain-www-paired-row .domain-name-cell {
  font-weight: 500;
}
.ssl-empty-hint { color: var(--text-muted); margin: 0; font-size: 0.875rem; text-align: center; padding: 2rem 1rem; }
.ssl-domain-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  width: 100%;
}
.ssl-domain-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ssl-domain-card:hover {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border-color));
  box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, 0.06));
}
.ssl-domain-card[data-status="active"] {
  border-left: 3px solid var(--green, #2fb344);
}
.ssl-domain-card[data-status="pending"] {
  border-left: 3px solid var(--yellow, #f59f00);
}
.ssl-domain-card[data-status="failed"] {
  border-left: 3px solid var(--red, #d63939);
}
.ssl-domain-card-main {
  flex: 1;
  min-width: 0;
}
.ssl-domain-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}
.ssl-domain-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.ssl-domain-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ssl-domain-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color-light, var(--border-color));
}
.ssl-domain-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}
.ssl-domain-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.875rem;
  color: var(--text);
}
.ssl-domain-meta-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.ssl-domain-meta-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.ssl-domain-issue-hint {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin: 0.35rem 0 0.5rem;
}
.ssl-modal-canonical-hint {
  margin: -0.35rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-muted, rgba(0,0,0,0.03));
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}
.ssl-domain-card-actions {
  flex-shrink: 0;
  padding-top: 0.15rem;
}
@media (max-width: 640px) {
  .ssl-domain-card {
    flex-direction: column;
    align-items: stretch;
  }
  .ssl-domain-card-actions .btn {
    width: 100%;
  }
}
.ssl-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.ssl-status-badge.active { background: #d1fae5; color: #065f46; }
.ssl-status-badge.pending { background: #fef3c7; color: #92400e; }
.ssl-status-badge.failed { background: #fee2e2; color: #991b1b; }
.ssl-status-badge.none { background: var(--bg-muted); color: var(--text-muted); }
.ssl-renewal-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
}
[data-theme="dark"] .ssl-renewal-badge { background: #1e3a8a; color: #bfdbfe; }

/* Performance / caching */
.cache-panel-card { display: flex; flex-direction: column; min-height: min(520px, calc(100vh - 10rem)); }
.cache-panel-body { display: flex; flex-direction: column; gap: 1.25rem; padding: 1rem 1.25rem 1.25rem; }
.cache-purge-panel {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-muted, rgba(0,0,0,0.02));
}
.cache-features-pending .cache-feature-card { opacity: 0.92; }
.cache-purge-title { font-weight: 600; margin-bottom: 0.25rem; color: var(--text); }
.cache-purge-desc, .cache-purge-note { margin: 0; color: var(--text-muted); font-size: 0.875rem; line-height: 1.45; }
.cache-purge-desc { margin-bottom: 0.75rem; }
.cache-purge-note { margin-top: 0.65rem; font-size: 0.82rem; }
.cache-purge-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.cache-purge-form .form-control { min-width: 12rem; flex: 1 1 12rem; }
.cache-feature-list { display: flex; flex-direction: column; gap: 0.75rem; }
.cache-status-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--primary, #2563eb) 20%, var(--border-color));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary, #2563eb) 6%, var(--bg-muted, rgba(0,0,0,0.02)));
  color: var(--text-muted);
  font-size: 0.875rem;
}
.cache-status-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: cache-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes cache-spin { to { transform: rotate(360deg); } }
.cache-feature-card {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1rem; border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-surface); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
}
.cache-feature-card.is-skeleton { pointer-events: none; }
.cache-skeleton-line {
  height: 0.75rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-muted) 25%, color-mix(in srgb, var(--border-color) 50%, var(--bg-muted)) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: cache-shimmer 1.2s ease-in-out infinite;
}
.cache-skeleton-line.title { width: 42%; height: 0.9rem; margin-bottom: 0.55rem; }
.cache-skeleton-line.desc { width: 88%; margin-bottom: 0.35rem; }
.cache-skeleton-line.meta { width: 34%; height: 0.65rem; }
@keyframes cache-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.cache-feature-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.cache-feature-title { font-weight: 600; color: var(--text); }
.cache-feature-tag {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem; border-radius: 999px; background: var(--bg-muted); color: var(--text-muted);
}
.cache-feature-desc { margin: 0 0 0.5rem; color: var(--text-muted); font-size: 0.875rem; line-height: 1.45; }
.cache-feature-meta { display: flex; flex-wrap: wrap; gap: 0.65rem 1rem; font-size: 0.82rem; }
.cache-feature-meta-label { color: var(--text-muted); margin-right: 0.25rem; }
.cache-feature-detail { color: var(--text-muted); }
.cache-feature-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.cache-status-on { color: var(--green, #059669); font-weight: 600; }
.cache-status-off { color: var(--text-muted); }
.cache-status-pending { color: var(--text-muted); font-style: italic; }
.cache-empty-hint { color: var(--text-muted); margin: 0; font-size: 0.875rem; text-align: center; padding: 2rem 1rem; }
[data-theme="dark"] .cache-status-on { color: #6ee7b7; }
@media (max-width: 720px) {
  .cache-feature-card { flex-direction: column; }
  .cache-feature-actions { width: 100%; justify-content: flex-end; }
}
[data-theme="dark"] .ssl-status-badge.active { background: #064e3b; color: #a7f3d0; }
[data-theme="dark"] .ssl-status-badge.pending { background: #78350f; color: #fde68a; }
[data-theme="dark"] .ssl-status-badge.failed { background: #7f1d1d; color: #fecaca; }
.ssl-form-section { display: none; }
.ssl-form-section.active { display: block; }
.ssl-form-section .form-group { margin-bottom: 0.85rem; }
.ssl-form-section textarea.form-control { min-height: 120px; font-family: ui-monospace, monospace; font-size: 0.8rem; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-color);
  border-radius: 24px;
  transition: 0.2s;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
