:root {
  color-scheme: dark;
  --bg: #030712;
  --bg-accent: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.25), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(14, 165, 233, 0.2), transparent 40%);
  --surface: #0f172a;
  --surface-soft: rgba(15, 23, 42, 0.82);
  --surface-strong: rgba(15, 23, 42, 0.95);
  --border: rgba(148, 163, 184, 0.25);
  --border-strong: rgba(148, 163, 184, 0.4);
  --card-border: rgba(148, 163, 184, 0.35);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-strong: #2563eb;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow-lg: 0 25px 70px rgba(2, 6, 23, 0.65);
  --shadow-md: 0 15px 45px rgba(2, 6, 23, 0.45);
  --global-scale: 0.75;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

@media (min-width: 1280px) {
  body {
    zoom: var(--global-scale);
  }
  @supports not (zoom: 0.75) {
    body {
      transform: scale(var(--global-scale));
      transform-origin: top center;
      min-height: calc(100vh / var(--global-scale));
    }
    body > * {
      width: calc(100% / var(--global-scale));
    }
  }
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-accent);
  opacity: 0.9;
  box-shadow: 0 20px 35px rgba(2, 6, 23, 0.45);
  pointer-events: none;
  z-index: -1;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
}


.server-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 0%, rgba(96, 165, 250, 0.22), transparent 55%);
  opacity: 0;
  transition: opacity 250ms ease;
}

.server-card:hover::after {
  opacity: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

button {
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.card-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.stat-block {
  flex: 1;
  min-width: 90px;
  background: rgba(2, 6, 23, 0.4);
  border-radius: 0.9rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.stat-block span {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-block strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 0.2rem;
}

.status-chip {
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-chip[data-state='online'] {
  border-color: rgba(52, 211, 153, 0.6);
  color: var(--success);
}

.status-chip[data-state='offline'] {
  border-color: rgba(248, 113, 113, 0.6);
  color: var(--danger);
}

.status-chip[data-state='starting'] {
  border-color: rgba(96, 165, 250, 0.6);
  color: var(--accent);
}

.status-chip[data-state='stopping'] {
  border-color: rgba(251, 191, 36, 0.6);
  color: var(--warning);
}

.auth-view {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 4rem);
}

.auth-layout {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  background: rgba(2, 6, 23, 0.82);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  padding: clamp(2rem, 4vw, 3rem);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.auth-hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 1rem;
}

.hero-badge {
  align-self: flex-start;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.5);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.auth-hero h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin: 0;
}

.auth-hero p {
  color: var(--muted);
  line-height: 1.6;
}

.hero-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
}

.auth-card {
  background: var(--surface);
  border-radius: 1.5rem;
  padding: clamp(1.75rem, 3vw, 2.5rem);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-title {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.auth-lead {
  margin: 0.2rem 0 0;
  font-size: 1.1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-form label {
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-form input {
  padding: 0.95rem 1.1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
}

.auth-form button {
  margin-top: 0.4rem;
  padding: 0.95rem 1.1rem;
  border-radius: 0.9rem;
  background: linear-gradient(120deg, #60a5fa, #2563eb);
  border: none;
  font-weight: 600;
  color: #020617;
  box-shadow: 0 20px 45px rgba(37, 99, 235, 0.35);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.auth-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 25px 55px rgba(37, 99, 235, 0.4);
}

.auth-hint {
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    padding-right: 0;
  }
}

.app {
  display: none;
}

.app:not(.hidden) {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background: var(--surface-strong);
  border-right: 1px solid var(--border);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 0;
  height: 100%;
}

.logo {
  font-size: 1.6rem;
  font-weight: 700;
}

nav {
  display: grid;
  gap: 0.75rem;
}

.nav-btn {
  all: unset;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-btn.active {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
}

.nav-btn.danger {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.08);
  margin-top: auto;
}

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.sidebar-section h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.server-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-server {
  all: unset;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid transparent;
  cursor: pointer;
}

.sidebar-server.active {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.15);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2.25rem 2.5rem;
  min-width: 0;
  min-height: 0;
  flex: 1;
}

.content.no-selection #dashboard-section,
.content.has-selection #server-section {
  display: flex;
  animation: fadeUp 220ms ease;
}

.content.no-selection #server-section,
.content.has-selection #dashboard-section {
  display: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  background: var(--surface);
  border-radius: 1.25rem;
  border: 1px solid var(--border);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

#dashboard-section {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(79, 70, 229, 0.25), transparent 55%), var(--surface);
  border: 1px solid rgba(99, 102, 241, 0.4);
}

#dashboard-section.adding-server .card-grid {
  display: none;
}

#dashboard-section.adding-server .add-server-panel {
  border-style: solid;
}

