/* openRon-Manager Dashboard Styles */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0f;
  color: #e0e0e0;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────── */

.header {
  background: #111118;
  border-bottom: 1px solid #222;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
}

.header-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Buttons ────────────────────────────────────── */

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary { background: #6366f1; color: white; }
.btn-primary:hover { background: #5558e3; }

.btn-secondary { background: #222; color: #ccc; border: 1px solid #333; }
.btn-secondary:hover { background: #2a2a2a; }

.btn-ghost { background: transparent; color: #888; }
.btn-ghost:hover { color: #ccc; background: rgba(255,255,255,0.04); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Main Content ───────────────────────────────── */

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.instances-section {
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.instance-count {
  font-size: 0.85rem;
  color: #666;
}

/* ── Instance List ──────────────────────────────── */

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

.instances-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: #555;
  font-style: italic;
  background: #0d0d14;
  border: 1px dashed #222;
  border-radius: 12px;
}

/* ── Instance Card ─────────────────────────────── */

.instance-card {
  background: #12121a;
  border: 1px solid #1e1e2e;
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color 0.15s ease;
}

.instance-card:hover {
  border-color: #333;
}

.instance-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.instance-card-name {
  font-weight: 600;
  font-size: 1rem;
}

.instance-card-url {
  font-size: 0.78rem;
  color: #888;
  word-break: break-all;
  margin-bottom: 0.75rem;
}

.instance-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: #666;
}

/* ── Status Badges ─────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-pending-registration .status-dot { background: #6b7280; }
.status-pending-registration { background: rgba(107,114,128,0.12); color: #9ca3af; }

.status-registered .status-dot { background: #eab308; }
.status-registered { background: rgba(234,179,8,0.12); color: #eab308; }

.status-deploying .status-dot { background: #3b82f6; animation: pulse-dot 1.5s ease-in-out infinite; }
.status-deploying { background: rgba(59,130,246,0.12); color: #3b82f6; }

.status-active .status-dot { background: #22c55e; }
.status-active { background: rgba(34,197,94,0.12); color: #22c55e; }

.status-suspended .status-dot, .status-locked .status-dot { background: #ef4444; }
.status-suspended .status-dot { background: #f97316; }
.status-suspended { background: rgba(249,115,22,0.12); color: #f97316; }

.status-locked .status-dot { background: #ef4444; }
.status-locked { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Instance Table ────────────────────────────── */

.table-container {
  border: 1px solid #1e1e2e;
  border-radius: 10px;
  background: #12121a;
  overflow: visible;
}

.instance-table {
  width: 100%;
  border-collapse: collapse;
}

.instance-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  border-bottom: 1px solid #1e1e2e;
  white-space: nowrap;
}

.instance-table td {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #1a1a28;
}

.instance-table tr:last-child td { border-bottom: none; }
.instance-table tr:hover td { background: rgba(99,102,241,0.04); }

/* ── Sortable Headers ─────────────────────────── */

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: #ccc;
}

.sortable.sorted {
  color: #818cf8;
}

.sort-icon {
  font-size: 0.7rem;
  color: #818cf8;
}

/* ── Open Instance Button ────────────────────── */

.open-instance-btn {
  background: none;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #6366f1;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.open-instance-btn:hover {
  color: #818cf8;
  background: rgba(99,102,241,0.1);
  border-color: #6366f1;
}

/* ── Kebab Action Menu ────────────────────────── */

.kebab-menu {
  position: relative;
  display: inline-block;
}

.kebab-trigger {
  background: none;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #888;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  line-height: 1;
  letter-spacing: 1px;
}

.kebab-trigger:hover {
  color: #e0e0e0;
  background: #1e1e2e;
  border-color: #444;
}

.kebab-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #1a1a2e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  overflow: hidden;
}

.kebab-dropdown.open {
  display: flex;
  flex-direction: column;
}

.kebab-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  color: #ccc;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.kebab-item:hover {
  background: rgba(99,102,241,0.1);
  color: #fff;
}

.kebab-item.kebab-success { color: #22c55e; }
.kebab-item.kebab-success:hover { background: rgba(34,197,94,0.15); }
.kebab-item.kebab-warning { color: #f59e0b; }
.kebab-item.kebab-warning:hover { background: rgba(245,158,11,0.15); }
.kebab-item.kebab-danger { color: #ef4444; }
.kebab-item.kebab-danger:hover { background: rgba(239,68,68,0.15); }

.kebab-divider {
  height: 1px;
  background: #2a2a3a;
  margin: 0.25rem 0;
}

/* ── Heartbeat Warning Indicators ─────────────── */

.heartbeat-warning {
  background: rgba(234,179,8,0.1);
  color: #eab308;
}

.heartbeat-stale {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

/* ── Deploy Wizard ────────────────────────────── */

.deploy-modal-wide {
  max-width: 600px;
}

.deploy-wizard {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.deploy-step {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #1a1a28;
}

.deploy-step:last-child { border-bottom: none; }

.deploy-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.deploy-step.pending .deploy-step-icon {
  background: #1e1e2e;
  border: 2px solid #333;
}
.deploy-step.pending .deploy-step-icon::after { content: ''; }

.deploy-step.running .deploy-step-icon {
  background: rgba(59,130,246,0.15);
  border: 2px solid #3b82f6;
  animation: deploy-spin 1s linear infinite;
}
.deploy-step.running .deploy-step-icon::after {
  content: '';
  width: 8px;
  height: 8px;
  border: 2px solid #3b82f6;
  border-top-color: transparent;
  border-radius: 50%;
  animation: deploy-spin 0.6s linear infinite;
}

.deploy-step.done .deploy-step-icon {
  background: rgba(34,197,94,0.15);
  border: 2px solid #22c55e;
  color: #22c55e;
}
.deploy-step.done .deploy-step-icon::after { content: '\2713'; }

.deploy-step.failed .deploy-step-icon {
  background: rgba(239,68,68,0.15);
  border: 2px solid #ef4444;
  color: #ef4444;
}
.deploy-step.failed .deploy-step-icon::after { content: '\2717'; }

@keyframes deploy-spin {
  to { transform: rotate(360deg); }
}

.deploy-step-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.deploy-step-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: #ccc;
}

.deploy-step.pending .deploy-step-label { color: #666; }
.deploy-step.running .deploy-step-label { color: #e0e0e0; }
.deploy-step.done .deploy-step-label { color: #22c55e; }
.deploy-step.failed .deploy-step-label { color: #ef4444; }

.deploy-step-detail {
  font-size: 0.75rem;
  color: #888;
  word-break: break-all;
}

.deploy-step.failed .deploy-step-detail { color: #f87171; }

#deploy-result {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 8px;
  text-align: center;
}

#deploy-result a {
  color: #22c55e;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}

#deploy-result a:hover { text-decoration: underline; }

.deploy-wizard-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #1e1e2e;
}

/* ── Modal ─────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: #16161e;
  border: 1px solid #27273a;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #222;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #666;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.modal-close:hover { color: #ccc; }

.modal-body {
  padding: 1.5rem;
}

/* ── Form ──────────────────────────────────────── */

.form-group {
  margin-bottom: 1.125rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #aaa;
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="url"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: #0c0c12;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.88rem;
  transition: border-color 0.15s ease;
}

input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

.monospace {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Secret Display ────────────────────────────── */

.secret-warning {
  background: rgba(234,179,8,0.08);
  border: 1px solid rgba(234,179,8,0.2);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.83rem;
  color: #eab308;
  margin-bottom: 1.125rem;
  line-height: 1.5;
}

.secret-warning code {
  background: rgba(234,179,8,0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

.secret-field {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.secret-field input {
  flex: 1;
  background: #0a0a10;
  border-color: #444;
  user-select: all;
  cursor: pointer;
}

/* ── Toast ─────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e1e2e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  font-size: 0.85rem;
  color: #ccc;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  z-index: 300;
  animation: slideIn 0.2s ease;
}

.toast.success { border-left: 3px solid #22c55e; }
.toast.error { border-left: 3px solid #ef4444; }
.toast.info { border-left: 3px solid #6366f1; }

@keyframes slideIn {
  from { transform: translateY(1rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Generic Table (used by detail page) ─────── */

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  border-bottom: 1px solid #1e1e2e;
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #15152a;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(79, 70, 229, 0.04); }

.empty-state {
  text-align: center !important;
  padding: 3rem 1rem !important;
  color: #555;
}

.monospace-sm {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
}

/* ── Instance Detail Page ──────────────────────── */

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #1e1e2e;
  color: #aaa;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.15s ease;
  margin-right: 0.25rem;
}

.back-btn:hover { background: #2a2a3a; color: #fff; }

/* ── Detail Cards ─────────────────────────────── */

.detail-card {
  background: #12121a;
  border: 1px solid #1e1e2e;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.detail-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ccc;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1e1e2e;
}

/* ── Detail Grid (overview/config) ────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  font-weight: 500;
}

.detail-value {
  font-size: 0.9rem;
  color: #e0e0e0;
  word-break: break-all;
}

.detail-value a {
  color: #818cf8;
  text-decoration: none;
}

.detail-value a:hover { text-decoration: underline; }

/* ── Agent State Badges ───────────────────────── */

.agent-state-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
}

.agent-running {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.agent-stopped {
  background: rgba(156, 163, 175, 0.12);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.2);
}

.agent-error {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Agent History Timeline ───────────────────── */

.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #1a1a28;
  font-size: 0.82rem;
  transition: background 0.1s ease;
}

.history-item:last-child { border-bottom: none; }
.history-item:hover { background: rgba(255,255,255,0.02); }

.history-time {
  color: #666;
  min-width: 150px;
  flex-shrink: 0;
  font-size: 0.78rem;
}

.history-agent {
  color: #818cf8;
  min-width: 80px;
}

.history-type {
  color: #888;
  min-width: 90px;
}

.history-event {
  font-weight: 500;
  min-width: 70px;
}

.history-started .history-event { color: #22c55e; }
.history-stopped .history-event { color: #9ca3af; }
.history-errored .history-event { color: #ef4444; }

.history-ticket {
  color: #aaa;
}

/* ── Resource Usage Bars ──────────────────────── */

.resource-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.resource-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.resource-label {
  font-size: 0.82rem;
  color: #888;
  min-width: 65px;
  font-weight: 500;
}

.resource-bar-container {
  flex: 1;
  height: 8px;
  background: #1a1a28;
  border-radius: 4px;
  overflow: hidden;
}

.resource-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.resource-bar-memory { background: linear-gradient(90deg, #6366f1, #818cf8); }
.resource-bar-cpu { background: linear-gradient(90deg, #22c55e, #4ade80); }

.resource-value {
  font-size: 0.82rem;
  color: #ccc;
  min-width: 65px;
  text-align: right;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Controls Grid ────────────────────────────── */

.controls-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Lifecycle Action Buttons ────────────────── */

.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: #d97706; color: white; }
.btn-warning:hover { background: #b45309; }

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

/* ── Confirmation Modal ──────────────────────── */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}

.confirm-card {
  background: #16161e;
  border: 1px solid #27273a;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.confirm-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #e0e0e0;
}

.confirm-message {
  font-size: 0.88rem;
  color: #999;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ── Sidebar Layout ──────────────────────────── */

.layout {
  display: flex;
  min-height: calc(100vh - 53px);
}

.sidebar {
  width: 220px;
  background: #111118;
  border-right: 1px solid #1e1e2e;
  padding: 1.25rem 0;
  flex-shrink: 0;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: #888;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: #ccc;
  background: rgba(255,255,255,0.03);
}

.sidebar-nav a.active {
  color: #818cf8;
  background: rgba(99,102,241,0.08);
  border-left-color: #6366f1;
}

.sidebar-nav .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.content-area {
  flex: 1;
  min-width: 0;
}

/* ── Login & Setup Pages ─────────────────────── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  background: #12121a;
  border: 1px solid #1e1e2e;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.auth-card-wide {
  max-width: 520px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.auth-logo h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e0e0e0;
}

.auth-logo p {
  font-size: 0.82rem;
  color: #666;
  margin-top: 0.35rem;
}

.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: #ef4444;
  margin-bottom: 1rem;
  display: none;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.auth-form .btn {
  width: 100%;
  justify-content: center;
  padding: 0.65rem 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: #666;
}

.auth-footer a {
  color: #818cf8;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: #0c0c12;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.88rem;
  transition: border-color 0.15s ease;
}

input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

/* ── Users Page ──────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.user-status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 500;
}

.user-status-active {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
}

.user-status-pending {
  background: rgba(234,179,8,0.12);
  color: #eab308;
}

/* ── Settings Page ───────────────────────────── */

.settings-section {
  background: #12121a;
  border: 1px solid #1e1e2e;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #ccc;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1e1e2e;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid #15152a;
}

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

.settings-label {
  font-size: 0.82rem;
  color: #888;
  font-weight: 500;
}

.settings-value {
  font-size: 0.88rem;
  color: #e0e0e0;
}

.settings-value.masked {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: #666;
}

.change-password-form {
  max-width: 400px;
}

.change-password-form .form-group {
  margin-bottom: 1rem;
}

/* ── Deploy Instance Form (index page) ───────── */

.deploy-form .form-group {
  margin-bottom: 1rem;
}

/* ── Invite Link Display ─────────────────────── */

.invite-link {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.75rem;
}

.invite-link input {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  background: #0a0a10;
  border-color: #444;
  user-select: all;
  cursor: pointer;
}

/* ── Responsive ──────────────────────────────── */

@media (max-width: 1024px) {
  .sidebar { width: 180px; }
}

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #1e1e2e;
    padding: 0.5rem 0;
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 0;
  }
  .sidebar-nav a {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 1rem;
    white-space: nowrap;
  }
  .sidebar-nav a.active {
    border-left-color: transparent;
    border-bottom-color: #6366f1;
  }
  .detail-grid { grid-template-columns: 1fr; }
  .history-item { flex-wrap: wrap; gap: 0.4rem; }
  .history-time { min-width: auto; }
  .auth-form .form-row { grid-template-columns: 1fr; }
}

/* ── Version Badge ───────────────────────────── */

.version-badge {
  font-size: 0.72rem;
  color: #eab308;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(234,179,8,0.3);
  background: rgba(234,179,8,0.08);
}

.version-badge:hover {
  color: #facc15;
  border-color: rgba(234,179,8,0.5);
  background: rgba(234,179,8,0.12);
}

/* ── Update Banner ───────────────────────────── */

.update-banner {
  display: none;
  background: #dc3545;
  color: white;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-weight: bold;
  font-size: 0.85rem;
  text-align: center;
  position: relative;
  animation: update-pulse 2s infinite;
}

.update-banner.visible { display: block; }

.has-update-banner .header { margin-top: 0; }

@keyframes update-pulse {
  0%, 100% { background: #dc3545; }
  50% { background: #b02a37; }
}

.update-banner-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78rem;
  margin-left: 0.75rem;
}

.update-banner-btn:hover { background: rgba(255,255,255,0.3); }

.update-banner-dismiss {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.2rem;
  cursor: pointer;
}

.update-banner-dismiss:hover { color: white; }

/* ── Release Notes Modal ─────────────────────── */

.release-notes-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.release-notes-backdrop.open {
  display: flex;
}

.release-notes-modal {
  width: 760px;
  max-width: 94vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: #12121e;
  border: 1px solid #2a2a3a;
  border-radius: 12px;
  overflow: hidden;
}

.release-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #1e1e2e;
}

.release-notes-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
}

.release-notes-versions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.release-notes-close {
  background: none;
  border: none;
  color: #666;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.release-notes-close:hover { color: #ccc; }

.release-notes-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

.release-notes-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #1e1e2e;
}

.btn-check-updates, .btn-close-modal {
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid #2a2a3a;
}

.btn-check-updates { background: #1e1e2e; color: #ccc; }
.btn-check-updates:hover { background: #2a2a3a; }
.btn-close-modal { background: #6366f1; color: white; border-color: #6366f1; }
.btn-close-modal:hover { background: #5558e6; }

/* ── Release Notes Content ───────────────────── */

.rn-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.rn-badge-current { background: #1e1e3a; color: #6366f1; }
.rn-badge-latest { background: #1a3a1a; color: #22c55e; }

.rn-version-block {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid #1e1e2e;
  border-radius: 8px;
  background: #0f0f1a;
}

.rn-version-block.rn-current {
  border-color: #6366f1;
  background: rgba(99,102,241,0.05);
}

.rn-version-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.rn-version-num {
  font-weight: 700;
  font-size: 0.95rem;
  color: #e0e0e0;
}

.rn-version-date {
  font-size: 0.75rem;
  color: #666;
}

.rn-you-are-here {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: #6366f1;
  color: white;
  font-weight: 600;
}

.rn-new-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: #22c55e;
  color: white;
  font-weight: 600;
}

.rn-section {
  font-size: 0.82rem;
  color: #aaa;
  margin: 0.75rem 0 0.35rem;
  font-weight: 600;
}

.rn-list {
  padding-left: 1.25rem;
  margin: 0;
}

.rn-list li {
  font-size: 0.82rem;
  color: #ccc;
  line-height: 1.5;
  margin-bottom: 0.2rem;
}

.rn-list code {
  background: #1e1e2e;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.78rem;
  color: #a5b4fc;
}
