:root {
  --bg: #07080c;
  --panel: #0e1017;
  --panel-2: #151822;
  --panel-3: #1a1e2a;
  --border: #232635;
  --text: #e7e9ee;
  --muted: #8b93a7;
  --accent: #5865f2;
  --accent-2: #7c3aed;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Inter, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }

/* ---------------- Buttons / inputs (shared) ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(88, 101, 242, .35); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--panel-3); border: 1px solid var(--border); }
.btn.secondary:hover { box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 12px; font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type="file"] { padding: 8px; }

.error { background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .3); color: #fca5a5; padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-top: 14px; }
.success { background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .3); color: #86efac; padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-top: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.stopped { background: var(--muted); }
.dot.error { background: var(--red); }
.dot.pending, .dot.provisioning, .dot.awaiting_artifact_url { background: var(--yellow); }

table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .empty-icon { font-size: 34px; margin-bottom: 10px; opacity: .6; }

/* ---------------- Public / marketing pages (no sidebar) ---------------- */

nav.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 16, 23, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand img { height: 36px; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--muted); font-size: 14px; transition: color .15s; }
.nav-links a:hover { color: var(--text); }

.hero { text-align: center; padding: 90px 24px 60px; }
.hero h1 { font-size: 48px; margin: 0 0 16px; }
.hero .gradient { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { color: var(--muted); font-size: 18px; max-width: 560px; margin: 0 auto 32px; }
.hero .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 40px 24px 90px; max-width: 1100px; margin: 0 auto; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.feature .icon { font-size: 28px; margin-bottom: 10px; }
.feature h3 { margin: 0 0 8px; }
.feature p { color: var(--muted); font-size: 14px; margin: 0; }

@media (max-width: 800px) { .features { grid-template-columns: 1fr; } .hero h1 { font-size: 34px; } }

.auth-wrap { max-width: 420px; margin: 80px auto; padding: 0 24px; }
.auth-wrap h1 { text-align: center; font-size: 26px; }
.auth-wrap .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }

footer.site-footer { text-align: center; padding: 30px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); margin-top: 60px; }

/* ---------------- App shell (sidebar layout) ---------------- */

