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

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

.hidden { display: none !important; }

:root {
  --background: 240 8% 3.5%;
  --foreground: 0 0% 98%;
  --card: 240 6% 9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 6% 10%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 217 91% 60%;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;

  /* Electric-blue brand accent — used for primary actions, active states, focus */
  --brand: 217 91% 60%;          /* #3b82f6 */
  --brand-hover: 217 91% 66%;
  --brand-foreground: 0 0% 100%;
  --brand-2: 199 92% 60%;        /* sky, for gradient sweeps */

  /* Elevation — layered shadows that actually read on a near-black surface */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 14px -3px rgb(0 0 0 / 0.55), 0 2px 6px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 18px 44px -10px rgb(0 0 0 / 0.65), 0 6px 16px -6px rgb(0 0 0 / 0.5);
  --glow-brand: 0 4px 20px -2px hsl(var(--brand) / 0.45);
  --glow-brand-strong: 0 6px 28px -2px hsl(var(--brand) / 0.6);

  --nav-w: 260px;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
}

html, body {
  height: 100%;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
body { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ── Material Symbols ─────────────────────────────────────────────────────── */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal;
  line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; word-wrap: normal; direction: ltr;
  -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none; vertical-align: middle;
}
.mi-20 { font-size: 20px; }
.mi-18 { font-size: 18px; }
.mi-16 { font-size: 16px; }
.mi-14 { font-size: 14px; }
.mi-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ── Typography & General ─────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.025em; }
.muted { color: hsl(var(--muted-foreground)); font-size: 12px; }
.divider { height: 1px; background: hsl(var(--border)); margin: 16px 0; }
.error-msg { color: hsl(var(--destructive)); font-size: 13px; margin-top: 8px; text-align: center; font-weight: 500; }

/* ── Login ──────────────────────────────────────────────────────────────────── */
#login-screen {
  display: flex; align-items: center; justify-content: center; height: 100vh; height: 100dvh; width: 100%;
  position: relative; overflow: hidden;
  background-color: hsl(var(--background));
  background-image: linear-gradient(to right, hsl(var(--border) / 0.5) 1px, transparent 1px),
                    linear-gradient(to bottom, hsl(var(--border) / 0.5) 1px, transparent 1px);
  background-size: 32px 32px;
}
/* Ambient blue glow behind the card */
#login-screen::before {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--brand) / 0.18), transparent 70%);
  filter: blur(20px); pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px; padding: 2.5rem 2rem;
  background: hsl(var(--card) / 0.8); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 1.5); box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.login-avatar {
  width: 52px; height: 52px; border-radius: calc(var(--radius) * 1.5);
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground));
  display: flex; align-items: center; justify-content: center; margin-bottom: 24px;
  box-shadow: var(--glow-brand);
}
.login-avatar svg { stroke: hsl(var(--brand-foreground)); }
.login-card h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.login-sub { color: hsl(var(--muted-foreground)); margin-bottom: 32px; font-size: 14px; }
#login-form { width: 100%; }
#login-form input {
  display: flex; width: 100%; padding: 0.5rem 0.75rem; font-size: 0.875rem; height: 36px;
  background: transparent; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); outline: none; margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#login-form input:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: transparent;
}
#login-form input::placeholder { color: hsl(var(--muted-foreground)); }

/* ── App shell ──────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: row; height: 100vh; height: 100dvh; width: 100%; overflow: hidden; }

/* ── Left sidebar ───────────────────────────────────────────────────────────── */
#left-nav {
  width: var(--nav-w); flex-shrink: 0; display: flex; flex-direction: column;
  background: hsl(240 7% 5.5%); border-right: 1px solid hsl(var(--border));
}
.nav-top { flex: 1; overflow: hidden; display: flex; flex-direction: column; padding: 16px 12px 12px; }

.nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.nav-logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground)); box-shadow: var(--glow-brand);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-logo svg, .nav-logo .material-symbols-rounded { stroke: hsl(var(--brand-foreground)); color: hsl(var(--brand-foreground)); width: 16px; height: 16px; }
.nav-brand-name { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; color: hsl(var(--foreground)); }

