/* CareerDoc — app.css — full rewrite */

/* ─── CSS Variables ─── */
:root {
  --bg: #F0F2F8;
  --bg2: #E8EBF4;
  --surface: #FFFFFF;
  --surface2: #F5F7FC;
  --border: #E0E4F0;
  --border2: #C4CADF;
  --text: #0D1017;
  --text2: #1A2035;
  --muted: #4F5970;
  --muted2: #606A88;
  --accent: #5B50D6;
  --accent2: #7B70E8;
  --accentg: linear-gradient(135deg,#5B50D6,#7B70E8);
  --danger: #E03830;
  --success: #0CAF74;
  --warn: #E8960A;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,.09);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.11);
  --shadow-xl: 0 20px 56px rgba(0,0,0,.14);
  --glow: 0 0 20px rgba(91,80,214,.15);
  --glow-lg: 0 0 40px rgba(91,80,214,.2);
  --sidebar-w: 260px;
  --sidebar-compact-w: 76px;
  --mobile-h: 60px;
  --bottom-nav-h: 64px;
  --radius: 14px;
  --radius-sm: 9px;
}

.dark {
  --bg: #080A12;
  --bg2: #0D1020;
  --surface: #111528;
  --surface2: #171A2F;
  --border: #1D2240;
  --border2: #282E50;
  --text: #EEF0FF;
  --text2: #D0D5F0;
  --muted: #8898B2;
  --muted2: #6068A0;
  --accent: #9A94F8;
  --accent2: #B4AFF8;
  --accentg: linear-gradient(135deg,#7B70E8,#9890F0);
  --danger: #F55350;
  --success: #1AC880;
  --warn: #F5A830;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 4px 14px rgba(0,0,0,.65);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.75);
  --shadow-xl: 0 20px 56px rgba(0,0,0,.85);
  --glow: 0 0 20px rgba(123,112,232,.3);
  --glow-lg: 0 0 40px rgba(123,112,232,.4);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ─── App Layout ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  transition: width .25s cubic-bezier(.4,0,.2,1), transform .25s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.4px;
}
.dark .sidebar-logo {
  background: linear-gradient(135deg, #e8eef6, #9890F0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo-mini {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg2);
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-compact-w);
    flex-basis: var(--sidebar-compact-w);
    opacity: 1;
    pointer-events: auto;
    transform: none;
    border-right-color: var(--border);
  }
  body.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 0;
  }
  body.sidebar-collapsed .sidebar-logo { display: none; }
  body.sidebar-collapsed .sidebar-logo-mini { display: inline-flex; }
  body.sidebar-collapsed .sidebar-header .theme-btn { display: none; }
  body.sidebar-collapsed .sidebar-nav,
  body.sidebar-collapsed .sidebar-footer {
    display: none;
  }
}

/* ─── Nav Groups (accordion) ─── */
.nav-group { border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 2px; }

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .12s, color .12s;
  user-select: none;
}
.nav-group-toggle:hover { background: var(--bg2); color: var(--text); }
.nav-group-toggle.active { color: var(--accent); background: rgba(91,80,214,.08); }
.dark .nav-group-toggle.active { background: rgba(123,112,232,.12); }

.nav-label { flex: 1; }

.nav-chevron {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted2);
  transition: transform .2s;
  line-height: 1;
}
.nav-group.open .nav-chevron { transform: rotate(90deg); }

.nav-icon { font-size: 15px; flex-shrink: 0; line-height: 1; }

.nav-sub {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px 14px;
}
.nav-group.open .nav-sub { display: flex; }
.nav-group .nav-sub,
.nav-group.open .nav-sub { display: none !important; }
.nav-chevron { display: none !important; }

.nav-sub-item {
  display: block;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background .1s, color .1s;
  cursor: pointer;
}
.nav-sub-item:hover { background: var(--bg2); color: var(--text); text-decoration: none; }
.nav-sub-item.active { color: var(--accent); background: rgba(91,80,214,.08); font-weight: 600; }
.dark .nav-sub-item.active { background: rgba(123,112,232,.12); }

/* Legacy nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg2); color: var(--text); }
.nav-item.active { color: var(--accent); background: rgba(91,80,214,.08); }

/* ─── Main Content ─── */
.main {
  flex: 1;
  padding: 32px 36px 48px;
  min-width: 0;
  max-width: 100%;
}

/* ─── Page Title ─── */
.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.2;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Stats ─── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--border2); }

.stat-val {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Pipeline Tabs ─── */
.pipeline-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 18px;
  padding-bottom: 2px;
}
.pipeline-tabs::-webkit-scrollbar { display: none; }

.pipeline-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.pipeline-tab:hover { color: var(--text); border-color: var(--border2); }
.pipeline-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--glow);
}

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--bg2); }

