:root {
  --sidebar-bg: #0f1728;
  --sidebar-bg-2: #141e32;
  --sidebar-line: rgba(166, 190, 230, 0.18);
  --main-bg: #0a1220;
  --card-bg: #131e32;
  --line: rgba(149, 175, 217, 0.2);
  --text: #dce9ff;
  --text-soft: #8fa6cb;
  --text-muted: #7288ad;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  --orange: #f7a06d;
  --green: #14d39a;
  --pink: #f27093;
  --cyan: #09c7d9;
  --ok: #1dcf8f;
  --warn: #f5b04f;
  --danger: #ef6f95;
  --info: #2fb4ff;
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(47, 180, 255, 0.1), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(29, 207, 143, 0.08), transparent 40%),
    var(--main-bg);
}

.font-mono {
  font-family: var(--font-mono);
}

.text-slate-500 {
  color: var(--text-soft);
}

.text-rose-400 {
  color: #ff7ba8;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: #dce6fb;
  padding: 1rem 0.8rem;
  border-right: 1px solid var(--sidebar-line);
  z-index: 30;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.brand-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-icon {
  display: inline-grid;
  place-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(220, 230, 251, 0.28);
  background: rgba(220, 230, 251, 0.09);
}

.brand-link strong {
  display: block;
  font-size: 1rem;
}

.brand-link small {
  display: block;
  color: #b5c4e2;
  font-size: 0.73rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-nav::before {
  content: "Informacion del servidor";
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9fb1d4;
  margin: 0.3rem 0 0.2rem;
  padding: 0 0.15rem;
}

.nav-link {
  border-radius: 0.6rem;
  padding: 0.6rem 0.7rem;
  color: #c8d5f0;
  text-decoration: none;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 500;
  display: block;
}

.nav-link-muted {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(220, 230, 251, 0.11);
}

.nav-link strong {
  display: block;
  color: #dce6fb;
  font-size: 0.84rem;
}

.nav-link small {
  display: block;
  margin-top: 0.18rem;
  color: #9fb1d4;
  font-size: 0.76rem;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: linear-gradient(130deg, #121f34, #1a2740);
  border-bottom: 1px solid rgba(149, 175, 217, 0.3);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.topbar-title-wrap {
  min-width: 0;
  margin-right: auto;
}

.topbar-title {
  margin: 0;
  font-size: 1.08rem;
  color: #e9f2ff;
  letter-spacing: 0.01em;
}

.topbar-subtitle {
  margin: 0.2rem 0 0;
  color: #a7bbdd;
  font-size: 0.82rem;
}

.topbar-search input {
  width: 220px;
  border-radius: 999px;
  border: 1px solid rgba(149, 175, 217, 0.3);
  background: rgba(8, 13, 23, 0.65);
  color: #dce9ff;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.85rem;
}

.topbar-search input:focus {
  outline: none;
  border-color: #57c5ff;
}

.topbar-meta {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.meta-chip {
  border: 1px solid rgba(149, 175, 217, 0.3);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  color: #a7bbdd;
  background: rgba(8, 13, 23, 0.5);
}

.meta-avatar {
  width: 1.9rem;
  height: 1.9rem;
  display: inline-grid;
  place-content: center;
  border-radius: 50%;
  background: rgba(47, 180, 255, 0.15);
  color: #95d9ff;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid rgba(47, 180, 255, 0.35);
}

.sidebar-toggle,
.sidebar-close {
  border: 1px solid rgba(149, 175, 217, 0.3);
  background: rgba(8, 13, 23, 0.7);
  color: #a7bbdd;
  border-radius: 0.45rem;
  width: 2rem;
  height: 2rem;
  display: none;
  cursor: pointer;
}

.main-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1rem 1.2rem 1.5rem;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.flash-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.flash {
  border: 1px solid transparent;
  border-radius: 0.6rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.86rem;
}

.flash-success {
  border-color: rgba(29, 207, 143, 0.35);
  background: rgba(29, 207, 143, 0.14);
  color: #78e7bc;
}

.flash-error {
  border-color: rgba(239, 111, 149, 0.35);
  background: rgba(239, 111, 149, 0.14);
  color: #ff9cc0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.kpi-card {
  border-radius: 0.55rem;
  color: #ffffff;
  padding: 1rem 1rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  right: -25px;
  bottom: -35px;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.kpi-card-orange {
  background: linear-gradient(135deg, #f8b084, var(--orange));
}

.kpi-card-green {
  background: linear-gradient(135deg, #39e6b4, var(--green));
}

.kpi-card-pink {
  background: linear-gradient(135deg, #f78eab, var(--pink));
}

.kpi-card-cyan {
  background: linear-gradient(135deg, #34dcea, var(--cyan));
}

.kpi-label {
  font-size: 0.8rem;
  opacity: 0.94;
}

.kpi-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.28rem;
  font-weight: 600;
}

.kpi-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.74rem;
  opacity: 0.92;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
}

.dashboard-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.card-title {
  margin: 0;
  color: #dce9ff;
  font-size: 0.95rem;
}

.card-subtitle {
  margin: 0 0 0.7rem;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(8, 13, 23, 0.62);
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  color: #9ab2d9;
  font-size: 0.76rem;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.status-dot.running {
  background: var(--ok);
}

.status-dot.starting {
  background: var(--warn);
}

.status-dot.stopped {
  background: var(--danger);
}

.status-detail {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.status-phase {
  margin: 0.35rem 0 0;
  min-height: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.progress-container {
  margin-top: 0.7rem;
}

.progress-bar {
  height: 0.55rem;
  border-radius: 999px;
  overflow: hidden;
  background: #edf2fb;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--info), var(--ok));
  transition: width 0.25s ease;
}

.progress-label {
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  font-size: 0.77rem;
}

#metrics-updated,
#server-info-badge {
  color: var(--text-soft);
  font-size: 0.75rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
}

.metric-item {
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  padding: 0.68rem 0.72rem;
  background: #101a2b;
}

.metric-label {
  color: var(--text-soft);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  margin-top: 0.2rem;
  color: #dce9ff;
  font-size: 1.02rem;
  font-weight: 600;
}

.metric-sub {
  margin-top: 0.2rem;
  color: #a2b6d7;
  font-size: 0.86rem;
}

.metric-load .metric-value {
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.metric-bar {
  margin-top: 0.35rem;
  border-radius: 999px;
  height: 0.4rem;
  overflow: hidden;
  background: rgba(8, 13, 23, 0.82);
}

.metric-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6ab3ff, #3bdbab);
}

.server-info-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.server-info-row .label {
  display: block;
  color: var(--text-soft);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.server-info-row p {
  margin: 0.22rem 0 0;
  color: #d3e3ff;
}

.players-list {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.players-list li {
  border-bottom: 1px dashed var(--line);
  padding: 0.22rem 0;
  color: #b9cced;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.action-btn {
  width: 100%;
  border-radius: 0.55rem;
  border: 1px solid transparent;
  text-align: left;
  padding: 0.72rem 0.8rem;
  background: #1b2941;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  filter: brightness(1.06);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.action-icon {
  display: block;
  font-size: 1.08rem;
  color: #ffffff;
}

.action-label {
  display: block;
  margin-top: 0.28rem;
  font-weight: 600;
  color: #ffffff;
  font-size: 0.95rem;
}

.action-desc {
  display: block;
  margin-top: 0.18rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.76rem;
}

.action-start {
  background: #16b879;
  border-color: #19cb86;
}

.action-stop {
  background: #e3a22f;
  border-color: #f0b54c;
}

.action-restart {
  background: #2a9fe8;
  border-color: #45b0f2;
}

.action-reset {
  background: #d95080;
  border-color: #e96795;
}

.logs-header-actions {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.logs-badge {
  border: 1px solid rgba(47, 180, 255, 0.4);
  background: rgba(47, 180, 255, 0.12);
  color: #9ddfff;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
}

#logs-mtime {
  color: var(--text-soft);
  font-size: 0.73rem;
}

#logs-refresh {
  border: 1px solid var(--line);
  background: #101a2b;
  color: var(--text-soft);
  border-radius: 0.38rem;
  padding: 0.24rem 0.5rem;
  cursor: pointer;
}

#logs-refresh:hover {
  color: #dce9ff;
}

.logs-container {
  min-height: 210px;
  max-height: 390px;
  overflow: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: #0c1627;
  padding: 0.72rem;
}

.logs-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  color: #b8cbed;
  font-size: 0.76rem;
  line-height: 1.48;
}

.footer-bar {
  border-top: 1px solid var(--line);
  padding: 0.8rem 1.2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-soft);
  font-size: 0.74rem;
  flex-wrap: wrap;
}

.footer-inner code {
  font-family: var(--font-mono);
  color: #9bb1d4;
}

.login-page {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card-wrap {
  width: 100%;
  max-width: 400px;
}

.login-card {
  padding: 1rem;
}

.login-title {
  margin: 0;
  color: #e6f0ff;
}

.login-subtitle {
  margin: 0.3rem 0 0;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
}

.login-label {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.login-input {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #0d1728;
  color: var(--text);
  padding: 0.65rem 0.7rem;
  font: inherit;
}

.login-input:focus {
  outline: none;
  border-color: #4dc8ff;
}

.login-error {
  margin: 0;
  color: #ff99bf;
  font-size: 0.82rem;
}

.login-btn {
  border: 1px solid rgba(47, 180, 255, 0.42);
  background: rgba(47, 180, 255, 0.15);
  color: #bce9ff;
  border-radius: 0.5rem;
  padding: 0.62rem 0.7rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.login-btn:hover {
  border-color: #53ccff;
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    width: 250px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle,
  .sidebar-close {
    display: inline-grid;
    place-content: center;
  }

  .topbar-search {
    display: none;
  }
}

@media (max-width: 700px) {
  .kpi-grid,
  .metrics-grid,
  .actions-grid {
    grid-template-columns: 1fr;
  }
}