/* Search */
.nav-search {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; margin-bottom: 18px; height: 38px;
  background: hsl(0 0% 100% / 0.04); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  color: hsl(var(--muted-foreground)); transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.nav-search:focus-within {
  background: hsl(var(--background));
  box-shadow: 0 0 0 3px hsl(var(--brand) / 0.18);
  border-color: hsl(var(--brand) / 0.6);
}
.nav-search input {
  flex: 1; background: none; border: none; color: hsl(var(--foreground)); font-size: 13px;
  outline: none; font-family: inherit;
}
.nav-search input::placeholder { color: hsl(var(--muted-foreground)); }

.nav-menu { margin-bottom: 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border-radius: var(--radius); background: transparent; border: none;
  color: hsl(var(--muted-foreground)); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 0.15s, color 0.15s; text-align: left;
}
.nav-item:hover { background: hsl(0 0% 100% / 0.05); color: hsl(var(--foreground)); }
.nav-item.active { background: hsl(var(--brand) / 0.12); color: hsl(var(--foreground)); font-weight: 600; }
.nav-item.active svg { stroke: hsl(var(--brand)); }
.nav-item svg { stroke: currentColor; width: 16px; height: 16px; }

/* Rounded accent bar on the active item (clean, modern) */
.nav-item.active::before, .nav-list-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: hsl(var(--brand));
}

.nav-section { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.nav-section-head {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; margin-bottom: 4px;
  font-size: 12px; font-weight: 600; color: hsl(var(--muted-foreground));
}
.nav-section-add {
  width: 24px; height: 24px; border-radius: 4px; background: transparent; border: none;
  color: hsl(var(--muted-foreground)); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.nav-section-add:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

.nav-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-list-item {
  position: relative;
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius);
  color: hsl(var(--muted-foreground)); font-size: 13px; cursor: pointer; transition: background 0.15s, color 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}
.nav-list-item:hover { background: hsl(0 0% 100% / 0.05); color: hsl(var(--foreground)); }
.nav-list-item.active { background: hsl(var(--brand) / 0.12); color: hsl(var(--foreground)); font-weight: 600; }
.nav-list-item.active svg { stroke: hsl(var(--brand)); }
.nav-list-item svg { flex-shrink: 0; width: 14px; height: 14px; }
.nav-list-item .nav-item-name { overflow: hidden; text-overflow: ellipsis; }
.nav-list-item .nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; margin-left: auto; }
.nav-empty { padding: 9px 12px; color: hsl(var(--muted-foreground)); font-size: 13px; }
.nav-sublabel {
  padding: 10px 12px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground)); opacity: 0.7;
}
.nav-sublabel:first-child { padding-top: 2px; }

/* Plan usage card (dashboard) */
.plan-usage-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 32px;
}
.plan-usage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.plan-usage-title { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 500; }
.plan-usage-edit {
  width: 28px; height: 28px; padding: 0; background: transparent; border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px); color: hsl(var(--muted-foreground));
  display: flex; align-items: center; justify-content: center;
}
.plan-usage-edit:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.plan-row { margin-bottom: 14px; }
.plan-row:last-of-type { margin-bottom: 0; }
.plan-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.plan-row-label { font-size: 14px; font-weight: 600; color: hsl(var(--foreground)); }
.plan-row-meta { font-size: 13px; color: hsl(var(--muted-foreground)); }
.plan-bar { height: 8px; background: hsl(var(--secondary)); border-radius: 4px; overflow: hidden; }
.plan-bar-fill { height: 100%; width: 0; border-radius: 4px; background: hsl(var(--brand)); transition: width 0.6s ease, background 0.3s; }
.plan-bar-fill.warn { background: var(--yellow); }
.plan-bar-fill.crit { background: var(--red); }
.plan-usage-config { margin-top: 16px; padding-top: 16px; border-top: 1px solid hsl(var(--border)); display: flex; flex-direction: column; gap: 10px; }
.plan-usage-config label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.plan-usage-config input {
  background: transparent; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); padding: 0 10px; height: 34px; font-size: 13px; outline: none;
}
.plan-usage-config input:focus { box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)); border-color: transparent; }
.plan-usage-config .btn-secondary { align-self: flex-start; }
.plan-usage-note { font-size: 11px; color: hsl(var(--muted-foreground)); line-height: 1.5; }

/* Usage / budget */
.usage-bar { height: 8px; background: hsl(var(--secondary)); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.usage-bar-fill { height: 100%; border-radius: 4px; background: hsl(var(--primary)); transition: width 0.6s ease, background 0.3s; }
.usage-bar-fill.warn { background: var(--yellow); }
.usage-bar-fill.crit { background: var(--red); }
.usage-remaining-line { font-size: 13px; margin-bottom: 14px; }
.usage-budget-edit { display: flex; gap: 8px; margin-top: 12px; }
.usage-budget-edit input {
  flex: 1; min-width: 0; background: transparent; border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px); color: hsl(var(--foreground)); padding: 0 10px; height: 32px;
  font-size: 13px; outline: none;
}
.usage-budget-edit input:focus { box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)); border-color: transparent; }

