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

/* ─── Skeleton Loading ─── */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

.skeleton { pointer-events: none; }
.skeleton-line {
  height: 12px;
  border-radius: 4px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.skeleton-line.big { height: 28px; margin: 10px 0; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w50 { width: 50%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w90 { width: 90%; }

/* ─── Motion & Animation ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* T08: Scroll-reveal — added by IntersectionObserver in dashboard.js */
.reveal-item {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .45s cubic-bezier(.22,1,.36,1), transform .45s cubic-bezier(.22,1,.36,1);
}
.reveal-item.in-view { opacity: 1; transform: translateY(0); }

/* Staggered delays for groups */
.reveal-item:nth-child(2) { transition-delay: .07s; }
.reveal-item:nth-child(3) { transition-delay: .14s; }
.reveal-item:nth-child(4) { transition-delay: .21s; }
.reveal-item:nth-child(5) { transition-delay: .28s; }
.reveal-item:nth-child(n+6) { transition-delay: .32s; }

/* T10: Keyboard Focus Ring */
:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-item { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

:root {
  /* ── Base backgrounds ── */
  --bg-base:      #0a0a0f;
  --bg-layer:     #0e0e16;
  --bg-elevated:  #13131e;
  --bg-high:      #1a1a28;

  /* ── Glass surfaces (used once backdrop-blur lands) ── */
  --surface-1:    rgba(255,255,255,.04);
  --surface-2:    rgba(255,255,255,.07);
  --surface-3:    rgba(255,255,255,.11);

  /* ── Borders ── */
  --border-subtle: rgba(255,255,255,.08);
  --border-muted:  rgba(255,255,255,.12);
  --border-strong: rgba(255,255,255,.22);

  /* ── Accent — violet + cyan gradient partner ── */
  --accent:       #8B5CF6;
  --accent-to:    #06B6D4;
  --accent-dim:   rgba(139,92,246,.13);
  --accent-glow:  rgba(139,92,246,.32);
  --accent-hover: #9D6FEF;

  /* ── Text ── */
  --text:         #F0F0F2;
  --text-sub:     #686c7a;
  --text-muted:   #38394a;

  /* ── Semantic ── */
  --green:  #22C55E;
  --red:    #EF4444;

  /* ── Radius system ── */
  --r-xs:  6px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;

  /* ── 4/8px spacing system ── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;

  /* ── Backward-compat aliases (→ phased out as glass lands in T04) ── */
  --bg:      var(--bg-base);
  --bg2:     var(--bg-elevated);
  --card:    var(--bg-elevated);
  --card2:   var(--bg-high);
  --border:  var(--border-subtle);
  --border2: var(--border-muted);
  --accent-d:var(--accent-dim);
  --accent-h:var(--accent-hover);
  --font:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body { height: 100%; }

body {
  background:
    radial-gradient(ellipse 80% 50% at 8% 8%,   rgba(139,92,246,.08) 0%, transparent 58%),
    radial-gradient(ellipse 60% 40% at 92% 18%,  rgba(6,182,212,.05) 0%, transparent 54%),
    radial-gradient(ellipse 80% 60% at 50% 108%, rgba(99,102,241,.07) 0%, transparent 56%),
    var(--bg-base);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

/* ─── Login ─── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 48% 38% at 50% 50%,  rgba(139,92,246,.16) 0%, transparent 56%),
    radial-gradient(ellipse 70% 50% at 50% 0%,   rgba(139,92,246,.09) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 8% 8%,    rgba(139,92,246,.08) 0%, transparent 58%),
    radial-gradient(ellipse 60% 40% at 92% 18%,  rgba(6,182,212,.05) 0%, transparent 54%),
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(99,102,241,.07) 0%, transparent 56%),
    var(--bg-base);
  background-attachment: fixed;
}

.login-container {
  width: 360px;
  padding: 40px 36px;
  background:
    linear-gradient(160deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.005) 100%) padding-box,
    linear-gradient(135deg, rgba(139,92,246,.28) 0%, rgba(255,255,255,.10) 40%, rgba(255,255,255,.05) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 32px 64px rgba(0,0,0,.55),
    0 0 48px rgba(139,92,246,.12),
    inset 0 1px 0 rgba(255,255,255,.08);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 6px;
}
.login-logo svg { filter: drop-shadow(0 0 10px rgba(139,92,246,.5)); }

.login-sub {
  color: var(--text-sub);
  font-size: 12px;
  margin-bottom: 32px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; color: var(--text-sub); letter-spacing: .04em; text-transform: uppercase; }
.field input {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xs);
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

.login-error {
  color: var(--red);
  font-size: 12px;
  text-align: center;
}
.hidden { display: none !important; }

/* ─── Buttons ─── */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-to) 100%);
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,.35);
  border: none;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  transition: filter .15s, transform .1s, box-shadow .2s;
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 0 18px rgba(139,92,246,.38); }
.btn-primary:active { transform: scale(.98); }
.btn-full { width: 100%; padding: 11px; }

.btn-sm {
  background: var(--card2);
  border: 1px solid var(--border2);
  color: #b8bcc8;
  border-radius: var(--r-xs);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
  background: transparent;
  border: none;
  color: #9499aa;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.btn-icon:hover { color: var(--text); background: var(--card2); }

/* ─── Dashboard Layout ─── */
.dashboard-body { display: flex; flex-direction: column; overflow: hidden; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  /* height set via safe-area rules below */
  min-height: 52px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,10,15,.80);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

.header-sub {
  color: var(--text-sub);
  font-size: 11px;
  border-left: 1px solid var(--border2);
  padding-left: 16px;
}

.greeting { color: var(--text-sub); font-size: 12px; }

.btn-ask {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-to) 100%);
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,.35);
  border: none;
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: filter .15s, box-shadow .2s;
  letter-spacing: .02em;
}
.btn-ask:hover { filter: brightness(1.1); box-shadow: 0 0 14px rgba(139,92,246,.35); }

