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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232733;
  --border: #2d3140;
  --text: #e1e4ed;
  --text2: #8b90a0;
  --accent: #6c8cff;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 360px;
}
.login-box h1 { font-size: 20px; margin-bottom: 20px; }
.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}
.login-box input:focus { border-color: var(--accent); }
/* Google sign-in button */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}
.google-btn:hover {
  background: #f7f8f8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.google-btn svg { flex-shrink: 0; }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; display: none; text-align: center; }

/* Layout */
.app { display: none; padding: 24px; max-width: 1400px; margin: 0 auto; }
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.header h1 { font-size: 22px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.refresh-btn {
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
}
.refresh-btn:hover { color: var(--text); border-color: var(--accent); }
.last-updated { color: var(--text2); font-size: 12px; }

/* User badge in header */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.user-email {
  color: var(--text2);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.role-superadmin {
  background: rgba(251,191,36,0.15);
  color: var(--yellow);
}
.role-admin {
  background: rgba(108,140,255,0.15);
  color: var(--accent);
}
.role-member {
  background: rgba(139,144,160,0.15);
  color: var(--text2);
}
.users-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s;
}
.users-btn:hover { border-color: var(--accent); }
.logout-link {
  color: var(--text2);
  text-decoration: none;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}
.logout-link:hover { color: var(--red); }

/* Users modal */
.users-add-form {
  padding: 16px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.instance-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.instance-cb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.instance-cb:hover { border-color: var(--accent); }
.instance-cb input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}
.users-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.users-table-header {
  display: grid;
  grid-template-columns: 2fr 0.8fr 1.2fr 1.2fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.users-table-row {
  display: grid;
  grid-template-columns: 2fr 0.8fr 1.2fr 1.2fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 6px;
  font-size: 13px;
  align-items: center;
}
.user-table-email {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-table-instances {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
}
.user-table-login {
  font-size: 11px;
  color: var(--text2);
}
.user-table-actions {
  display: flex;
  gap: 4px;
}
.btn-sm {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }

/* Grid */
.instances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }

.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge.native { background: #1e3a5f; color: #60a5fa; }
.badge.container { background: #1e3a2e; color: #4ade80; }

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 12px;
}
.stat-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.stat-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s;
}

/* Meta */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 12px;
}
.meta-item { display: flex; gap: 4px; }
.meta-item span:first-child { color: var(--text2); }
.meta-item span:last-child { color: var(--text); }

/* Agents */
.agents-section { margin-top: 16px; }
.agents-section h3 { font-size: 13px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.agent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 6px;
  margin-bottom: 4px;
}
.agent-name { font-weight: 600; font-size: 13px; }
.agent-model { font-size: 12px; color: var(--text2); font-family: var(--mono); }

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.action-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* Cron */
.cron-section { margin-top: 16px; }
.cron-section h3 {
  font-size: 13px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cron-toggle-btn {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
}
.cron-toggle-btn:hover { text-decoration: underline; }
.cron-list { display: none; }
.cron-list.expanded { display: block; }
.cron-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 6px;
  margin-bottom: 4px;
  gap: 8px;
}
.cron-info { flex: 1; min-width: 0; }
.cron-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 4px; min-width: 0; }
.cron-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cron-inspect-btn { flex-shrink: 0; }
.cron-meta { font-size: 11px; color: var(--text2); font-family: var(--mono); margin-top: 2px; }
.cron-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.cron-toggle input { opacity: 0; width: 0; height: 0; }
.cron-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 10px;
  transition: 0.2s;
}
.cron-slider:before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text2);
  border-radius: 50%;
  transition: 0.2s;
}
.cron-toggle input:checked + .cron-slider { background: var(--green); }
.cron-toggle input:checked + .cron-slider:before { transform: translateX(16px); background: white; }
.cron-toggle input:disabled + .cron-slider { opacity: 0.5; cursor: wait; }
.cron-issues {
  font-size: 11px;
  color: var(--orange);
  margin-top: 2px;
}
.cron-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.cron-status-dot.ok { background: var(--green); }
.cron-status-dot.warn { background: var(--orange); }
.cron-status-dot.off { background: var(--text2); opacity: 0.4; }
.deps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 6px;
}
.dep-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
}
.dep-badge.ok { background: #0a2e1a; color: var(--green); }
.dep-badge.warn { background: #2e1a0a; color: var(--orange); }
.dep-badge.missing { background: #2e0a0a; color: var(--red); }

/* Logs panel */
.logs-panel {
  display: none;
  margin-top: 24px;
}
.logs-panel.visible { display: block; }
.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.logs-header h2 { font-size: 16px; }
.logs-close { cursor: pointer; color: var(--text2); font-size: 18px; }
.logs-close:hover { color: var(--text); }
.logs-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text2);
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text2);
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
  cursor: pointer;
  color: var(--text2);
  font-size: 20px;
  background: none;
  border: none;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* File Browser */
.file-breadcrumb {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.file-breadcrumb a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.file-breadcrumb a:hover { text-decoration: underline; }
.file-breadcrumb span { color: var(--text2); }
.workspace-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.workspace-tab {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
}
.workspace-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(108,140,255,0.1);
}
.file-list { list-style: none; }
.file-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  gap: 10px;
  transition: background 0.1s;
}
.file-item:hover { background: var(--surface2); }
.file-icon { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.file-name { flex: 1; font-size: 13px; font-weight: 500; }
.file-meta { font-size: 11px; color: var(--text2); font-family: var(--mono); display: flex; gap: 12px; }
.file-content-view {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text);
}

