/* =============================================================================
   BoardSnap dashboard (web app shell)
   ============================================================================= */

:root {
  --side-w: 240px;
  --topbar-h: 60px;
  --banner-h: 36px;
}

.app-body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-body .ambient { display: none; }

/* Top bar */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr minmax(280px, 580px) 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 18px;
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; justify-self: end; }

.topbar-pill {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 38px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-muted);
  transition: border-color 0.15s var(--ease);
}

.topbar-search:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}

.topbar-search input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

.topbar-search input::placeholder { color: var(--ink-muted); }

.topbar-search .kbd {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
}

.iconbtn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.iconbtn:hover { color: var(--cyan); border-color: rgba(0, 229, 255, 0.3); }

.avatar {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad);
  color: #04060b;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 50%;
  letter-spacing: 0;
}

/* Demo banner */
.demo-banner {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  height: var(--banner-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 12.5px;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.12), rgba(255, 45, 208, 0.12));
  border-bottom: 1px solid var(--line);
}

.demo-banner a {
  color: var(--cyan);
  font-weight: 600;
  margin-left: 8px;
}

.demo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: chipPulse 1.4s ease-in-out infinite;
}

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: calc(100vh - var(--topbar-h) - var(--banner-h));
}

/* Sidebar */
.app-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + var(--banner-h));
  height: calc(100vh - var(--topbar-h) - var(--banner-h));
  overflow-y: auto;
  background: #07080d;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}

.side-section { margin-bottom: 18px; }
.side-section:last-of-type { margin-bottom: 8px; }

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

.side-cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--grad);
  color: #04060b;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}

.side-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 45, 208, 0.35);
}

.side-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  text-transform: uppercase;
  padding: 6px 12px 6px;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  margin-bottom: 1px;
}

.side-item:hover { color: var(--ink); background: rgba(255,255,255,0.03); }

.side-item.active {
  color: var(--ink);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.22);
}

.side-item.active.project {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.10), rgba(255, 45, 208, 0.06));
  border: 1px solid rgba(0, 229, 255, 0.20);
}

.side-item.subtle { color: var(--ink-muted); }

.side-item svg { flex-shrink: 0; opacity: 0.85; }

.side-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: rgba(255,255,255,0.04);
  padding: 2px 7px;
  border-radius: 999px;
}

.proj-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.proj-dot.c { background: var(--cyan); }
.proj-dot.m { background: var(--magenta); }
.proj-dot.v { background: var(--violet); }

/* Main column */
.app-main {
  padding: 28px 36px 60px;
  min-width: 0;
}

/* Project header */
.proj-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.proj-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.proj-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 60%, var(--cyan) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.proj-sub {
  font-size: 13.5px;
  color: var(--ink-muted);
  max-width: 720px;
  line-height: 1.55;
}

.proj-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.ghost-btn,
.grad-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  transition: all 0.15s var(--ease);
  text-decoration: none;
}

.ghost-btn:hover { border-color: var(--cyan); color: var(--cyan); }

.ghost-btn.small { padding: 7px 12px; font-size: 12px; }

.grad-btn {
  background: var(--grad);
  color: #04060b;
  border-color: transparent;
}
.grad-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255, 45, 208, 0.35); }
.grad-btn.full { width: 100%; justify-content: center; padding: 12px 16px; }

/* Tabs */
.proj-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  background: transparent;
  border: none;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}

.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--cyan);
}

.tab-count {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: rgba(255,255,255,0.05);
  padding: 1px 7px;
  border-radius: 999px;
}

.tab-panel.hidden { display: none; }

/* Boards toolbar */
.boards-toolbar,
.actions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.seg-btn.active {
  background: rgba(0, 229, 255, 0.10);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.25);
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.chip-filter {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.chip-filter:hover { color: var(--ink); }
.chip-filter.active {
  color: var(--ink);
  background: rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.3);
}

/* Boards grid */
.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.boards-grid.list-view {
  grid-template-columns: 1fr;
}

.boards-grid.list-view .board-card {
  flex-direction: row;
  align-items: stretch;
}

.boards-grid.list-view .board-thumb {
  width: 200px;
  flex: 0 0 200px;
  height: auto;
  min-height: 100px;
}

