@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-hover: #E2E8F0;
  --border: #E2E8F0;
  --border-focus: #94A3B8;

  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --text-inverse: #FFFFFF;

  --brand-primary: #2563EB;
  --brand-primary-hover: #1D4ED8;
  --brand-primary-light: #EFF6FF;

  --accent-emerald: #059669;
  --accent-emerald-light: #ECFDF5;
  --accent-amber: #D97706;
  --accent-amber-light: #FFFBEB;
  --accent-rose: #DC2626;
  --accent-rose-light: #FEF2F2;

  --terminal-bg: #0B0F19;
  --terminal-text: #E2E8F0;
  --terminal-border: #1E293B;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
}

.sidebar-header {
  padding: 20px 20px 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
  border-radius: var(--radius-full);
}

.sidebar-server-context {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-page);
}

.server-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.server-select:focus {
  border-color: var(--brand-primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 12px 10px 4px 10px;
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--brand-primary);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Area */
.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header */
.app-header {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.header-server-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Content Container */
.app-content {
  padding: 28px;
  flex: 1;
}

/* Card */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Grid Systems */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

/* Stat Card */
.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap.blue { background-color: var(--brand-primary-light); color: var(--brand-primary); }
.stat-icon-wrap.green { background-color: var(--accent-emerald-light); color: var(--accent-emerald); }
.stat-icon-wrap.amber { background-color: var(--accent-amber-light); color: var(--accent-amber); }
.stat-icon-wrap.rose { background-color: var(--accent-rose-light); color: var(--accent-rose); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--brand-primary-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-main);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-subtle);
  border-color: var(--border-focus);
}

.btn-success {
  background-color: var(--accent-emerald);
  color: #FFFFFF;
}
.btn-success:hover:not(:disabled) {
  background-color: #047857;
}

.btn-danger {
  background-color: var(--accent-rose);
  color: #FFFFFF;
}
.btn-danger:hover:not(:disabled) {
  background-color: #B91C1C;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Status Indicator Dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}
.status-dot.running { background-color: var(--accent-emerald); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25); }
.status-dot.starting { background-color: var(--accent-amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25); animation: craftpanel-pulse 1.2s infinite ease-in-out; }
.status-dot.stopping { background-color: #EA580C; box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.25); animation: craftpanel-pulse 1.2s infinite ease-in-out; }
.status-dot.restarting { background-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); animation: craftpanel-pulse 1.2s infinite ease-in-out; }
.status-dot.stopped { background-color: var(--text-subtle); }
.status-dot.crashed { background-color: var(--accent-rose); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25); }

.btn-disabled, .btn:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background-color: var(--accent-emerald-light); color: var(--accent-emerald); }
.badge-amber { background-color: var(--accent-amber-light); color: var(--accent-amber); }
.badge-rose { background-color: var(--accent-rose-light); color: var(--accent-rose); }
.badge-blue { background-color: var(--brand-primary-light); color: var(--brand-primary); }
.badge-gray { background-color: var(--bg-subtle); color: var(--text-muted); }

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-page);
}

table.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tr:hover td {
  background-color: var(--bg-page);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-light);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Console Container */