.nav-footer { padding: 12px; border-top: 1px solid hsl(var(--border)); }
.nav-user {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(0 0% 100% / 0.03); transition: background 0.15s, border-color 0.15s;
}
.nav-user:hover { background: hsl(0 0% 100% / 0.06); border-color: hsl(var(--brand) / 0.4); }
.nav-user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0; box-shadow: var(--glow-brand);
}
.nav-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nav-user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: hsl(var(--foreground)); }
.nav-user-plan { font-size: 11px; color: hsl(var(--muted-foreground)); }
.nav-user-logout {
  width: 28px; height: 28px; border-radius: 4px; background: transparent; border: none;
  color: hsl(var(--muted-foreground)); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
.nav-user-logout:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }

/* ── Main area ──────────────────────────────────────────────────────────────── */
#main-area {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  background-color: hsl(var(--background));
  background-image: linear-gradient(to right, hsl(var(--border) / 0.5) 1px, transparent 1px),
                    linear-gradient(to bottom, hsl(var(--border) / 0.5) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Dashboard ──────────────────────────────────────────────────────────────── */
#dashboard { flex: 1; overflow-y: auto; overflow-x: hidden; width: 100%; }
.dashboard-inner { max-width: 1200px; margin: 0 auto; width: 100%; padding: 48px 56px 32px; }
.greeting-section { margin-bottom: 40px; }
.greeting-text h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 4px; }
.greeting-text h2 { font-size: 16px; color: hsl(var(--muted-foreground)); font-weight: 400; margin-bottom: 12px; }
.gradient-text {
  background: linear-gradient(120deg, hsl(var(--brand)), hsl(var(--brand-2)));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.greeting-sub { color: hsl(var(--muted-foreground)); font-size: 14px; }

/* Stats row */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.stat-card-label { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 500; margin-bottom: 6px; }
.stat-card-value { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; }
.stat-card-active .stat-card-value { color: var(--green); }

.section-header {
  margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between;
}
.section-header h3 { font-size: 14px; font-weight: 600; color: hsl(var(--foreground)); letter-spacing: -0.01em; text-transform: none; }
.live-indicator { font-size: 12px; color: var(--green); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.live-indicator::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; animation: pulse 2s infinite; }

/* System monitor grid */
.system-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.sys-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.sys-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sys-card-label { font-size: 12px; color: hsl(var(--muted-foreground)); font-weight: 500; }
.sys-card-icon { font-size: 14px; color: hsl(var(--muted-foreground)); }
.sys-card-value { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 4px; }
.sys-card-sub { font-size: 12px; color: hsl(var(--muted-foreground)); margin-bottom: 12px; }
.sys-bar { height: 6px; background: hsl(var(--secondary)); border-radius: 3px; overflow: hidden; }
.sys-bar-fill { height: 100%; border-radius: 3px; background: hsl(var(--primary)); transition: width 0.6s ease; }
.sys-bar-fill.warn { background: var(--yellow); }
.sys-bar-fill.crit { background: var(--red); }

/* Project rows */
#projects-grid { display: flex; flex-direction: column; gap: 8px; }
.project-row {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.project-row:hover { border-color: hsl(var(--muted-foreground)); }
.project-row-icon {
  width: 40px; height: 40px; background: hsl(var(--secondary)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px); display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.project-row-main { flex: 1; min-width: 0; }
.project-row-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.project-row-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.project-row-desc { font-size: 13px; color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-row-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.project-row-chev { color: hsl(var(--muted-foreground)); flex-shrink: 0; }
.project-row-chev svg { width: 16px; height: 16px; }
.meta-item { font-size: 13px; color: hsl(var(--muted-foreground)); display: flex; align-items: center; gap: 4px; }

/* Badge */
.badge {
  font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 9999px;
  text-transform: capitalize; border: 1px solid transparent;
  display: inline-flex; align-items: center;
}
.badge.success, .badge.active-badge { background: transparent; color: var(--green); border-color: var(--green); }
.badge.failed  { background: transparent; color: var(--red); border-color: var(--red); }
.badge.running { background: transparent; color: var(--yellow); border-color: var(--yellow); }
.badge.none    { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 64px 20px; text-align: center; border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: 4px; opacity: 0.5; color: hsl(var(--muted-foreground)); }
.empty-state .empty-icon .material-symbols-rounded { font-size: 40px; }
.feature-card-icon .material-symbols-rounded { color: hsl(var(--foreground)); }
.empty-state h3 { font-size: 16px; font-weight: 600; }
.empty-state p { font-size: 14px; color: hsl(var(--muted-foreground)); }

/* ── Project view ───────────────────────────────────────────────────────────── */
#project-view { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.project-layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }
#app-header {
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  height: 56px; border-bottom: 1px solid hsl(var(--border)); flex-shrink: 0;
  background: hsl(var(--background) / 0.8); backdrop-filter: blur(12px);
}
.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-btn-inline {
  width: 32px; height: 32px; background: transparent; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.nav-btn-inline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav-btn-inline svg { width: 16px; height: 16px; }
.breadcrumb-sep { color: hsl(var(--muted-foreground)); margin: 0 4px; }
#header-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; min-width: 0; }

/* Header action buttons (rename / delete) */
.rename-btn, .danger-btn {
  width: 28px; height: 28px; border-radius: calc(var(--radius) - 2px); flex-shrink: 0;
  background: transparent; border: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.rename-btn { color: hsl(var(--muted-foreground)); }
.danger-btn { color: hsl(var(--muted-foreground)); }
.rename-btn:hover { background: hsl(0 0% 100% / 0.06); color: hsl(var(--brand)); border-color: hsl(var(--brand) / 0.5); }
.danger-btn:hover { background: hsl(var(--destructive) / 0.18); color: var(--red); border-color: hsl(var(--destructive)); }
.rename-btn .material-symbols-rounded, .danger-btn .material-symbols-rounded { font-size: 18px; color: inherit; }
.rename-btn svg, .danger-btn svg { width: 15px; height: 15px; }
.modal-text { font-size: 13px; line-height: 1.55; color: hsl(var(--foreground)); margin-bottom: 12px; }
.modal-text.muted { color: hsl(var(--muted-foreground)); }
.header-title-input {
  font-weight: 600; font-size: 14px; font-family: inherit; color: hsl(var(--foreground));
  background: hsl(var(--background)); border: 1px solid hsl(var(--brand) / 0.6);
  border-radius: calc(var(--radius) - 2px); padding: 4px 8px; outline: none; min-width: 0; max-width: 240px;
  box-shadow: 0 0 0 3px hsl(var(--brand) / 0.15);
}

.model-badge {
  display: flex; align-items: center; gap: 6px; background: transparent; border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px); padding: 4px 10px; font-size: 12px; color: hsl(var(--foreground)); font-weight: 500;
}
.status-pill {
  display: flex; align-items: center; gap: 8px; background: transparent;
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px); padding: 4px 10px;
  font-size: 12px; color: hsl(var(--foreground)); font-weight: 500;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--muted-foreground)); flex-shrink: 0; }
.status-dot.processing { background: var(--yellow); animation: blink 1.2s infinite; }
.status-dot.done { background: var(--green); }
.status-dot.idle { background: hsl(var(--muted-foreground)); }
#header-active-badge { display: none; } /* Redundant with status */

/* ── Chat ───────────────────────────────────────────────────────────────────── */
.chat-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: transparent; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px; display: flex; flex-direction: column; gap: 24px; }
.messages.has-messages { max-width: 800px; margin: 0 auto; width: 100%; }