.boards-grid.list-view .board-body {
  flex: 1;
  padding: 14px 18px;
}

.board-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  cursor: pointer;
}

.board-body h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-body p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-card:hover {
  border-color: rgba(0, 229, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.board-thumb {
  position: relative;
  inset: auto;
  box-shadow: none;
  border-radius: 0;
  height: 150px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0px,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent 16px
    ),
    linear-gradient(160deg, #d8e0d4 0%, #c1cab9 100%);
}

.board-thumb.v2 {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 12px),
    linear-gradient(160deg, #f0e6d8 0%, #d6c8b2 100%);
}
.board-thumb.v3 {
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 22px),
    linear-gradient(160deg, #d8dfee 0%, #b9c2d6 100%);
}
.board-thumb.v4 {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 18px),
    linear-gradient(160deg, #e2dee8 0%, #c8c0d4 100%);
}
.board-thumb.v5 {
  background:
    repeating-linear-gradient(135deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 14px),
    linear-gradient(160deg, #e0e8d6 0%, #c4cfb0 100%);
}
.board-thumb.v6 {
  background:
    linear-gradient(160deg, #2c303a 0%, #1a1d28 100%);
}
.board-thumb.v6::after {
  content: 'Queued · offline';
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.board-thumb::before {
  content: none;
}

.board-overlay {
  position: absolute;
  inset: 10px 10px auto auto;
  display: flex;
  justify-content: flex-end;
}

.board-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.65);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--ink);
  backdrop-filter: blur(6px);
}

.board-tag.done { color: #34C759; border-color: rgba(52, 199, 89, 0.4); }
.board-tag.warn { color: #FFCC00; border-color: rgba(255, 204, 0, 0.45); }
.board-tag.pending { color: var(--ink-muted); }

.board-body {
  padding: 14px 16px 16px;
}

.board-body h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.board-body p {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.board-meta {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* Chat */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 460px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  overflow: hidden;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  display: flex;
  gap: 12px;
  max-width: 78%;
}

.msg.user {
  align-self: flex-end;
  margin-left: auto;
}

.msg.ai {
  align-self: flex-start;
}

.msg-avatar {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,229,255,0.16), rgba(255,45,208,0.16));
  border: 1px solid rgba(0,229,255,0.3);
  display: grid; place-items: center;
}

.msg-avatar .dot-sm,
.dot-sm {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--grad);
  display: inline-block;
}

.msg-body {
  font-size: 14px;
  line-height: 1.55;
  padding: 12px 16px;
  border-radius: 14px;
}

.msg.ai .msg-body {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.msg.user .msg-body {
  background: var(--grad);
  color: #04060b;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

.msg-body ol { margin: 6px 0 0 18px; }
.msg-body li { margin: 2px 0; }
.msg-body em { color: var(--ink-muted); font-style: normal; }

.hl {
  background: rgba(0, 229, 255, 0.12);
  border-bottom: 1px dotted rgba(0, 229, 255, 0.5);
  padding: 1px 4px;
  border-radius: 4px;
}

.msg-body.typing {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 14px 18px;
}

.lp-typing {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
  position: relative;
  animation: typingDot 1.2s ease-in-out infinite;
  animation-delay: 0.2s;
}
.lp-typing::before, .lp-typing::after {
  content: '';
  position: absolute;
  top: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
  animation: typingDot 1.2s ease-in-out infinite;
}
.lp-typing::before { left: -10px; animation-delay: 0s; }
.lp-typing::after { left: 10px; animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1); }
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.chat-context {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.chat-input input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: 0;
  transition: border-color 0.15s var(--ease);
}

.chat-input input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12); }

.chat-send {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--grad);
  color: #04060b;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}

.chat-send:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 45, 208, 0.35); }

/* Action items */
.action-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.action-check {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-muted);
  cursor: pointer;
}

.action-check.done {
  background: #34C759;
  border-color: #34C759;
  position: relative;
}

