/* ===== Design Tokens ===== */
:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #1a1a1a;
  --bg-card: #0d0d0d;
  --bg-card-hover: #151515;
  --bg-input: #050505;

  --text-primary: #F6EFD2;
  --text-secondary: #E2DDB4;
  --text-muted: #a8a48a;
  --text-inverse: #000000;

  --do-blue: #E43636;
  --do-blue-hover: #c42e2e;
  --purple: #E43636;
  --purple-light: #F6EFD2;
  --green: #10b981;
  --green-light: #34d399;
  --red: #E43636;
  --yellow: #f59e0b;
  --orange: #f97316;

  --border: #1a1a1a;
  --border-focus: #E43636;
  --border-hover: #2a2a2a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 30px rgba(228, 54, 54, 0.3);
  --shadow-glow-purple: 0 0 30px rgba(228, 54, 54, 0.3);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);

  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  --step-content-max: 640px;
}

/* ===== Theme Overrides (post-login) ===== */
body[data-theme="ember"] {
  --do-blue: #FF7F11;
  --do-blue-hover: #e87210;
  --border-focus: #FF7F11;
  --shadow-glow-blue: 0 0 30px rgba(255, 127, 17, 0.3);
  --shadow-glow-purple: 0 0 30px rgba(255, 127, 17, 0.2);
}
body[data-theme="grove"] {
  --do-blue: #6CA651;
  --do-blue-hover: #5d9344;
  --border-focus: #6CA651;
  --shadow-glow-blue: 0 0 30px rgba(108, 166, 81, 0.3);
  --shadow-glow-purple: 0 0 30px rgba(108, 166, 81, 0.2);
}
body[data-theme="bloom"] {
  --do-blue: #EC7FA9;
  --do-blue-hover: #d96e96;
  --border-focus: #EC7FA9;
  --shadow-glow-blue: 0 0 30px rgba(236, 127, 169, 0.3);
  --shadow-glow-purple: 0 0 30px rgba(236, 127, 169, 0.2);
  --bg-primary: #1a0f15;
  --bg-secondary: #140a10;
  --bg-tertiary: #261520;
  --bg-card: #1a0f15;
  --bg-card-hover: #2a1825;
  --bg-input: #10080d;
  --text-primary: #FFEDFA;
  --text-secondary: #FFB8E0;
  --text-muted: #c07a9e;
}
body[data-theme="deep"] {
  --do-blue: #249E94;
  --do-blue-hover: #1a8a80;
  --border-focus: #249E94;
  --shadow-glow-blue: 0 0 30px rgba(36, 158, 148, 0.3);
  --shadow-glow-purple: 0 0 30px rgba(36, 158, 148, 0.2);
  --bg-primary: #001a20;
  --bg-secondary: #00222a;
  --bg-tertiary: #003a42;
  --bg-card: #002a30;
  --bg-card-hover: #003a42;
  --bg-input: #001218;
  --text-primary: #d0f0ea;
  --text-secondary: #3BC1A8;
  --text-muted: #5a9a8e;
  --border: #0C7779;
}
body[data-theme="stone"] {
  --do-blue: #F2A65A;
  --do-blue-hover: #e09545;
  --border-focus: #F2A65A;
  --shadow-glow-blue: 0 0 30px rgba(242, 166, 90, 0.3);
  --shadow-glow-purple: 0 0 30px rgba(242, 166, 90, 0.2);
  --bg-primary: #1a1814;
  --bg-secondary: #14120e;
  --bg-tertiary: #2d2a22;
  --bg-card: #1a1814;
  --bg-card-hover: #2d2a22;
  --bg-input: #100e0a;
  --text-primary: #E8E2D8;
  --text-secondary: #BFC6C4;
  --text-muted: #8a9a7e;
}
body[data-theme="bw"] {
  --do-blue: #ffffff;
  --do-blue-hover: #e0e0e0;
  --border-focus: #ffffff;
  --shadow-glow-blue: 0 0 30px rgba(255, 255, 255, 0.2);
  --shadow-glow-purple: 0 0 30px rgba(255, 255, 255, 0.15);
  --bg-primary: #0a0a0a;
  --bg-secondary: #000000;
  --bg-tertiary: #1a1a1a;
  --bg-card: #0f0f0f;
  --bg-card-hover: #1a1a1a;
  --bg-input: #050505;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #888888;
  --border: #333333;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--do-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--purple-light);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--green-light);
}

/* ===== App Layout ===== */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Steps ===== */
.step {
  display: none;
  flex: 1;
}
.step.active {
  display: flex;
  flex-direction: column;
  animation: stepFadeIn 0.4s ease;
}

.step-content {
  width: 100%;
  max-width: var(--step-content-max);
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.step-header {
  margin-bottom: 36px;
}
.step-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.step-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ===== Stepper ===== */
.stepper {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
}
.stepper.hidden {
  display: none;
}
.stepper-steps {
  display: flex;
  justify-content: center;
  gap: 0;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
}
.stepper-track {
  display: none;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: default;
  padding: 0;
  flex: 1;
  position: relative;
}
.stepper-step::before {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(-50% + 14px);
  right: calc(50% + 14px);
  height: 2px;
  background: var(--border);
  transition: background var(--transition-normal);
}
.stepper-step:first-child::before {
  display: none;
}
.stepper-step.completed::before,
.stepper-step.active::before {
  background: var(--do-blue);
}
.stepper-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 2px solid var(--border);
  transition: all var(--transition-normal);
  position: relative;
  z-index: 1;
}
.stepper-step.active .stepper-circle {
  background: var(--do-blue);
  color: #fff;
  border-color: var(--do-blue);
  box-shadow: 0 0 12px rgba(228, 54, 54, 0.4);
}
.stepper-step.completed .stepper-circle {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.stepper-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition-normal);
}
.stepper-step.active .stepper-label {
  color: var(--text-primary);
}
.stepper-step.completed .stepper-label {
  color: var(--green-light);
}

