/* ==========================================================================
   Nexo — Design system
   ========================================================================== */
:root {
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-3: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-glow: rgba(139, 92, 246, 0.38);
  --bg-1: #08050f;
  --bg-2: #130b22;
  --bg-3: #24123f;
  --panel: rgba(22, 15, 38, 0.78);
  --panel-strong: rgba(30, 19, 52, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --ink: #f6f3ff;
  --ink-soft: #d8d0ee;
  --muted: #b7a7d9;
  --faint: #7f6c9d;
  --line: rgba(167, 139, 250, 0.16);
  --line-strong: rgba(167, 139, 250, 0.34);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #34d399;
  --warning: #fbbf24;
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 50px -12px var(--accent-glow);
  --sidebar-w: 268px;
  --topbar-h: 76px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --normal: 260ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg-1);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: var(--accent); color: white; }

/* ---------- background ---------- */
.bg {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: radial-gradient(1200px 800px at 15% 0%, var(--bg-2), var(--bg-1) 60%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; animation: float 24s ease-in-out infinite alternate; }
.orb-a { width: 52vw; height: 52vw; min-width: 420px; min-height: 420px; left: -14vw; top: -20vw; background: radial-gradient(circle, var(--accent), transparent 65%); }
.orb-b { width: 42vw; height: 42vw; min-width: 320px; min-height: 320px; right: -12vw; top: 12vh; background: radial-gradient(circle, #ec4899, transparent 65%); animation-delay: -6s; }
.orb-c { width: 36vw; height: 36vw; min-width: 280px; min-height: 280px; left: 32vw; bottom: -18vw; background: radial-gradient(circle, #3b82f6, transparent 65%); animation-delay: -12s; opacity: 0.24; }
@keyframes float { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(4vw,-3vh,0) scale(1.08); } }
#particles { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.7; }
.grain { position: absolute; inset: 0; opacity: 0.035; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); mix-blend-mode: overlay; }

/* ---------- shared bits ---------- */
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  color: white; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px -8px var(--accent-glow); flex: none;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; }
.brand-mark.small svg { width: 19px; height: 19px; }
.brand-mark.large { width: 64px; height: 64px; border-radius: 20px; margin-bottom: 22px; }
.brand-mark.large svg { width: 32px; height: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-xs);
  padding: 10px 16px; font-size: 14px; font-weight: 600; line-height: 1.2;
  transition: transform var(--fast) var(--ease), background var(--fast), border-color var(--fast), box-shadow var(--fast), opacity var(--fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:focus-visible, .icon-btn:focus-visible, .tab-btn:focus-visible, .filter-btn:focus-visible, .color-swatch:focus-visible, .theme-option:focus-visible, .avatar-option:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
.btn-primary {
  color: white; background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: 0 10px 24px -10px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 14px 30px -10px var(--accent-glow); }
.btn-ghost { color: var(--ink-soft); background: var(--panel-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--line-strong); color: var(--ink); }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(248,113,113,0.28); }
.btn-danger:hover { background: rgba(248,113,113,0.18); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: white;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-soft); color: var(--muted);
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.icon-btn:hover { color: var(--ink); background: var(--accent-soft); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; }

.subtitle { color: var(--faint); font-size: 13px; }
.empty-state { color: var(--faint); font-size: 14px; padding: 18px 0; text-align: center; }
.section-header { margin-bottom: 22px; }
.section-header h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 750; letter-spacing: -0.035em; }
.section-desc { color: var(--faint); font-size: 14px; margin-top: 4px; max-width: 680px; }
.section-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); backdrop-filter: blur(18px);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.panel-hint { color: var(--faint); font-size: 12px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input-wrap { position: relative; display: flex; align-items: center; }
input[type="text"], input[type="email"], input[type="search"], input[type="password"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: rgba(9, 5, 17, 0.55); padding: 11px 13px; color: var(--ink);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.toggle-pass {
  position: absolute; right: 8px; border: 0; background: transparent; color: var(--faint);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 6px;
}
.error { color: var(--danger); font-size: 12px; min-height: 0; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.checkmark { display: none; }
.switch-text { font-size: 13px; color: var(--faint); text-align: center; }
.link-btn { border: 0; background: none; color: var(--accent-2); font-weight: 600; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- auth ---------- */
.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr;
  align-items: stretch; gap: 0; padding: 28px; max-width: 1240px; margin: 0 auto;
}
.auth-visual { display: flex; align-items: center; padding: 48px; }
.auth-visual-inner { max-width: 480px; }
.auth-visual h2 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; letter-spacing: -0.045em; margin-bottom: 16px; }
.auth-visual p { color: var(--muted); font-size: 16px; max-width: 420px; }
.auth-points { list-style: none; margin-top: 28px; display: grid; gap: 12px; }
.auth-points li { position: relative; padding-left: 26px; color: var(--ink-soft); font-size: 14px; }
.auth-points li::before {
  content: ""; position: absolute; left: 0; top: 5px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent); box-shadow: inset 0 0 0 4px var(--bg-1);
}
.auth-card {
  align-self: center; width: 100%; max-width: 460px; justify-self: center;
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 36px;
  background: linear-gradient(165deg, rgba(30,19,52,0.88), rgba(10,6,18,0.94));
  box-shadow: var(--shadow), var(--shadow-glow); backdrop-filter: blur(24px) saturate(140%);
  animation: cardIn 0.55s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand h1 { font-size: 26px; letter-spacing: -0.04em; }
.brand .subtitle { margin-top: 2px; }
.auth-view { display: none; }
.auth-view.active { display: block; animation: viewIn 0.3s var(--ease) both; }

/* ---------- app shell ---------- */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-w); position: fixed; inset: 0 auto 0 0; z-index: 60;
  display: flex; flex-direction: column; gap: 18px; padding: 20px 16px;
  background: rgba(8, 5, 15, 0.86); border-right: 1px solid var(--line);
  backdrop-filter: blur(24px); transition: transform var(--normal) var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; border-bottom: 1px solid var(--line); }
