@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-base: #09090b;
  --bg-surface: #111114;
  --bg-elevated: #18181c;
  --bg-hover: #1f1f24;
  --border-subtle: #232329;
  --border-strong: #32323a;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --success: #10b981;
  --danger: #ef4444;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ---------- AUTHENTICATION VIEW ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(to right, rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.015) 1px, transparent 1px),
    var(--bg-base);
  background-size: 40px 40px;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--text-primary);
  color: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.03em;
}

.brand-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-title span {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.auth-card h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-card .sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 22px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 20px;
}

.tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ---------- SHELL LAYOUT (SIDEBAR + MAIN) ---------- */
.app-wrap {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

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

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.servers-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.server-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.server-nav-item:hover {
  background: var(--bg-elevated);
}

.server-nav-item.selected {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.server-nav-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

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

.server-nav-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-nav-port {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.sidebar-link:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 6px;
  padding-right: 6px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
}

/* ---------- MAIN WORKSPACE ---------- */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-base);
}

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

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

.instance-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.status-pill.online {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
}

.status-pill.stopped {
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- TELEMETRY BAR ---------- */
.telemetry-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.telemetry-sep {
  width: 1px;
  height: 26px;
  background: var(--border-subtle);
}

/* ---------- SUB-NAVIGATION TABS ---------- */
.nav-tabs {
  display: flex;
  gap: 24px;
  padding: 0 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 2px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

/* ---------- CONTENT PANELS ---------- */
.content-area {
  padding: 24px 28px;
  max-width: 1240px;
  width: 100%;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.panel-body {
  padding: 18px;
}

/* ---------- TERMINAL / CONSOLE ---------- */
.terminal-window {
  background: #050507;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.terminal-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.console-box {
  padding: 16px;
  height: 460px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #d4d4d8;
  white-space: pre-wrap;
}

.terminal-input-bar {
  display: flex;
  align-items: center;
  background: #0a0a0d;
  border-top: 1px solid var(--border-subtle);
  padding: 0 12px;
}

.terminal-prompt {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 12.5px;
  padding-right: 8px;
  user-select: none;
}

.terminal-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 11px 0;
}

.terminal-input-bar input:focus {
  outline: none;
}

/* ---------- CREDENTIAL / SPEC TABLE ---------- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
}

.spec-row {
  border-bottom: 1px solid var(--border-subtle);
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-label {
  width: 240px;
  padding: 13px 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
  vertical-align: middle;
}

.spec-value {
  padding: 13px 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spec-value input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  width: 100%;
}

.spec-value input:focus {
  outline: none;
}

.spec-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- FORMS & INPUTS ---------- */
.field {
  display: block;
  margin-bottom: 16px;
}

.field span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--text-secondary);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 720px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.err {
  color: var(--danger);
  font-size: 12.5px;
  margin-bottom: 10px;
  min-height: 18px;
}

/* ---------- BUTTONS ---------- */
button,
.btn {
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 5px;
  padding: 7px 13px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-base);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #e4e4e7;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.btn-success:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
}

.btn-icon {
  padding: 5px 8px;
  font-size: 11.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-full {
  width: 100%;
}

/* ---------- EMPTY STATE & MODAL ---------- */
.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.65);
  max-height: 92vh;
  overflow-y: auto;
}

/* ---------- PLAN SELECTOR CARDS ---------- */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
  text-align: left;
}

@media (max-width: 720px) {
  .plans-grid {
    grid-template-columns: 1fr;
  }
}

.plan-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plan-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.plan-card.selected {
  border-color: var(--text-primary);
  background: var(--bg-elevated);
}

.plan-tier-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 8px;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.plan-tier-tag.paid {
  border-color: rgba(249, 115, 22, 0.4);
  color: var(--accent);
  background: rgba(249, 115, 22, 0.08);
}

.plan-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.plan-price {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.plan-specs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.plan-specs li {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-specs li b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

.modal-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
}

svg.ic {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- STANDALONE PAGES (PLANS.HTML & CHECKOUT.HTML) ---------- */
.page-header {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.page-nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.page-nav-link:hover,
.page-nav-link.active {
  color: var(--text-primary);
}

.page-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 44px 24px 72px;
}

.page-hero {
  margin-bottom: 36px;
}

.page-hero h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.page-hero p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 640px;
}

.plans-page-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 44px;
}

@media (max-width: 900px) {
  .plans-page-grid {
    grid-template-columns: 1fr;
  }
}

.plan-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s;
}

.plan-box.featured {
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.plan-box-price {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 12px 0 4px;
}

.plan-box-price span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-box-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.compare-table th,
.compare-table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.compare-table th {
  background: var(--bg-elevated);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.compare-table td:not(:first-child) {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* ---------- CHECKOUT LAYOUT ---------- */
.checkout-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 900px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 24px;
  position: sticky;
  top: 24px;
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.summary-line b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-total span:last-child {
  font-family: var(--font-mono);
  font-size: 18px;
}

.pay-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.pay-method-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.12s;
}

.pay-method-card.selected {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-elevated);
}