/* Welcome */
.messages-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 32px; padding: 40px; max-width: 760px; margin: 0 auto; width: 100%;
}
.welcome-avatar {
  width: 56px; height: 56px; border-radius: calc(var(--radius) * 1.5);
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground));
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-brand-strong);
}
.welcome-avatar svg { stroke: hsl(var(--brand-foreground)); width: 24px; height: 24px; }
.welcome { text-align: center; width: 100%; }
.welcome h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; margin-bottom: 8px; }
.welcome h2 { font-size: 16px; font-weight: 400; color: hsl(var(--muted-foreground)); }

/* Feature cards */
.feature-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; width: 100%; }
.feature-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 20px 16px; text-align: left;
}
.feature-card-icon { font-size: 20px; margin-bottom: 12px; }
.feature-card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.feature-card-desc { font-size: 13px; color: hsl(var(--muted-foreground)); line-height: 1.5; }

/* Suggestion pills */
.prompt-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.suggestion-pill {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  background: hsl(var(--card) / 0.6); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  cursor: pointer; text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.suggestion-pill:hover {
  background: hsl(var(--card)); border-color: hsl(var(--brand) / 0.5);
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.suggestion-pill:hover .pill-add { color: hsl(var(--brand)); }
.pill-dot { display: none; }
.pill-icon { display: flex; align-items: center; color: hsl(var(--muted-foreground)); flex-shrink: 0; }
.suggestion-pill:hover .pill-icon { color: hsl(var(--foreground)); }
.pill-text { flex: 1; font-size: 13px; color: hsl(var(--foreground)); font-weight: 500; }
.pill-add {
  color: hsl(var(--muted-foreground)); display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 400; transition: color 0.15s;
}
.suggestion-pill:hover .pill-add { color: hsl(var(--foreground)); }

/* Messages */
.message { display: flex; gap: 16px; max-width: 100%; }
.message.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.message.user .msg-avatar { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.message.claude .msg-avatar {
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground)); box-shadow: var(--glow-brand);
}
.message.claude .msg-avatar svg { width: 16px; height: 16px; stroke: hsl(var(--brand-foreground)); }

.msg-body { max-width: calc(100% - 48px); line-height: 1.6; word-break: break-word; font-size: 14px; }
.message.claude .msg-body { color: hsl(var(--foreground)); padding-top: 4px; }
.message.user .msg-body {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 1.5); border-top-right-radius: 4px;
  padding: 12px 16px; color: hsl(var(--secondary-foreground)); box-shadow: var(--shadow-sm);
}
.msg-body p { margin: 0 0 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body h1,.msg-body h2,.msg-body h3 { margin: 20px 0 10px; font-size: 16px; font-weight: 600; }
.msg-body ul,.msg-body ol { padding-left: 24px; margin: 12px 0; }
.msg-body li { margin-bottom: 4px; }
.msg-body pre {
  position: relative;
  background: hsl(240, 6%, 8%); border: 1px solid hsl(var(--border)); border-radius: 8px; padding: 14px 16px;
  overflow-x: auto; margin: 14px 0; font-size: 13px; line-height: 1.6; color: #e2e8f0;
}
.msg-body code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace; font-size: 13px;
  background: hsl(var(--secondary)); padding: 2px 5px; border-radius: 4px; color: hsl(var(--foreground));
}
.msg-body pre code { background: none; padding: 0; color: inherit; }
.msg-body a { color: hsl(var(--brand)); text-decoration: underline; text-underline-offset: 4px; }

