:root {
  --bg: #020617;
  --bg-elevated: #020617;
  --card-bg: #020617;
  --accent: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.16);
  --accent-strong: #db2777;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(148, 163, 184, 0.35);
  --danger: #f97373;
  --warn: #fbbf24;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.8);
  --shadow-card: 0 14px 30px rgba(15, 23, 42, 0.9);
}

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

body.wb-body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(236,72,153,0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(59,130,246,0.12), transparent 55%),
    #020617;
}

/* Login */
.wb-login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.wb-login-card {
  width: 100%;
  max-width: 420px;
  background: radial-gradient(circle at top, rgba(236,72,153,0.16), transparent 55%), #020617;
  border-radius: 26px;
  box-shadow: var(--shadow-soft);
  padding: 28px 26px 24px;
  border: 1px solid rgba(148,163,184,0.4);
  backdrop-filter: blur(18px);
}

.wb-title {
  margin: 0 0 4px;
  font-size: 2.2rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 3px;
  background: linear-gradient(135deg, rgba(236,72,153,0.9), rgba(147,51,234,0.9));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.wb-subtitle {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 2px 2px 4px rgba(236, 72, 153, 0.3);
}

.wb-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wb-form label {
  font-size: .8rem;
  color: var(--muted);
}

.wb-form input {
  background: rgba(15,23,42,0.9);
  border-radius: 12px;
  border: 1px solid rgba(51,65,85,0.9);
  color: var(--text);
  padding: 9px 11px;
  font-size: .9rem;
  outline: none;
}

.wb-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(236,72,153,0.5);
}

.wb-btn-primary {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  box-shadow: 0 14px 35px rgba(236,72,153,0.5);
}

.wb-btn-primary:hover {
  filter: brightness(1.05);
}

.wb-error {
  margin-top: 6px;
  font-size: .8rem;
  color: var(--danger);
}

.wb-footnote {
  margin-top: 14px;
  font-size: .75rem;
  color: var(--muted);
}

/* Password field with eye toggle */
.passwordField {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.passwordField input {
  flex: 1;
  padding-right: 45px;
}

.togglePasswordBtn {
  background: rgba(236, 72, 153, 0.1);
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: #ec4899;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  min-width: 42px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.togglePasswordBtn:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
  transform: scale(1.05);
}

.togglePasswordBtn:active {
  transform: scale(0.95);
}

/* Server Actions Menu */
.wb-server-menu {
  position: fixed;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 9999;
  min-width: 220px;
  max-width: 250px;
  animation: menuFadeIn 0.15s ease-out;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wb-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.wb-menu-item:last-child {
  margin-bottom: 0;
}

.wb-menu-item:hover {
  background: rgba(236, 72, 153, 0.15);
  color: #ec4899;
  transform: translateX(3px);
}

.wb-menu-item:active {
  transform: translateX(3px) scale(0.98);
}

/* Layout principal */
.wb-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wb-topbar {
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at top left, rgba(236,72,153,0.25), transparent 55%), rgba(15,23,42,0.96);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.wb-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wb-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(236,72,153,0.4), rgba(15,23,42,1));
  font-size: 1rem;
}

.wb-topbar-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(236,72,153,0.9), rgba(147,51,234,0.9));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.wb-topbar-sub {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 
    0 1px 0 #e2e8f0,
    0 2px 0 #cbd5e1,
    0 3px 0 #94a3b8,
    0 4px 6px rgba(0,0,0,0.5);
  filter: brightness(1.1);
}

.wb-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wb-userinfo {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: .8rem;
}

.wb-userrole {
  color: var(--muted);
  font-size: .72rem;
}

.wb-btn-secondary {
  padding: 7px 11px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(148,163,184,0.6);
  color: var(--text);
  font-size: .8rem;
  cursor: pointer;
}

.wb-btn-secondary:hover {
  border-color: var(--accent);
}

.wb-main {
  flex: 1;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  max-height: calc(100vh - 60px);
}

/* Sidebar */
.wb-sidebar {
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  background: radial-gradient(circle at top, rgba(15,23,42,0.6), rgba(15,23,42,1));
  overflow-y: auto;
}

.wb-sidebar::-webkit-scrollbar {
  width: 8px;
}

.wb-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.wb-sidebar::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.4);
  border-radius: 4px;
}

.wb-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(236, 72, 153, 0.6);
}

.wb-nav-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
}

.wb-nav-btn:hover {
  background: rgba(15,23,42,0.8);
}

.wb-nav-active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(236,72,153,0.5);
}

/* Content */
.wb-content {
  padding: 18px 18px 26px;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

.wb-content::-webkit-scrollbar {
  width: 10px;
}

.wb-content::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 5px;
}

.wb-content::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.5);
  border-radius: 5px;
}