/* ===== Stepper Right (account + theme) ===== */
.stepper-right {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
}
.stepper-account {
  position: relative;
}
.stepper-account-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.stepper-account-btn:hover {
  border-color: var(--do-blue);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.stepper-account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.stepper-account-dropdown.hidden {
  display: none;
}
.stepper-account-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  word-break: break-all;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.stepper-account-signout {
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: opacity var(--transition-fast);
}
.stepper-account-signout:hover {
  opacity: 0.8;
}

/* ===== Compact Theme Dock (stepper & navbar) ===== */
.theme-dock-compact {
  display: flex;
  gap: 5px;
  align-items: center;
}
.theme-swatch-sm {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, transform 0.2s;
}
.theme-swatch-sm:hover {
  transform: scale(1.2);
}
.theme-swatch-sm.active {
  border-color: var(--do-blue);
}
.theme-swatch-sm span {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ===== Navbar Right ===== */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* ===== Navbar Account ===== */
.navbar-account {
  position: relative;
}
.navbar-account-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.navbar-account-btn:hover {
  border-color: var(--do-blue);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.navbar-account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.navbar-account-dropdown.hidden {
  display: none;
}
.navbar-account-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  word-break: break-all;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.navbar-account-role {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.navbar-account-role.hidden {
  display: none;
}
.navbar-role-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 12px;
}
.navbar-role-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.toggle-switch-sm {
  width: 34px !important;
  height: 18px !important;
  min-width: 34px;
}
.toggle-switch-sm::after {
  width: 14px !important;
  height: 14px !important;
}
.toggle-input:checked + .toggle-switch-sm::after {
  transform: translateX(16px);
}
.navbar-account-signout {
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: opacity var(--transition-fast);
}
.navbar-account-signout:hover {
  opacity: 0.8;
}

/* ===== Deploy SSH Collect ===== */
.deploy-ssh-collect {
  animation: stepFadeIn 0.4s ease;
}
.deploy-ssh-collect.hidden {
  display: none;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--do-blue);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--do-blue-hover);
  box-shadow: var(--shadow-glow-blue);
}
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}
.btn-lg {
  font-size: 1.1rem;
  padding: 16px 40px;
  border-radius: var(--radius-lg);
}
.btn-full {
  width: 100%;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.btn-spinner {
  display: inline-flex;
}
.btn-spinner.hidden {
  display: none;
}

/* ===== Landing (legacy — now handled by landing.css) ===== */

/* ===== Servers List ===== */
.servers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.server-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  font-family: var(--font-sans);
  color: var(--text-primary);
}
.server-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.server-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.server-card-name {
  font-weight: 600;
  font-size: 1rem;
}
.server-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.server-card-dot.dot-active {
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
.server-card-dot.dot-other {
  background: var(--text-muted);
}
.server-card-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.server-card-ip {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green-light);
}
.server-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Back Button ===== */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 16px;
  transition: color var(--transition-fast);
}
.btn-back:hover {
  color: var(--text-primary);
}
.btn-back svg {
  flex-shrink: 0;
}

/* ===== Inputs ===== */
.input-group {
  margin-bottom: 16px;
}
.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.input-with-toggle {
  position: relative;
}
.input-with-toggle input {
  padding-right: 48px;
}
.input-with-toggle .btn-icon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder {
  color: var(--text-muted);
}

.input-help {
  margin-top: 10px;
  font-size: 0.85rem;
}
.input-help a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.input-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 6px;
}
.input-error.hidden {
  display: none;
}

/* ===== Auth Form ===== */
.auth-form {
  max-width: 480px;
}
.auth-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hover);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-social:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}
.btn-social:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-social svg {
  flex-shrink: 0;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.btn-link {
  background: none;
  border: none;
  color: var(--do-blue);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  transition: color var(--transition-fast);
}
.btn-link:hover {
  color: var(--do-blue-hover);
}

/* ===== SSH Key Textarea ===== */
.ssh-key-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.ssh-key-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}
.ssh-key-textarea::placeholder {
  color: var(--text-muted);
}

/* ===== Token Status ===== */
.token-form {
  max-width: 480px;
}
.token-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  font-size: 0.9rem;
}
.token-status.hidden {
  display: none;
}
.token-status.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green-light);
}
.token-status.error {
  background: rgba(228, 54, 54, 0.1);
  border: 1px solid rgba(228, 54, 54, 0.25);
  color: #f09090;
}
.token-status-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.token-status.success .token-status-icon::after {
  content: '✓';
  font-weight: bold;
}
.token-status.error .token-status-icon::after {
  content: '✕';
  font-weight: bold;
}