/* Usage Dashboard */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.usage-stat {
  background: var(--surface2);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.usage-stat .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.usage-stat .label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.usage-agents { margin-top: 12px; }
.usage-agent-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  align-items: center;
}
.usage-agent-row:nth-child(even) { background: var(--surface2); }
.usage-agent-row.header {
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Memory Editor */
.memory-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.memory-file-item:hover { background: var(--border); }
.memory-file-info { display: flex; flex-direction: column; gap: 2px; }
.memory-file-name { font-size: 13px; font-weight: 500; }
.memory-file-meta { font-size: 11px; color: var(--text2); }
.memory-editor {
  width: 100%;
  min-height: 300px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  resize: vertical;
  line-height: 1.6;
}
.memory-editor:focus { outline: none; border-color: var(--accent); }

/* Git Badge */
.git-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  margin-right: 4px;
}
.git-badge.clean { background: #0a2e1a; color: var(--green); }
.git-badge.dirty { background: #2e1a0a; color: var(--orange); }
.git-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.git-commit {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.git-commit-hash {
  color: var(--text2);
  opacity: 0.6;
  font-family: var(--mono);
}

/* Agent Management */
.agent-form {
  display: grid;
  gap: 12px;
}
.agent-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-form label {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.agent-form input, .agent-form select {
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}
.agent-form input:focus, .agent-form select:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-primary {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  padding: 8px 16px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger-sm {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.7;
}
.btn-danger-sm:hover { opacity: 1; background: rgba(248,113,113,0.1); }
.restart-banner {
  padding: 10px 14px;
  background: #2e1a0a;
  border: 1px solid var(--orange);
  border-radius: 8px;
  color: var(--orange);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.success { background: #065f46; color: #6ee7b7; }
.toast.error { background: #7f1d1d; color: #fca5a5; }

/* Git file list */
.git-files-list {
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--surface2);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  max-height: 200px;
  overflow-y: auto;
}
.git-file-row {
  padding: 2px 0;
  display: flex;
  gap: 6px;
}
.git-file-status {
  width: 20px;
  text-align: center;
  font-weight: 600;
  flex-shrink: 0;
}
.git-file-name { color: var(--text2); }
.git-status-modified { color: var(--yellow); }
.git-status-added { color: var(--green); }
.git-status-deleted { color: var(--red); }
.git-status-untracked { color: var(--text2); }
.git-status-renamed { color: var(--accent); }
.git-status-other { color: var(--text2); }

/* ============ ADD INSTANCE CARD ============ */
.card.add-instance-card {
  border: 2px dashed var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  cursor: pointer;
  transition: all 0.2s;
}
.card.add-instance-card:hover {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.04);
}
.add-instance-inner {
  text-align: center;
  color: var(--text2);
}
.add-instance-inner .add-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  color: var(--text2);
  transition: all 0.2s;
}
.card.add-instance-card:hover .add-icon {
  border-color: var(--accent);
  color: var(--accent);
}
.add-instance-inner .add-label {
  font-size: 14px;
  font-weight: 600;
}
.add-instance-inner .add-sublabel {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text2);
  opacity: 0.7;
}

/* ============ PROVISIONING WIZARD ============ */
.wizard-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: wizardFadeIn 0.25s ease;
}
@keyframes wizardFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Wizard header */
.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.wizard-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wizard-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.wizard-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.wizard-close:hover {
  color: var(--text);
  border-color: var(--red);
  color: var(--red);
}

/* Step indicator */
.wizard-steps-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.wizard-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text2);
  background: var(--surface2);
  flex-shrink: 0;
  transition: all 0.3s;
}
.wizard-step-item.completed .wizard-step-dot {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}
.wizard-step-item.active .wizard-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.wizard-step-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  transition: color 0.3s;
}
.wizard-step-item.active .wizard-step-label {
  color: var(--text);
  font-weight: 600;
}
.wizard-step-item.completed .wizard-step-label {
  color: var(--green);
}
.wizard-step-connector {
  width: 32px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
  transition: background 0.3s;
}
.wizard-step-connector.completed {
  background: var(--green);
}