.sidebar-brand strong { display: block; font-size: 17px; letter-spacing: -0.03em; }
.sidebar-brand span { display: block; color: var(--faint); font-size: 11px; margin-top: 1px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; padding: 4px 0; }
.tab-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 12px;
  background: transparent; color: var(--faint); font-size: 13.5px; font-weight: 600;
  text-align: left; transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast);
}
.tab-btn svg { width: 19px; height: 19px; flex: none; }
.tab-btn:hover { color: var(--ink-soft); background: var(--panel-soft); }
.tab-btn.active { color: var(--ink); background: linear-gradient(90deg, var(--accent-soft), transparent); border-color: var(--line); }
.tab-btn.active svg { color: var(--accent-2); }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.mini-user { display: flex; align-items: center; gap: 10px; padding: 4px 4px 8px; min-width: 0; }
.mini-user div { min-width: 0; }
.mini-user strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-user span { display: block; color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-shell { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px; border-bottom: 1px solid var(--line);
  background: rgba(8, 5, 15, 0.7); backdrop-filter: blur(22px);
  position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-btn { display: none; }
.page-kicker { display: block; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.page-heading h1 { font-size: 20px; letter-spacing: -0.03em; line-height: 1.1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search-box input { width: 240px; padding-left: 35px; border-radius: 999px; background: rgba(255,255,255,0.04); }
.user-badge { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-left: 4px; }
.user-avatar-small { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, var(--accent), #ec4899); display: grid; place-items: center; flex: none; }
.user-avatar-small img { width: 100%; height: 100%; object-fit: cover; }

.main-content { flex: 1; padding: 28px; max-width: 1360px; width: 100%; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: viewIn 0.35s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- dashboard ---------- */
.hero-card {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; margin-bottom: 20px; background: linear-gradient(120deg, rgba(139,92,246,0.22), rgba(236,72,153,0.08) 55%, transparent);
  box-shadow: var(--shadow-sm);
}
.hero-glow { position: absolute; width: 320px; height: 320px; right: -80px; top: -140px; border-radius: 50%; background: radial-gradient(circle, var(--accent-glow), transparent 70%); filter: blur(20px); }
.hero-row { display: flex; align-items: center; gap: 16px; }
.hero-kicker { color: var(--accent-2); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.hero-card h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.04em; line-height: 1.1; margin-top: 2px; }
.hero-text { color: var(--muted); font-size: 14px; margin-top: 16px; max-width: 620px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, var(--accent), #ec4899); flex: none; box-shadow: 0 0 0 3px var(--bg-1), 0 0 0 4px var(--line-strong); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 76px; height: 76px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); animation: cardIn 0.45s var(--ease) both; }
.stat-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--accent-2); background: var(--accent-soft); flex: none; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-card strong { display: block; font-size: 24px; letter-spacing: -0.04em; line-height: 1.1; }
.stat-card span { color: var(--faint); font-size: 12px; }

.split-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 20px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.quick-btn { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel-soft); color: var(--ink-soft); font-size: 13px; font-weight: 600; text-decoration: none; transition: background var(--fast), border-color var(--fast), transform var(--fast), color var(--fast); }
.quick-btn svg { width: 18px; height: 18px; color: var(--accent-2); }
.quick-btn:hover { background: var(--accent-soft); border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.activity-list { display: grid; gap: 8px; }

/* ---------- tasks / projects ---------- */
.task-input-row, .project-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.task-input { flex: 1; min-width: 180px; }
.task-priority, .project-form select { width: auto; min-width: 100px; }
.project-form input:first-child { flex: 1.1; min-width: 180px; }
.project-form input:nth-child(2) { flex: 2; min-width: 220px; }
.task-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter-btn { border: 1px solid var(--line); background: transparent; color: var(--faint); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; transition: background var(--fast), color var(--fast), border-color var(--fast); }
.filter-btn:hover { color: var(--ink-soft); border-color: var(--line-strong); }
.filter-btn.active { color: var(--ink); background: var(--accent-soft); border-color: var(--line-strong); }
.task-list, .project-list { display: grid; gap: 8px; }
.task-item { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel-soft); animation: viewIn 0.3s var(--ease) both; }
.task-item.completed .task-title { color: var(--faint); text-decoration: line-through; }
.task-check { width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: transparent; flex: none; position: relative; }
.task-check.checked { background: var(--accent); border-color: var(--accent); }
.task-check.checked::after { content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.task-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-priority-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--faint); }
.task-priority-badge.alta { color: #fca5a5; border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.08); }
.task-priority-badge.media { color: #fcd34d; border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.08); }
.task-priority-badge.baja { color: #86efac; border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.08); }
.task-delete { border: 0; background: transparent; color: var(--faint); font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.task-delete:hover { color: var(--danger); background: var(--danger-soft); }
.project-card { border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel-soft); padding: 14px; display: grid; gap: 6px; animation: viewIn 0.3s var(--ease) both; }
.project-top { display: flex; align-items: center; gap: 10px; }
.project-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-desc { color: var(--faint); font-size: 13px; }
.project-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.project-status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--faint); }
.project-status.activo { color: #86efac; border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.08); }
.project-status.completado { color: var(--accent-2); border-color: var(--line-strong); background: var(--accent-soft); }
.project-actions { display: flex; gap: 6px; margin-left: auto; }

/* ---------- github ---------- */
.github-status { margin-bottom: 16px; }
.status-card { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.status-indicator { width: 11px; height: 11px; border-radius: 50%; background: var(--faint); flex: none; box-shadow: 0 0 0 4px var(--panel-soft); }
.status-indicator.ok { background: var(--success); box-shadow: 0 0 0 4px rgba(52,211,153,0.14); }
.status-indicator.warn { background: var(--warning); box-shadow: 0 0 0 4px rgba(251,191,36,0.14); }
.status-card h3 { font-size: 15px; }
.status-card p { color: var(--faint); font-size: 13px; }
.github-detail { display: grid; gap: 2px; margin-bottom: 16px; }
.github-repo { padding: 11px 2px; border-bottom: 1px solid var(--line); }
.github-repo:last-child { border-bottom: 0; }
.github-repo a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.github-repo a:hover { text-decoration: underline; }
.github-repo-meta { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }

/* ---------- iframe ---------- */
.iframe-panel { padding: 0; overflow: hidden; }
.iframe-panel iframe { display: block; width: 100%; height: min(68vh, 720px); border: 0; background: var(--bg-1); }

/* ---------- voice ---------- */
.voice-container { display: grid; gap: 16px; }
.voice-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.voice-btn.recording { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 10px 24px -10px rgba(239,68,68,0.5); }
.voice-status { color: var(--faint); font-size: 13px; }
.voice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-tts { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 10px; }
.voice-tts h3 { font-size: 14px; }

/* ---------- chat ---------- */
.chat-container { display: grid; gap: 14px; }
.chat-notice { border: 1px solid rgba(251,191,36,0.28); background: rgba(251,191,36,0.07); color: #fcd34d; border-radius: var(--radius-xs); padding: 10px 13px; font-size: 12px; }
.chat-messages { display: grid; gap: 12px; max-height: 420px; overflow-y: auto; padding: 4px; }
.chat-msg { display: flex; gap: 10px; align-items: flex-start; }
.chat-msg-user { flex-direction: row-reverse; }
.chat-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--accent-2); background: var(--accent-soft); flex: none; }
.chat-bubble { max-width: min(640px, 80%); padding: 11px 14px; border-radius: 14px; background: var(--panel-soft); border: 1px solid var(--line); font-size: 14px; }
.chat-msg-user .chat-bubble { background: var(--accent-soft); border-color: var(--line-strong); }
.chat-input-row { display: flex; gap: 10px; }
.chat-input { flex: 1; }

/* ---------- profile ---------- */
.profile-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 20px; align-items: start; }
.profile-card { display: grid; gap: 22px; }
.profile-header { display: flex; align-items: center; gap: 16px; }
.profile-header h3 { font-size: 20px; letter-spacing: -0.03em; }
.profile-section { display: grid; gap: 14px; }
.profile-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); }
.color-picker { display: flex; gap: 9px; flex-wrap: wrap; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--c); box-shadow: 0 0 0 1px var(--line); transition: transform var(--fast), border-color var(--fast); }
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-picker { display: flex; gap: 8px; }
.theme-option { flex: 1; padding: 9px 12px; border-radius: var(--radius-xs); border: 1px solid var(--line); background: transparent; color: var(--faint); font-size: 13px; font-weight: 600; }
.theme-option.active { color: var(--accent-2); border-color: var(--line-strong); background: var(--accent-soft); }
.avatar-picker { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 7px; }
.avatar-option { border: 2px solid transparent; border-radius: 12px; background: var(--panel-soft); padding: 3px; aspect-ratio: 1; overflow: hidden; }
.avatar-option img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; display: block; }
.avatar-option.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.account-info { display: grid; gap: 10px; }
.info-row { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 13px; }
.info-row:last-child { border-bottom: 0; padding-bottom: 0; }
.info-label { color: var(--faint); }
.info-value { color: var(--ink-soft); text-align: right; word-break: break-word; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--panel-strong); border: 1px solid var(--line-strong);
  color: var(--ink); border-radius: 12px; padding: 12px 18px; font-size: 13px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity var(--fast), transform var(--normal) var(--ease);
  z-index: 200; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="ok"] { border-color: rgba(52,211,153,0.4); }