/* ===== Config Sections ===== */
.config-section {
  margin-bottom: 32px;
}
.config-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.optional-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.required-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
}
.ssh-key-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.ssh-tab {
  flex: 1;
  padding: 6px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.ssh-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.ssh-download-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ssh-download-hint {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}
.ssh-callout-warning {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 180, 0, 0.1);
  border: 1px solid rgba(255, 180, 0, 0.2);
  color: var(--text-secondary);
}
.ssh-generated-pubkey textarea {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.ssh-password-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.key-passphrase-group {
  margin-bottom: 12px;
}

/* ===== Card Grid (Regions) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.region-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.region-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.region-card.selected {
  border-color: var(--do-blue);
  background: rgba(228, 54, 54, 0.08);
  box-shadow: 0 0 0 1px var(--do-blue);
}
.region-card .region-flag {
  font-size: 1.4rem;
  margin-bottom: 4px;
}
.region-card .region-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
}
.region-card .region-slug {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ===== Method Cards ===== */
.method-grid {
  grid-template-columns: repeat(2, 1fr);
}
.method-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.method-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.method-card.selected {
  border-color: var(--do-blue);
  background: rgba(228, 54, 54, 0.08);
  box-shadow: 0 0 0 1px var(--do-blue);
}
.method-card .method-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.method-card .method-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.method-card .method-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.method-badge {
  display: inline-block;
  background: var(--do-blue);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Size List ===== */
.size-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.size-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.size-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.size-card.selected {
  border-color: var(--do-blue);
  background: rgba(228, 54, 54, 0.08);
}
.size-card.unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}
.size-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-hover);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  position: relative;
}
.size-card.selected .size-radio {
  border-color: var(--do-blue);
}
.size-card.selected .size-radio::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--do-blue);
}
.size-info {
  flex: 1;
  min-width: 0;
}
.size-info .size-label {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.size-info .size-specs {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 2px;
}
.size-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(228, 54, 54, 0.15);
  color: var(--do-blue);
}
.size-badge.recommended {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green-light);
}
.size-price {
  text-align: right;
  flex-shrink: 0;
}
.size-price .price-monthly {
  font-weight: 700;
  font-size: 1rem;
}
.size-price .price-hourly {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== SSH Keys ===== */
.ssh-keys-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ssh-key-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ssh-key-row:hover {
  background: var(--bg-card-hover);
}
.ssh-key-row input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hover);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.ssh-key-row input[type="checkbox"]:checked {
  background: var(--do-blue);
  border-color: var(--do-blue);
}
.ssh-key-row input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 2px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.ssh-key-name {
  font-weight: 500;
  font-size: 0.9rem;
}
.ssh-key-fp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}
.ssh-keys-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ===== Toggle Switches ===== */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.toggle-row:hover {
  background: var(--bg-card-hover);
}
.toggle-info {
  display: flex;
  flex-direction: column;
}
.toggle-name {
  font-weight: 500;
  font-size: 0.9rem;
}
.toggle-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.toggle-input {
  appearance: none;
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition-fast);
  border: 1px solid var(--border);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-fast);
}
.toggle-input:checked + .toggle-switch {
  background: var(--do-blue);
  border-color: var(--do-blue);
}
.toggle-input:checked + .toggle-switch::after {
  transform: translateX(20px);
  background: #fff;
}

/* ===== Deploy Progress ===== */
.deploy-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}
.deploy-progress.hidden {
  display: none;
}
.deploy-header {
  margin-bottom: 40px;
}
.deploy-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.deploy-header p {
  color: var(--text-secondary);
}
.deploy-stages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  min-width: 280px;
}
.deploy-stage {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-normal);
}
.deploy-stage.active {
  color: var(--text-primary);
  background: var(--bg-card);
}
.deploy-stage.completed {
  color: var(--green-light);
}
.stage-indicator {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.stage-spinner {
  display: none;
}
.stage-check {
  display: none;
}
.deploy-stage.active .stage-spinner {
  display: block;
  animation: spin 1s linear infinite;
  color: var(--do-blue);
}
.deploy-stage.completed .stage-check {
  display: block;
  color: var(--green);
}
.deploy-stage.completed .stage-check.hidden {
  display: block;
}
.deploy-stage.completed .stage-spinner {
  display: none;
}
.stage-label {
  font-size: 0.95rem;
  font-weight: 500;
}
.deploy-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}
.timer-label {
  color: var(--text-muted);
}
.timer-value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-secondary);
}
.deploy-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  color: var(--yellow);
  font-size: 0.85rem;
  margin-bottom: 20px;
  max-width: 400px;
}
.deploy-warning.hidden {
  display: none;
}

/* ===== Success ===== */
.success-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 60px;
}
.success-header {
  margin-bottom: 32px;
}
.success-icon {
  color: var(--green);
  margin-bottom: 16px;
  animation: successPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.success-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.success-header p {
  color: var(--text-secondary);
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px 0;
  width: 100%;
  margin-bottom: 32px;
}
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}
.info-row + .info-row {
  border-top: 1px solid var(--border);
}
.info-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.info-value-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg-input);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--green-light);
}
.btn-copy {
  color: var(--text-muted);
}
.btn-copy:hover {
  color: var(--do-blue);
}
.btn-copy.copied {
  color: var(--green);
}

.next-steps {
  width: 100%;
  text-align: left;
  margin-bottom: 32px;
}
.next-steps h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.checklist {
  list-style: none;
  counter-reset: step;
}
.checklist li {
  counter-increment: step;
  padding: 10px 0 10px 36px;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.checklist li:last-child {
  border-bottom: none;
}
.checklist li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.checklist code {
  font-size: 0.82rem;
}

.success-links {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.success-links .btn {
  font-size: 0.85rem;
  padding: 10px 20px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.3s ease;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.modal-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-actions .btn {
  padding: 10px 24px;
  font-size: 0.9rem;
}

/* ===== Notifications ===== */
.notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}
.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}
.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
}
.toast.success .toast-icon {
  color: var(--green);
}
.toast.error {
  border-color: rgba(228, 54, 54, 0.3);
}
.toast.error .toast-icon {
  color: var(--red);
}
.toast.warning {
  border-color: rgba(245, 158, 11, 0.3);
}
.toast.warning .toast-icon {
  color: var(--yellow);
}
.toast.info {
  border-color: rgba(228, 54, 54, 0.3);
}
.toast.info .toast-icon {
  color: var(--do-blue);
}
.toast-message {
  flex: 1;
  line-height: 1.4;
}
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}
.toast-close:hover {
  color: var(--text-primary);
}