#dashboard-section::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(96, 165, 250, 0.15);
  pointer-events: none;
}

.host-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.host-metric-card {
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-label {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.metric-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

#server-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  flex: 1;
  background: radial-gradient(circle at 90% 0%, rgba(37, 99, 235, 0.18), transparent 60%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.9));
}

#config-section {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pill-btn {
  padding: 0.72rem 1.1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.12);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
}

.pill-btn.primary {
  background: linear-gradient(120deg, #60a5fa, #2563eb);
  border-color: rgba(37, 99, 235, 0.6);
  color: #020617;
}

.pill-btn.ghost,
.ghost-btn {
  background: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  color: var(--muted);
}

.ghost-btn {
  padding: 0.5rem 0.9rem;
  border-radius: 0.75rem;
}

.ghost-btn.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.add-server-panel {
  border-radius: 1.1rem;
  border: 1px dashed rgba(96, 165, 250, 0.4);
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.add-server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.add-server-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.add-server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.add-server-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.add-server-grid input,
.add-server-grid textarea {
  padding: 0.75rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(2, 6, 23, 0.4);
  color: var(--text);
}

.add-server-grid .full-width {
  grid-column: 1 / -1;
}

.palworld-toggle label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.palworld-fields {
  background: rgba(15, 23, 42, 0.55);
  border-radius: 0.9rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 0.9rem;
}

.palworld-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.palworld-fields input {
  width: 100%;
}

.add-server-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-auto-rows: minmax(150px, auto);
  gap: 1rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.server-card {
  border-radius: 1rem;
  border: 1px solid var(--card-border);
  padding: 1.2rem;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  transition: transform 150ms ease, border 150ms ease, box-shadow 200ms ease;
  position: relative;
  overflow: hidden;
  min-height: 150px;
}

.server-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 20px 35px rgba(2, 6, 23, 0.45);
}

.server-card.online {
  border-color: rgba(52, 211, 153, 0.45);
}

.server-card.offline {
  border-color: rgba(248, 113, 113, 0.4);
}

.server-card.starting {
  border-color: rgba(96, 165, 250, 0.45);
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.server-heading {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 240px;
}

.server-heading-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-status {
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
  justify-content: flex-end;
}

.actions button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.2rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.12);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.85rem;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 30px rgba(2, 6, 23, 0.4);
}

.actions button::before {
  font-size: 1rem;
}

.actions button[data-loading='true'] {
  opacity: 0.7;
  position: relative;
}

.actions button[data-loading='true']::after {
  content: '';
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#action-start {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

#action-start::before {
  content: '▶';
}

#action-stop {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.18);
  color: var(--danger);
}

#action-stop::before {
  content: '■';
}

#action-restart {
  border-color: rgba(96, 165, 250, 0.45);
  color: var(--accent);
}

#action-restart::before {
  content: '↻';
}

#action-update {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.18);
  color: var(--warning);
}

#action-update::before {
  content: '⇪';
}

#action-backup {
  border-color: rgba(14, 165, 233, 0.45);
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent);
}

#action-backup::before {
  content: '⤓';
}

#action-delete {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

#action-delete::before {
  content: '✖';
}

.action-feedback {
  min-height: 1rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

.action-feedback.success {
  color: var(--success);
}

.action-feedback.error {
  color: var(--danger);
}

.server-tabs {
  margin-top: 1.75rem;
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.tab-btn {
  all: unset;
  padding: 0.8rem 1rem;
  border-radius: 0.85rem 0.85rem 0 0;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--text);
  background: rgba(15, 23, 42, 0.9);
}

.tab-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.tab-panels {
  position: relative;
  flex: 1;
  min-height: 0;
}

.tab-panel {
  display: none;
  padding-top: 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.tab-panel.active {
  display: block;
}

.tab-panel.palworld-loading::after,
.panel.palworld-loading::after {
  content: 'Chargement…';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.75);
  border-radius: inherit;
  font-weight: 600;
}

.server-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.5fr) minmax(320px, 0.5fr);
  gap: 1.25rem;
  min-height: 0;
  height: 100%;
}