/* Chat Bar */
.chat-bar-wrap {
  padding: 12px 24px 0;
  flex-shrink: 0;
}

.chat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background:
    linear-gradient(160deg, rgba(255,255,255,.025) 0%, rgba(255,255,255,.005) 100%) padding-box,
    linear-gradient(160deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.05) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 0 14px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  transition: background .15s;
}
.chat-bar:focus-within {
  background:
    linear-gradient(160deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.008) 100%) padding-box,
    linear-gradient(160deg, rgba(139,92,246,.45) 0%, rgba(6,182,212,.18) 100%) border-box;
}

.chat-icon { color: var(--text-sub); flex-shrink: 0; }

.chat-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 11px 0;
  outline: none;
}
.chat-bar input::placeholder { color: var(--text-sub); }

.btn-send {
  background: transparent;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .15s;
}
.btn-send:hover { color: var(--accent); }

/* Inline chat panel */
.chat-panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--border2);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 240px;
  overflow-y: auto;
}
.chat-panel.open { display: block; }

.chat-messages { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.msg { display: flex; gap: 8px; }
.msg-role {
  font-size: 10px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .06em;
  flex-shrink: 0;
  padding-top: 1px;
  width: 40px;
}
.msg-role.user { color: var(--accent); }
.msg-content { font-size: 13px; color: var(--text); white-space: pre-wrap; line-height: 1.55; }

/* Main */
.main {
  flex: 1;
  min-height: 0;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  background:
    linear-gradient(160deg, rgba(255,255,255,.025) 0%, rgba(255,255,255,.005) 100%) padding-box,
    linear-gradient(160deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.05) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 16px 18px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  transition: transform .25s cubic-bezier(.34,1.4,.64,1), box-shadow .25s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.16);
}
.stat-label { font-size: 10px; color: var(--text-sub); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; font-weight: 500; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); letter-spacing: -.04em; line-height: 1; }
.stat-value span { color: var(--accent); }
.stat-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.stat-sub { font-size: 10px; color: var(--text-sub); }
.stat-trend { font-size: 10px; font-weight: 600; color: var(--green); }
.stat-trend.neutral { color: var(--text-sub); }

/* Content + Sidebar */
.content-sidebar {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 12px;
}

.charts-col { display: flex; flex-direction: column; gap: 12px; }

/* Cards */
.card {
  background:
    linear-gradient(160deg, rgba(255,255,255,.025) 0%, rgba(255,255,255,.005) 100%) padding-box,
    linear-gradient(160deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.05) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 16px 18px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  transition: transform .25s cubic-bezier(.34,1.4,.64,1), box-shadow .25s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.16);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 11px; font-weight: 600; color: var(--text); letter-spacing: .06em; text-transform: uppercase; }