/* ===== Skeletons ===== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.skeleton-card {
  height: 72px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-row {
  height: 64px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}
.skeleton-row.short {
  height: 48px;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .step-content {
    padding: 24px 16px 40px;
  }
  .info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
  }
  .success-links {
    flex-direction: column;
    width: 100%;
  }
  .success-links .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .size-card {
    flex-wrap: wrap;
  }
  .size-price {
    width: 100%;
    text-align: left;
    margin-top: 4px;
    padding-left: 34px;
  }
  .stepper {
    padding: 14px 12px;
  }
  .stepper-label {
    font-size: 0.6rem;
  }
  .stepper-right {
    position: static;
    transform: none;
    margin-left: auto;
    gap: 8px;
  }
  .stepper-right .theme-dock-compact {
    display: none;
  }
  .modal {
    margin: 16px;
  }
  .ssh-key-fp {
    display: none;
  }
}

/* ===== Guide Layout ===== */
.guide-content {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Progress Bar ===== */
.guide-progress {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}
.guide-progress-fill {
  height: 100%;
  background: var(--do-blue);
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background 0.4s ease;
  width: 0%;
}
.guide-progress-fill.complete {
  background: var(--green);
}
.guide-progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ===== Accordion ===== */
.guide-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}
.guide-item.expanded {
  border-color: var(--border-hover);
}
.guide-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font-family: var(--font-sans);
}
.guide-item-header:hover {
  background: var(--bg-card-hover);
}
.guide-item-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.guide-item.checked .guide-item-num {
  background: var(--green);
  color: #fff;
}
.guide-item-title {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
}
.guide-item.checked .guide-item-title {
  color: var(--text-muted);
}
.guide-item-badge {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.guide-item-badge.required {
  background: rgba(228, 54, 54, 0.12);
  color: var(--do-blue);
}
.guide-item-badge.optional {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
}
.guide-item-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.guide-item.expanded .guide-item-chevron {
  transform: rotate(180deg);
}
.guide-item-body {
  display: none;
  padding: 0 20px 20px;
}
.guide-item.expanded .guide-item-body {
  display: block;
}

/* ===== Locked Sections ===== */
.guide-item.locked {
  opacity: 0.45;
}
.guide-item.locked .guide-item-header {
  cursor: not-allowed;
}
.guide-item.locked .guide-item-header:hover {
  background: none;
}
.guide-item.locked .guide-item-num {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.7rem;
}
.guide-lock-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0;
}

/* ===== Check Button ===== */
.guide-check-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.guide-check-btn:hover {
  border-color: var(--green);
  color: var(--green-light);
}
.guide-check-btn.checked {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--green-light);
}

/* ===== Code Block Component ===== */
.code-block {
  margin: 12px 0;
}
.code-block-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.code-block-row {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.code-block-text {
  flex: 1;
  margin: 0;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green-light);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  background: none;
  border: none;
}
.code-block-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 100%;
  min-height: 44px;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.code-block-copy:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.code-block-copy.copied {
  color: var(--green);
}

/* ===== Callouts ===== */
.guide-callout {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 12px 0;
}
.guide-callout-icon {
  flex-shrink: 0;
  font-weight: bold;
  margin-top: 1px;
}
.guide-callout-info {
  background: rgba(228, 54, 54, 0.08);
  border: 1px solid rgba(228, 54, 54, 0.2);
  color: #f09090;
}
.guide-callout-info .guide-callout-icon {
  color: var(--do-blue);
}
.guide-callout-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.guide-callout-warning .guide-callout-icon {
  color: var(--yellow);
}

/* ===== Provider Cards ===== */
.provider-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.provider-card {
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}
.provider-card:hover {
  border-color: var(--border-hover);
}
.provider-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.provider-card-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ===== Selectable Provider Cards ===== */
.provider-card-selectable {
  cursor: pointer;
  outline: none;
  user-select: none;
}
.provider-card-selectable:hover {
  border-color: var(--do-blue);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.provider-card-selectable:focus-visible {
  border-color: var(--do-blue);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}

/* ===== LLM Config Area ===== */
.llm-config-area {
  margin-bottom: 12px;
}
.llm-provider-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.llm-provider-header {
  margin-bottom: 4px;
}

/* ===== Auth Method Tabs ===== */
.llm-method-tabs {
  display: flex;
  gap: 0;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
}
.llm-method-tab {
  flex: 1;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.llm-method-tab:not(:last-child) {
  border-right: 1px solid var(--border);
}
.llm-method-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.llm-method-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== Credential Area ===== */
.llm-credential-area {
  margin-top: 8px;
}

/* ===== LLM Config Responsive ===== */
@media (max-width: 768px) {
  .llm-provider-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .llm-provider-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Guide Typography ===== */
.guide-heading {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text-primary);
}
.guide-heading:first-child {
  margin-top: 0;
}
.guide-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 8px 0;
}
.guide-steps {
  list-style: none;
  counter-reset: guide-step;
  margin: 10px 0;
  padding: 0;
}
.guide-steps li {
  counter-increment: guide-step;
  padding: 8px 0 8px 32px;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}
.guide-steps li::before {
  content: counter(guide-step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ===== SSH Help Text ===== */
.ssh-help-text {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== Guide Forms ===== */
.guide-form {
  margin: 16px 0;
}
.guide-form-group {
  margin-bottom: 14px;
}
.guide-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.guide-input,
.guide-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.guide-input:focus,
.guide-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}
.guide-input::placeholder {
  color: var(--text-muted);
}
.guide-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a8a48a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.guide-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ===== Status Indicators ===== */
.guide-status {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin: 12px 0;
  min-height: 20px;
}
.guide-status:empty {
  display: none;
}
.guide-status-waiting {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--yellow);
}
.guide-status-ok {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green-light);
}
.guide-status-error {
  background: rgba(228, 54, 54, 0.08);
  border: 1px solid rgba(228, 54, 54, 0.2);
  color: #f09090;
}

/* ===== Service Status List ===== */
.guide-service-results {
  margin: 12px 0;
}
.guide-service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.guide-service-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.guide-service-dot.dot-ok {
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.guide-service-dot.dot-error {
  background: var(--red);
  box-shadow: 0 0 6px rgba(228, 54, 54, 0.5);
}
.guide-service-name {
  font-weight: 500;
  font-size: 0.88rem;
  flex: 1;
}
.guide-service-status {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== Test Result ===== */
.guide-test-result {
  margin: 12px 0;
}
.guide-test-response {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.guide-test-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.guide-test-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green-light);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ===== Feature List ===== */
.guide-feature-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}
.guide-feature-list li {
  padding: 6px 0 6px 24px;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}
.guide-feature-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* ===== Small Button Variant ===== */
.btn-sm {
  padding: 8px 18px;
  font-size: 0.85rem;
}
.guide-btn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ===== Health Progress Bar ===== */
.guide-health-progress {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
  transition: opacity 0.4s;
}
.guide-health-progress.complete {
  opacity: 0;
}
.guide-health-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--do-blue), var(--green));
  border-radius: 2px;
  transition: width 0.6s ease-out;
  min-width: 2%;
}