.app {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand { padding: 4px 8px 20px; font-size: 18px; }
.sidebar .brand img { height: 30px; }

.side-section { margin-top: 18px; }
.side-label { font-size: 11px; letter-spacing: .07em; color: var(--muted); text-transform: uppercase; padding: 0 10px; margin-bottom: 8px; font-weight: 700; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.side-link .ic { width: 18px; text-align: center; flex-shrink: 0; }
.side-link:hover { background: var(--panel-3); color: var(--text); }
.side-link.active { background: rgba(88, 101, 242, .14); color: #b7bdff; }

.side-spacer { flex: 1; }

.side-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}
.side-card .t { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.side-card .d { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.side-card a.btn, .side-card button.btn { width: 100%; }

.side-logout {
  margin-top: 10px;
  color: #fca5a5;
}
.side-logout:hover { background: rgba(239,68,68,.1); color: #fca5a5; }

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 80px;
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px; width: 100%; }
  .mobile-topbar { display: flex; }
}

.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 30;
}
.mobile-topbar .brand { font-size: 16px; }
.mobile-topbar .brand img { height: 26px; }
.hamburger { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 16px; cursor: pointer; }

/* ---------------- Dashboard hero / welcome ---------------- */

.welcome-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.welcome-row h1 { font-size: 30px; margin: 0; }
.welcome-row .stat-pill { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--border); padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.welcome-row .stat-pill b { color: var(--text); }
.sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

.notice-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.notice-card.rejected { border-color: rgba(239,68,68,.4); }

/* ---------------- Server grid / cards ---------------- */

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 20px; }
.service-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.service-card:hover { border-color: #34394d; transform: translateY(-2px); }
.service-card .top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 10px; }
.service-card h3 { margin: 0; font-size: 17px; }
.service-card .type-pill { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; display: block; }
.service-card .desc { color: var(--muted); font-size: 13px; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.service-card .actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.service-card .actions .btn { flex: 1; }

/* ---------------- Server creation wizard ---------------- */

.wizard { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
@media (max-width: 800px) { .wizard { grid-template-columns: 1fr; } }

.wizard-nav .card { padding: 16px; }
.wizard-nav .wnav-title { font-weight: 700; margin-bottom: 2px; }
.wizard-nav .wnav-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.wstep { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.wstep .num { width: 22px; height: 22px; border-radius: 50%; background: var(--panel-3); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.wstep.active { color: var(--text); font-weight: 600; }
.wstep.active .num { background: var(--accent); color: white; }
.wstep.done .num { background: var(--green); color: white; }

.type-tabs { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.type-tab { flex: 1; min-width: 130px; text-align: center; padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; font-weight: 600; }
.type-tab.active { border-color: var(--accent); background: rgba(88, 101, 242, .14); }

.field-count { text-align: right; font-size: 11px; color: var(--muted); margin-top: -14px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------------- Per-server console page ---------------- */

.server-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.server-header h1 { margin: 0; font-size: 26px; }
.server-header .sub { margin-bottom: 0; }
.server-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.server-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 24px 0 22px; }
.server-tab { padding: 10px 16px; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.server-tab.active { color: var(--text); border-color: var(--accent); }

.console-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .console-layout { grid-template-columns: 1fr; } }

.console-box {
  background: #05060a;
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  padding: 16px;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  height: 460px;
  overflow-y: auto;
  color: #a6f9c1;
}
.console-empty { color: var(--muted); font-family: inherit; }

.console-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 10px 12px;
}
.console-input-row .chev { color: var(--accent); font-family: monospace; font-weight: 700; }
.console-input-row input { border: none; background: none; padding: 6px 0; }
.console-input-row input:focus { outline: none; }
.console-send { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 6px 8px; border-radius: 8px; }
.console-send:hover { color: var(--accent); background: var(--panel-3); }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.stat-card .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.stat-card .val { font-size: 16px; font-weight: 700; word-break: break-word; }
.stat-card .val.muted { color: var(--muted); font-weight: 500; font-size: 14px; }
.copy-mini { cursor: pointer; color: var(--muted); font-size: 12px; margin-left: 6px; }
.copy-mini:hover { color: var(--text); }

/* ---------------- File manager ---------------- */

.fm-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.fm-search { flex: 1; min-width: 200px; }
.fm-breadcrumb { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.fm-breadcrumb a { color: var(--muted); }
.fm-breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.fm-breadcrumb .sep { opacity: .5; }

.fm-table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.fm-table-wrap table { margin: 0; }
.fm-row-name { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.fm-row-name .ic { width: 18px; text-align: center; }
.fm-row-name:hover { color: var(--accent); }
.fm-actions-cell { display: flex; gap: 6px; justify-content: flex-end; }
.fm-icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.fm-icon-btn:hover { color: var(--text); background: var(--panel-3); }
.fm-icon-btn.danger:hover { color: #fca5a5; background: rgba(239,68,68,.1); }

.editor-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.editor-head .fname { font-family: monospace; font-size: 14px; }
.editor-wrap textarea {
  width: 100%;
  height: 520px;
  border: none;
  border-radius: 0;
  background: #05060a;
  color: #d7e9ff;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
  padding: 18px;
  resize: vertical;
}
.editor-wrap textarea:focus { outline: none; }

/* ---------------- Modal ---------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,5,8,.7);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 100%; max-width: 420px; }
.modal h3 { margin-top: 0; }
.modal .form-actions { margin-top: 20px; }

/* ---- Jail tab ---- */
.jail-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; max-width: 560px; }
.jail-panel h3 { margin: 0 0 6px; }
.jail-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.jail-form input { flex: 1; min-width: 140px; }
.unit-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.unit-btn {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-3);
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s;
}
.unit-btn:hover { color: var(--text); }
.unit-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
