/* ViscoLoop brand palette: dark by default, with a light mode toggle
   (see [data-theme="light"] below). --primary stays orange in both modes. */
:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #1f1f1f;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --border: #262626;
  --primary: #fa792e;
  --primary-ink: #121212;
  --primary-tint: rgba(250, 121, 46, 0.1);
  --primary-wash: rgba(250, 121, 46, 0.03);
  --primary-tint-strong: rgba(250, 121, 46, 0.4);
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(10, 10, 10, 0.85);
  --font-sans: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", "Plus Jakarta Sans", sans-serif;
}

:root[data-theme="light"] {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f0f0f2;
  --text: #14161a;
  --text-muted: #6b6f76;
  --border: #e4e4e7;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.1);
  --topbar-bg: rgba(247, 247, 248, 0.85);
}
:root[data-theme="light"] .tag-urgent { background: rgba(239, 68, 68, 0.1); color: #b91c1c; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar img { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.topbar h1 { font-family: var(--font-display); font-size: 19px; margin: 0; font-weight: 700; cursor: pointer; }
.topbar .tagline {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
@media (max-width: 640px) {
  .topbar .tagline { display: none; }
}

.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }
.pill-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pill-btn:hover { color: var(--text); border-color: var(--text-muted); }
.pill-btn.active { background: var(--primary-tint); color: var(--primary); border-color: var(--primary-tint-strong); }

.back-link {
  display: inline-block;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--primary); }

main {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.view { display: none; }
.view.active { display: block; }

h2.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 14px;
}

/* Hero: badge pill + big headline + subtext, shown at the top of Home */
.hero { padding: 12px 0 32px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.hero .motto {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.9px;
  margin: 0 0 14px;
  max-width: 640px;
}
.hero .motto strong { font-weight: 800; }
.hero p.hero-sub {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 620px;
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile.featured { background: var(--primary-wash); border-width: 2px; }

.tile-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--primary-tint);
  margin-bottom: 6px;
}
.tile.featured .tile-icon { background: var(--primary); }

.tile-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
}

.tile .icon { font-size: 26px; }
.tile .title { font-weight: 700; font-size: 18px; }
.tile .desc { color: var(--text-muted); font-size: 15px; line-height: 1.4; flex: 1; }
.tile .meta { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile-actions { display: flex; gap: 8px; margin-top: 8px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-block { width: 100%; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 12, 25, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal.modal-lg { max-width: 640px; }
.modal h3 { margin: 0 0 14px; }
.modal h4 { font-family: var(--font-display); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* Ask Viscoman search bar (Home page) */
.ask-viscoman { margin-bottom: 28px; }
.ask-viscoman .section-title { margin-bottom: 12px; }
.viscoman-search { display: flex; gap: 10px; }
.viscoman-search input {
  flex: 1;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}
.viscoman-search .btn { border-radius: 999px; padding: 13px 24px; }

#viscoman-result:not(:empty) { margin-top: 14px; }
.viscoman-answer {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.viscoman-thinking { color: var(--text-muted); }
.viscoman-question { font-weight: 700; margin-bottom: 8px; }
.viscoman-sources { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Viscoman flies across the screen while a search is in flight */
.viscoman-icon {
  position: fixed;
  top: 20%;
  left: -60px;
  font-size: 38px;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}
.viscoman-icon.flying {
  opacity: 1;
  animation: viscoman-fly 1.8s linear infinite;
}
@keyframes viscoman-fly {
  0%   { left: -10%; top: 22%; transform: rotate(-8deg); }
  25%  { left: 20%;  top: 8%;  transform: rotate(6deg); }
  50%  { left: 50%;  top: 28%; transform: rotate(-6deg); }
  75%  { left: 80%;  top: 10%; transform: rotate(8deg); }
  100% { left: 110%; top: 24%; transform: rotate(-8deg); }
}

.empty-state { color: var(--text-muted); font-size: 14px; padding: 24px 0; text-align: center; }

.status-pill {
  display: inline-block;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 4px 10px;
  border-radius: 999px;
}
.status-submitted { background: #2a2a2a; color: #c7c3bd; }
.status-in-review { background: #4a3a10; color: #fbd383; }
.status-approved { background: #1e2f52; color: #8ab4ff; }
.status-action-plan { background: #34215c; color: #c4a6ff; }
.status-in-progress { background: #3a2410; color: #ffb066; }
.status-implemented { background: #123729; color: #6ee7b7; }
.status-deferred { background: #4a1616; color: #fca5a5; }
.status-closed { background: #0f3a3a; color: #7dd3d8; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* "How the loop works" explainer */
.loop-explainer { margin-bottom: 24px; }
.loop-explainer h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 4px; }
.loop-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.loop-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.loop-step-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary-tint);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
.loop-step-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }

/* Kanban board */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-column {
  flex: 0 0 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.kanban-column-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.kanban-column-cards { display: flex; flex-direction: column; gap: 10px; }
.kanban-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 16px 0; }
.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.kanban-card:hover { border-color: var(--primary-tint-strong); transform: translateY(-1px); }
.kanban-card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.kanban-card-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.kanban-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-meta { font-size: 11px; color: var(--text-muted); }

.tag-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.tag-urgent { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }

.comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.comment {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.comment-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }

.hint {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.install-banner.show { display: flex; }

@media (min-width: 720px) {
  main { padding: 28px 20px; }
}