/* ===== Inline Chat Panel (Verify Step) ===== */
.guide-chat-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 380px;
}
.guide-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}
.guide-chat-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.guide-chat-status {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.guide-chat-status.connected {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green-light);
}
.guide-chat-status.connecting,
.guide-chat-status.reconnecting {
  background: rgba(245, 158, 11, 0.12);
  color: var(--yellow);
}
.guide-chat-status.error,
.guide-chat-status.disconnected {
  background: rgba(228, 54, 54, 0.12);
  color: #f09090;
}
.guide-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  max-height: 220px;
}
.guide-chat-messages:empty::before {
  content: 'Send a message to test your agent';
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  align-self: center;
  margin-top: 40px;
}
.guide-chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.guide-chat-typing.hidden { display: none; }
.guide-chat-input-area {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.guide-chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  transition: border-color var(--transition-fast);
}
.guide-chat-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}
.guide-chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 22px;
  max-height: 80px;
  padding: 3px 0;
}
.guide-chat-input::placeholder {
  color: var(--text-muted);
}

/* ===== Embedded Dashboard ===== */
.dashboard-frame-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-primary);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  height: 606px; /* 46px toolbar + 560px iframe */
}
.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  gap: 10px;
  flex-shrink: 0;
  height: 46px;
}
.dashboard-url-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.dashboard-url-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}
.dashboard-url-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-toolbar-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.dashboard-toolbar-actions .btn-icon {
  width: 30px;
  height: 30px;
}
.dashboard-frame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  background: #fff;
}
.dashboard-loading {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.88rem;
  z-index: 2;
}
.dashboard-loading .spinner {
  animation: spin 1s linear infinite;
}

/* Certificate banner for self-signed iframes */
.dashboard-cert-banner {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.88rem;
  z-index: 3;
  padding: 24px;
  text-align: center;
}
.dashboard-cert-banner p {
  margin: 0;
  max-width: 420px;
  line-height: 1.5;
}
.dashboard-cert-actions {
  display: flex;
  gap: 10px;
  margin: 8px 0;
}
.dashboard-cert-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Dashboard fullscreen */
.dashboard-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 999;
  height: 100vh;
  border-radius: 0;
  border: none;
}
body.dashboard-fs-active {
  overflow: hidden;
}

/* ===== Control UI Launcher Card ===== */
.guide-control-launcher {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  padding: 20px;
  margin: 12px 0 16px;
  text-align: center;
}
.guide-control-url {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 6px 14px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.guide-control-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}
.btn-open-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 28px;
  font-size: 0.95rem;
  text-decoration: none;
}
.guide-control-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 0;
}

/* ===== Gateway Token Card ===== */
.guide-token-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  padding: 16px 20px;
  margin: 16px 0 8px;
}
.guide-token-card .guide-heading {
  margin-top: 0;
  margin-bottom: 4px;
}
.guide-token-display {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 8px 0;
  overflow-x: auto;
}
.guide-token-value {
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--text-primary);
}
.guide-token-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ===== Guide Responsive ===== */
@media (max-width: 768px) {
  .guide-content {
    max-width: 100%;
  }
  .guide-item-header {
    padding: 14px 16px;
  }
  .guide-item-body {
    padding: 0 16px 16px;
  }
  .provider-cards {
    grid-template-columns: 1fr;
  }
  .code-block-text {
    font-size: 0.78rem;
  }
  .dashboard-frame-wrap {
    height: 446px;
  }
}
@media (max-width: 640px) {
  .guide-item-badge {
    display: none;
  }
  .dashboard-frame-wrap {
    height: 366px;
  }
  .dashboard-url-text {
    font-size: 0.7rem;
  }
}

/* ===== Views ===== */
.view {
  display: none;
  flex: 1;
}
.view.active {
  display: flex;
  flex-direction: column;
  animation: stepFadeIn 0.3s ease;
}
.view-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.navbar.hidden {
  display: none;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--do-blue);
  flex-shrink: 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.navbar-items {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.navbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.navbar-item:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.navbar-item.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--do-blue);
}
.navbar-item svg {
  flex-shrink: 0;
}
.navbar-server-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ===== Dashboard View ===== */
.view-dashboard-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.view-dashboard-content .dashboard-view-frame {
  flex: 1;
  height: auto !important;
  border-radius: 0;
  border: none;
  border-top: none;
}

/* ===== Chat View ===== */
.view-chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-name {
  font-weight: 600;
  font-size: 1rem;
}
.chat-connection-status {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.chat-status-connected {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green-light);
}
.chat-status-connecting,
.chat-status-reconnecting {
  background: rgba(245, 158, 11, 0.12);
  color: var(--yellow);
}
.chat-status-error,
.chat-status-disconnected {
  background: rgba(228, 54, 54, 0.12);
  color: #f09090;
}