/* Table → Cards on mobile */
@media (max-width: 640px) {
  .table-wrap table { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .table-wrap tr {
    display: block;
    border-radius: 14px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
  }
  .table-wrap tr:hover { background: var(--surface); }
  .table-wrap td {
    display: block;
    border-bottom: none;
    padding: 3px 0;
    white-space: normal;
    max-width: none;
    overflow: visible;
  }
}

/* ─── Row Tints ─── */
tr.row-saved        { background: rgba(37,99,235,.04); }
tr.row-applied      { background: rgba(16,185,129,.04); }
tr.row-interviewing { background: rgba(245,158,11,.05); }
tr.row-offered      { background: rgba(20,184,166,.05); }
tr.row-rejected     { background: rgba(239,68,68,.04); }
tr.row-withdrawn    { background: rgba(100,116,139,.04); }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,80,214,.12);
}

input::placeholder, textarea::placeholder { color: var(--muted2); }

textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2366708A'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(91,80,214,.25);
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(91,80,214,.35); text-decoration: none; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border2);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--border2); background: var(--bg2); color: var(--text); text-decoration: none; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(224,56,48,.25);
}
.btn-danger:hover:not(:disabled) { background: rgba(224,56,48,.08); border-color: rgba(224,56,48,.4); text-decoration: none; }

.btn-save {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-save:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); text-decoration: none; color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Theme Button ─── */
.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background .15s, border-color .15s;
  color: var(--text);
  flex-shrink: 0;
}
.theme-btn:hover { background: var(--surface2); border-color: var(--border2); }

.sidebar-toggle-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  font-family: inherit;
}
.sidebar-toggle-btn:hover { background: var(--bg2); border-color: var(--border2); }
.sidebar-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.sidebar-collapsed .sidebar-toggle-btn { background: var(--bg2); border-color: var(--border2); }
.sidebar-toggle-icon { transition: transform .2s ease; }
body.sidebar-collapsed .sidebar-toggle-icon { transform: rotate(180deg); }
@media (max-width: 768px) {
  .sidebar-toggle-btn { display: none; }
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: capitalize;
}

.badge-saved        { background: rgba(37,99,235,.12); color: #3b82f6; border: 1px solid rgba(37,99,235,.2); }
.badge-applied      { background: rgba(16,185,129,.12); color: #059669; border: 1px solid rgba(16,185,129,.2); }
.badge-interviewing { background: rgba(245,158,11,.12); color: #d97706; border: 1px solid rgba(245,158,11,.2); }
.badge-offered      { background: rgba(20,184,166,.12); color: #0f766e; border: 1px solid rgba(20,184,166,.2); }
.badge-rejected     { background: rgba(239,68,68,.12); color: #dc2626; border: 1px solid rgba(239,68,68,.2); }
.badge-withdrawn    { background: rgba(100,116,139,.1); color: #64748b; border: 1px solid rgba(100,116,139,.2); }

.dark .badge-saved        { color: #93c5fd; }
.dark .badge-applied      { color: #6ee7b7; }
.dark .badge-interviewing { color: #fde68a; }
.dark .badge-offered      { color: #5eead4; }
.dark .badge-rejected     { color: #fca5a5; }
.dark .badge-withdrawn    { color: #94a3b8; }

/* ─── Alerts ─── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
}
.alert-error {
  background: rgba(224,56,48,.08);
  border: 1px solid rgba(224,56,48,.2);
  color: var(--danger);
}
.alert-success {
  background: rgba(12,175,116,.08);
  border: 1px solid rgba(12,175,116,.2);
  color: var(--success);
}

/* ─── Spinner ─── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal Tabs ─── */
.modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.modal-tab {
  flex: 1;
  padding: 9px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
  border-right: 1px solid var(--border);
  user-select: none;
}
.modal-tab:last-child { border-right: none; }
.modal-tab:hover:not(.active) { background: rgba(91,80,214,.04); color: var(--text); }
.modal-tab.active { background: var(--surface2); color: var(--accent); }

.modal-pane { display: none; }
.modal-pane.active { display: block; }

/* ─── Drop Zone ─── */
.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg2);
}
.drop-zone:hover { border-color: var(--accent); background: rgba(91,80,214,.04); }
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(91,80,214,.07);
  box-shadow: var(--glow);
}

/* ─── Avatar ─── */
.avatar-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

/* ─── Fit Rings ─── */
.fit-rings {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 16px 0 8px;
}

.fit-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.fit-ring-svg {
  width: 80px;
  height: 80px;
}

.fit-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.fit-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset .6s ease, stroke .3s;
}

.fit-ring-pct {
  font-size: 13px;
  font-weight: 800;
  fill: var(--text);
  dominant-baseline: auto;
}

.fit-ring-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.fit-ring-match {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
}

.fit-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  margin: 0 8px;
}

.fit-detail {
  font-size: 11px;
  text-align: center;
  line-height: 1.5;
  margin-top: 2px;
}

.fit-detail .str { color: var(--success); display: block; }
.fit-detail .gap { color: var(--danger); display: block; }

/* ─── Auth ─── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: var(--shadow-xl);
}

.auth-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
  border-right: 1px solid var(--border);
}
.auth-tab:last-child { border-right: none; }
.auth-tab.active { background: var(--surface2); color: var(--text); }
.auth-tab:hover:not(.active) { background: rgba(91,80,214,.04); }

/* ─── Plan Cards ─── */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 820px) {
  .plan-cards { grid-template-columns: 1fr; }
}

.plan-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, box-shadow .2s;
}
.plan-card:hover { border-color: var(--border2); box-shadow: var(--shadow-lg); }
.plan-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(91,80,214,.2), var(--glow);
}

.plan-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.plan-price span { font-size: 13px; font-weight: 400; color: var(--muted); }

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.plan-features li { font-size: 13px; color: var(--text); display: flex; align-items: flex-start; gap: 8px; }
.plan-features li::before { content: "✓"; color: var(--success); font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.plan-features li.locked { color: var(--muted); }
.plan-features li.locked::before { content: "✗"; color: var(--border2); }

.plan-btn { margin-top: 20px; }
.plan-btn button { width: 100%; }

/* ─── Integrations ─── */
.integration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) { .integration-grid { grid-template-columns: 1fr; } }

.integration-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color .2s, box-shadow .2s;
}
.integration-card:hover { border-color: var(--border2); box-shadow: var(--shadow-md); }

.integration-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }

.integration-info { flex: 1; min-width: 0; }
.integration-info h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.integration-info p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }

/* ─── Chat (injected by chat.js) ─── */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accentg);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  box-shadow: var(--shadow-lg), var(--glow);
  transition: transform .15s;
  font-size: 22px;
}
.chat-fab:hover { transform: scale(1.08); }