/* Copy button injected into code blocks (post-sanitize, by JS) */
.code-copy {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0;
  background: hsl(var(--secondary) / 0.8); border: 1px solid hsl(var(--border)); border-radius: 6px;
  color: hsl(var(--muted-foreground)); cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.msg-body pre:hover .code-copy, .code-copy.copied { opacity: 1; }
.code-copy:hover { color: hsl(var(--foreground)); background: hsl(var(--secondary)); }
.code-copy.copied { color: var(--green); border-color: var(--green); }
/* On touch devices there's no hover — always show it */
@media (hover: none) { .code-copy { opacity: 0.7; } }

/* Activity rows */
.activity-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin-left: 48px;
  background: transparent; border: 1px solid hsl(var(--border));
  border-radius: var(--radius); font-size: 13px; color: hsl(var(--muted-foreground));
  max-width: calc(100% - 48px);
}
.activity-icon { font-size: 14px; flex-shrink: 0; }
.activity-text {
  font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: hsl(var(--foreground));
}
.system-msg {
  text-align: center; font-size: 12px; color: hsl(var(--muted-foreground)); padding: 8px 16px;
  background: hsl(var(--secondary)); border-radius: 9999px; align-self: center; font-weight: 500;
}

/* Thinking bar */
.thinking-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 32px;
  border-top: 1px solid hsl(var(--border)); font-size: 13px; color: hsl(var(--muted-foreground)); flex-shrink: 0;
  background: hsl(var(--background) / 0.8); backdrop-filter: blur(12px);
}
.spinner {
  width: 16px; height: 16px; border: 2px solid hsl(var(--brand) / 0.25); border-top-color: hsl(var(--brand));
  border-radius: 50%; animation: spin 0.65s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat input */
.chat-input-area {
  padding: 12px 16px; flex-shrink: 0;
  background: hsl(var(--background) / 0.8); backdrop-filter: blur(12px);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 10;
}
.chat-input-card {
  max-width: 800px; margin: 0 auto; background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 1.5); padding: 0;
  box-shadow: var(--shadow-md); transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-card:focus-within {
  border-color: hsl(var(--brand) / 0.6);
  box-shadow: var(--shadow-md), 0 0 0 3px hsl(var(--brand) / 0.15);
}
.chat-input-simple {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px;
}
.chat-input-simple textarea {
  flex: 1; background: none; border: none; color: hsl(var(--foreground)); font-size: 16px;
  resize: none; font-family: inherit; outline: none; line-height: 1.6;
  max-height: 120px; min-height: 44px; padding: 4px; margin: 0;
  -webkit-appearance: none;
}
.chat-input-simple textarea::placeholder { color: hsl(var(--muted-foreground)); }

/* Attach (image upload) button */
.attach-btn {
  width: 44px; height: 44px; padding: 0; flex-shrink: 0;
  background: transparent; border: none; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground)); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s;
}
.attach-btn:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.attach-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Attachment tray (thumbnails above the input) */
.attach-tray {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 10px 0;
}
.attach-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 6px;
  background: hsl(var(--secondary)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px); max-width: 260px;
}
.attach-chip.done { border-color: hsl(var(--brand) / 0.5); }
.attach-chip.error { border-color: hsl(var(--destructive)); }
.attach-remove {
  width: 24px; height: 24px; padding: 0; flex-shrink: 0; margin-left: 2px;
  background: transparent; border: none; border-radius: 4px;
  color: hsl(var(--muted-foreground)); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s;
}
.attach-remove:hover { background: hsl(var(--background)); color: hsl(var(--foreground)); }
.attach-thumb {
  width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0; background: hsl(var(--muted));
}
.attach-icon {
  display: flex; align-items: center; justify-content: center;
  font-size: 18px !important; color: hsl(var(--muted-foreground));
  background: hsl(var(--background)); border-radius: 4px;
}
.attach-meta { display: flex; flex-direction: column; min-width: 0; }
.attach-name {
  font-size: 12px; font-weight: 500; color: hsl(var(--foreground));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-status {
  font-size: 11px; color: hsl(var(--muted-foreground));
  display: flex; align-items: center; gap: 4px;
}
.attach-chip.done .attach-status { color: var(--green); }
.attach-chip.error .attach-status { color: hsl(var(--destructive)); }
.attach-spinner {
  width: 10px; height: 10px; border: 2px solid hsl(var(--border)); border-top-color: hsl(var(--foreground));
  border-radius: 50%; animation: spin 0.65s linear infinite; display: inline-block;
}
.send-btn {
  width: 44px; height: 44px; padding: 0; border: none; border-radius: var(--radius);
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground)); cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: var(--glow-brand);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.send-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--glow-brand-strong); }
.send-btn:active:not(:disabled) { transform: translateY(0); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.send-btn svg { width: 20px; height: 20px; stroke: hsl(var(--brand-foreground)); }

.input-disclaimer {
  text-align: center; font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 12px;
  max-width: 800px; margin-left: auto; margin-right: auto;
}

/* ── Info sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: 300px; flex-shrink: 0; display: flex; flex-direction: column;
  overflow: hidden; border-left: 1px solid hsl(var(--border)); background: hsl(var(--background));
}
@media (max-width: 1100px) {
  .sidebar { display: none; }
}
.sidebar-tabs { display: flex; border-bottom: 1px solid hsl(var(--border)); flex-shrink: 0; }
.tab-btn {
  flex: 1; padding: 12px 0; background: transparent; border: none; border-bottom: 2px solid transparent;
  color: hsl(var(--muted-foreground)); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: color 0.15s;
}
.tab-btn:hover { color: hsl(var(--foreground)); }
.tab-btn.active { color: hsl(var(--foreground)); border-bottom-color: hsl(var(--foreground)); }
.tab-content { flex: 1; overflow-y: auto; padding: 20px; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-section-title {
  font-size: 13px; font-weight: 600; color: hsl(var(--foreground)); margin-bottom: 12px;
}
.kv-row {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 0;
  font-size: 13px;
}
.kv-key { color: hsl(var(--muted-foreground)); }
.kv-value { font-weight: 500; color: hsl(var(--foreground)); }
.history-item {
  padding: 8px 0; font-size: 13px; color: hsl(var(--muted-foreground)); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; cursor: default;
}
.history-item:hover { color: hsl(var(--foreground)); }
.deploy-section { margin-bottom: 20px; }
.deploy-section label { display: block; font-size: 13px; color: hsl(var(--foreground)); margin-bottom: 8px; font-weight: 500; }
.deploy-section input {
  width: 100%; background: transparent; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); padding: 8px 12px; font-size: 13px; outline: none;
  font-family: 'JetBrains Mono', monospace; margin-bottom: 12px;
}
.deploy-section input:focus {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: transparent;
}
.terminal {
  background: hsl(240, 5%, 10%); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px);
  padding: 12px; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: #e2e8f0; white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow-y: auto; margin: 12px 0; line-height: 1.6;
}
.deploy-history-item {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 13px;
}
.deploy-time { color: hsl(var(--muted-foreground)); font-size: 12px; }
.file-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-left: -8px; margin-right: -8px;
  border-radius: calc(var(--radius) - 2px); font-size: 13px; color: hsl(var(--muted-foreground));
}
.file-item:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.file-icon { width: 14px; text-align: center; flex-shrink: 0; }
.file-dir { color: hsl(var(--foreground)); font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
button {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 13px; font-weight: 500; border: none;
  border-radius: calc(var(--radius) - 2px); transition: background-color 0.15s, opacity 0.15s;
  cursor: pointer; height: 36px; padding: 0 16px;
}
button:disabled { opacity: 0.5; pointer-events: none; }
/* Fixed-size icon buttons must not inherit the base button's horizontal padding */
.nav-btn-inline, .nav-section-add, .nav-user-logout, .close-sidebar-btn, .hamburger-btn, .send-btn { padding: 0; }
.btn-accent, .btn-primary {
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: hsl(var(--brand-foreground)); box-shadow: var(--glow-brand);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn-accent:hover, .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--glow-brand-strong); }
.btn-accent:active, .btn-primary:active { transform: translateY(0); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { background: hsl(var(--secondary)/0.8); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--secondary)); }
.btn-danger { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; margin-bottom: 12px; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 425px; box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.025em; margin-bottom: 24px; color: hsl(var(--foreground)); }
.modal label { display: block; font-size: 13px; color: hsl(var(--foreground)); margin-bottom: 8px; font-weight: 500; }
.modal input {
  display: flex; width: 100%; height: 36px; padding: 8px 12px; background: transparent;
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); font-size: 13px; outline: none; margin-bottom: 16px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.modal input:focus {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: transparent;
}
.modal input::placeholder { color: hsl(var(--muted-foreground)); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* ── Server Status sheet ───────────────────────────────────────────────────── */
.status-sheet { max-width: 560px; max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; }
.sheet-close {
  width: 32px; height: 32px; border-radius: var(--radius); flex-shrink: 0;
  background: transparent; border: none; color: hsl(var(--muted-foreground)); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s;
}
.sheet-close:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.sheet-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground)); margin: 18px 0 10px;
}