/* Message List */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Message Bubbles */
.chat-bubble {
  max-width: 80%;
  display: flex;
  flex-direction: column;
}
.chat-bubble-user {
  align-self: flex-end;
}
.chat-bubble-agent {
  align-self: flex-start;
}
.chat-bubble-content {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-bubble-user .chat-bubble-content {
  background: var(--do-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-agent .chat-bubble-content {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-bubble-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}
.chat-bubble-user .chat-bubble-time {
  text-align: right;
}
.chat-system-msg {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px;
}

/* Typing Indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.chat-typing.hidden {
  display: none;
}
.chat-typing-dots {
  display: flex;
  gap: 3px;
}
.chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Input Area */
.chat-input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  transition: border-color var(--transition-fast);
}
.chat-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}
.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  padding: 4px 0;
}
.chat-input::placeholder {
  color: var(--text-muted);
}
.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--do-blue);
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.chat-send-btn:hover {
  background: var(--do-blue-hover);
}

/* ===== Settings View ===== */
.settings-section {
  margin-bottom: 28px;
}
.settings-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.settings-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.settings-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Navbar Responsive ===== */
@media (max-width: 768px) {
  .navbar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    border-bottom: none;
    border-top: 1px solid var(--border);
    padding: 0 8px;
    height: 60px;
    z-index: 200;
  }
  .navbar-brand {
    display: none;
  }
  .navbar-right {
    display: none;
  }
  .navbar-items {
    flex: 1;
    justify-content: space-around;
  }
  .navbar-item {
    flex-direction: column;
    gap: 2px;
    padding: 6px 12px;
    font-size: 0.68rem;
    border-radius: var(--radius-sm);
  }
  .navbar-item.active {
    border-bottom: none;
    background: rgba(228, 54, 54, 0.1);
    color: var(--do-blue);
  }
  /* Add bottom padding for fixed navbar */
  .view.active {
    padding-bottom: 64px;
  }
  .chat-input-area {
    padding-bottom: 20px;
  }
}

/* ===== Tailscale Styles ===== */

/* Setup guide: mode selector */
.ts-mode-selector {
  margin: 16px 0;
}
.ts-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 6px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.ts-radio-label:hover {
  border-color: var(--border-hover);
}
.ts-radio-label input[type="radio"] {
  accent-color: var(--do-blue);
}
.ts-radio-text {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Setup guide: command area */
.ts-command-area {
  margin: 16px 0;
}
.ts-poll-area {
  margin-top: 16px;
}
.ts-delete-creds {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.ts-delete-creds:hover {
  color: var(--red);
}

/* Setup guide: device card (State 3) */
.ts-device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}
.ts-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.ts-info-row + .ts-info-row {
  border-top: 1px solid var(--border);
}
.ts-info-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 100px;
}
.ts-info-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--green-light);
}

/* Status dots */
.ts-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ts-status-online {
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.ts-status-offline {
  background: var(--text-muted);
}

/* Network View: Setup (no credentials) */
.ts-setup-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px;
}
.ts-setup-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.ts-setup-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}
.ts-info-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.ts-info-box p {
  margin-bottom: 8px;
}
.ts-setup-steps {
  padding-left: 20px;
  margin: 0;
}
.ts-setup-steps li {
  margin: 4px 0;
}
.ts-cred-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ts-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ts-form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.ts-form-input {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
}
.ts-form-input:focus {
  border-color: var(--border-focus);
}
.ts-form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}
.ts-cred-form .input-with-toggle {
  display: flex;
  align-items: center;
  position: relative;
}
.ts-cred-form .input-with-toggle .ts-form-input {
  padding-right: 42px;
}
.ts-cred-form .input-with-toggle .btn-icon {
  position: absolute;
  right: 8px;
}
.ts-error {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

/* Network View: sections */
.ts-setup-section,
.ts-device-section {
  padding: 0 24px;
}
.ts-section-title {
  font-size: 1rem;
  font-weight: 600;
  padding: 20px 0 8px;
}
.ts-section-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Network View: server setup cards */
.ts-server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}
.ts-server-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.ts-server-card-name {
  font-weight: 600;
}
.ts-server-card-ip {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.ts-server-card-body {
  padding: 16px;
}
.ts-server-card-body .ts-mode-selector {
  margin: 0 0 12px;
}
.ts-server-card-body .ts-radio-label {
  padding: 8px 10px;
  margin: 4px 0;
}
.ts-cmd-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Network View: header actions */
.ts-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Network View: header */
.ts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.ts-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.ts-header-title {
  font-size: 1.25rem;
  font-weight: 600;
}
.ts-header-tailnet {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}
.ts-refresh-btn svg {
  display: block;
}

/* Network View: device list */
.ts-device-list {
  padding: 8px 0;
}
.ts-device-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}
.ts-device-row:hover {
  background: var(--bg-card-hover);
}
.ts-device-info {
  flex: 1;
  min-width: 0;
}
.ts-device-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ts-device-hostname {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ts-device-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.ts-meta-sep {
  margin: 0 6px;
  opacity: 0.4;
}
.ts-device-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.ts-tag-chip {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  white-space: nowrap;
}
.ts-tag-unauth {
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
}
.ts-openclaw-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: rgba(228, 54, 54, 0.15);
  color: var(--do-blue);
  white-space: nowrap;
}
.ts-device-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ts-remove-btn {
  color: var(--text-muted);
}
.ts-remove-btn:hover {
  color: var(--red);
}
.ts-no-devices {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

/* ===== Network Graph Visualization ===== */
.netgraph-section {
  position: relative;
  height: 440px;
  background: linear-gradient(170deg, #000000 0%, #001510 40%, #000d0a 100%);
  border-bottom: 1px solid rgba(0, 212, 170, 0.12);
  overflow: hidden;
  flex-shrink: 0;
}
.netgraph-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Scanline overlay */
.netgraph-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 2;
}
/* Vignette */
.netgraph-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
  z-index: 1;
}
.netgraph-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
/* Corner bracket decorations */
.netgraph-overlay::before,
.netgraph-overlay::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: rgba(0, 212, 170, 0.18);
  border-style: solid;
}
.netgraph-overlay::before {
  top: 10px;
  left: 10px;
  border-width: 1px 0 0 1px;
}
.netgraph-overlay::after {
  bottom: 10px;
  right: 10px;
  border-width: 0 1px 1px 0;
}
/* HUD corners */
.netgraph-hud-tl,
.netgraph-hud-tr,
.netgraph-hud-bl,
.netgraph-hud-br {
  position: absolute;
  padding: 18px 22px;
}
.netgraph-hud-tl { top: 0; left: 0; }
.netgraph-hud-tr { top: 0; right: 0; text-align: right; }
.netgraph-hud-bl { bottom: 0; left: 0; }
.netgraph-hud-br { bottom: 0; right: 0; text-align: right; }
.netgraph-hud-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(0, 212, 170, 0.45);
  text-transform: uppercase;
  margin-bottom: 3px;
}
.netgraph-hud-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(246, 239, 210, 0.75);
}
.netgraph-hud-secure {
  color: rgba(0, 212, 170, 0.85);
}
.netgraph-hud-offline {
  color: rgba(245, 158, 11, 0.85);
}
.netgraph-empty-msg {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 3;
}
.netgraph-empty-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(0, 212, 170, 0.35);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .netgraph-section {
    height: 300px;
  }
  .netgraph-hud-tl,
  .netgraph-hud-tr,
  .netgraph-hud-bl,
  .netgraph-hud-br {
    padding: 12px 14px;
  }
  .netgraph-hud-label { font-size: 0.58rem; }
  .netgraph-hud-value { font-size: 0.72rem; }
}