.toast[data-kind="error"] { border-color: rgba(248,113,113,0.45); }

/* ---------- mobile ---------- */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 55; border: 0; padding: 0;
  background: rgba(3, 1, 8, 0.62); backdrop-filter: blur(2px);
}
@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-grid, .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; padding: 20px; }
  .auth-visual { display: none; }
  .auth-card { max-width: 480px; }
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-shell { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .search-box input { width: 170px; }
  .main-content { padding: 20px 16px 32px; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 64px; }
  .topbar-actions .user-badge span:last-child { display: none; }
  .search-box input { width: 130px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-card strong { font-size: 20px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .task-input-row, .project-form { flex-direction: column; }
  .task-input-row .btn, .project-form .btn { width: 100%; }
  .task-priority, .project-form select { width: 100%; }
  .avatar-picker { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .hero-card { padding: 20px; }
  .panel { padding: 16px; }
  .auth-card { padding: 26px 20px; }
  .section-header h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- light theme ---------- */
body.light {
  --bg-1: #f6f3ff;
  --bg-2: #ece6fb;
  --bg-3: #ddd2f6;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --panel-soft: rgba(139, 92, 246, 0.055);
  --ink: #1c162c;
  --ink-soft: #3f3358;
  --muted: #5b4a78;
  --faint: #7c6a99;
  --line: rgba(109, 90, 138, 0.18);
  --line-strong: rgba(109, 90, 138, 0.34);
  --shadow-sm: 0 8px 24px -14px rgba(60, 40, 100, 0.28);
  --shadow: 0 24px 60px -26px rgba(60, 40, 100, 0.34);
}
body.light .bg { background: radial-gradient(1200px 800px at 15% 0%, var(--bg-2), var(--bg-1) 60%); }
body.light .sidebar, body.light .topbar { background: rgba(250, 248, 255, 0.86); }
body.light .auth-card { background: linear-gradient(165deg, rgba(255,255,255,0.94), rgba(246,243,255,0.96)); }
body.light input[type="text"], body.light input[type="email"], body.light input[type="search"], body.light input[type="password"], body.light select, body.light textarea { background: rgba(255,255,255,0.75); }
body.light .chat-bubble, body.light .task-item, body.light .stat-card, body.light .panel { color: var(--ink); }
body.light .btn-ghost { color: var(--ink-soft); }
