:root {
  --bg-page: #f4f8fb;
  --bg-surface: #ffffff;
  --bg-soft: #f0f7ff;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-blue: #bae6fd;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #0284c7;
  --primary-bright: #0ea5e9;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --rose: #e11d48;
  --rose-bg: #fff1f2;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 8px 24px -4px rgba(2, 132, 199, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #ffffff 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-blue);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  max-width: 420px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-bright), var(--primary-dark));
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-bright), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
}

.brand-title { font-weight: 800; font-size: 16.5px; color: var(--text-main); }
.brand-sub { font-size: 12px; color: var(--text-muted); }

.nav-menu { display: flex; flex-direction: column; gap: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.nav-item:hover { background: var(--bg-soft); color: var(--primary); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--border-blue);
  font-weight: 700;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg-surface);
  color: var(--primary-dark);
  border: 1px solid var(--border-blue);
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
}
.status-dot.online { background: var(--emerald); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18); }
.status-dot.busy { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.22); }

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  padding: 0 6px;
}

.industry-list { display: flex; flex-direction: column; gap: 4px; }

.industry-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.industry-btn:hover, .industry-btn.active {
  background: var(--bg-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.tailscale-card {
  margin-top: auto;
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12.5px;
}

.ts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 8px;
  font-size: 12px;
}

.ts-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.ts-code {
  font-family: Consolas, monospace;
  background: #ffffff;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-blue);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 11.5px;
  text-decoration: none;
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.search-wrapper {
  flex: 1;
  max-width: 620px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon { position: absolute; left: 14px; font-size: 15px; color: var(--text-muted); }
.search-wrapper input {
  width: 100%;
  padding: 11px 38px 11px 42px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 14px;
}
.search-wrapper input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}
.btn-clear {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--bg-soft);
  border: 1px solid var(--border-blue);
  color: var(--primary-dark);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.ai-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-bright), var(--primary));
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.22);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.btn-secondary { background: #ffffff; color: var(--text-main); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-soft); border-color: var(--border-blue); color: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }

.tab-panel {
  display: none;
  padding: 32px 36px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}
.tab-panel.active { display: block; }

.commander-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}
.commander-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.commander-title-group h1 { font-size: 21px; font-weight: 800; color: var(--text-main); }
.commander-title-group p { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }
.commander-input-bar { display: flex; gap: 12px; margin-bottom: 14px; }
.commander-input-bar input {
  flex: 1;
  padding: 13px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--border-blue);
  background: #ffffff;
  font-size: 14.5px;
}
.preset-commands { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-btn {
  background: #ffffff;
  border: 1px solid var(--border-blue);
  color: var(--primary-dark);
  padding: 6px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.preset-btn:hover { background: var(--primary); color: #ffffff; border-color: var(--primary); }

.subagents-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.subagent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subagent-card.working { border-color: var(--primary-bright); background: #f8fdff; }
.subagent-card.done { border-color: #6ee7b7; }
.sa-top { display: flex; align-items: center; justify-content: space-between; }
.sa-code { font-size: 11px; font-weight: 800; color: var(--primary); background: var(--primary-light); padding: 3px 9px; border-radius: 99px; }
.sa-status-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--bg-subtle); color: var(--text-muted); }
.sa-status-pill.working { background: var(--amber-bg); color: var(--amber); }
.sa-status-pill.done { background: var(--emerald-bg); color: var(--emerald); }
.sa-name { font-size: 15px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 6px; }
.sa-role { font-size: 12.2px; color: var(--text-secondary); }
.sa-task-box { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 12px; margin-top: auto; }

.commander-bottom-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; }
.timeline-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.tl-item { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-subtle); font-size: 12.8px; }
.tl-item.command { background: var(--bg-soft); border-color: var(--border-blue); }
.tl-item.report { background: var(--emerald-bg); border-color: #a7f3d0; }
.tl-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 11.5px; color: var(--primary-dark); margin-bottom: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.stat-value { font-size: 27px; font-weight: 800; color: var(--text-main); margin: 4px 0; }
.stat-meta { font-size: 12px; color: var(--text-muted); }
.text-blue { color: var(--primary); }
.text-amber { color: var(--amber); }
.text-emerald { color: var(--emerald); }
.text-muted { color: var(--text-muted); font-size: 12.5px; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.filter-select { background: var(--bg-subtle); color: var(--text-main); border: 1px solid var(--border); padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.filter-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 7px 12px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.panel-grid-2, .vlm-catalog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 17.5px; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
.card-desc { font-size: 13.2px; color: var(--text-secondary); margin-bottom: 18px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.8px; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
.form-input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-subtle); font-size: 13.8px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.keyword-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: var(--bg-soft); border: 1px solid var(--border-blue); color: var(--primary-dark); padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--primary); color: #fff; }
.terminal-box { background: #0f172a; border-radius: 12px; padding: 14px; height: 250px; overflow-y: auto; font-family: Consolas, monospace; font-size: 12px; color: #38bdf8; white-space: pre-wrap; margin-bottom: 16px; }
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job-item { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 10px 13px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; gap: 8px; }
.upload-dropzone { border: 2px dashed var(--border-blue); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; background: var(--bg-soft); }
.vlm-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.vlm-badge { display: inline-block; background: var(--primary-light); color: var(--primary-dark); padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; align-self: flex-start; }
.hidden { display: none !important; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.card-header-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mobile-brand-row { display: none; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.mobile-brand-left { display: flex; align-items: center; gap: 9px; cursor: pointer; min-width: 0; }
.mobile-brand-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mobile-industry-strip { display: none; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mobile-industry-strip::-webkit-scrollbar { display: none; }
.mob-ind-chip { flex-shrink: 0; white-space: nowrap; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--border); background: #ffffff; color: var(--text-secondary); font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); }
.mob-ind-chip.active { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.download-progress-box { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--border-blue); }
.dl-header { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.progress-track { width: 100%; height: 10px; background: #dbeafe; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary-bright), var(--emerald)); transition: width 0.3s ease; }
.mobile-bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 90; justify-content: space-around; box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06); }
.mob-nav-btn { background: transparent; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; cursor: pointer; padding: 6px 10px; border-radius: 10px; flex: 1; min-width: 0; white-space: nowrap; }
.mob-nav-icon { font-size: 17px; line-height: 1.1; }
.mob-nav-btn.active { color: var(--primary-dark); background: var(--primary-light); }
.mob-nav-btn b { font-weight: 800; color: var(--primary); }