/* System metric grid */
.status-sys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sysm { background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 12px; }
.sysm-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sysm-label { font-size: 12px; color: hsl(var(--muted-foreground)); }
.sysm-val { font-size: 13px; font-weight: 600; }
.sysm-bar { height: 5px; background: hsl(var(--secondary)); border-radius: 9999px; overflow: hidden; }
.sysm-fill { height: 100%; background: hsl(var(--brand)); border-radius: 9999px; transition: width 0.4s; }
.sysm-fill.warn { background: var(--yellow); }
.sysm-fill.crit { background: var(--red); }

/* pm2 process rows */
.status-pm2 { display: flex; flex-direction: column; gap: 8px; }
.pm2-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 12px;
}
.pm2-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.pm2-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pm2-dot.up { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pm2-dot.down { background: var(--red); }
.pm2-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm2-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.pm2-status.up { background: hsl(142 70% 45% / 0.15); color: var(--green); }
.pm2-status.down { background: hsl(0 70% 50% / 0.15); color: var(--red); }
.pm2-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px;
  color: hsl(var(--muted-foreground)); white-space: nowrap;
}
.pm2-actions { display: flex; gap: 6px; margin-left: auto; }
#status-logs { max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* Live status pill (project cards + project header) */
.live-pill {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 9999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.live-pill .live-dot { width: 7px; height: 7px; border-radius: 50%; }
.live-up   { background: hsl(142 70% 45% / 0.14); color: var(--green); }
.live-up   .live-dot { background: var(--green); box-shadow: 0 0 7px var(--green); }
.live-down { background: hsl(0 70% 50% / 0.14); color: var(--red); }
.live-down .live-dot { background: var(--red); }
#header-live { display: inline-flex; align-items: center; margin-left: 4px; }
.card-live:empty { display: none; }
.live-services { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
@media (max-width: 560px) {
  .status-sys { grid-template-columns: 1fr; }
  .pm2-meta { width: 100%; order: 3; }
  .pm2-actions { margin-left: 0; }
}

/* ── Mobile sidebar ────────────────────────────────────────────────────────── */
.hamburger-btn {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 110;
  width: 36px; height: 36px; border-radius: calc(var(--radius) - 2px);
  background: transparent; border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground)); cursor: pointer;
}
.hamburger-btn:hover { background: hsl(var(--secondary)); }