.server-grid > div {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kv-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.history-entry {
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.55);
  padding: 0.75rem 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: flex-start;
  border-left: 4px solid rgba(148, 163, 184, 0.35);
}

.history-entry strong {
  display: block;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-entry span {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.history-entry p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.history-entry[data-status='success'] {
  border-left-color: rgba(52, 211, 153, 0.7);
}

.history-entry[data-status='error'] {
  border-left-color: rgba(248, 113, 113, 0.8);
}

.history-entry[data-status='pending'] {
  border-left-color: rgba(251, 191, 36, 0.7);
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.2);
}

.kv-key {
  color: var(--muted);
}

.status-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.status-pill[data-state='online'] {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--success);
}

.status-pill[data-state='offline'] {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.status-pill[data-state='starting'] {
  border-color: rgba(96, 165, 250, 0.45);
  color: var(--accent);
}

.log-viewer {
  background: #020617;
  border-radius: 1rem;
  padding: 1.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-family: 'Fira Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  border: 1px solid rgba(125, 211, 252, 0.25);
  box-shadow: inset 0 0 35px rgba(2, 6, 23, 0.65);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.form-field,
.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-grid input,
.form-grid textarea {
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
}

.form-grid textarea {
  resize: vertical;
  min-height: 110px;
}

.env-field-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.env-editor {
  border: 1px dashed rgba(96, 165, 250, 0.35);
  border-radius: 0.85rem;
  padding: 0.85rem;
  background: rgba(2, 6, 23, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.alert-field {
  border: 1px dashed rgba(34, 197, 94, 0.35);
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  background: rgba(22, 101, 52, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.alert-field input[type='text'] {
  padding: 0.75rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(74, 222, 128, 0.4);
  background: rgba(10, 38, 25, 0.65);
  color: var(--text);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.env-rows {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.env-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.env-row input {
  flex: 1;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
}

.env-row input.env-key {
  max-width: 200px;
}

.env-equal {
  color: var(--muted);
  font-weight: 600;
}

.env-remove {
  border-radius: 0.65rem;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  padding: 0.35rem 0.65rem;
  font-size: 1rem;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.form-actions button {
  padding: 0.85rem 1.5rem;
  border-radius: 0.9rem;
  background: var(--accent);
  color: #020617;
  border: none;
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.35);
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stacked-form button {
  align-self: flex-start;
}

.secondary {
  background: rgba(96, 165, 250, 0.15) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(96, 165, 250, 0.4) !important;
}

.danger {
  background: rgba(248, 113, 113, 0.15) !important;
  color: var(--danger) !important;
  border: 1px solid rgba(248, 113, 113, 0.45) !important;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.95rem 1.3rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-left: 4px solid var(--accent);
  background: rgba(2, 6, 23, 0.9);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  backdrop-filter: blur(10px);
}

.toast::before {
  content: attr(data-icon);
  font-size: 1.1rem;
}

.toast.success {
  color: var(--success);
  border-left-color: var(--success);
}

.toast.error {
  color: var(--danger);
  border-left-color: var(--danger);
}

.toast.info {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: left;
}

.hidden {
  display: none !important;
}

.muted-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.palworld-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: -0.25rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(96, 165, 250, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 120px;
}

.summary-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.summary-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.palworld-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.palworld-column {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.palworld-actions button,
.palworld-actions input,
.palworld-actions textarea {
  width: 100%;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.player-item {
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
}

.player-name {
  display: block;
  font-weight: 600;
}

.player-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1280px) {
  .app:not(.hidden) {
    grid-template-columns: 240px 1fr;
  }
  .sidebar {
    width: 240px;
    padding: 2rem 1.5rem;
  }
  .content {
    padding: 2rem 2rem 2.5rem;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 1024px) {
  .app:not(.hidden) {
    grid-template-columns: 220px 1fr;
  }
  .sidebar {
    width: 220px;
    padding: 1.75rem 1.25rem;
  }
  .sidebar-section {
    max-height: 220px;
  }
  .content {
    padding: 1.75rem;
  }
}

@media (max-width: 900px) {
  .app:not(.hidden) {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    height: auto;
    gap: 1rem;
    overflow: hidden;
  }
  .sidebar {
    position: relative;
    top: 0;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.25rem;
    padding: 1.1rem 1.25rem 1.25rem;
    gap: 0.75rem;
    background: linear-gradient(140deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.9));
    box-shadow: 0 25px 45px rgba(2, 6, 23, 0.55);
  }
  .logo {
    width: 100%;
    font-size: 1.35rem;
    margin-bottom: 0.35rem;
  }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    width: 100%;
  }
  .nav-btn,
  #logout-btn {
    flex: 1 1 100%;
    text-align: center;
    margin-top: 0;
    border-radius: 999px;
  }
  .sidebar-section {
    order: 3;
    width: 100%;
    max-height: none;
    margin-top: 0.5rem;
  }
  .server-list {
    max-height: 240px;
    overflow-y: auto;
    border-radius: 1rem;
    padding: 0.25rem 0.1rem;
    background: rgba(2, 6, 23, 0.35);
  }
  .sidebar-footer {
    order: 4;
    width: 100%;
    text-align: center;
    padding-top: 0.25rem;
  }
  .content {
    padding: 0 0.85rem 1.5rem;
    gap: 1rem;
  }
  .panel {
    padding: 1.1rem;
    border-radius: 1rem;
  }
  .panel-header,
  .server-header,
  .add-server-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .panel-actions,
  .add-server-actions,
  .server-heading-meta,
  .actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .actions button {
    flex: 1 1 calc(50% - 0.4rem);
    justify-content: center;
  }
  .server-grid,
  .palworld-grid {
    grid-template-columns: 1fr;
  }
  .server-tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .tab-btn {
    flex: 1 1 calc(50% - 0.4rem);
    text-align: center;
  }
  .card-grid {
    grid-template-columns: 1fr;
    padding-right: 0;
    gap: 0.85rem;
  }
}

@media (max-width: 720px) {
  .sidebar {
    position: static;
    padding: 1.25rem 1.5rem;
    gap: 1rem;
    box-shadow: none;
  }
  .sidebar nav {
    flex-direction: column;
  }
  .nav-btn,
  #logout-btn {
    flex: initial;
    width: 100%;
  }
  .sidebar-section {
    max-height: none;
  }
  .content {
    padding: 1.25rem;
  }
  .panel {
    padding: 1.25rem;
  }
  .add-server-grid,
  .palworld-fields-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .panel-actions,
  .add-server-actions {
    gap: 0.5rem;
  }
  .tab-btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 0.97rem;
  }
  .content {
    padding: 1rem;
  }
  .panel {
    padding: 1rem;
  }
  .actions button,
  .panel-actions .pill-btn,
  .add-server-actions button,
  .add-server-actions .pill-btn,
  .ghost-btn {
    flex: 1 1 100%;
    width: 100%;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .palworld-summary {
    grid-template-columns: 1fr;
  }
  .log-viewer {
    min-height: 200px;
    padding: 1rem;
  }
  .add-server-panel {
    padding: 1rem;
  }
  .panel-header,
  .server-header,
  .add-server-header {
    gap: 0.6rem;
  }
}

@media (max-width: 460px) {
  h1,
  h2,
  h3 {
    font-size: clamp(1.4rem, 3vw, 1.6rem);
  }
  .auth-view {
    padding: 1.25rem 1rem;
  }
  .auth-layout {
    padding: 1.75rem 1.25rem;
  }
  .panel {
    border-radius: 0.9rem;
  }
  .server-tabs {
    gap: 0.35rem;
  }
  .tab-btn {
    padding: 0.65rem;
  }
  .toast {
    left: 50%;
    right: auto;
    width: calc(100% - 2.5rem);
    transform: translateX(-50%);
  }
}

@media (max-width: 360px) {
  .sidebar,
  .content {
    padding: 0.85rem;
  }
  .panel {
    padding: 0.85rem;
  }
  .pill-btn,
  .ghost-btn,
  .nav-btn {
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
  }
  .actions button {
    padding: 0.7rem 0.85rem;
  }
  .summary-value {
    font-size: 1.45rem;
  }
  .sidebar-footer {
    font-size: 0.75rem;
  }
}

@media (max-width: 320px) {
  body {
    font-size: 0.9rem;
  }
  .auth-layout,
  .panel {
    padding: 0.75rem;
  }
  .tab-btn,
  .actions button {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