.card-badge {
  font-size: 10px;
  color: var(--text-sub);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}
.card-badge.accent {
  color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-to) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  border-color: var(--accent-dim);
}

/* Chart */
.chart-wrap {
  position: relative;
  height: 160px;
  overflow: hidden;
}
.chart-wrap canvas { max-width: 100%; }

/* Connections */
.connections-card { height: 100%; }

.connections-list { display: flex; flex-direction: column; gap: 2px; }

.conn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background .15s;
}
.conn-item:hover { background: var(--bg2); }

.conn-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-sub);
  text-transform: uppercase;
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
}
.conn-dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* Skills Section */
.skills-section { display: flex; flex-direction: column; gap: 12px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-sub); }
.section-count { font-size: 11px; color: var(--text-sub); }
.section-header .btn-sm { margin-left: auto; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.skill-card {
  background:
    linear-gradient(160deg, rgba(255,255,255,.025) 0%, rgba(255,255,255,.005) 100%) padding-box,
    linear-gradient(160deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.05) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .25s cubic-bezier(.34,1.4,.64,1);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.skill-card:hover {
  transform: translateY(-2px);
  background:
    linear-gradient(160deg, rgba(255,255,255,.035) 0%, rgba(255,255,255,.01) 100%) padding-box,
    linear-gradient(160deg, rgba(139,92,246,.38) 0%, rgba(6,182,212,.14) 100%) border-box;
  box-shadow: 0 8px 24px rgba(0,0,0,.22), 0 0 16px rgba(139,92,246,.12);
}

.skill-name { font-size: 12px; font-weight: 600; margin-bottom: 5px; letter-spacing: .01em; }
.skill-desc { font-size: 11px; color: var(--text-sub); line-height: 1.5; }

.skill-footer { display: flex; justify-content: flex-end; margin-top: 12px; }
.skill-run {
  font-size: 11px;
  color: #c4b5fd;
  background: var(--accent-d);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  transition: background .15s;
}
.skill-run:hover { background: rgba(139,92,246,.22); }

.skills-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px;
  background: var(--card);
  border: 1px dashed var(--border2);
  border-radius: var(--r-sm);
  text-align: center;
  color: var(--text-sub);
  font-size: 12px;
}
.skills-empty.show { display: flex; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background:
    linear-gradient(160deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.008) 100%) padding-box,
    linear-gradient(160deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.07) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  width: 680px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin: 10px auto 0;
  display: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.modal-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.modal-input-row input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xs);
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
}
.modal-input-row input:focus { border-color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sub); }

/* Typing indicator */
.typing { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing span {
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1s infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }

/* ─── Settings Page ─── */
.settings-main { overflow-y: auto; }

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 0;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--r-xs);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.settings-nav-item:hover { background: var(--card); color: var(--text); }
.settings-nav-item.active { background: var(--card); color: var(--text); }
.settings-nav-item svg { flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.admin-badge { background: var(--accent-d); color: var(--accent); border: 1px solid var(--accent-dim); }

.settings-content { min-width: 0; }

.settings-panel { display: flex; flex-direction: column; gap: 16px; }
.settings-panel.hidden { display: none; }

.settings-title { font-size: 15px; font-weight: 700; }
.settings-subtitle { font-size: 12px; font-weight: 600; margin-bottom: 14px; color: var(--text-sub); text-transform: uppercase; letter-spacing: .05em; }
.settings-title-row { display: flex; align-items: center; justify-content: space-between; }

.settings-card {
  background:
    linear-gradient(160deg, rgba(255,255,255,.025) 0%, rgba(255,255,255,.005) 100%) padding-box,
    linear-gradient(160deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.05) 100%) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 20px 22px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Settings info rows */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.info-row + .info-row { border-top: 1px solid var(--border-subtle); }
.info-label { font-size: 11px; color: var(--text-sub); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.info-value { font-size: 12px; color: var(--text); font-weight: 500; }
.info-role-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-to) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }

.form-feedback {
  font-size: 12px;
  min-height: 18px;
  border-radius: 4px;
  padding: 0;
}
.form-feedback.error { color: var(--red); }
.form-feedback.success { color: var(--green); }

.btn-sm-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-to) 100%);
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,.35);
  border: none;
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: filter .15s;
}
.btn-sm-primary:hover { filter: brightness(1.1); }