.console-box {
  background-color: var(--terminal-bg);
  border: 1px solid var(--terminal-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: 600px;
  overflow: hidden;
}

.console-header {
  padding: 10px 16px;
  background-color: #080B12;
  border-bottom: 1px solid var(--terminal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.console-title {
  color: #94A3B8;
  font-size: 12px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-output {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  font-family: 'Consolas', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.45;
  color: #E2E8F0;
  background-color: #080B12;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
}

.console-line {
  display: block;
  min-height: 1.45em;
  font-family: 'Consolas', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  color: #E2E8F0;
}
.console-line.info { color: #E2E8F0; }
.console-line.warn { color: #FBBF24; }
.console-line.error { color: #F87171; }
.console-line.cmd { color: #38BDF8; font-weight: 600; }

.console-input-wrap {
  padding: 10px 16px;
  background-color: #080B12;
  border-top: 1px solid var(--terminal-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.console-prompt {
  color: #38BDF8;
  font-family: var(--font-mono);
  font-weight: 700;
}

.console-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-card.wide {
  max-width: 860px;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-page);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100001;
}

.toast {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px;
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 4px solid var(--accent-emerald); }
.toast.error { border-left: 4px solid var(--accent-rose); }
.toast.info { border-left: 4px solid var(--brand-primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Setup & Auth Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-page);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 32px;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  height: 54px;
  margin-bottom: 14px;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-sidebar {
    width: 72px;
  }
  .brand-title, .brand-badge, .nav-section-title, .nav-item span, .user-meta, .sidebar-server-context {
    display: none;
  }
  .app-main {
    margin-left: 72px;
  }
  .grid-cols-4, .grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   CraftPanel Code Editor Styles
   ========================================================================== */

.code-editor-root {
  display: flex;
  flex-direction: column;
  background-color: #0F172A;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 520px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-family: var(--font-mono);
}

.code-editor-root.is-fullscreen {
  height: calc(100vh - 160px) !important;
}

.modal-card.editor-modal-fullscreen {
  max-width: 98vw !important;
  width: 98vw !important;
  max-height: 96vh !important;
  height: 96vh !important;
}

.code-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background-color: #1E293B;
  border-bottom: 1px solid #334155;
  gap: 12px;
}

.code-editor-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-file-badge {
  font-size: 12px;
  font-weight: 600;
  color: #F8FAFC;
  background: #334155;
  padding: 3px 8px;
  border-radius: 4px;
}

.editor-lang-badge {
  font-size: 10px;
  font-weight: 700;
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.code-editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #0F172A;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 2px 6px;
}

.editor-search-input {
  background: transparent;
  border: none;
  color: #F8FAFC;
  font-size: 11px;
  font-family: var(--font-sans);
  outline: none;
  width: 140px;
}

.editor-search-count {
  font-size: 10px;
  color: #94A3B8;
  padding: 0 4px;
}

.editor-tool-btn {
  background: #334155;
  border: 1px solid #475569;
  color: #E2E8F0;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.editor-tool-btn:hover {
  background: #475569;
  color: #FFF;
}

.code-editor-workspace {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: #0F172A;
}

.code-editor-gutter {
  width: 52px;
  background-color: #141E33;
  border-right: 1px solid #1E293B;
  color: #64748B;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  padding: 12px 0;
  text-align: right;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}

.gutter-line {
  padding-right: 12px;
  height: 20px;
}

.gutter-line.active-line {
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.08);
  font-weight: 600;
}

.code-editor-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.code-editor-highlight,
.code-editor-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  margin: 0;
  border: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 20px;
  tab-size: 2;
  white-space: pre;
  word-break: normal;
  overflow: auto;
  box-sizing: border-box;
}

.code-editor-highlight {
  background: transparent;
  color: #F8FAFC;
  pointer-events: none;
  z-index: 1;
}

.code-editor-highlight code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: inherit;
}

.code-editor-input {
  background: transparent;
  color: transparent;
  caret-color: #38BDF8;
  resize: none;
  outline: none;
  z-index: 2;
}

.code-editor-input::selection {
  background: rgba(56, 189, 248, 0.25);
  color: transparent;
}

/* Syntax Token Colors */
.tok-comment {
  color: #6A9955 !important;
  font-style: italic;
}

.tok-key {
  color: #38BDF8 !important;
  font-weight: 600;
}

.tok-string {
  color: #FCD34D !important;
}

.tok-number {
  color: #C084FC !important;
}

.tok-bool {
  color: #4ADE80 !important;
  font-weight: 600;
}

.tok-section {
  color: #F472B6 !important;
  font-weight: 700;
}

.tok-search {
  background-color: rgba(245, 158, 11, 0.45);
  color: inherit;
  border-radius: 2px;
  padding: 0;
}

.tok-search.tok-search-active {
  background-color: #38BDF8 !important;
  color: #0F172A !important;
  font-weight: 700;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #0284C7;
}

.code-editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  background-color: #1E293B;
  border-top: 1px solid #334155;
  font-size: 11px;
  color: #94A3B8;
  font-family: var(--font-mono);
}

/* Server Lifecycle Transition Overlay */
.server-lifecycle-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(8, 11, 18, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  user-select: none;
  animation: fadeIn 0.25s ease;
}

.server-lifecycle-card {
  background-color: #0F172A;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.server-lifecycle-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.server-lifecycle-icon-wrap.stopping {
  background-color: rgba(234, 88, 12, 0.15);
  color: #F97316;
  border: 2px solid rgba(234, 88, 12, 0.3);
}

.server-lifecycle-icon-wrap.stopped {
  background-color: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 2px solid rgba(239, 68, 68, 0.3);
}

.server-lifecycle-icon-wrap.restarting {
  background-color: rgba(37, 99, 235, 0.15);
  color: #3B82F6;
  border: 2px solid rgba(37, 99, 235, 0.3);
}

.server-lifecycle-icon-wrap.starting {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 2px solid rgba(16, 185, 129, 0.3);
}

.server-lifecycle-spinner {
  animation: craftpanel-spin 1.2s linear infinite;
}

.server-lifecycle-title {
  font-size: 19px;
  font-weight: 700;
  color: #F8FAFC;
  margin: 0;
}

.server-lifecycle-desc {
  font-size: 13.5px;
  color: #94A3B8;
  margin: 0;
  line-height: 1.5;
}

.server-lifecycle-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   Console Autocomplete & In-Game Command Assistant Overlay (HUD)
   ========================================================================== */
.console-assistant-hud {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 50;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

.console-hint-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.9);
  border-bottom: 1px solid #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #F8FAFC;
  flex-wrap: wrap;
}

.console-hint-bar .hint-icon {
  font-size: 13px;
  color: var(--accent-amber);
}

.console-hint-bar .hint-usage {
  font-weight: 600;
  color: #E2E8F0;
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.console-hint-bar .syntax-param {
  color: #38BDF8;
  font-weight: 600;
}

.console-hint-bar .syntax-opt {
  color: #FBBF24;
  font-weight: 500;
}

.console-hint-bar .hint-desc {
  font-size: 11px;
  color: #94A3B8;
  margin-left: auto;
}

.console-suggestions-list {
  display: flex;
  flex-direction: column;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  color: #CBD5E1;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
}

.suggestion-item.active {
  box-shadow: inset 2px 0 0 #3B82F6;
}

.suggestion-item .sug-match {
  color: #34D399;
  font-weight: 700;
}

.suggestion-item .sug-key-hint {
  font-size: 10px;
  color: #64748B;
  background: rgba(30, 41, 59, 0.8);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid #334155;
}

/* ==========================================================================
   Monitoring Categories & Live Graphs
   ========================================================================== */
.mon-nav-pills {
  display: flex;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.mon-pill {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mon-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.mon-pill.active {
  color: #FFF;
  background: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 180px;
}

.chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: #F8FAFC;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 20;
  white-space: nowrap;
  display: none;
  transform: translate(-50%, -110%);
}


/* Console: rows are virtualized, see js/virtual-log.js */
.console-output { min-width: 0; width: 100%; }
.console-jump-latest {
  position: absolute;
  right: 22px;
  bottom: 12px;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid #334155;
  border-radius: var(--radius-full);
  background-color: #1E293B;
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.console-jump-latest:hover { background-color: #334155; }

/* Assistant */
.chat-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: calc(100vh - 118px);
  min-height: 460px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  background-color: var(--bg-page);
  border-right: 1px solid var(--border);
}
.chat-new { width: 100%; justify-content: center; }
.chat-new svg { width: 14px; height: 14px; }
.chat-history { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-history-empty { padding: 12px 6px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.chat-history-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
}
.chat-history-item:hover, .chat-history-item:focus-visible { background-color: var(--bg-subtle); outline: none; }
.chat-history-item.active { background-color: var(--bg-hover); font-weight: 600; }
.chat-history-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history-delete {
  flex-shrink: 0;
  display: none;
  width: 22px;
  height: 22px;
  padding: 3px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.chat-history-delete:hover { background-color: var(--accent-rose-light); color: var(--accent-rose); }
.chat-history-item:hover .chat-history-delete, .chat-history-delete:focus-visible { display: block; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.chat-title { min-width: 0; font-size: 14px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-model { flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 18px; }
.chat-row { width: 100%; max-width: 820px; margin: 0 auto; }
.chat-row-user { display: flex; justify-content: flex-end; }
.chat-bubble {
  max-width: 80%;
  padding: 9px 14px;
  border-radius: 14px 14px 4px 14px;
  background-color: var(--bg-subtle);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chat-row-assistant { display: flex; flex-direction: column; gap: 8px; }
.chat-row-assistant:empty::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-subtle);
  animation: craftpanel-pulse 1.2s infinite ease-in-out;
}

.chat-md { font-size: 14px; line-height: 1.6; color: var(--text-main); overflow-wrap: anywhere; }
.chat-md > :first-child { margin-top: 0; }
.chat-md > :last-child { margin-bottom: 0; }
.chat-md p { margin: 0 0 10px; }
.chat-md ul, .chat-md ol { margin: 0 0 10px; padding-left: 22px; }
.chat-md li { margin-bottom: 3px; }
.chat-md h3, .chat-md h4, .chat-md h5, .chat-md h6 { margin: 14px 0 6px; font-size: 14px; font-weight: 700; }
.chat-md h3 { font-size: 16px; }
.chat-md code { padding: 1px 5px; border-radius: 4px; background-color: var(--bg-subtle); font-family: var(--font-mono); font-size: 12.5px; }
.chat-md a { color: var(--brand-primary); text-decoration: underline; }
.chat-code {
  margin: 0 0 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background-color: var(--terminal-bg);
  color: #E2E8F0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}
.chat-md .chat-code code { padding: 0; background: none; color: inherit; }

.chat-thinking > summary, .chat-tool > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.chat-thinking > summary::-webkit-details-marker, .chat-tool > summary::-webkit-details-marker { display: none; }
.chat-thinking > summary { width: fit-content; padding: 2px 0; font-size: 13px; color: var(--text-muted); }
.chat-thinking > summary:hover { color: var(--text-main); }
.chat-thinking > summary svg { width: 14px; height: 14px; flex-shrink: 0; }
.chat-thinking.is-active .chat-thinking-label {
  background: linear-gradient(90deg, var(--text-muted) 30%, var(--text-subtle) 50%, var(--text-muted) 70%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: chat-shimmer 1.8s linear infinite;
}
@keyframes chat-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.chat-thinking-body {
  margin: 6px 0 2px 6px;
  padding-left: 13px;
  border-left: 2px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.chat-thinking-body.chat-md { color: var(--text-muted); }

.chat-tool { border: 1px solid var(--border); border-radius: var(--radius-sm); background-color: var(--bg-surface); font-size: 13px; }
.chat-tool > summary { padding: 7px 10px; min-width: 0; }
.chat-tool > summary:hover { background-color: var(--bg-page); }
.chat-tool-status { flex-shrink: 0; width: 15px; height: 15px; color: var(--text-muted); }
.chat-tool-status svg { display: block; width: 100%; height: 100%; }
.chat-tool.is-running .chat-tool-status { animation: craftpanel-pulse 1.2s infinite ease-in-out; }
.chat-tool.is-ok .chat-tool-status { color: var(--accent-emerald); }
.chat-tool.is-failed .chat-tool-status { color: var(--accent-rose); }
.chat-tool.is-waiting { border-color: var(--accent-amber); }
.chat-tool.is-waiting .chat-tool-status { color: var(--accent-amber); }
.chat-tool-name { flex-shrink: 0; font-weight: 600; color: var(--text-main); }
.chat-tool-arg {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-tool-time { flex-shrink: 0; margin-left: auto; font-size: 11px; color: var(--text-subtle); }
.chat-tool-body { padding: 10px; border-top: 1px solid var(--border); }
.chat-tool-section-title { margin-bottom: 4px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.chat-tool-body pre {
  margin: 0 0 10px;
  padding: 8px 10px;
  max-height: 260px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background-color: var(--bg-page);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-tool-output pre { margin-bottom: 0; }
.chat-approval { margin-bottom: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background-color: var(--accent-amber-light); }
.chat-approval.is-destructive { background-color: var(--accent-rose-light); }
.chat-approval-text { margin-bottom: 8px; font-weight: 600; color: var(--text-main); }
.chat-approval-all { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-size: 12px; cursor: pointer; }
.chat-approval-actions { display: flex; gap: 6px; }
.chat-error { padding: 8px 12px; border-radius: var(--radius-sm); background-color: var(--accent-rose-light); color: var(--accent-rose); font-size: 13px; overflow-wrap: anywhere; }
.chat-cancelled { font-size: 12px; color: var(--text-subtle); }

.chat-composer { display: flex; align-items: flex-end; gap: 8px; width: calc(100% - 36px); max-width: 820px; margin: 0 auto; padding: 8px 8px 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background-color: var(--bg-surface); }
.chat-composer:focus-within { border-color: var(--border-focus); }
.chat-composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 180px;
  padding: 6px 0;
  border: none;
  outline: none;
  resize: none;
  background: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}
.chat-send { flex-shrink: 0; width: 34px; height: 34px; padding: 8px; border-radius: 50%; }
.chat-send svg { display: block; width: 100%; height: 100%; }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-disclaimer { margin: 6px 18px 10px; text-align: center; font-size: 11px; color: var(--text-subtle); }

.chat-welcome, .chat-notice { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; margin: auto; max-width: 560px; }
.chat-notice { padding: 64px 24px; }
.chat-welcome h3, .chat-notice h3 { font-size: 18px; font-weight: 700; color: var(--text-main); }
.chat-welcome p, .chat-notice p { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.chat-notice-icon { width: 36px; height: 36px; color: var(--brand-primary); }
.chat-notice-icon svg { width: 100%; height: 100%; }
.chat-suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; margin-top: 6px; }
.chat-suggestion {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.chat-suggestion:hover { background-color: var(--bg-subtle); border-color: var(--border-focus); }

@media (max-width: 760px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 100px); }
  .chat-sidebar { display: none; }
  .chat-suggestions { grid-template-columns: minmax(0, 1fr); }
}

/* MCP settings */
.mcp-endpoint {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
  user-select: all;
}
.mcp-config {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--terminal-bg);
  color: #E2E8F0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
}
.mcp-warning { padding: 8px 12px; border-radius: var(--radius-sm); background-color: var(--accent-amber-light); color: var(--accent-amber); font-size: 12px; line-height: 1.5; }
.form-hint a { color: var(--brand-primary); text-decoration: underline; }


/* Installed plugins */
.plugin-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.plugin-version { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plugin-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Version choice in the install dialog */
.version-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.version-picker select { flex: 1; min-width: 180px; }