.close-sidebar-btn {
  display: none; width: 28px; height: 28px; border-radius: 4px;
  background: transparent; border: none; color: hsl(var(--muted-foreground));
  margin-left: auto; flex-shrink: 0;
}
.close-sidebar-btn:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 140;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.2s ease-in-out;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .sidebar { display: none; }
  .feature-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; align-items: center; justify-content: center; }
  .close-sidebar-btn { display: flex; align-items: center; justify-content: center; }

  #left-nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 150;
    width: 86vw; max-width: 320px; transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 1px hsl(var(--border));
  }
  #left-nav.open { transform: translateX(0); box-shadow: 24px 0 48px rgba(0,0,0,0.5); }

  /* Bigger, thumb-friendly drawer targets + prominent search */
  .nav-top { padding: 14px 12px 12px; }
  .nav-search { height: 46px; margin-bottom: 18px; }
  .nav-search input { font-size: 15px; }
  .nav-item { padding: 13px 12px; font-size: 15px; min-height: 48px; }
  .nav-item svg { width: 19px; height: 19px; }
  .nav-list-item { padding: 13px 12px; font-size: 15px; min-height: 48px; }
  .nav-section-head { padding: 10px 12px; font-size: 13px; }
  .nav-section-add { width: 32px; height: 32px; }
  .close-sidebar-btn { width: 40px; height: 40px; }
  .nav-user { padding: 8px; }

  #main-area { margin-left: 0; }
  .greeting-text h1 { font-size: 24px; }
  .system-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-row { grid-template-columns: 1fr; gap: 12px; }
  .feature-cards { grid-template-columns: 1fr; gap: 12px; }
  .prompt-suggestions { grid-template-columns: 1fr; gap: 8px; }

  #app-header { padding-left: 56px; padding-right: 16px; }
  .messages { padding: 16px 12px; }
  .dashboard-inner { padding: 64px 24px 24px; }
  .chat-input-area { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .chat-input-simple { padding: 8px; }
  .chat-input-simple textarea { min-height: 40px; font-size: 16px; }
  .send-btn { width: 40px; height: 40px; }
  .attach-btn { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
  .feature-cards { grid-template-columns: 1fr; }
  .system-grid { grid-template-columns: 1fr; }
  .dashboard-inner { padding: 56px 14px 20px; }
  .login-card { padding: 2rem 1.25rem; max-width: 90vw; }
  .messages { padding: 12px 10px; gap: 16px; }
  .message { gap: 10px; }
  .msg-avatar { width: 26px; height: 26px; font-size: 11px; }
  .msg-avatar svg, .msg-avatar .material-symbols-rounded { font-size: 14px; }
  .msg-body { max-width: calc(100% - 36px); font-size: 14px; }
  .message.user .msg-body { padding: 10px 12px; }
  .chat-input-area { padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .chat-input-card { border-radius: 4px; }
  .chat-input-simple { padding: 6px; gap: 6px; }
  .chat-input-simple textarea { min-height: 40px; font-size: 16px; padding: 6px; }
  .send-btn { width: 40px; height: 40px; }
  #app-header { height: 48px; padding: 0 12px; }
  .header-left { gap: 6px; }
}

/* ── Scrollbars ─────────────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: hsl(240 4% 22%) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(240 4% 22%); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: hsl(240 4% 30%); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(110%) scale(0.95); }
  to   { opacity: 1; transform: translateX(0)   scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0)    scale(1);    max-height: 120px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(110%) scale(0.95); max-height: 0;     margin-bottom: -10px; }
}
.deploy-toast {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 320px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  background: hsl(240 6% 11%);
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.deploy-toast.removing {
  animation: toastOut 0.25s ease-in forwards;
}
.deploy-toast-bar {
  height: 3px;
  width: 100%;
}
.deploy-toast-body {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.deploy-toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.deploy-toast-content {
  flex: 1;
  min-width: 0;
}
.deploy-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: #f4f4f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deploy-toast-sub {
  font-size: 11.5px;
  color: #71717a;
  margin-top: 2px;
}
.deploy-toast-close {
  background: none;
  border: none;
  color: #52525b;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s;
}
.deploy-toast-close:hover { color: #a1a1aa; }
.deploy-toast-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px 60px;
}
.deploy-toast-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #3f3f46;
  transition: background 0.15s, border-color 0.15s;
}
.deploy-toast-btn-primary {
  background: #27272a;
  color: #e4e4e7;
}
.deploy-toast-btn-primary:hover { background: #3f3f46; border-color: #52525b; }
.deploy-toast-btn-ghost {
  background: none;
  color: #71717a;
}
.deploy-toast-btn-ghost:hover { background: #27272a; color: #a1a1aa; }
.deploy-toast-log {
  margin: 0 16px 14px;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: #a1a1aa;
  max-height: 130px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
}
.hidden { display: none !important; }