/* ===== Solo Server State ===== */
.netgraph-solo {
  height: 380px;
}
.net-solo-header {
  padding: 24px 24px 0;
}
.net-solo-header .ts-header-title {
  font-size: 1.25rem;
  font-weight: 600;
}

/* VPN CTA card */
.net-vpn-cta {
  padding: 20px 24px 32px;
  max-width: 640px;
  margin: 0 auto;
}
.net-vpn-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.net-vpn-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}
.net-vpn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(0, 212, 170, 0.08);
  color: rgba(0, 212, 170, 0.75);
  flex-shrink: 0;
}
.net-vpn-card-title-area {
  flex: 1;
  min-width: 0;
}
.net-vpn-card-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.net-vpn-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 2px 0 0;
  line-height: 1.5;
}
.net-vpn-card-body {
  padding: 0 20px 20px;
}
.net-vpn-card-body .ts-cred-form {
  margin-top: 4px;
}
.net-vpn-card-body .ts-info-box {
  margin-bottom: 16px;
}
.net-vpn-provider-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.net-vpn-provider-active {
  border-color: rgba(0, 212, 170, 0.3);
  color: rgba(0, 212, 170, 0.85);
}

/* No-server fallback */
.net-empty-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 16px;
}
.net-empty-wrap .ts-section-desc {
  margin-bottom: 4px;
}

@media (max-width: 768px) {
  .netgraph-solo {
    height: 300px;
  }
  .net-solo-header {
    padding: 16px 16px 0;
  }
  .net-vpn-cta {
    padding: 16px 16px 24px;
  }
  .net-vpn-card-header {
    flex-wrap: wrap;
    padding: 14px 16px;
  }
  .net-empty-wrap {
    padding: 48px 16px;
  }
}

/* ===== Native Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dashboard-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.dashboard-card-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.dashboard-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
}
.dashboard-card-body {
  padding: 16px 18px;
}
.dashboard-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.dashboard-info-row + .dashboard-info-row {
  border-top: 1px solid var(--border);
}
.dashboard-info-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.dashboard-info-value {
  font-size: 0.88rem;
  color: var(--text-primary);
}
.dashboard-info-value.mono {
  font-family: var(--font-mono);
  color: var(--green-light);
}
.dashboard-health-indicator {
  font-weight: 500;
}
.dashboard-health-indicator.health-ok {
  color: var(--green-light);
}
.dashboard-health-indicator.health-error {
  color: #f09090;
}
.dashboard-error-banner {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(240, 144, 144, 0.1);
  border: 1px solid rgba(240, 144, 144, 0.3);
  border-radius: var(--radius-sm);
  color: #f09090;
  font-size: 0.82rem;
  line-height: 1.4;
}
.dashboard-error-banner.hidden {
  display: none;
}

/* Dashboard actions */
.dashboard-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dashboard-action-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  width: 100%;
  text-align: left;
}
.dashboard-action-link:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.dashboard-action-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.dashboard-action-ssh {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.dashboard-ssh-cmd {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--green-light);
  flex: 1;
  background: none;
  padding: 0;
}
.dashboard-copy-btn {
  font-size: 0.85rem;
}