/* Wizard body */
.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  display: flex;
  justify-content: center;
}
.wizard-content {
  width: 100%;
  max-width: 720px;
  animation: wizardSlideIn 0.2s ease;
}
@keyframes wizardSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.wizard-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.wizard-content .step-desc {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 24px;
}

/* Wizard footer */
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.wizard-footer-left {}
.wizard-footer-right {
  display: flex;
  gap: 8px;
}

/* Wizard form elements */
.wiz-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.wiz-form-grid.single {
  grid-template-columns: 1fr;
}
.wiz-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wiz-field.full-width {
  grid-column: 1 / -1;
}
.wiz-field label {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.wiz-field input,
.wiz-field select,
.wiz-field textarea {
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.15s;
}
.wiz-field input:focus,
.wiz-field select:focus,
.wiz-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.wiz-field input.invalid,
.wiz-field select.invalid {
  border-color: var(--red);
}
.wiz-field .field-hint {
  font-size: 11px;
  color: var(--text2);
  opacity: 0.7;
}
.wiz-field input::placeholder {
  color: var(--text2);
  opacity: 0.5;
}

/* Test connection button + result */
.test-conn-btn {
  padding: 10px 20px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.test-conn-btn:hover {
  background: rgba(108, 140, 255, 0.1);
}
.test-conn-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.test-conn-btn .spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.conn-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
  animation: wizardFadeIn 0.3s ease;
}
.conn-result.success {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.conn-result.error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.conn-result h4 {
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.conn-result.success h4 { color: var(--green); }
.conn-result.error h4 { color: var(--red); }
.conn-result .sys-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.conn-result .sys-info-item {
  background: var(--surface2);
  border-radius: 6px;
  padding: 8px 12px;
}
.conn-result .sys-info-item .si-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
}
.conn-result .sys-info-item .si-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
}

/* Profile cards */
.profile-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.profile-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.profile-card:hover {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.04);
}
.profile-card.selected {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.08);
  box-shadow: 0 0 0 1px var(--accent);
}
.profile-card .pc-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.profile-card .pc-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.profile-card .pc-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 10px;
}
.profile-card .pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-card .pc-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Runtime selection */
.runtime-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.runtime-option {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.runtime-option:hover {
  border-color: var(--accent);
}
.runtime-option.selected {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.08);
}
.runtime-option .ro-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.runtime-option .ro-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.runtime-option .ro-desc {
  font-size: 12px;
  color: var(--text2);
}
.container-options {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  animation: wizardFadeIn 0.2s;
}
.container-options h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Agent rows */
.agent-config-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-config-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: relative;
}
.agent-config-row .agent-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.agent-config-row .agent-row-header span {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.agent-remove-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.agent-remove-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.add-agent-btn {
  padding: 10px;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.add-agent-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Channel config */
.channel-section {
  margin-bottom: 16px;
}
.channel-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.channel-section h4 .ch-icon {
  font-size: 18px;
}

/* Security checkboxes */
.wiz-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface2);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.wiz-checkbox:hover {
  background: var(--border);
}
.wiz-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.wiz-checkbox .cb-text {
  flex: 1;
}
.wiz-checkbox .cb-label {
  font-size: 14px;
  font-weight: 500;
}
.wiz-checkbox .cb-desc {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

/* Review section */
.review-section {
  margin-bottom: 20px;
}
.review-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.review-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 16px;
  font-size: 13px;
}
.review-grid .rg-label {
  color: var(--text2);
  font-weight: 500;
}
.review-grid .rg-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

/* Deploy progress */
.deploy-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.deploy-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 13px;
  opacity: 0.3;
  transition: all 0.3s;
}
.deploy-step.active {
  opacity: 1;
  background: rgba(108, 140, 255, 0.08);
  border: 1px solid rgba(108, 140, 255, 0.2);
}
.deploy-step.done {
  opacity: 1;
}
.deploy-step .ds-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.deploy-step .ds-icon .spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.deploy-step .ds-text {
  flex: 1;
}
.deploy-step .ds-detail {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
}
.deploy-done-banner {
  margin-top: 20px;
  padding: 20px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 10px;
  text-align: center;
  animation: wizardFadeIn 0.3s;
}
.deploy-done-banner h3 {
  color: var(--green);
  font-size: 18px;
  margin-bottom: 8px;
}
.deploy-done-banner p {
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 16px;
}
.deploy-done-banner .btn-primary {
  display: inline-block;
}