/* Role selector in form */
.role-select { display: flex; flex-direction: column; gap: 8px; }

.role-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: border-color .15s;
}
.role-option:has(input:checked) { border-color: var(--accent); background: var(--accent-d); }
.role-option input[type="radio"] { margin-top: 2px; accent-color: var(--accent); }
.role-label { display: flex; flex-direction: column; gap: 2px; }
.role-name { font-size: 13px; font-weight: 600; }
.role-desc { font-size: 11px; color: var(--text-sub); }

/* User list */
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; padding-bottom: 0; }
.user-row:first-child { padding-top: 0; }

.user-info-col { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-d);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-you { font-size: 11px; color: var(--text-sub); margin-left: 4px; }

.user-actions { display: flex; align-items: center; gap: 8px; }

.role-select-inline {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xs);
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}
.role-select-inline.admin { border-color: rgba(139,92,246,.3); color: var(--accent); }
.role-select-inline:focus { border-color: var(--accent); }
.role-select-inline:disabled { opacity: .4; cursor: default; }

.btn-delete {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  border-radius: var(--r-xs);
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-delete:hover { color: var(--red); border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.08); }

/* ─── Mobile base: prevent iOS input zoom (requires font-size >= 16px on inputs) ─── */
@media (max-width: 768px) {
  .field input,
  .chat-bar input,
  .modal-input-row input,
  select { font-size: 16px !important; }
}

/* ─── Safe area (iPhone notch / Dynamic Island / home indicator) ─── */
.header {
  padding-top: env(safe-area-inset-top);
  height: calc(52px + env(safe-area-inset-top));
}
.main {
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
.modal {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ─── Tablet & phone landscape (≤ 1024px) ─── */
/* Stats: 2×2 grid; charts stacked full-width = exactly 2 stat-card widths */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .content-sidebar { grid-template-columns: 1fr; }
  .connections-card { height: auto; }
}

/* ─── iPad portrait & tablet (≤ 900px) ─── */
@media (max-width: 900px) {
  .header-sub { display: none; }

  /* Settings: sidebar becomes horizontal tab row */
  .settings-layout { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding: 0 0 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-item { white-space: nowrap; flex-shrink: 0; }
  .nav-badge { margin-left: 6px; }
}

/* ─── Large phone / iPhone Pro Max (≤ 480px) ─── */
@media (max-width: 480px) {
  .header { padding: 0 14px; }
  .greeting { display: none; }

  .chat-bar-wrap { padding: 10px 12px 0; }
  .chat-bar input::placeholder { font-size: 12px; }

  .main { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); gap: 12px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 9px; }

  .card { padding: 12px 14px; }
  .chart-wrap { height: 130px; }

  /* Skills: single column on small phones */
  .skills-grid { grid-template-columns: 1fr; }
  .skill-card { padding: 14px 16px; }

  /* Connections: horizontal scroll */
  .connections-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .connections-list::-webkit-scrollbar { display: none; }
  .conn-item {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg2);
    border-radius: var(--r-sm);
    min-width: 90px;
    flex-shrink: 0;
  }
  .conn-name { font-size: 10px; text-align: center; }

  /* Modal fullscreen on small phones */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90dvh;
    border-radius: var(--r-lg) 16px 0 0;
    border-bottom: none;
  }
  .modal-header { padding: 14px 16px; }
  .modal-messages { padding: 12px 16px; }
  .modal-input-row { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }

  /* Inline chat panel */
  .chat-panel { max-height: 180px; }

  /* Settings */
  .settings-card { padding: 16px; }
  .settings-title-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .user-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .user-actions { width: 100%; justify-content: space-between; }

  /* Buttons: larger touch targets */
  .btn-icon { padding: 10px; }
  .btn-ask { padding: 8px 16px; }
  .conn-item { min-height: 44px; }
  .settings-nav-item { padding: 10px 14px; min-height: 44px; }
}

/* ─── Small phones (≤ 375px, iPhone SE) ─── */
@media (max-width: 375px) {
  .logo-text { display: none; }
  .stats-row { gap: 6px; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 18px; }
}

/* ─── dvh fallback for older iOS (Safari < 15.4) ─── */
.dashboard-body { height: 100vh; height: 100dvh; }
.login-body { min-height: 100vh; min-height: 100dvh; }