.chat-panel {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-xl), var(--glow);
  z-index: 199;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.open { display: flex; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg.thinking {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-style: italic;
}

/* ─── Public Site Nav ─── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 48px;
  height: 64px;
  background: rgba(240,242,248,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background .2s;
}
.dark .site-nav { background: rgba(8,10,18,.88); }

.site-nav-logo {
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  margin-right: auto;
  color: var(--text);
  letter-spacing: -0.4px;
}
.dark .site-nav-logo {
  background: linear-gradient(135deg, #e8eef6, #9890F0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.nav-link:hover { color: var(--text); text-decoration: none; }

.btn-nav-ghost {
  padding: 7px 16px;
  border-radius: 9px;
  border: 1.5px solid var(--border2);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  font-family: inherit;
}
.btn-nav-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn-nav-primary {
  padding: 7px 18px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity .15s;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-nav-primary:hover { opacity: .88; text-decoration: none; color: #fff; }

/* ─── Public Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo { font-size: 15px; font-weight: 800; color: var(--muted); }

.footer-links { display: flex; gap: 24px; }
.footer-links a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.7;
  transition: color .15s, opacity .15s;
}
.footer-links a:hover { color: var(--text); opacity: 1; }

.footer-copy { font-size: 12px; color: var(--muted); opacity: 0.5; }

/* ─── Bottom Nav (mobile only) ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 80;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  gap: 3px;
  text-decoration: none;
  transition: color .15s;
  min-height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.bottom-nav-item:hover { color: var(--text); text-decoration: none; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item svg { width: 22px; height: 22px; }

/* ─── FAB (mobile only) ─── */
.fab {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accentg);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg), var(--glow);
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: transform .15s;
  font-size: 24px;
  font-family: inherit;
}
.fab:hover { transform: scale(1.08); }

/* ─── Mobile Header ─── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 60;
  box-shadow: var(--shadow-sm);
}

.mobile-hamburger {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  border-radius: 8px;
  transition: background .12s;
  padding: 0;
}
.mobile-hamburger:hover { background: var(--bg2); }

.mobile-logo {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ─── Sidebar Overlay ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  backdrop-filter: blur(2px);
}

/* ─── Utilities ─── */
.text-muted { color: var(--muted); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

/* ─── Responsive: Mobile ≤768px ─── */
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .app-layout { flex-direction: column; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--sidebar-w);
    max-width: 82vw;
    z-index: 70;
    transform: translateX(-110%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid var(--border);
  }

  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-overlay { display: block; }

  .main {
    margin-top: var(--mobile-h);
    padding: 20px 16px calc(var(--bottom-nav-h) + 20px);
  }

  .bottom-nav { display: flex; }
  .fab { display: flex; }
  .stats { grid-template-columns: 1fr 1fr; }
  .site-nav { padding: 0 20px; gap: 12px; }
  .nav-link { display: none; }
  .site-footer { padding: 24px 20px; flex-direction: column; align-items: flex-start; }
}

/* ─── Dark mode: accent-as-background needs darker shade for white-text contrast ─── */
.dark .btn-primary,
.dark .btn-nav-primary { background: #5048C8; border-color: #5048C8; }
.dark .pipeline-tab.active { background: #5048C8; }
.dark .chat-msg.user { background: #5048C8; }
.dark .chat-fab,
.dark .fab { background: linear-gradient(135deg, #5048C8, #6058D8); }

/* ─── Large screens ─── */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .fab { display: none !important; }
  .mobile-header { display: none !important; }
  /* Hide sidebar collapse button */
  .sidebar-toggle-btn { display: none; }
}