/* DRY RUN / LIVE MODE banners */
.dry-run-banner {
  padding: 8px 14px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}
.dry-run-banner.live-mode-banner {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--red);
}

/* Deploy live button */
.deploy-live-btn {
  background: var(--red) !important;
}
.deploy-live-btn:hover {
  opacity: 0.9;
}

/* Deploy step error state */
.deploy-step.error {
  opacity: 1;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.ds-error-output {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 120px;
  overflow-y: auto;
}

/* Deploy output toggle */
.ds-output-toggle {
  margin-top: 4px;
  padding: 2px 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  font-size: 10px;
  cursor: pointer;
  font-family: var(--font);
}
.ds-output-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ds-output {
  margin-top: 6px;
}
.ds-output pre {
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
  margin: 0;
}

/* Deploy error banner */
.deploy-error-banner {
  margin-top: 20px;
  padding: 20px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 10px;
  text-align: center;
  animation: wizardFadeIn 0.3s;
}
.deploy-error-banner h3 {
  color: var(--red);
  font-size: 18px;
  margin-bottom: 8px;
}
.deploy-error-banner p {
  color: var(--text2);
  font-size: 13px;
}

/* ============ OVERWRITE TOGGLE & INSTANCES ============ */
.overwrite-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: background 0.15s;
}
.overwrite-toggle:hover { background: var(--border); }
.overwrite-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  cursor: pointer;
}
.overwrite-toggle-label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}
.overwrite-warning {
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 8px;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.overwrite-instances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.overwrite-instance-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.overwrite-instance-card:hover {
  border-color: var(--orange);
  background: rgba(251, 146, 60, 0.04);
}
.overwrite-instance-card.selected {
  border-color: var(--orange);
  background: rgba(251, 146, 60, 0.08);
  box-shadow: 0 0 0 1px var(--orange);
}
.overwrite-instance-card .oi-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.overwrite-instance-card .oi-ip {
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
}
.overwrite-instance-card .oi-meta {
  font-size: 11px;
  color: var(--text2);
  margin-top: 6px;
}

/* ============ OVERWRITE CONFIRM MODAL ============ */
.overwrite-confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  animation: fadeIn 0.15s;
}
.overwrite-confirm-modal {
  background: var(--surface);
  border: 1px solid var(--red);
  border-radius: 12px;
  padding: 24px;
  max-width: 460px;
  width: 90%;
  animation: slideUp 0.2s;
}
.overwrite-confirm-modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--red);
}
.overwrite-confirm-modal p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.overwrite-confirm-input {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
}
.overwrite-confirm-input:focus {
  outline: none;
  border-color: var(--red);
}
.overwrite-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.btn-danger {
  padding: 8px 16px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { opacity: 0.9; }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ CREATE PROFILE FORM ============ */
.create-profile-form {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  animation: wizardFadeIn 0.2s;
}
.profile-card.create-profile-card {
  border-style: dashed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.profile-card.create-profile-card:hover {
  border-color: var(--accent);
}
.profile-card .pc-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s;
  z-index: 1;
}
.profile-card .pc-delete:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(248,113,113,0.1);
}
.profile-card .pc-custom-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(108,140,255,0.15);
  color: var(--accent);
}
.profile-card {
  position: relative;
}
.emoji-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.emoji-option {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.emoji-option:hover { border-color: var(--accent); }
.emoji-option.selected {
  border-color: var(--accent);
  background: rgba(108,140,255,0.1);
  box-shadow: 0 0 0 1px var(--accent);
}
.np-radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.np-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.np-radio input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}
.np-agents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.np-agent-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr auto;
  gap: 8px;
  align-items: center;
}
.np-agent-row input,
.np-agent-row select {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}
.np-agent-row input:focus,
.np-agent-row select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ============ MOBILE RESPONSIVE ============ */