.action-check.done::after {
  content: '';
  position: absolute;
  top: 4px; left: 6px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.action > div { flex: 1; min-width: 0; }
.action-title { font-size: 14px; font-weight: 600; }
.action-meta { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

.action-state {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: rgba(255,255,255,0.04);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.action-state.warn { color: #FFCC00; border-color: rgba(255, 204, 0, 0.4); background: rgba(255, 204, 0, 0.08); }
.action-state.ok { color: #34C759; border-color: rgba(52, 199, 89, 0.4); background: rgba(52, 199, 89, 0.08); }

/* Context grid */
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.context-card {
  position: relative;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.context-card h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.context-card p {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.55;
}

.ctx-tag {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 3px 8px;
  border-radius: 999px;
}

.context-card.add {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}

.context-card.add:hover { border-color: var(--cyan); }
.context-card.add h4 { color: var(--cyan); }

/* Export */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.export-card {
  padding: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ex-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.export-card p {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.55;
  flex: 1;
}

.export-card code {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.export-note {
  font-size: 13px;
  color: var(--ink-muted);
  background: rgba(0, 229, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.18);
  padding: 14px 18px;
  border-radius: 12px;
}

.export-note strong { color: var(--cyan); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 18px;
  background: rgba(8, 9, 14, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 12px;
  color: var(--ink);
  font-size: 13.5px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast a {
  color: var(--cyan);
  font-weight: 600;
  margin-left: 4px;
}

/* Responsive */
@media (max-width: 1100px) {
  :root { --side-w: 220px; }
  .app-main { padding: 22px 26px 60px; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .topbar-search { display: none; }
  .app-topbar { grid-template-columns: 1fr auto; }
  .app-main { padding: 20px 16px 60px; }
  .proj-title { font-size: 26px; }
  .topbar-pill { display: none; }
}

@media (max-width: 560px) {
  .demo-banner { font-size: 11px; flex-wrap: wrap; height: auto; padding: 6px 12px; }
  .demo-banner a { margin-left: 0; }
  .proj-actions .grad-btn span { display: none; }
  .msg { max-width: 92%; }
  .chat-input { flex-wrap: wrap; }
  .chat-context { order: -1; flex-basis: 100%; justify-content: center; }
}

/* ---------- Topbar popovers (Notifications + Settings) ---------- */
.topbar-right { position: relative; }
.popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: rgba(15, 18, 26, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.popover[hidden] { display: none; }
.popover button,
.popover a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  font-family: inherit;
  width: 100%;
  letter-spacing: 0.005em;
}
.popover button:hover,
.popover a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--cyan);
}
.popover-empty {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.4;
}
.popover-empty strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- Modal (Project settings) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFade 120ms ease-out;
}
.modal-backdrop[hidden] { display: none; }
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-card {
  background: rgba(15, 18, 26, 0.98);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  padding: 22px 24px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  animation: modalRise 150ms ease-out;
}
@keyframes modalRise {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.modal-close {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 10px 4px;
  border-radius: 6px;
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}
#projSettingsForm label {
  display: block;
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#projSettingsForm input,
#projSettingsForm textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  resize: vertical;
  box-sizing: border-box;
}
#projSettingsForm input:focus,
#projSettingsForm textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}
#projSettingsForm small {
  display: block;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.45;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.modal-status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-muted);
  min-height: 18px;
}
.modal-status:not(:empty) {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- Modal danger zone (archive) ---------- */
.modal-danger {
  margin-top: 22px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 80, 80, 0.18);
  background: rgba(255, 80, 80, 0.04);
  border-radius: 10px;
}
.modal-danger-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 120, 120, 0.85);
  margin-bottom: 10px;
}
.modal-danger small {
  display: block;
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  font-weight: 400;
}
.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid rgba(255, 80, 80, 0.35);
  border-radius: 8px;
  color: rgba(255, 130, 130, 0.95);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
}
.danger-btn:hover {
  background: rgba(255, 80, 80, 0.08);
  border-color: rgba(255, 80, 80, 0.55);
}
.danger-btn.confirm {
  background: rgba(255, 70, 70, 0.85);
  border-color: rgba(255, 70, 70, 1);
  color: #fff;
  animation: dangerPulse 1.4s ease-in-out infinite;
}
@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 70, 70, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 70, 70, 0); }
}
