:root {
  --bg: #0b0d12;
  --panel: #111520;
  --muted: #8a95ad;
  --text: #e6ecff;
  --brand: #f9c74f;
  --brand-2: #f9844a;
  --border: #1e2433;
  --ok: #36d399;
  --warn: #fbbf24;
  --err: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: var(--panel);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: 0 auto;
}

.nav-logo img {
  height: 32px;
  width: 32px;
  display: block;
  filter: drop-shadow(0 0 4px var(--brand));
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.nav-links li a {
  color: var(--text);
  font-weight: 500;
}

.site-main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.layout-two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.layout-full {
  max-width: 100%;
  margin: 2rem;
}

h1, h2, h3 {
  margin: 1.5rem 0 1rem;
  font-weight: 600;
}

/* Default form style */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  background: var(--panel);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Override for inline forms inside server cards */
form.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f131d;
  color: var(--text);
  font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(249, 199, 79, 0.3);
}

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--brand);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

legend {
  font-weight: 600;
  padding: 0 0.5rem;
}

button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  background: var(--brand);
  color: #111;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
button:hover {
  background: var(--brand-2);
  color: #fff;
}
button:active {
  transform: scale(0.97);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

th, td {
  padding: 0.75rem;
  border: 1px solid var(--border);
}

th {
  background: var(--panel);
  text-align: left;
  font-weight: 600;
}

footer {
  margin-top: 3rem;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.dashboard {
  display: grid;
  gap: 2rem;
}

.stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.stat-card {
  flex: 1 1 200px;
  background: var(--panel);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
}

.stat-card h2 {
  margin: 0.5rem 0;
  font-size: 1.8rem;
  color: var(--brand);
}

.stat-card a {
  color: var(--text);
  font-weight: 600;
}
.stat-card a:hover {
  color: var(--brand);
}

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropbtn {
  background: var(--brand);
  color: #111;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(249,199,79,0.5);
}
.dropbtn:hover {
  background: var(--brand-2);
  color: #fff;
  box-shadow: 0 0 10px rgba(249,132,74,0.7);
}
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background: var(--panel);
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 10;
  padding: 0.5rem;
}
.dropdown-content form { margin: 0; }
.dropdown-content button {
  width: 100%;
  background: none;
  color: var(--text);
  text-align: left;
  padding: 0.5rem;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}
.dropdown-content button:hover {
  background: var(--brand);
  color: #111;
}
.dropdown:hover .dropdown-content { display: block; }

/* Pills & alerts */
.pill {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.9em;
  font-weight: 600;
  border-radius: 6px;
  color: #fff;
}
.alert--exists, .pill--ok {
  background-color: var(--ok);
  box-shadow: 0 0 10px rgba(54,211,153,0.6);
}
.pill--warn {
  background: var(--warn);
  color: #111;
  box-shadow: 0 0 10px rgba(251,191,36,0.6);
}
.pill--err, .alert--error {
  background: var(--err);
  box-shadow: 0 0 10px rgba(248,113,113,0.6);
}
.alert--ok {
  background-color: var(--ok);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 0 10px rgba(54,211,153,0.6);
}

/* Spinner */
.spinner { display: none; text-align: center; margin-top: 15px; }
.spinner img { width: 48px; height: 48px; }
.roll-icon { animation: roll 2s linear infinite; }
@keyframes roll {
  0%   { transform: translateX(-20px) rotate(0deg); }
  50%  { transform: translateX(20px) rotate(180deg); }
  100% { transform: translateX(-20px) rotate(360deg); }
}

/* Storage bar */
.storage-bar { margin: 1rem 0; }
.storage-bar__label { font-size: 0.9rem; margin-bottom: 4px; color: var(--muted); }
.storage-bar__track {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  height: 16px;
}
.storage-bar__fill {
  background: var(--brand);
  height: 100%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(249,199,79,0.5);
}

button.danger { background-color: #dc2626; color: white; }
button.danger:hover { background-color: #b91c1c; }

/* Tabs */
.tabs { display: flex; gap: 1rem; margin-bottom: 1rem; }
.tab-btn, .tab-button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.tab-btn:hover, .tab-button:hover { background: var(--brand); color: #111; }
.tab-btn.active, .tab-button.active {
  background: var(--brand-2);
  color: #fff;
  box-shadow: 0 0 8px rgba(249,132,74,0.6);
}
.tab-panel.hidden, .tab-section { display: none; }
.tab-section.active, .tab-content.active { display: block; }

.tokens-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
}
.tokens-actions form { margin: 0; }

.btn-small {
  font-size: 0.7rem;
  padding: 2px 6px;
  margin: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.btn-warn { background: var(--warn); color: #000; }
.btn-err { background: var(--err); color: #fff; }
.btn-small:hover { opacity: 0.85; }

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tab-button {
  padding: 0.5rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  border-radius: 4px;
  color: var(--text);
}
.tab-button.active {
  background: var(--brand);
  color: #000;
}
.tab-button.danger {
  background: var(--err);
  color: #fff;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-user img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}
.page-title {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  padding: 1rem;
}

.server-card {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.server-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.server-banner { position: relative; }
.server-art {
  width: 100%;
  height: 180px;
  object-fit: cover;
  filter: brightness(0.9);
}

.server-info {
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
}
.server-info h3 {
  margin: 0 0 0.8rem 0;
  font-size: 1.2rem;
}
.server-info p { margin: 0.4rem 0; }

.server-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.server-actions .btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-ok { background: var(--ok); color: #fff; }
.btn-warn { background: var(--warn); color: #000; }
.btn-neutral { background: var(--muted); color: #fff; }
.btn:hover { filter: brightness(0.9); }

/* Match pill sizing for clickable Wake Up button */
.pill-button {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.9em;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  line-height: 1;
  background: var(--err);
  color: #fff;
  box-shadow: 0 0 10px rgba(248,113,113,0.6);
  transition: background 0.2s;
}
.pill-button:hover {
  background: var(--brand-2);
  color: #fff;
}