@media (max-width: 768px) {
  /* Layout */
  .app { padding: 12px; }
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }
  .header h1 { font-size: 18px; }
  .header-right { width: 100%; justify-content: space-between; }

  /* Grid - single column */
  .instances-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Cards */
  .card { padding: 14px; }
  .card-header { margin-bottom: 12px; }
  .card-title { font-size: 15px; }

  /* Stats */
  .stats-row { gap: 8px; margin-bottom: 12px; }
  .stat { padding: 8px 10px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 15px; }

  /* Meta */
  .meta-row { gap: 8px 12px; font-size: 11px; margin-bottom: 10px; }

  /* Agent rows */
  .agent-row { padding: 6px 10px; }
  .agent-name { font-size: 12px; }
  .agent-model { font-size: 11px; }

  /* Actions - wrap and bigger tap targets */
  .actions { flex-wrap: wrap; gap: 6px; }
  .action-btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Cron */
  .cron-row { padding: 8px 10px; }
  .cron-name { font-size: 12px; white-space: normal; }
  .cron-meta { font-size: 10px; }
  .cron-toggle { width: 40px; height: 22px; }
  .cron-slider:before { height: 16px; width: 16px; }
  .cron-toggle input:checked + .cron-slider:before { transform: translateX(18px); }
  .deps-row { padding: 6px 10px; gap: 6px; }
  .dep-badge { font-size: 10px; padding: 2px 6px; }

  /* Git badges */
  .git-badges-row { flex-direction: column; gap: 8px; }
  .git-badge { font-size: 10px; }
  .git-commit {
    -webkit-line-clamp: unset;
    display: block;
  }
  .git-files-list { font-size: 10px; }
  .git-file-name { word-break: break-all; }

  /* Modals - full screen */
  .modal-overlay { align-items: stretch; justify-content: stretch; padding: 0; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .modal-header { padding: 12px 14px; }
  .modal-header h2 { font-size: 15px; }
  .modal-close { padding: 8px 12px; font-size: 24px; min-width: 44px; min-height: 44px; }
  .modal-body { padding: 12px 14px; }
  .modal-footer { padding: 10px 14px; }

  /* File browser */
  .file-breadcrumb { font-size: 12px; gap: 2px; }
  .file-item { padding: 10px 8px; gap: 8px; }
  .file-name { font-size: 12px; }
  .file-meta { font-size: 10px; flex-direction: column; gap: 2px; }
  .file-content-view { font-size: 11px; padding: 12px; max-height: 60vh; }
  .workspace-tabs { flex-wrap: wrap; }

  /* Memory editor */
  .memory-editor { min-height: 200px; font-size: 12px; padding: 10px; }
  .memory-file-item { padding: 10px 12px; }

  /* Usage */
  .usage-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .usage-stat { padding: 10px; }
  .usage-stat .value { font-size: 20px; }
  .usage-agent-row { font-size: 11px; gap: 6px; padding: 6px 8px; }

  /* Agent management */
  .agent-form { gap: 10px; }
  .agent-form input, .agent-form select { padding: 10px 12px; font-size: 14px; min-height: 44px; }

  /* Logs panel */
  .logs-content { font-size: 11px; max-height: 60vh; padding: 12px; }
  .logs-close { font-size: 24px; padding: 4px 8px; min-width: 44px; min-height: 44px; cursor: pointer; }

  /* Buttons - bigger tap targets */
  .btn-primary, .btn-secondary { padding: 10px 16px; font-size: 14px; min-height: 44px; }
  .refresh-btn { padding: 8px 14px; min-height: 44px; }

  /* Toast */
  .toast { bottom: 12px; right: 12px; left: 12px; text-align: center; }

  /* Login */
  .login-box { width: calc(100% - 32px); max-width: 360px; padding: 24px; }
  .login-box input { padding: 12px 14px; min-height: 44px; }
  .google-btn { padding: 12px; min-height: 44px; }

  /* User badge */
  .user-badge { flex-wrap: wrap; gap: 6px; }
  .user-email { max-width: 140px; font-size: 11px; }

  /* Users table */
  .users-table-header { display: none; }
  .users-table-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px;
  }
  .user-table-actions { margin-top: 4px; }

  /* Add instance card */
  .card.add-instance-card { min-height: 140px; }

  /* Wizard */
  .wizard-steps-bar { padding: 12px 16px; }
  .wizard-step-label { display: none; }
  .wizard-step-connector { width: 16px; }
  .wizard-step-dot { width: 24px; height: 24px; font-size: 11px; }
  .wizard-body { padding: 16px; }
  .wizard-header { padding: 12px 16px; }
  .wizard-header h2 { font-size: 16px; }
  .wizard-close { min-width: 44px; min-height: 44px; }
  .wizard-footer { padding: 12px 16px; }
  .wizard-content h3 { font-size: 18px; }
  .wizard-content .step-desc { font-size: 13px; }
  .wiz-form-grid { grid-template-columns: 1fr; }
  .wiz-field input, .wiz-field select, .wiz-field textarea { font-size: 16px; min-height: 44px; }
  .profile-cards { grid-template-columns: 1fr; }
  .runtime-options { grid-template-columns: 1fr; }
  .conn-result .sys-info { grid-template-columns: 1fr; }
  .test-conn-btn { min-height: 44px; width: 100%; justify-content: center; }
  .review-grid { grid-template-columns: 100px 1fr; gap: 4px 10px; font-size: 12px; }
  .review-grid .rg-value { font-size: 11px; word-break: break-all; }
  .deploy-step { padding: 8px 10px; font-size: 12px; }
  .deploy-step .ds-detail { font-size: 10px; }
  .agent-config-row { padding: 12px; }
  .add-agent-btn { min-height: 44px; }
}