.wb-content::-webkit-scrollbar-thumb:hover {
  background: rgba(236, 72, 153, 0.7);
}

.wb-section-title {
  font-size: 1.1rem;
  margin: 0 0 12px;
}

.wb-subsection-title {
  margin-top: 26px;
  margin-bottom: 8px;
  font-size: .95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.wb-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.wb-filters {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wb-filters input,
.wb-filters select {
  background: rgba(15,23,42,0.9);
  border-radius: 999px;
  border: 1px solid rgba(51,65,85,0.9);
  color: var(--text);
  padding: 6px 10px;
  font-size: .8rem;
  outline: none;
}

.wb-filters input:focus,
.wb-filters select:focus {
  border-color: var(--accent);
}

/* Cards */
.wb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.wb-card {
  background: radial-gradient(circle at top, rgba(15,23,42,0.7), rgba(15,23,42,1));
  border-radius: var(--radius-xl);
  padding: 12px 14px 10px;
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: var(--shadow-card);
}

.wb-card-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.wb-card-clickable:hover {
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
  transform: translateY(-2px);
}

.wb-card-clickable:active {
  transform: translateY(0);
}

.wb-card-warning {
  border-color: rgba(251, 191, 36, 0.4);
}

.wb-card-warning:hover {
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.wb-card-wide {
  grid-column: span 2;
}

.wb-card-label {
  font-size: .8rem;
  color: var(--muted);
}

.wb-card-value {
  margin-top: 4px;
  font-size: 1.4rem;
  font-weight: 600;
}

.wb-card-foot {
  margin-top: 4px;
  font-size: .75rem;
  color: var(--muted);
}

.wb-warn {
  color: var(--warn);
}

.wb-danger {
  color: var(--danger);
}

/* Tablas */
.wb-table-wrapper {
  margin-top: 8px;
  border-radius: 18px;
  border: 1px solid rgba(51,65,85,0.9);
  overflow-x: auto;
  overflow-y: visible;
  background: rgba(15,23,42,0.96);
  box-shadow: var(--shadow-soft);
  position: relative;
}

.wb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.wb-table thead {
  background: rgba(15,23,42,0.98);
}

.wb-table th,
.wb-table td {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(31,41,55,0.9);
}

.wb-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: .75rem;
}

.wb-table tbody tr:nth-child(even) {
  background: rgba(15,23,42,0.85);
}

.wb-table tbody tr:hover {
  background: rgba(30,64,175,0.25);
}

.wb-table-empty {
  text-align: center;
  color: var(--muted);
  padding: 14px 9px;
}

/* Modal */
.wb-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}

.wb-modal-content {
  background: radial-gradient(circle at top, rgba(236,72,153,0.16), transparent 55%), #020617;
  border-radius: 22px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(148,163,184,0.4);
  box-shadow: var(--shadow-soft);
}

.wb-modal-terminal {
  max-width: 1200px;
  width: 95%;
  max-height: 95vh;
}

.wb-modal-content h3 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

/* Filter buttons for renewed modal */
.wb-filter-btn {
  padding: 8px 16px;
  border: 1px solid rgba(148,163,184,0.3);
  background: rgba(15,23,42,0.6);
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wb-filter-btn:hover {
  border-color: rgba(236,72,153,0.5);
  background: rgba(236,72,153,0.15);
}

.wb-filter-btn.active {
  background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(219,39,119,0.3));
  border-color: rgba(236,72,153,0.7);
  color: #fff;
  font-weight: 600;
}

/* Compact progress bars */
.wb-compact-bar {
  display: inline-block;
  width: 60px;
  height: 18px;
  background: rgba(148,163,184,0.2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  vertical-align: middle;
}

.wb-compact-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.wb-compact-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

#terminal {
  border: 2px solid rgba(236, 72, 153, 0.3);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  height: 500px;
}

#terminal .xterm {
  height: 100% !important;
  padding: 10px;
}

#terminal .xterm-viewport {
  overflow-y: scroll !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(236, 72, 153, 0.6) rgba(15, 23, 42, 0.8);
}

#terminal .xterm-viewport::-webkit-scrollbar {
  width: 12px;
}

#terminal .xterm-viewport::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 6px;
}

#terminal .xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.6);
  border-radius: 6px;
  border: 2px solid rgba(15, 23, 42, 0.8);
}

#terminal .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(236, 72, 153, 0.9);
}

#terminal .xterm-screen {
  height: auto !important;
}

/* Responsive */
@media (max-width: 900px) {
  .wb-main {
    grid-template-columns: 1fr;
  }
  .wb-sidebar {
    display: flex;
    gap: 6px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
}

/* Small devices */
@media (max-width: 600px) {
  .wb-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .wb-topbar-right {
    width: 100%;
    justify-content: space-between;
  }
}