/* Dashboard chat section */
.dashboard-chat-section {
  margin: 0 24px 24px;
  max-width: 852px; /* 900 - 2*24 */
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  max-height: 400px;
}
.dashboard-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}
.dashboard-chat-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.dashboard-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
  max-height: 220px;
}
.dashboard-chat-messages:empty::before {
  content: 'Send a message to chat with your agent';
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  align-self: center;
  margin-top: 30px;
}
.dashboard-chat-input-area {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Dashboard integrations */
.dashboard-integrations-section {
  margin: 0 24px 16px;
  max-width: 852px;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  overflow: hidden;
}
.dashboard-integrations-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.dashboard-integrations-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.dashboard-integrations-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.dashboard-integrations-grid {
  display: flex;
  gap: 10px;
  padding: 16px;
  flex-wrap: wrap;
}
.dashboard-integration-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.dashboard-integration-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.dashboard-integration-card.active {
  border-color: var(--green-light);
  background: rgba(16, 185, 129, 0.06);
}
.dashboard-integration-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.dashboard-integration-label {
  white-space: nowrap;
}
.dashboard-integrations-form-area:empty {
  display: none;
}
.dashboard-control-embed {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.dashboard-control-embed .dashboard-frame-wrap {
  margin-bottom: 0;
  height: 546px;
}
.dashboard-control-placeholder {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.dashboard-control-note {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.dashboard-quick-setup-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
}
.dashboard-quick-setup-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.dashboard-quick-setup-arrow {
  font-size: 0.7rem;
  flex-shrink: 0;
}
.dashboard-quick-setup-toggle .dashboard-integrations-subtitle {
  font-weight: 400;
}
.dashboard-quick-setup-body.collapsed {
  display: none;
}
.dashboard-channel-form {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.dashboard-channel-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dashboard-channel-form-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
}
.dashboard-channel-webhook {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.dashboard-channel-webhook .guide-form-label {
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.dashboard-channel-form .guide-form-group {
  margin-bottom: 10px;
}
.dashboard-channel-form .btn-primary {
  margin-top: 4px;
}

/* Dashboard recovery card */
.dashboard-recovery-card {
  max-width: 560px;
  margin: 48px auto;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.dashboard-recovery-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.dashboard-recovery-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}
.dashboard-recovery-instructions {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}
.dashboard-recovery-instructions ol {
  padding-left: 20px;
  margin: 8px 0;
}
.dashboard-recovery-instructions li {
  margin: 6px 0;
}
.dashboard-recovery-form {
  margin-top: 16px;
}
.dashboard-recovery-form .guide-input {
  margin-bottom: 12px;
}
.dashboard-recovery-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.dashboard-recovery-status {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.dashboard-recovery-status:empty {
  display: none;
}
.dashboard-recovery-status.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green-light);
}
.dashboard-recovery-status.error {
  background: rgba(228, 54, 54, 0.1);
  border: 1px solid rgba(228, 54, 54, 0.25);
  color: #f09090;
}

/* Dashboard responsive */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .dashboard-chat-section {
    margin: 0 16px 16px;
    width: calc(100% - 32px);
  }
  .dashboard-integrations-section {
    margin: 0 16px 16px;
    width: calc(100% - 32px);
  }
  .dashboard-control-embed {
    padding: 10px;
  }
  .dashboard-control-embed .dashboard-frame-wrap {
    height: 440px;
  }
  .dashboard-integrations-grid {
    gap: 8px;
    padding: 12px;
  }
  .dashboard-integration-card {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .dashboard-recovery-card {
    margin: 24px 16px;
    padding: 24px;
  }
}

/* Responsive adjustments for network view */
@media (max-width: 640px) {
  .ts-header {
    padding: 16px;
  }
  .ts-header-left {
    flex-direction: column;
    gap: 4px;
  }
  .ts-device-row {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .ts-device-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }
}

/* ===== Hostname Group ===== */
.hostname-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hostname-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
}
.hostname-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(228, 54, 54, 0.15);
}
.hostname-input-wrap input {
  flex: 1;
  min-width: 80px;
  padding: 10px 0 10px 14px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
}
.hostname-input-wrap input::placeholder {
  color: var(--text-muted);
}
.hostname-separator {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  flex-shrink: 0;
  user-select: none;
}
.hostname-suffix {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding-right: 14px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

/* ===== Server Sidebar ===== */
.server-sidebar {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
  display: flex;
  align-items: stretch;
}
.sidebar-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.sidebar-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--green);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}
.sidebar-panel {
  width: 0;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: width var(--transition-normal);
  display: flex;
  flex-direction: column;
}
.server-sidebar.expanded .sidebar-panel {
  width: 220px;
}
.server-sidebar.expanded .sidebar-toggle {
  border-radius: 0;
  border-right: none;
}
.sidebar-panel-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px 8px;
  white-space: nowrap;
}
.sidebar-server-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px 10px;
  overflow-y: auto;
  max-height: 240px;
}
.sidebar-server-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: left;
  white-space: nowrap;
  width: 100%;
}
.sidebar-server-item:hover {
  background: var(--bg-tertiary);
}
.sidebar-server-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}
.sidebar-server-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.sidebar-server-ip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .server-sidebar {
    display: none;
  }
}

/* ===== Admin Module ===== */

.admin-tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  padding-bottom: 0;
}

.admin-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

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

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

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.admin-stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.admin-stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.admin-status-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-status-active, .admin-status-open { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.admin-status-new { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.admin-status-in_progress { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
.admin-status-resolved, .admin-status-closed { background: rgba(168, 164, 138, 0.15); color: var(--text-muted); }
.admin-status-deleted { background: rgba(228, 54, 54, 0.15); color: var(--red); }
.admin-status-normal { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.admin-status-high { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.admin-status-urgent { background: rgba(228, 54, 54, 0.15); color: var(--red); }
.admin-status-low { background: rgba(168, 164, 138, 0.15); color: var(--text-muted); }

.admin-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(228, 54, 54, 0.15);
  color: var(--do-blue);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-search-wrap {
  margin-bottom: 16px;
}

.admin-search {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.admin-search:focus {
  border-color: var(--border-focus);
}

.admin-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-thread-msg {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.admin-thread-admin {
  border-left: 3px solid var(--do-blue);
}

.admin-thread-user {
  border-left: 3px solid var(--text-muted);
}

.admin-thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.admin-thread-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.admin-reply-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast);
}

.admin-reply-textarea:focus {
  border-color: var(--border-focus);
}

.admin-select {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  margin: 0 8px;
}

.admin-back-btn {
  margin-bottom: 12px;
}

.admin-audit-details {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.support-ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: background var(--transition-fast);
}

.support-ticket-row:hover {
  background: var(--bg-card-hover);
}

.support-ticket-subject {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