@media (max-width: 480px) {
  .app { padding: 8px; }
  .card { padding: 12px; }
  .stats-row { gap: 6px; }
  .stat { padding: 6px 8px; }
  .stat-label { font-size: 9px; letter-spacing: 0.3px; }
  .stat-value { font-size: 14px; }
  .meta-row { font-size: 11px; }
  .actions { gap: 4px; }
  .action-btn { padding: 8px 10px; font-size: 12px; flex: 1 1 auto; min-width: 0; }
  .usage-grid { grid-template-columns: repeat(2, 1fr); }
  .usage-stat .value { font-size: 18px; }
  .wizard-step-connector { width: 10px; }
  .wizard-step-dot { width: 22px; height: 22px; font-size: 10px; }
  .profile-card { padding: 14px; }
  .profile-card .pc-name { font-size: 14px; }
  .profile-card .pc-desc { font-size: 11px; }
  .overwrite-instances-grid { grid-template-columns: 1fr; }
  .np-agent-row { grid-template-columns: 1fr 1fr; }
  .np-agent-row select { grid-column: 1 / -1; }
  .create-profile-form { padding: 14px; }
  .overwrite-confirm-modal { padding: 18px; }
}

/* Instance checkboxes in user management */
.instance-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.instance-cb {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s, opacity 0.15s;
  user-select: none;
}
.instance-cb:has(input:not([disabled])):hover { border-color: var(--accent); }
.instance-cb:has(input:checked:not([disabled])) { border-color: var(--accent); background: #1a2340; }
.instance-cb input { cursor: pointer; width: 14px; height: 14px; }

/* Cron inspect button */
.cron-inspect-btn {
  font-size: 11px;
  cursor: pointer;
  opacity: 0.4;
  margin-left: 4px;
  transition: opacity 0.15s;
  vertical-align: middle;
}
.cron-inspect-btn:hover { opacity: 1; }

/* Cron detail modal */
.cron-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.cron-detail-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 72px;
  padding-top: 2px;
  flex-shrink: 0;
}
.cron-detail-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
}
.cron-detail-pre {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface2);
  border-radius: 6px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text2);
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
  width: 100%;
}
.cron-payload-text { color: var(--text); }

.agent-chat-btn:hover { opacity: 1; background: var(--surface); }
