/* ZenithGuard OS — design system
   Direction: Linear / Vercel — strict, dark-first, hairline borders, single accent.
   Selectors used by script.js are preserved; visual layer is fully rewritten. */

/* ------- Tokens (dark default) ------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Surface */
  --bg: #0a0a0a;
  --bg-elev: #101012;
  --surface: #0f0f10;
  --surface-2: #141416;
  --surface-3: #1a1a1d;
  --hover: rgba(255, 255, 255, 0.04);

  /* Lines */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Ink */
  --fg: #ededed;
  --fg-2: #a1a1a1;
  --fg-3: #6b6b70;
  --fg-4: #4a4a4f;

  /* Accent — single brand color (Linear-ish indigo) */
  --accent: #5e6ad2;
  --accent-fg: #ffffff;
  --accent-hover: #6f7be0;
  --accent-soft: rgba(94, 106, 210, 0.14);

  /* Semantic (desaturated) */
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);

  /* Geometry */
  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Type */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono:
    ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* Light theme — same discipline, inverted */
[data-theme="light"] {
  color-scheme: light;

  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --surface-3: #ededed;
  --hover: rgba(0, 0, 0, 0.04);

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);

  --fg: #0a0a0a;
  --fg-2: #525258;
  --fg-3: #84848a;
  --fg-4: #b0b0b6;

  --accent-soft: rgba(94, 106, 210, 0.10);
}

/* Variable font with feature settings */
@supports (font-variation-settings: normal) {
  :root {
    font-feature-settings: "ss01", "cv11";
  }
}

/* ------- Reset / Base ------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

html {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  letter-spacing: -0.005em;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 600;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

p {
  color: var(--fg-2);
}

small {
  font-size: 12px;
  color: var(--fg-3);
}

code,
kbd {
  font-family: var(--font-mono);
}

::selection {
  background: var(--accent-soft);
  color: var(--fg);
}

svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 2px solid var(--bg);
}

/* ------- App layout ------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ------- Sidebar ------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 6px;
}

.brand a {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--fg);
  background: var(--surface);
}

.brand-mark svg {
  width: 14px;
  height: 14px;
}

.brand-name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  padding: 8px 8px 6px;
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--r);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  transition: color 80ms, background 80ms;
}

.nav-item svg {
  width: 15px;
  height: 15px;
  color: var(--fg-3);
}

.nav-item:hover {
  background: var(--hover);
  color: var(--fg);
}

.nav-item:hover svg {
  color: var(--fg-2);
}

.nav-item.active {
  background: var(--surface-2);
  color: var(--fg);
}

.nav-item.active svg {
  color: var(--fg);
}

.sidebar-foot {
  margin-top: auto;
  padding: 10px 8px 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-title {
  padding: 0 4px;
  margin-bottom: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 8px 7px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background 80ms, border-color 80ms, transform 80ms;
}

.stat-cell:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.stat-cell:active {
  transform: translateY(0.5px);
}

.stat-cell strong {
  font-size: 15px;
  font-weight: 600;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.1;
}

.stat-cell small {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--fg-3);
  flex: none;
}

.dot.live {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

/* ------- Main / Topbar ------- */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.mobile-menu {
  display: none;
}

.search {
  position: relative;
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px;
  gap: 8px;
  transition: border-color 80ms, background 80ms;
}

.search:focus-within {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.search svg {
  color: var(--fg-3);
  width: 14px;
  height: 14px;
}

.search input {
  flex: 1;
  background: none;
  border: 0;
  outline: 0;
  font-size: 13px;
  color: var(--fg);
}

.search input::placeholder {
  color: var(--fg-3);
}

.kbd {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.search-clear {
  display: none;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  border-radius: var(--r-sm);
}

.search-clear svg {
  width: 12px;
  height: 12px;
}

.search-clear:hover {
  color: var(--fg);
  background: var(--hover);
}

.search.has-value .search-clear {
  display: inline-flex;
}

.search.has-value .kbd {
  display: none;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r);
  color: var(--fg-2);
  border: 1px solid transparent;
  transition: background 80ms, color 80ms, border-color 80ms;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--fg);
  border-color: var(--border);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
  height: 24px;
}

.avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
}

/* ------- Views ------- */
.view {
  display: none;
  padding: 28px 24px 64px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.view.active {
  display: block;
}

/* ------- Page heads ------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.page-head.sub {
  margin-top: 36px;
}

.page-head h1 + .subtitle,
.page-head h2 + .subtitle {
  margin-top: 6px;
}

.subtitle {
  font-size: 13px;
  color: var(--fg-2);
  max-width: 56ch;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
  margin-bottom: 8px;
}

/* ------- Buttons ------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: background 80ms, border-color 80ms, color 80ms;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-2);
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.btn.ghost:hover {
  background: var(--hover);
  color: var(--fg);
}

/* ------- Segmented control ------- */
.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  gap: 2px;
}

.segmented button {
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--fg-2);
  border-radius: var(--r-sm);
  font-weight: 500;
}

.segmented button:hover {
  color: var(--fg);
}

.segmented button.active {
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* ------- Stat row ------- */
.stat-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-bottom: 22px;
  overflow: hidden;
}

.stat {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stat:last-child {
  border-right: 0;
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

.stat-value {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 600;
  font-feature-settings: "tnum";
  color: var(--fg);
}

.stat-delta {
  font-size: 12px;
  color: var(--fg-3);
}

.stat-delta.up {
  color: var(--green);
}

.stat-delta.warn {
  color: var(--amber);
}

.stat-score {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.stat-score-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-score-meta strong {
  font-size: 14px;
  font-weight: 600;
}

.stat-score-meta small {
  color: var(--fg-3);
  font-size: 12px;
}

/* Score ring — minimal monochrome */
.score-ring {
  --score: 0;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: relative;
  background:
    conic-gradient(var(--accent) calc(var(--score) * 1%), var(--surface-3) 0);
  flex: none;
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.score-ring span {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 600;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}

/* ------- Cards / Grid ------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.card-head .eyebrow {
  margin-bottom: 2px;
}

/* ------- Tasks ------- */
.task-list {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.task {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 80ms;
}

.task:last-child {
  border-bottom: 0;
}

.task:hover {
  background: var(--hover);
}

.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: var(--r-sm);
  border: 1.2px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: background 80ms, border-color 80ms;
}

.task input[type="checkbox"]:hover {
  border-color: var(--fg-3);
}

.task input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.5px solid var(--accent-fg);
  border-bottom: 1.5px solid var(--accent-fg);
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.task span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.task strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.task small {
  color: var(--fg-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task b {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.task.done strong {
  color: var(--fg-3);
  text-decoration: line-through;
  text-decoration-color: var(--fg-4);
}

.task.done small {
  color: var(--fg-4);
}

.task-delete {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  opacity: 0;
  transition: opacity 80ms, background 80ms, color 80ms;
}

.task-delete svg {
  width: 13px;
  height: 13px;
}

.task:hover .task-delete {
  opacity: 1;
}

.task-delete:hover {
  background: var(--red-soft);
  color: var(--red);
}

.task-form {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.task-form input {
  flex: 1;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px;
  font-size: 13px;
  outline: 0;
  color: var(--fg);
  transition: border-color 80ms;
}

.task-form input::placeholder {
  color: var(--fg-3);
}

.task-form input:focus {
  border-color: var(--border-strong);
}

/* ------- Log ------- */
.log {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.log li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.log li:last-child {
  border-bottom: 0;
}

.log time {
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  padding-top: 1px;
}

.log strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}

.log p {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.45;
}

/* ------- Risk form ------- */
.risk-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 500;
}

.field select,
.field input[type="text"],
.field input[type="search"] {
  height: 32px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px;
  color: var(--fg);
  outline: 0;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg-3) 50%),
    linear-gradient(135deg, var(--fg-3) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 13px,
    calc(100% - 9px) 13px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.field select:focus,
.field input:focus {
  border-color: var(--border-strong);
  background-color: var(--surface);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  height: 24px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--surface-3);
  border-radius: 999px;
}
input[type="range"]::-moz-range-track {
  height: 3px;
  background: var(--surface-3);
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--fg);
  border: 2px solid var(--bg);
  margin-top: -6px;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-strong);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--fg);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-strong);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

.range-labels small {
  font-size: 11px;
  color: var(--fg-3);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
}

.check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: var(--r-sm);
  border: 1.2px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 80ms, border-color 80ms;
}

.check input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.check input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.5px solid var(--accent-fg);
  border-bottom: 1.5px solid var(--accent-fg);
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.risk-form .btn {
  align-self: flex-start;
  margin-top: 4px;
}

/* ------- Risk result ------- */
.result-panel {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.result-placeholder {
  padding: 28px 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-placeholder h2 {
  color: var(--fg);
}

.result-placeholder p {
  font-size: 13px;
  max-width: 44ch;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.result-risk-badge {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  color: var(--fg);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.result-risk-badge small {
  color: var(--fg-3);
  font-size: 11px;
  font-weight: 500;
}

.result-risk-badge.accent-pink {
  color: var(--red);
  background: var(--red-soft);
  border-color: transparent;
}
.result-risk-badge.accent-orange {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: transparent;
}
.result-risk-badge.accent-green {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}

.result-panel > p {
  padding: 12px 20px 0;
  font-size: 13px;
}

.action-list {
  margin: 0;
  padding: 12px 20px 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-list li {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
}

.action-list li::marker {
  color: var(--fg-3);
  font-feature-settings: "tnum";
  font-size: 12px;
}

/* ------- Status pill ------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-2);
  text-transform: uppercase;
}

.status-pill.accent-pink {
  color: var(--red);
  background: var(--red-soft);
  border-color: transparent;
}
.status-pill.accent-orange {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: transparent;
}
.status-pill.accent-green {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}

/* ------- Modules ------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}

.module {
  padding: 18px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 80ms;
}

.module:last-child {
  border-right: 0;
}

.module:hover {
  background: var(--surface-2);
}

.module h3 {
  font-size: 13px;
}

.module p {
  font-size: 12px;
  line-height: 1.5;
}

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

.device-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 80ms, background 80ms;
}

.device-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.device-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--fg-2);
  background: var(--surface-2);
  margin-bottom: 4px;
}

.device-icon svg {
  width: 14px;
  height: 14px;
}

.device-card h3 {
  font-size: 14px;
}

.device-card > p {
  font-size: 12px;
  color: var(--fg-2);
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.device-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-2);
}

.device-status.ok,
.device-status.good {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}

.device-status.warn,
.device-status.warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: transparent;
}

.device-status.critical,
.device-status.bad {
  color: var(--red);
  background: var(--red-soft);
  border-color: transparent;
}

/* ------- Knowledge ------- */
.kb-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-2);
}

.kb-stats strong {
  color: var(--fg);
  font-weight: 600;
  font-feature-settings: "tnum";
  margin-right: 2px;
}

.kb-stats .sep {
  color: var(--fg-4);
}

.kb-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.kb-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 80ms, color 80ms, border-color 80ms;
}

.kb-tabs button:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.kb-tabs button.active {
  background: var(--surface-3);
  color: var(--fg);
  border-color: var(--border-strong);
}

.kb-tabs button small {
  color: var(--fg-3);
  font-size: 11px;
  font-feature-settings: "tnum";
}

.kb-tabs button.active small {
  color: var(--fg-2);
}

.kb-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 16px;
  align-items: start;
}

.kb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.knowledge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 80ms, background 80ms;
}

.knowledge-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.knowledge-card.active {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: inset 2px 0 0 0 var(--accent);
}

.article-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.article-card-meta small {
  color: var(--fg-3);
  font-size: 11px;
  font-feature-settings: "tnum";
}

.mini-label {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

.knowledge-card h3 {
  font-size: 14px;
  letter-spacing: -0.005em;
}

.knowledge-card p {
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.5;
}

.knowledge-card ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.knowledge-card ul li {
  position: relative;
  padding-left: 14px;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.5;
}

.knowledge-card ul li::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  width: 8px;
  height: 1px;
  background: var(--fg-4);
}

.text-button {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: var(--fg-2);
  cursor: pointer;
  align-self: flex-start;
  transition: color 80ms;
}

.text-button:hover {
  color: var(--fg);
}

.article-open {
  margin-top: 4px;
}

/* Article reader */
.article-reader {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow: auto;
  padding: 22px 22px 24px;
  background: var(--surface);
}

.article-reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.article-reader-head > span:last-child {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

.article-reader h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.article-reader > p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg-2);
}

.article-reader-points {
  list-style: none;
  margin: 14px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-reader-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
}

.article-reader-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 10px;
  height: 1px;
  background: var(--accent);
}

.article-reader-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 14px;
}

.article-reader-sections section h3 {
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.005em;
}

.article-reader-sections section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-reader-sections section ul li {
  position: relative;
  padding-left: 14px;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.55;
}

.article-reader-sections section ul li::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 0;
  width: 6px;
  height: 1px;
  background: var(--fg-4);
}

/* ------- Empty state ------- */
.empty-state {
  display: none;
  font-size: 13px;
  color: var(--fg-3);
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  text-align: center;
}

.empty-state.visible {
  display: block;
}

/* Hidden via JS */
.search-hidden,
.filter-hidden {
  display: none !important;
}

/* ------- Chat / Assistant ------- */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 540px;
}

.chat-log {
  flex: 1;
  padding: 18px 18px 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  max-height: 60vh;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
}

.message span {
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.message p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg);
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.user p {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 18px 0;
}

.chat-prompts button {
  font-size: 12px;
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface);
  transition: background 80ms, color 80ms, border-color 80ms;
}

.chat-prompts button:hover {
  background: var(--surface-2);
  color: var(--fg);
  border-color: var(--border-strong);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  background: var(--bg-elev);
}

.chat-form input {
  flex: 1;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  font-size: 13px;
  outline: 0;
  color: var(--fg);
  transition: border-color 80ms;
}

.chat-form input::placeholder {
  color: var(--fg-3);
}

.chat-form input:focus {
  border-color: var(--border-strong);
}

/* ------- Responsive ------- */
@media (max-width: 960px) {
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }
  .stat {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .stat:nth-child(2n) {
    border-right: 0;
  }
  .stat:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .stat:first-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: 1fr 1fr;
  }
  .module {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .module:nth-child(2n) {
    border-right: 0;
  }
  .module:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .kb-layout {
    grid-template-columns: 1fr;
  }
  .article-reader {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 160ms ease;
    background: var(--bg);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.4);
  }

  .app {
    grid-template-columns: 1fr;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    padding: 0 14px;
  }

  .view {
    padding: 20px 14px 60px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
  .module {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .module:last-child {
    border-bottom: 0;
  }

  .user-name {
    display: none;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* =============================================================== */
/* ZenithGuard community — addons (auth, forum, feed, tests, profile) */
/* =============================================================== */

.view-root {
  padding: 28px 24px 64px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* User chip */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  transition: background 80ms, border-color 80ms;
  text-decoration: none;
}
.user-chip:hover { background: var(--surface-3); border-color: var(--border-strong); }
.user-chip.muted { color: var(--fg-3); padding-left: 10px; }
.user-chip svg, .user-chip rect { display: block; }
.user-chip > span:not(:first-child) { padding-right: 4px; }

/* Page-head adjustments */
.page-head {
  flex-wrap: wrap;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 8px;
  transition: color 80ms;
}
.back-link:hover { color: var(--fg); }

/* Feed grid */
.feed-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.feed-col-wide { grid-column: 1 / 2; }

.feed-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.feed-list > li { border-bottom: 1px solid var(--border); }
.feed-list > li:last-child { border-bottom: 0; }
.feed-list > li > a {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  transition: background 80ms;
}
.feed-list > li > a:hover { background: var(--hover); }
.feed-list .feed-num {
  font-size: 12px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  color: var(--fg-3);
  text-align: left;
}
.feed-list strong { display: block; font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.feed-list small { color: var(--fg-3); font-size: 12px; }
.feed-empty { padding: 14px 16px; color: var(--fg-3); font-size: 12.5px; }

.leaders {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.leaders > li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.leaders > li:last-child { border-bottom: 0; }
.leaders .rank {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
  text-align: center;
  font-feature-settings: "tnum";
}
.leaders small {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}

.my-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.my-results .eyebrow { margin-bottom: 6px; }
.my-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--r);
  font-size: 12.5px;
  transition: background 80ms;
}
.my-result:hover { background: var(--hover); }
.my-result small { color: var(--fg-3); font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* Article list */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 80ms, background 80ms;
}
.article-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.article-card h3 { font-size: 14px; }
.article-card p { font-size: 12.5px; line-height: 1.5; flex: 1; }
.article-card-foot {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-2);
}

/* Article page */
.article-page,
.thread-page,
.profile-page {
  max-width: 760px;
  margin: 0 auto;
}
.article-page h1,
.thread-page h1 {
  font-size: 28px;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.article-page .lede {
  font-size: 16px;
  color: var(--fg-2);
  line-height: 1.55;
  margin: 8px 0 16px;
}
.article-vote {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.article-vote .btn span {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  opacity: 0.85;
}
.article-meta-line { font-size: 12px; color: var(--fg-3); }

/* Comments */
.comments .comment-list,
.reply-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comments .comment-list > li,
.reply-list > li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.comments .comment-list > li > header,
.reply-list > li > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.comments .comment-list > li time,
.reply-list > li time {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.comments .comment-list > li p,
.reply-list > li p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg);
}

.comment-form,
.reply-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.comment-form textarea,
.reply-form textarea,
.form textarea {
  width: 100%;
  resize: vertical;
  font-family: var(--font-sans);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  color: var(--fg);
  outline: 0;
  font-size: 13px;
  line-height: 1.5;
  transition: border-color 80ms, background 80ms;
}
.comment-form textarea:focus,
.reply-form textarea:focus,
.form textarea:focus,
.form input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}
.comment-form button,
.reply-form button { align-self: flex-start; }

/* Forum */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 22px;
}
.cat {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 80ms;
}
.cat:hover { background: var(--surface-2); }
.cat strong { font-size: 13.5px; }
.cat p { font-size: 12px; line-height: 1.4; }
.cat small { font-size: 11px; color: var(--fg-3); margin-top: 4px; font-family: var(--font-mono); font-feature-settings: "tnum"; }

.thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.thread-list > li { border-bottom: 1px solid var(--border); }
.thread-list > li:last-child { border-bottom: 0; }
.thread-list > li > a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 16px;
  transition: background 80ms;
}
.thread-list > li > a:hover { background: var(--hover); }
.thread-row-main strong { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.thread-row-main small { color: var(--fg-3); font-size: 12px; }
.thread-row-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  white-space: nowrap;
}

/* Thread page */
.thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.thread-head small { font-size: 12px; color: var(--fg-3); }
.thread-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}

/* Generic form (used for new-thread, auth) */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
.form .field input,
.form .field select,
.form .field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--fg);
  outline: 0;
}
.form .btn { align-self: flex-start; }
.form-error {
  color: var(--red);
  font-size: 12px;
  min-height: 14px;
  margin: 0;
}

/* Tests */
.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.test-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 80ms, background 80ms;
}
.test-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.test-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.test-card h3 { font-size: 15px; }
.test-card p { font-size: 12.5px; line-height: 1.5; }

.test-form {
  gap: 18px;
}
.test-q {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin: 0;
  background: var(--surface);
}
.test-q legend {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  padding: 0 4px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}
.q-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  flex: none;
  margin-top: 1px;
}
.test-q .check { padding: 6px 0; align-items: flex-start; line-height: 1.4; }
.test-q .check input { margin-top: 2px; }

.result-block {
  padding: 0;
}
.result-actions {
  display: flex;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
}
.test-review {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.review-q {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  background: var(--surface-2);
}
.review-q.ok { border-color: rgba(34, 197, 94, 0.35); background: var(--green-soft); }
.review-q.bad { border-color: rgba(239, 68, 68, 0.35); background: var(--red-soft); }
.review-q h4 { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.review-q p { font-size: 12.5px; line-height: 1.5; margin: 2px 0; color: var(--fg); }
.review-q .explain { color: var(--fg-2); font-style: italic; }

/* Profile */
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.profile-avatar {
  flex: none;
}
.profile-avatar svg {
  width: 80px !important;
  height: 80px !important;
  border-radius: 12px !important;
}
.profile-meta { flex: 1; }
.profile-meta h1 { font-size: 24px; }
.profile-meta small { color: var(--fg-3); font-size: 12px; }
.profile-stats { margin-bottom: 22px; }

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.result-list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 6px;
  background: var(--surface);
}
.result-list > li > a { flex: 1; font-size: 13px; }
.result-list > li small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  color: var(--fg-2);
}
.result-list > li time { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }

/* Auth */
.auth-wrap {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 320px);
  gap: 16px;
  align-items: start;
  max-width: 740px;
  margin: 40px auto 0;
}
.auth-card .form { padding: 18px 20px 16px; }
.auth-form .field { gap: 4px; }
.auth-foot {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  font-size: 12.5px;
  color: var(--fg-2);
}
.auth-foot a { color: var(--accent); }
.auth-hint {
  padding: 18px 20px;
}
.auth-hint h3 { font-size: 13px; margin-bottom: 8px; }
.auth-hint p { font-size: 12.5px; line-height: 1.55; }
.auth-hint code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.demo-creds {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.demo-creds li { font-size: 12.5px; color: var(--fg-2); }

/* Responsive overrides for new components */
@media (max-width: 960px) {
  .feed-grid { grid-template-columns: 1fr; }
  .feed-col-wide { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .view-root { padding: 20px 14px 60px; }
  .article-page h1, .thread-page h1 { font-size: 22px; }
  .cat-grid { grid-template-columns: 1fr; }
  .thread-list > li > a { flex-direction: column; align-items: flex-start; gap: 6px; }
}


/* =============================================================== */
/* ZenithGuard Lab — analyzers and trainer                           */
/* =============================================================== */

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Lab index */
.lab-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 760px;
}

.lab-tool {
  display: grid;
  grid-template-columns: 44px 1fr 24px;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 80ms, background 80ms, transform 80ms;
}
.lab-tool:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.lab-tool:active {
  transform: translateY(0.5px);
}
.lab-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.lab-icon svg { width: 20px; height: 20px; }
.lab-tool h3 { font-size: 15px; margin-bottom: 2px; }
.lab-tool p { font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }
.lab-arrow {
  font-size: 18px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  transition: color 80ms, transform 80ms;
}
.lab-tool:hover .lab-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

/* ----- Password lab ----- */
.pw-lab {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 760px;
}
.pw-input-row {
  display: flex;
  gap: 6px;
}
.pw-input-row input {
  flex: 1;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--fg);
  outline: 0;
  transition: border-color 80ms, background 80ms;
}
.pw-input-row input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}
.pw-input-row .icon-btn { width: 40px; height: 40px; }

.pw-strength {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pw-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}
.pw-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 200ms ease, background 200ms ease;
  background: var(--red);
}
.pw-bar > span[data-score="0"] { background: var(--red); }
.pw-bar > span[data-score="1"] { background: #f97316; }
.pw-bar > span[data-score="2"] { background: var(--amber); }
.pw-bar > span[data-score="3"] { background: #84cc16; }
.pw-bar > span[data-score="4"] { background: var(--green); }

.pw-strength-label {
  min-width: 90px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.pw-strength-label[data-score="0"] { color: var(--red); }
.pw-strength-label[data-score="1"] { color: #f97316; }
.pw-strength-label[data-score="2"] { color: var(--amber); }
.pw-strength-label[data-score="3"] { color: #84cc16; }
.pw-strength-label[data-score="4"] { color: var(--green); }

.pw-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-elev);
}
.pw-stats > div {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pw-stats > div:last-child { border-right: 0; }
.pw-stats strong {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  color: var(--fg);
}
.pw-stats small {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

.pw-section .section-title { margin-top: 0; }

.crack-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.crack-list > li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface);
  font-size: 12.5px;
}
.crack-list > li:first-child { border-top-left-radius: var(--r); border-top-right-radius: var(--r); }
.crack-list > li:last-child {
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
}
.crack-list > li > span { color: var(--fg-2); }
.crack-list > li > strong {
  color: var(--fg);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-weight: 600;
}

.pw-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pw-issues > li {
  font-size: 12.5px;
  padding: 8px 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: var(--amber-soft);
  border-radius: var(--r);
  color: var(--fg);
}
.pw-issues > li.ok {
  border-color: rgba(34, 197, 94, 0.35);
  background: var(--green-soft);
}
.pw-issues > li.feed-empty {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--fg-3);
  text-align: center;
}

/* ----- URL lab ----- */
.url-lab {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.url-form {
  display: flex;
  gap: 8px;
}
.url-form input {
  flex: 1;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  outline: 0;
}
.url-form input:focus { border-color: var(--border-strong); background: var(--surface); }

.url-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.url-suggestions .eyebrow { margin-bottom: 0; margin-right: 4px; }
.url-suggestions button {
  cursor: pointer;
  transition: background 80ms, color 80ms, border-color 80ms;
}
.url-suggestions button:hover {
  background: var(--surface-3);
  color: var(--fg);
  border-color: var(--border-strong);
}

.url-result:empty { display: none; }
.url-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.url-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
}
.url-verdict h2 {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0;
  word-break: break-all;
}

.url-parts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-elev);
}
.url-part {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.url-part:last-child { border-bottom: 0; }
.url-part > small {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-family: var(--font-mono);
}
.url-part > strong {
  font-family: var(--font-mono);
  font-weight: 500;
  word-break: break-all;
  color: var(--fg);
}
.url-part.warn > strong { color: var(--amber); }

.url-label {
  display: inline;
}
.url-label.muted { color: var(--fg-3); }
.url-label.strong { color: var(--fg); font-weight: 600; }

.glyph-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: var(--red-soft);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg);
  margin: 2px 4px 2px 0;
}
.glyph-chip small {
  font-family: var(--font-mono);
  color: var(--fg-3);
  font-size: 10px;
}

.url-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.url-issues > li {
  padding: 8px 12px;
  border-radius: var(--r);
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--surface);
}
.url-issues > li.bad {
  border-color: rgba(239, 68, 68, 0.35);
  background: var(--red-soft);
}
.url-issues > li.ok {
  border-color: rgba(34, 197, 94, 0.35);
  background: var(--green-soft);
}

/* ----- Phish trainer ----- */
.phish-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 16px;
  max-width: 760px;
}
.phish-stats > div {
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.phish-stats > div:last-child { border-right: 0; }
.phish-stats strong {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.phish-stats small {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

.phish-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-width: 760px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.phish-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.phish-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}
.phish-meta {
  font-size: 12.5px;
  color: var(--fg-2);
  font-weight: 500;
  text-align: right;
  flex: 1;
  padding-left: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phish-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.phish-from {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.phish-from small {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-family: var(--font-mono);
}
.phish-from span {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  word-break: break-all;
}
.phish-text {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--fg);
}

.phish-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
}
.phish-link-pre {
  color: var(--accent);
  font-weight: 600;
}
.phish-link code {
  color: var(--fg);
  background: transparent;
}

.phish-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.phish-btn {
  height: 44px;
  font-size: 14px;
  font-weight: 600;
}
.phish-btn.phish-bad {
  background: transparent;
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.4);
}
.phish-btn.phish-bad:hover {
  background: var(--red-soft);
  border-color: var(--red);
}
.phish-btn.phish-good {
  background: var(--green);
  color: #052e1a;
  border-color: var(--green);
}
.phish-btn.phish-good:hover {
  background: #16a34a;
  border-color: #16a34a;
}

.phish-keys {
  text-align: center;
  font-size: 11px;
  color: var(--fg-3);
  padding-bottom: 12px;
}

/* Reveal */
.phish-reveal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-width: 760px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.phish-reveal.ok { border-color: rgba(34, 197, 94, 0.35); }
.phish-reveal.bad { border-color: rgba(239, 68, 68, 0.45); }
.phish-reveal > header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--fg-2);
  flex-wrap: wrap;
}
.phish-reveal h2 {
  font-size: 16px;
  margin-top: 4px;
}
.phish-reveal .btn { align-self: flex-start; }

.reveal-flags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reveal-flags > li {
  position: relative;
  padding: 8px 12px 8px 28px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-elev);
}
.reveal-flags > li::before {
  content: "→";
  position: absolute;
  left: 10px;
  top: 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

.phish-mistakes {
  padding: 0 20px 16px;
}
.phish-mistakes .reveal-flags > li small {
  display: block;
  color: var(--fg-3);
  margin-top: 2px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .pw-stats { grid-template-columns: 1fr 1fr; }
  .pw-stats > div:nth-child(2) { border-right: 0; }
  .pw-stats > div:nth-child(1), .pw-stats > div:nth-child(2) { border-bottom: 1px solid var(--border); }
  .phish-stats { grid-template-columns: 1fr 1fr; }
  .phish-stats > div:nth-child(2) { border-right: 0; }
  .phish-stats > div:nth-child(1), .phish-stats > div:nth-child(2) { border-bottom: 1px solid var(--border); }
  .url-part { grid-template-columns: 64px 1fr; }
}


/* =============================================================== */
/* Motion — Linear/Vercel-style: fast, ease-out, never bouncy       */
/* =============================================================== */

/* Animatable conic-gradient on score ring */
@property --score-anim {
  syntax: '<integer>';
  inherits: false;
  initial-value: 0;
}

:root {
  --motion-fast: 140ms;
  --motion: 220ms;
  --motion-slow: 360ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ring-fill {
  from { --score-anim: 0; }
  to { --score-anim: var(--score, 0); }
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

/* ---- Page-level enter ---- */
.view-root > * {
  animation: view-enter var(--motion) var(--ease-out) both;
}

/* ---- Card grids: stagger ---- */
.feed-grid > *,
.article-grid > *,
.cat-grid > *,
.test-grid > *,
.module-grid > *,
.lab-grid > *,
.thread-list > li,
.kb-tabs > button,
.stat-row > .stat,
.profile-stats > .stat,
.phish-stats > div,
.pw-stats > div {
  animation: card-rise var(--motion-slow) var(--ease-out) both;
}

/* Stagger via nth-child up to 8, then constant */
.feed-grid > *:nth-child(1),
.article-grid > *:nth-child(1),
.cat-grid > *:nth-child(1),
.test-grid > *:nth-child(1),
.module-grid > *:nth-child(1),
.lab-grid > *:nth-child(1),
.thread-list > li:nth-child(1),
.stat-row > .stat:nth-child(1),
.profile-stats > .stat:nth-child(1),
.phish-stats > div:nth-child(1),
.pw-stats > div:nth-child(1) { animation-delay: 0ms; }

.feed-grid > *:nth-child(2),
.article-grid > *:nth-child(2),
.cat-grid > *:nth-child(2),
.test-grid > *:nth-child(2),
.module-grid > *:nth-child(2),
.lab-grid > *:nth-child(2),
.thread-list > li:nth-child(2),
.stat-row > .stat:nth-child(2),
.profile-stats > .stat:nth-child(2),
.phish-stats > div:nth-child(2),
.pw-stats > div:nth-child(2) { animation-delay: 40ms; }

.feed-grid > *:nth-child(3),
.article-grid > *:nth-child(3),
.cat-grid > *:nth-child(3),
.test-grid > *:nth-child(3),
.module-grid > *:nth-child(3),
.lab-grid > *:nth-child(3),
.thread-list > li:nth-child(3),
.stat-row > .stat:nth-child(3),
.profile-stats > .stat:nth-child(3),
.phish-stats > div:nth-child(3),
.pw-stats > div:nth-child(3) { animation-delay: 80ms; }

.feed-grid > *:nth-child(4),
.article-grid > *:nth-child(4),
.cat-grid > *:nth-child(4),
.test-grid > *:nth-child(4),
.module-grid > *:nth-child(4),
.lab-grid > *:nth-child(4),
.thread-list > li:nth-child(4),
.stat-row > .stat:nth-child(4),
.profile-stats > .stat:nth-child(4),
.phish-stats > div:nth-child(4),
.pw-stats > div:nth-child(4) { animation-delay: 120ms; }

.feed-grid > *:nth-child(5),
.article-grid > *:nth-child(5),
.cat-grid > *:nth-child(5),
.test-grid > *:nth-child(5),
.lab-grid > *:nth-child(5),
.thread-list > li:nth-child(5) { animation-delay: 160ms; }

.feed-grid > *:nth-child(6),
.article-grid > *:nth-child(6),
.cat-grid > *:nth-child(6),
.test-grid > *:nth-child(6),
.thread-list > li:nth-child(6) { animation-delay: 200ms; }

.article-grid > *:nth-child(7),
.cat-grid > *:nth-child(7),
.thread-list > li:nth-child(7) { animation-delay: 240ms; }

.article-grid > *:nth-child(n+8),
.cat-grid > *:nth-child(n+8),
.thread-list > li:nth-child(n+8) { animation-delay: 280ms; }

/* ---- KB tabs: subtle stagger ---- */
.kb-tabs > button { animation-duration: var(--motion); }
.kb-tabs > button:nth-child(1) { animation-delay: 0ms; }
.kb-tabs > button:nth-child(2) { animation-delay: 25ms; }
.kb-tabs > button:nth-child(3) { animation-delay: 50ms; }
.kb-tabs > button:nth-child(4) { animation-delay: 75ms; }
.kb-tabs > button:nth-child(5) { animation-delay: 100ms; }
.kb-tabs > button:nth-child(n+6) { animation-delay: 120ms; }

/* ---- Hover lifts ---- */
.article-card,
.test-card,
.lab-tool,
.knowledge-card,
.device-card,
.cat,
.stat-cell {
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out);
}

.article-card:hover,
.test-card:hover,
.lab-tool:hover,
.knowledge-card:hover,
.device-card:hover,
.cat:hover {
  transform: translateY(-1px);
}

/* ---- Buttons: snappy press ---- */
.btn,
.icon-btn,
.kb-tabs button,
.segmented button,
.chat-prompts button,
.url-suggestions button {
  transition:
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out),
    transform 80ms var(--ease-out);
}

.btn:active,
.icon-btn:active {
  transform: translateY(1px) scale(0.99);
}

/* ---- Nav items: slide in active marker ---- */
.nav-item {
  position: relative;
  transition:
    color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out);
}

.nav-item::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 50%;
  width: 2px;
  height: 0;
  background: var(--accent);
  border-radius: 2px;
  transform: translateY(-50%);
  transition: height var(--motion) var(--ease-snap);
  pointer-events: none;
}

.nav-item.active::before {
  height: 16px;
}

/* ---- Score ring: animate fill on enter ---- */
.score-ring {
  background:
    conic-gradient(var(--accent) calc(var(--score-anim, var(--score)) * 1%), var(--surface-3) 0);
  animation: ring-fill 1100ms var(--ease-out) both;
}

/* ---- Live dot: gentle pulse ---- */
.dot.live {
  animation: pulse-dot 2.4s ease-in-out infinite;
}

/* ---- Search expand ---- */
.search {
  transition:
    border-color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    box-shadow var(--motion) var(--ease-out);
}
.search:focus-within {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- Inputs ---- */
input,
select,
textarea {
  transition:
    border-color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out);
}

/* ---- Phish card: replace transition ---- */
.phish-card,
.phish-reveal {
  animation: card-rise var(--motion-slow) var(--ease-out) both;
}

/* ---- Password bar: smoother ---- */
.pw-bar > span {
  transition:
    width var(--motion-slow) var(--ease-snap),
    background var(--motion) var(--ease-out);
}

/* ---- Auth screens ---- */
.auth-card,
.auth-hint {
  animation: card-rise var(--motion-slow) var(--ease-out) both;
}
.auth-hint { animation-delay: 80ms; }

/* ---- Article reader sections ---- */
.article-reader-sections > section {
  animation: card-rise var(--motion-slow) var(--ease-out) both;
}
.article-reader-sections > section:nth-child(1) { animation-delay: 50ms; }
.article-reader-sections > section:nth-child(2) { animation-delay: 110ms; }
.article-reader-sections > section:nth-child(3) { animation-delay: 170ms; }
.article-reader-sections > section:nth-child(4) { animation-delay: 220ms; }
.article-reader-sections > section:nth-child(n+5) { animation-delay: 260ms; }

/* ---- Loaders skeleton (utility, optional) ---- */
.skeleton {
  background:
    linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%);
  background-size: 200% 100%;
  animation: shimmer 1400ms linear infinite;
  border-radius: var(--r);
  color: transparent;
}

/* ---- Reveal flags pop-in ---- */
.reveal-flags > li {
  animation: card-rise var(--motion) var(--ease-out) both;
}
.reveal-flags > li:nth-child(1) { animation-delay: 80ms; }
.reveal-flags > li:nth-child(2) { animation-delay: 140ms; }
.reveal-flags > li:nth-child(3) { animation-delay: 200ms; }
.reveal-flags > li:nth-child(n+4) { animation-delay: 240ms; }

/* ---- Reduced motion: kill everything ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .view-root > *,
  .feed-grid > *,
  .article-grid > *,
  .lab-grid > *,
  .cat-grid > *,
  .test-grid > *,
  .thread-list > li,
  .auth-card,
  .auth-hint,
  .phish-card,
  .phish-reveal,
  .reveal-flags > li,
  .article-reader-sections > section {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .article-card:hover,
  .test-card:hover,
  .lab-tool:hover,
  .knowledge-card:hover,
  .device-card:hover,
  .cat:hover {
    transform: none;
  }
}


/* =============================================================== */
/* Theme transition                                                 */
/* =============================================================== */

/* Modern: View Transitions API (Chromium 111+, Safari 18+) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  mix-blend-mode: normal;
}

/* Fallback for Firefox & older browsers */
html.theme-fading,
html.theme-fading *,
html.theme-fading *::before,
html.theme-fading *::after {
  transition:
    background-color 300ms cubic-bezier(0.16, 1, 0.3, 1),
    background 300ms cubic-bezier(0.16, 1, 0.3, 1),
    color 300ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 300ms cubic-bezier(0.16, 1, 0.3, 1),
    fill 300ms cubic-bezier(0.16, 1, 0.3, 1),
    stroke 300ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Theme toggle button: small rotate on click for feedback */
[data-theme-toggle] {
  transition:
    background var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    transform 320ms var(--ease-out);
}
[data-theme-toggle]:active {
  transform: rotate(-30deg);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.001ms;
  }
}


/* =============================================================== */
/* Feed — editorial layout                                          */
/* =============================================================== */

.feed-hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 22px;
  padding: 28px 28px 26px;
  margin-bottom: 22px;
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.feed-hero-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.feed-hero-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: background var(--motion-fast) var(--ease-out);
}
.feed-hero-tag:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.feed-hero h1 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 4px 0 6px;
}
.feed-hero h1 a {
  color: var(--fg);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 240ms var(--ease-out);
}
.feed-hero h1 a:hover { background-size: 100% 1px; }

.feed-hero-lede {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 56ch;
}

.feed-hero-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  margin-top: 4px;
}

.feed-hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.feed-hero-side {
  display: flex;
  align-items: stretch;
}
.hero-cta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.hero-cta strong {
  font-size: 18px;
  letter-spacing: -0.015em;
}
.hero-cta p {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}
.hero-cta-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

/* Featured rail */
.feed-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.feed-rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out);
}
.feed-rail-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.feed-rail-card h3 { font-size: 15px; line-height: 1.3; letter-spacing: -0.01em; }
.feed-rail-card p { font-size: 12.5px; line-height: 1.5; color: var(--fg-2); flex: 1; }
.feed-rail-card footer { display: flex; gap: 6px; }

/* Two-col layout: activity stream + sticky aside */
.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.feed-main { min-width: 0; }

.feed-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.feed-section-head h2 { font-size: 18px; letter-spacing: -0.015em; }
.feed-section-tabs { display: flex; gap: 4px; }

/* Activity buckets */
.act-bucket { margin-bottom: 22px; }
.act-bucket-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
  margin: 0 0 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.act-bucket-title small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  color: var(--fg-4);
}

.act-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.act-list::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.act {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  padding: 10px 0;
  align-items: flex-start;
  position: relative;
}

.act-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  font-family: var(--font-mono);
  position: relative;
  z-index: 1;
  flex: none;
}
.act-thread .act-icon { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.act-reply  .act-icon { color: var(--fg-2); }
.act-comment .act-icon { color: var(--fg-2); font-size: 12px; }
.act-test .act-icon { color: var(--green); border-color: rgba(34, 197, 94, 0.4); background: var(--green-soft); }
.act-join .act-icon { color: var(--amber); border-color: rgba(245, 158, 11, 0.4); background: var(--amber-soft); }

.act-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.act-body p {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.4;
  margin: 0;
}
.act-body p strong { color: var(--fg); font-weight: 600; }
.act-body .user-chip { display: inline-flex; padding: 1px 6px 1px 1px; }
.act-link { color: var(--fg); border-bottom: 1px dashed var(--border-strong); }
.act-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.act-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
  line-height: 1.35;
  transition: color var(--motion-fast) var(--ease-out);
}
.act-title:hover { color: var(--accent); }

.act-quote {
  font-size: 12.5px;
  color: var(--fg-3);
  line-height: 1.45;
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
  margin-top: 4px;
}

.act > time {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  padding-top: 7px;
  white-space: nowrap;
}

/* Sticky aside */
.feed-aside {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
}
.feed-aside .card { padding: 0; }
.feed-aside .card-head { padding: 12px 16px; }
.feed-aside .leaders { padding: 4px 0 8px; }

.feed-list.compact > li > a { padding: 10px 16px; }
.feed-list.compact .feed-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  text-align: center;
  display: inline-block;
  width: max-content;
  min-width: 32px;
}

.aside-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}
.aside-stats > div {
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.aside-stats > div:nth-child(2n) { border-right: 0; }
.aside-stats > div:nth-last-child(-n+2) { border-bottom: 0; }
.aside-stats strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.aside-stats small {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.feed-aside-link {
  border-radius: 0 0 var(--r-md) var(--r-md);
  padding: 12px 16px;
  width: 100%;
  justify-content: flex-start;
  border-top: 1px solid var(--border);
}

/* Stagger for activity items */
.act-list > li {
  animation: card-rise var(--motion) var(--ease-out) both;
}
.act-list > li:nth-child(1) { animation-delay: 0ms; }
.act-list > li:nth-child(2) { animation-delay: 35ms; }
.act-list > li:nth-child(3) { animation-delay: 70ms; }
.act-list > li:nth-child(4) { animation-delay: 105ms; }
.act-list > li:nth-child(5) { animation-delay: 140ms; }
.act-list > li:nth-child(6) { animation-delay: 175ms; }
.act-list > li:nth-child(n+7) { animation-delay: 210ms; }

/* Responsive */
@media (max-width: 960px) {
  .feed-hero { grid-template-columns: 1fr; padding: 22px 22px 20px; }
  .feed-hero h1 { font-size: 26px; }
  .feed-rail { grid-template-columns: 1fr; }
  .feed-layout { grid-template-columns: 1fr; }
  .feed-aside { position: static; }
}
@media (max-width: 720px) {
  .feed-hero { padding: 18px 16px; }
  .feed-hero h1 { font-size: 22px; }
  .act > time { display: none; }
}


/* =============================================================== */
/* Hero CTA — personal dashboard / community pulse                  */
/* =============================================================== */

.hero-cta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.hero-cta-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero-cta-head strong {
  font-size: 16px;
  letter-spacing: -0.015em;
}

.hero-cta-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  margin: -4px;
  border-radius: var(--r);
  transition: background var(--motion-fast) var(--ease-out);
}
.hero-cta-user:hover { background: var(--surface-2); }
.hero-cta-user > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.hero-cta-user strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero-cta-user small {
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-feature-settings: "tnum";
}

/* Level progress */
.level-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}
.level-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, white));
  border-radius: 999px;
  transition: width 600ms var(--ease-snap);
}

/* Section in CTA */
.hero-cta-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}
.hero-cta-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.hero-cta-section-head .eyebrow { margin-bottom: 0; }
.hero-cta-section-head small {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 3px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-3);
  transition: transform var(--motion-fast) var(--ease-out);
  animation: card-rise var(--motion) var(--ease-out) both;
}
.heatmap-cell[data-level="1"] {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-3));
}
.heatmap-cell[data-level="2"] {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}
.heatmap-cell[data-level="3"] {
  background: var(--accent);
}
.heatmap-cell:hover {
  transform: scale(1.18);
  outline: 1px solid var(--border-strong);
}
.heatmap-cell:nth-child(1) { animation-delay: 0ms; }
.heatmap-cell:nth-child(2) { animation-delay: 20ms; }
.heatmap-cell:nth-child(3) { animation-delay: 40ms; }
.heatmap-cell:nth-child(4) { animation-delay: 60ms; }
.heatmap-cell:nth-child(5) { animation-delay: 80ms; }
.heatmap-cell:nth-child(6) { animation-delay: 100ms; }
.heatmap-cell:nth-child(7) { animation-delay: 120ms; }
.heatmap-cell:nth-child(8) { animation-delay: 140ms; }
.heatmap-cell:nth-child(9) { animation-delay: 160ms; }
.heatmap-cell:nth-child(10) { animation-delay: 180ms; }
.heatmap-cell:nth-child(11) { animation-delay: 200ms; }
.heatmap-cell:nth-child(12) { animation-delay: 220ms; }
.heatmap-cell:nth-child(13) { animation-delay: 240ms; }
.heatmap-cell:nth-child(14) { animation-delay: 260ms; }

/* Streak row */
.hero-cta-streak {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--fg-2);
}
.hero-cta-streak strong {
  color: var(--fg);
  font-feature-settings: "tnum";
  font-weight: 600;
  margin-right: 1px;
}
.streak-flame {
  font-size: 14px;
  filter: saturate(1.1);
}
.hero-cta-streak .status-pill {
  margin-left: auto;
}

/* Pulse list (logged-out) */
.pulse-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.pulse-list > li {
  padding: 10px 6px;
  text-align: center;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pulse-list > li:last-child { border-right: 0; }
.pulse-list > li strong {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  color: var(--fg);
}
.pulse-list > li small {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.pulse-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-2);
  margin: 0;
}

@media (max-width: 720px) {
  .pulse-list { grid-template-columns: repeat(5, 1fr); font-size: 11px; }
  .pulse-list > li strong { font-size: 15px; }
}


/* =============================================================== */
/* Feed section divider — animated gradient line                    */
/* =============================================================== */

.feed-section-head {
  position: relative;
  border-bottom: 0;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.feed-section-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--accent) 0,
    var(--accent) 36px,
    color-mix(in srgb, var(--accent) 50%, transparent) 60px,
    var(--border-strong) 110px,
    var(--border) 220px,
    transparent
  );
  transform: scaleX(0);
  transform-origin: left;
  animation: line-extend 720ms cubic-bezier(0.16, 1, 0.3, 1) 80ms forwards;
}

.feed-section-head::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  opacity: 0;
  animation: dot-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) 720ms forwards;
}

@keyframes line-extend {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes dot-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .feed-section-head::after {
    animation: none;
    transform: scaleX(1);
  }
  .feed-section-head::before {
    animation: none;
    opacity: 1;
    transform: scale(1);
  }
}


/* =============================================================== */
/* Activity timeline — animated gradient vertical line              */
/* =============================================================== */

.act-list::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(
    180deg,
    var(--accent) 0,
    var(--accent) 24px,
    color-mix(in srgb, var(--accent) 50%, transparent) 56px,
    var(--border-strong) 120px,
    var(--border) 320px,
    transparent
  );
  transform: scaleY(0);
  transform-origin: top;
  animation: line-extend-v 800ms cubic-bezier(0.16, 1, 0.3, 1) 120ms forwards;
}

.act-list::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 2px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  opacity: 0;
  animation: dot-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) 800ms forwards;
}

@keyframes line-extend-v {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .act-list::before {
    animation: none;
    transform: scaleY(1);
  }
  .act-list::after {
    animation: none;
    opacity: 1;
  }
}


/* =============================================================== */
/* Activity timeline line — soft fade at both ends, no leading dot  */
/* =============================================================== */

.act-list::before {
  left: 13px;
  top: 0;
  bottom: 0;
  background: linear-gradient(
    180deg,
    transparent 0,
    var(--border) 16px,
    var(--border-strong) 64px,
    var(--border-strong) calc(100% - 64px),
    var(--border) calc(100% - 16px),
    transparent 100%
  );
  transform: none;
  transform-origin: center;
  animation: timeline-fade 600ms cubic-bezier(0.16, 1, 0.3, 1) 120ms both;
}

.act-list::after {
  display: none;
}

@keyframes timeline-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .act-list::before {
    animation: none;
    opacity: 1;
  }
}


/* =============================================================== */
/* Profile page redesign                                            */
/* =============================================================== */

.profile-page { max-width: 880px; }

.profile-banner {
  --banner-hue: 220;
  height: 140px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  background:
    radial-gradient(ellipse 70% 80% at 20% 110%, hsla(var(--banner-hue), 65%, 55%, 0.40), transparent 60%),
    radial-gradient(ellipse 60% 70% at 85% 20%, hsla(calc(var(--banner-hue) + 60), 70%, 60%, 0.30), transparent 60%),
    linear-gradient(135deg, hsla(var(--banner-hue), 45%, 16%, 1), hsla(calc(var(--banner-hue) + 30), 30%, 10%, 1));
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Dot grid overlay */
.profile-banner::before {
  content: "";
  position: absolute;
  inset: -40px;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 16px 16px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 90%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 90%);
  animation: banner-pan 60s linear infinite;
  pointer-events: none;
}

/* Bottom fade into the head card below — blend seamlessly with --surface */
.profile-banner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--surface) 70%, transparent) 60%, var(--surface) 100%);
  pointer-events: none;
}

[data-theme="light"] .profile-banner {
  background:
    radial-gradient(ellipse 70% 80% at 20% 110%, hsla(var(--banner-hue), 80%, 70%, 0.55), transparent 60%),
    radial-gradient(ellipse 60% 70% at 85% 20%, hsla(calc(var(--banner-hue) + 60), 80%, 75%, 0.45), transparent 60%),
    linear-gradient(135deg, hsla(var(--banner-hue), 55%, 92%, 1), hsla(calc(var(--banner-hue) + 30), 55%, 96%, 1));
}
[data-theme="light"] .profile-banner::before {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
}

@keyframes banner-pan {
  from { transform: translate(0, 0); }
  to { transform: translate(-32px, -32px); }
}

@media (prefers-reduced-motion: reduce) {
  .profile-banner::before { animation: none; }
}

.profile-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  padding: 0 22px 18px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--r-md) var(--r-md);
  margin-bottom: 18px;
}

.profile-avatar-wrap {
  position: relative;
  z-index: 2;
  margin-top: -52px;
  padding: 4px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  width: max-content;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.profile-avatar-wrap svg {
  width: 96px !important;
  height: 96px !important;
  border-radius: 10px !important;
}

.profile-identity {
  padding-top: 14px;
  min-width: 0;
}
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-name-row h1 {
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.profile-level {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-family: var(--font-mono);
}

.profile-bio {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-2);
  margin: 6px 0 8px;
}

.profile-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-3);
}
.profile-meta-line > span:nth-child(odd) { color: var(--fg-2); }

.profile-actions {
  padding-top: 18px;
}

/* Level row */
.profile-level-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}
.profile-level-bar {
  height: 6px;
}
.profile-level-row small {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

/* Heatmap block */
.profile-heatmap-block {
  margin-bottom: 22px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-heatmap-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.profile-heatmap-head .eyebrow { margin-bottom: 0; }
.profile-heatmap-head small {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
}
.heatmap.heatmap-large {
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
}
.heatmap-large .heatmap-cell {
  border-radius: 3px;
}
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-top: 2px;
}
.heatmap-legend .heatmap-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  animation: none;
}
.heatmap-legend > span:not(.heatmap-cell) { padding: 0 4px; }

/* Tabs */
.profile-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }

.profile-tab {
  position: relative;
  padding: 10px 14px;
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-out);
}
.profile-tab small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 10.5px;
  color: var(--fg-3);
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.profile-tab:hover { color: var(--fg); }
.profile-tab.active { color: var(--fg); }
.profile-tab.active small { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); }
.profile-tab::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--motion) var(--ease-snap);
}
.profile-tab.active::after { transform: scaleX(1); }

.profile-pane { display: none; }
.profile-pane.active {
  display: block;
  animation: fade-in var(--motion) var(--ease-out) both;
}

.profile-act-list { padding-left: 4px; }

/* Badges grid */
.badge-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.badge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out);
}
.badge-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.badge-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
}
.badge-card strong { font-size: 14px; }
.badge-card small { font-size: 12px; color: var(--fg-3); line-height: 1.4; }
.badge-card.accent-orange .badge-icon { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--amber) 60%, transparent)); }
.badge-card.accent-green .badge-icon { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--green) 50%, transparent)); }

/* =============================================================== */
/* Profile editor                                                   */
/* =============================================================== */

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 880px;
}
.edit-card { padding: 0; }
.edit-card .form { padding: 16px 20px 18px; }
.edit-card-danger {
  grid-column: 1 / -1;
  border-color: rgba(239, 68, 68, 0.25);
}

.edit-avatar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 18px 20px;
  align-items: center;
}
.edit-avatar-preview {
  flex: none;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 12px;
}
.edit-avatar-preview svg {
  width: 96px !important;
  height: 96px !important;
  border-radius: 10px !important;
}
.edit-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.edit-avatar-actions .btn { align-self: flex-start; }
.edit-avatar-actions small {
  color: var(--fg-3);
  font-size: 11.5px;
  line-height: 1.45;
}
.edit-avatar-actions input {
  font-family: var(--font-mono);
  font-size: 12px;
  height: 30px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px;
  color: var(--fg);
  outline: 0;
}
.edit-avatar-actions input:focus { border-color: var(--border-strong); background: var(--surface); }

.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.form-hint {
  margin: 0;
  font-size: 12px;
  color: var(--green);
  min-height: 14px;
}

.edit-danger {
  padding: 16px 20px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.edit-danger .btn {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--red);
}
.edit-danger .btn:hover {
  background: var(--red-soft);
  border-color: var(--red);
}
.edit-danger .form-hint {
  color: var(--fg-3);
  flex: 1 1 100%;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .profile-head {
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
  }
  .profile-avatar-wrap { margin-top: -42px; }
  .profile-avatar-wrap svg { width: 76px !important; height: 76px !important; }
  .profile-identity { padding-top: 8px; }
  .profile-actions { padding-top: 0; }
  .profile-level-row { grid-template-columns: 1fr; }
  .heatmap.heatmap-large { grid-template-columns: repeat(7, 1fr); }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-avatar { grid-template-columns: 1fr; text-align: left; }
  .profile-tabs { gap: 0; }
}


/* =============================================================== */
/* Tests page — rich cards, stats, filters                          */
/* =============================================================== */

.tests-overview {
  margin-bottom: 22px;
}

.test-filters { margin-bottom: 18px; }

.test-grid-rich {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.test-card-rich {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.test-card-rich:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.test-card-rich-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.test-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--fg-3);
  font-feature-settings: "tnum";
}

.difficulty {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
}
.difficulty.diff-easy {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, 0.3);
}
.difficulty.diff-medium {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.3);
}
.difficulty.diff-hard {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.3);
}

.test-badge {
  margin-left: auto;
  font-size: 16px;
  line-height: 1;
}
.test-badge.gold {
  color: var(--amber);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--amber) 60%, transparent));
}
.test-badge.silver {
  color: var(--fg-2);
}

.test-card-rich-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.test-card-rich-body .mini-label {
  margin-bottom: 2px;
}
.test-card-rich-body h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
}
.test-card-rich-body p {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-2);
}

.test-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-3);
}
.test-card-meta > span:nth-child(odd) {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Best-score progress bar */
.test-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.test-progress.empty {
  text-align: center;
  padding: 6px 10px;
  border-style: dashed;
}
.test-progress.empty small {
  font-style: italic;
  color: var(--fg-3);
}
.test-progress small {
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.test-progress-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.test-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width var(--motion-slow) var(--ease-snap);
  background: var(--accent);
}
.test-progress-bar > span[data-score="1"] { background: var(--red); }
.test-progress-bar > span[data-score="2"] { background: var(--amber); }
.test-progress-bar > span[data-score="3"] { background: #84cc16; }
.test-progress-bar > span[data-score="4"] { background: var(--green); }

.test-card-foot {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.test-card-foot .btn { flex: 1 1 auto; justify-content: center; }
.test-card-foot .btn.ghost { flex: 0 0 auto; }

/* Bottom grid: history + leaderboard */
.tests-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}
.tests-bottom-grid .card { padding: 0; }
.tests-bottom-grid .card-head { padding: 12px 16px; }
.tests-bottom-grid .result-list,
.tests-bottom-grid .leaders { padding: 4px 0 8px; }
.tests-bottom-grid .result-list > li {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  padding: 10px 16px;
}
.tests-bottom-grid .result-list > li:last-child { border-bottom: 0; }

.kib-analytics-card {
  grid-column: 1 / -1;
  overflow: hidden;
  padding: 0;
  margin: 0 0 18px;
}
.kib-analytics-card .card-head {
  gap: 12px;
  align-items: center;
}
.kib-analytics-card .card-head .btn {
  flex: 0 0 auto;
}
.kib-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  padding: 0 16px 16px;
}
.kib-analytics-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
}
.kib-analytics-stats article {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}
.kib-analytics-stats span,
.kib-analytics-weak small {
  display: block;
  color: var(--fg-3);
  font-size: 11px;
  line-height: 1.35;
}
.kib-analytics-stats strong {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  margin-top: 6px;
  color: var(--fg);
  font-size: 24px;
  line-height: 1;
}
.kib-analytics-stats small {
  color: var(--fg-3);
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kib-chart {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.kib-chart h3 {
  margin: 0 0 12px;
  font-size: 14px;
}
.kib-chart ul {
  display: flex;
  align-items: end;
  gap: 10px;
  min-height: 170px;
  margin: 0;
  padding: 10px 0 0;
  border-bottom: 1px solid var(--border);
  list-style: none;
}
.kib-chart li {
  display: grid;
  grid-template-rows: 18px 1fr 18px 18px;
  justify-items: center;
  align-items: end;
  min-width: 0;
  height: 160px;
  flex: 1 1 0;
}
.kib-chart li > strong {
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}
.kib-chart li > small,
.kib-chart li > em {
  color: var(--fg-3);
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
  text-align: center;
}
.kib-column {
  display: block;
  width: min(100%, 34px);
  min-height: 8px;
  border-radius: 5px 5px 0 0;
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.kib-column.bad { background: var(--red); }
.kib-column.warn { background: var(--amber); }
.kib-column.ok { background: var(--green); }
.kib-column.great { background: var(--accent); }
.kib-question-chart {
  grid-column: 1 / -1;
}
.kib-question-chart ul {
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 0;
}
.kib-question-chart li {
  min-width: 38px;
}
.kib-question-chart .kib-column {
  width: 22px;
}
.kib-analytics-weak {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.kib-analytics-weak h3 {
  margin: 0 0 10px;
  font-size: 14px;
}
.kib-analytics-weak ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.kib-analytics-weak li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  align-items: center;
}
.kib-analytics-weak strong {
  display: block;
  overflow: hidden;
  color: var(--fg);
  font-size: 12.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kib-bar {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.kib-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--red));
}

@media (max-width: 720px) {
  .test-grid-rich { grid-template-columns: 1fr; }
  .tests-bottom-grid { grid-template-columns: 1fr; }
  .tests-overview { grid-template-columns: 1fr 1fr; }
  .kib-analytics-grid,
  .kib-analytics-stats {
    grid-template-columns: 1fr;
  }
  .kib-analytics-weak li {
    grid-template-columns: 1fr;
  }
  .kib-analytics-weak strong {
    white-space: normal;
  }
  .kib-chart li {
    min-width: 54px;
  }
  .kib-question-chart li {
    min-width: 36px;
  }
}


/* =============================================================== */
/* Lab — index page redesign                                        */
/* =============================================================== */

.lab-overview { margin-bottom: 22px; }

/* Quick scan */
.lab-quick {
  padding: 18px 20px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 80% at 0% 100%, var(--accent-soft), transparent 60%),
    var(--surface);
}
.lab-quick-head {
  margin-bottom: 12px;
}
.lab-quick-head .eyebrow { margin-bottom: 4px; }
.lab-quick-head h2 { font-size: 18px; letter-spacing: -0.015em; }

.lab-quick-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.lab-quick-form input {
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  outline: 0;
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out);
}
.lab-quick-form input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}

.lab-quick-kind {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.lab-quick-kind[data-kind="url"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.lab-quick-kind[data-kind="password"] {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, 0.3);
}

.lab-quick-result:empty { display: none; }
.lab-quick-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.quick-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quick-result-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.quick-result-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.quick-result-head strong {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  color: var(--fg);
}
.quick-result-head small {
  color: var(--fg-3);
  font-size: 12px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.quick-pw-strength {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 240px;
}
.quick-pw-strength .pw-bar { height: 4px; }
.url-issues.compact,
.pw-issues.compact {
  margin: 0;
}
.url-issues.compact > li,
.pw-issues.compact > li {
  font-size: 12px;
  padding: 5px 10px;
}
.quick-result-clean {
  font-size: 12.5px;
  color: var(--green);
  margin: 0;
}

/* Rich tool grid */
.lab-grid.lab-grid-rich {
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.lab-tool-rich {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out);
}

.lab-tool-rich::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 80px;
  background: linear-gradient(180deg, var(--tool-tint, var(--accent-soft)), transparent);
  opacity: 0.6;
  pointer-events: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.lab-tool-rich:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.lab-tool-rich.tool-password { --tool-tint: color-mix(in srgb, var(--accent) 18%, transparent); --tool-accent: var(--accent); }
.lab-tool-rich.tool-url { --tool-tint: color-mix(in srgb, var(--amber) 18%, transparent); --tool-accent: var(--amber); }
.lab-tool-rich.tool-phish { --tool-tint: color-mix(in srgb, var(--green) 18%, transparent); --tool-accent: var(--green); }

.lab-tool-rich-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.lab-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  font-feature-settings: "tnum";
}
.lab-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--tool-tint);
  color: var(--tool-accent);
  border: 1px solid color-mix(in srgb, var(--tool-accent) 30%, transparent);
}

.lab-tool-art {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  min-height: 100px;
  position: relative;
  z-index: 1;
}

.mini-bar {
  display: grid;
  grid-template-columns: 60px 1fr 56px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.mini-bar code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-bar small {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: right;
  font-weight: 600;
  color: var(--fg-3);
}
.mini-bar small[data-score="0"] { color: var(--red); }
.mini-bar small[data-score="1"] { color: #f97316; }
.mini-bar small[data-score="2"] { color: var(--amber); }
.mini-bar small[data-score="3"] { color: #84cc16; }
.mini-bar small[data-score="4"] { color: var(--green); }
.mini-bar-rail {
  display: block;
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar-rail > span {
  display: block;
  height: 100%;
  background: var(--red);
  border-radius: 999px;
  transition: width var(--motion-slow) var(--ease-snap);
}
.mini-bar-rail > span[data-score="0"] { background: var(--red); }
.mini-bar-rail > span[data-score="1"] { background: #f97316; }
.mini-bar-rail > span[data-score="2"] { background: var(--amber); }
.mini-bar-rail > span[data-score="3"] { background: #84cc16; }
.mini-bar-rail > span[data-score="4"] { background: var(--green); }

.mini-url {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  background: var(--surface);
}
.mini-url.bad { border-color: rgba(239, 68, 68, 0.25); background: var(--red-soft); }
.mini-url.ok { border-color: rgba(34, 197, 94, 0.25); background: var(--green-soft); }
.mini-url code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.mini-url-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-2);
}
.mini-url-badge.accent-pink { background: var(--red-soft); color: var(--red); border-color: transparent; }
.mini-url-badge.accent-orange { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.mini-url-badge.accent-green { background: var(--green-soft); color: var(--green); border-color: transparent; }

.lab-phish-art {
  gap: 10px;
}
.phish-art-row {
  display: flex;
  gap: 6px;
}
.phish-art-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-2);
}
.phish-art-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.phish-art-stats > div {
  padding: 6px 8px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.phish-art-stats > div:last-child { border-right: 0; }
.phish-art-stats strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.phish-art-stats small {
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.phish-art-progress {
  padding: 0 2px;
}
.phish-art-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.phish-art-bar > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width var(--motion-slow) var(--ease-snap);
}

.lab-tool-rich-body { flex: 1; position: relative; z-index: 1; }
.lab-tool-rich-body h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.lab-tool-rich-body p {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-2);
}

.lab-tool-rich-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.lab-feature {
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--fg-3);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.lab-tool-rich-foot .lab-arrow {
  margin-left: auto;
  font-size: 16px;
  color: var(--fg-3);
  transition: color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}
.lab-tool-rich:hover .lab-arrow {
  color: var(--tool-accent);
  transform: translateX(3px);
}

/* Pipeline / roadmap */
.lab-pipeline {
  margin-top: 36px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.lab-pipeline-head {
  margin-bottom: 14px;
}
.lab-pipeline-head .eyebrow { margin-bottom: 4px; }
.lab-pipeline-head h2 { font-size: 20px; letter-spacing: -0.02em; }
.lab-pipeline-head .subtitle {
  font-size: 13px;
  margin-top: 4px;
}

.pipeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.pipeline-list > li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.pipeline-list strong {
  font-size: 13.5px;
  display: block;
  margin-bottom: 2px;
}
.pipeline-list small {
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg-3);
}
.pipeline-stage {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  height: max-content;
  align-self: start;
}
.pipeline-list > li:nth-child(-n+2) .pipeline-stage {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.pipeline-list > li:nth-child(n+3) .pipeline-stage {
  color: var(--fg-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

@media (max-width: 960px) {
  .lab-grid.lab-grid-rich { grid-template-columns: 1fr; }
  .lab-quick-form { grid-template-columns: 1fr auto; }
  .lab-quick-form .lab-quick-kind { grid-column: 1 / 2; justify-self: start; }
}
@media (max-width: 720px) {
  .quick-result-head { grid-template-columns: 1fr; }
  .quick-pw-strength { width: 100%; }
  .lab-overview { grid-template-columns: 1fr 1fr; }
}


/* =============================================================== */
/* Leaderboard — podium + ranked rest                               */
/* =============================================================== */

.leaderboard-card { padding: 0; overflow: hidden; }
.leaderboard {
  display: flex;
  flex-direction: column;
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 8px;
  padding: 16px 14px 12px;
  align-items: end;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.podium-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  min-height: 130px;
  position: relative;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.podium-cell:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.podium-cell.empty {
  background: transparent;
  border: 1px dashed var(--border);
  pointer-events: none;
}

.podium-cell.place-1 {
  min-height: 156px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--amber) 22%, transparent), var(--surface) 60%);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.10);
}
.podium-cell.place-2 {
  background: linear-gradient(180deg, color-mix(in srgb, var(--fg-3) 14%, transparent), var(--surface) 60%);
}
.podium-cell.place-3 {
  background: linear-gradient(180deg, color-mix(in srgb, #cd7f32 22%, transparent), var(--surface) 60%);
  border-color: rgba(205, 127, 50, 0.35);
}

.podium-medal {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}
.podium-cell.place-1 .podium-medal {
  font-size: 28px;
  animation: medal-bob 3s ease-in-out infinite;
}
@keyframes medal-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .podium-cell.place-1 .podium-medal { animation: none; }
}

.podium-avatar {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  padding: 3px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: transform var(--motion-fast) var(--ease-out);
}
.podium-avatar:hover { transform: scale(1.05); }
.podium-avatar svg {
  display: block;
  border-radius: 8px !important;
}

.podium-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.podium-cell.place-1 .podium-name { font-size: 14px; }

.podium-pts {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.podium-pts small {
  font-weight: 500;
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 2px;
}

/* Rest list */
.leaderboard-rest {
  list-style: none;
  margin: 0;
  padding: 0;
}
.leaderboard-rest > li {
  display: grid;
  grid-template-columns: 22px 1fr 60px 36px;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--motion-fast) var(--ease-out);
}
.leaderboard-rest > li:last-child { border-bottom: 0; }
.leaderboard-rest > li:hover { background: var(--hover); }

.leaderboard-rest .rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  text-align: right;
  font-feature-settings: "tnum";
}

.leaderboard-rest .relative-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.leaderboard-rest .relative-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, white));
  border-radius: 999px;
  transition: width var(--motion-slow) var(--ease-snap);
}

.leaderboard-rest .rest-pts {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 12px;
  color: var(--fg-2);
  text-align: right;
}

/* =============================================================== */
/* Lab grid — 2-col mosaic with featured PWD spanning rows          */
/* =============================================================== */

.lab-grid.lab-grid-rich {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-auto-rows: min-content;
  gap: 14px;
  align-items: stretch;
}

.lab-tool-rich.featured {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
}

.lab-tool-rich {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.lab-open-link {
  margin-left: auto;
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  transition: color var(--motion-fast) var(--ease-out);
}
.lab-tool-rich:hover .lab-open-link {
  color: var(--tool-accent, var(--fg));
}

.lab-art-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.lab-art-label .eyebrow { margin-bottom: 0; }
.lab-art-label small {
  font-size: 11px;
  color: var(--fg-3);
}

.lab-art-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
}
.lab-art-summary > div {
  padding: 8px 6px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.lab-art-summary > div:last-child { border-right: 0; }
.lab-art-summary strong {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  font-feature-settings: "tnum";
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lab-art-summary small {
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* Featured card grows lab-tool-art to fill space */
.lab-tool-rich.featured .lab-tool-art {
  flex: 1;
  min-height: 220px;
}
.lab-tool-rich.featured .lab-tool-rich-body h3 {
  font-size: 18px;
}
.lab-tool-rich.featured .lab-tool-rich-body p {
  font-size: 13px;
}

@media (max-width: 960px) {
  .lab-grid.lab-grid-rich {
    grid-template-columns: 1fr;
  }
  .lab-tool-rich.featured {
    grid-row: auto;
  }
  .podium {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .podium-cell { min-height: 110px; padding: 10px 6px; }
  .podium-cell.place-1 { min-height: 130px; }
}
@media (max-width: 720px) {
  .leaderboard-rest > li {
    grid-template-columns: 18px 1fr 40px;
    gap: 8px;
  }
  .leaderboard-rest .rest-pts { display: none; }
}


/* =============================================================== */
/* Lab Workbench — single tabbed surface                            */
/* =============================================================== */

.lab-workbench {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.wb-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.wb-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  color: var(--fg-2);
  transition:
    color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion) var(--ease-snap);
}
.wb-tab:last-child { border-right: 0; }
.wb-tab:hover { background: var(--hover); color: var(--fg); }
.wb-tab.active {
  color: var(--fg);
  background: var(--surface);
  border-bottom-color: var(--accent);
}

.wb-tab-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  font-weight: 600;
}
.wb-tab.active .wb-tab-num { color: var(--accent); }

.wb-tab-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wb-tab-hint {
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

.wb-body {
  padding: 22px;
  min-height: 320px;
}

.wb-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade-in var(--motion) var(--ease-out) both;
}

/* Input row (shared between password and URL) */
.wb-input-row {
  display: flex;
  gap: 8px;
}
.wb-input-row input {
  flex: 1;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg);
  outline: 0;
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out);
}
.wb-input-row input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}
.wb-input-row .icon-btn { width: 40px; height: 40px; }

/* Password strength bar */
.wb-strength {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.wb-strength .pw-bar { height: 6px; }
.wb-strength .pw-strength-label { min-width: 110px; }

/* 5-cell stat grid */
.wb-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-elev);
}
.wb-grid > div {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.wb-grid > div:last-child { border-right: 0; }
.wb-grid strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  font-feature-settings: "tnum";
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-grid small {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

/* Issues + states */
.wb-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  align-items: center;
}
.wb-issue {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--fg);
}
.wb-empty {
  font-size: 12.5px;
  color: var(--fg-3);
  font-style: italic;
}
.wb-clean {
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
}

.wb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.wb-hint {
  font-size: 11.5px;
  color: var(--fg-3);
}

/* URL pane */
.wb-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wb-presets button {
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.wb-presets button:hover {
  background: var(--surface-3);
  color: var(--fg);
  border-color: var(--border-strong);
}

.wb-url-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  min-height: 80px;
}
.wb-url-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wb-url-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.wb-url-host {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
}

.wb-url-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wb-url-parts > span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
}
.wb-url-parts > span small {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.wb-url-parts > span.warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.3);
}

.wb-url-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wb-url-issues > li {
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: var(--r);
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: var(--red-soft);
  color: var(--fg);
  line-height: 1.5;
}

/* Phish pane — embedded sample card */
.wb-phish-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--motion) var(--ease-out);
}
.wb-phish-card.ok { border-color: rgba(34, 197, 94, 0.45); }
.wb-phish-card.bad { border-color: rgba(239, 68, 68, 0.45); }

.wb-phish-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.wb-phish-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wb-phish-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.wb-phish-actions .btn { height: 40px; font-weight: 600; }

.wb-phish-reveal {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-elev);
}
.wb-phish-reveal small { font-size: 12px; color: var(--fg-2); }
.wb-phish-reveal small strong { color: var(--fg); }
.wb-phish-reveal .reveal-flags > li { font-size: 12px; padding: 6px 12px 6px 26px; }

@media (max-width: 720px) {
  .wb-tabs { grid-template-columns: 1fr; }
  .wb-tab { border-right: 0; border-bottom: 1px solid var(--border); }
  .wb-tab.active { border-bottom-color: var(--accent); }
  .wb-body { padding: 16px; }
  .wb-grid { grid-template-columns: repeat(2, 1fr); }
  .wb-grid > div { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .wb-grid > div:nth-child(2n) { border-right: 0; }
  .wb-grid > div:nth-last-child(-n+1) { border-bottom: 0; }
  .wb-foot { flex-direction: column; align-items: flex-start; }
}


/* =============================================================== */
/* Topbar — breadcrumbs + search dropdown                           */
/* =============================================================== */

.topbar-trail {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 360px;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}
.topbar-trail:empty {
  display: none;
}

.trail-item {
  color: var(--fg-3);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  transition: color var(--motion-fast) var(--ease-out);
}
a.trail-item:hover {
  color: var(--fg);
}
.trail-item.current {
  color: var(--fg);
  font-weight: 600;
}
.trail-sep {
  color: var(--fg-4);
  font-family: var(--font-mono);
  font-size: 12px;
  flex: none;
}

/* Search dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.32);
  max-height: 480px;
  overflow-y: auto;
  z-index: 30;
  display: none;
  padding: 6px;
}
.search-dropdown.open { display: block; animation: fade-in 160ms var(--ease-out) both; }

.sd-section + .sd-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.sd-section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.sd-section-head small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  color: var(--fg-4);
}

.sd-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--fg);
  transition: background var(--motion-fast) var(--ease-out);
}
.sd-item:hover { background: var(--hover); }
.sd-kind {
  display: grid;
  place-items: center;
  width: 28px;
  height: 22px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  text-transform: uppercase;
}
.sd-item strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-item small {
  display: block;
  font-size: 11px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-empty {
  padding: 16px 14px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
}
.sd-foot {
  display: block;
  padding: 8px 10px;
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--accent);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  text-decoration: none;
}
.sd-foot:hover {
  background: var(--accent-soft);
}

/* =============================================================== */
/* Forum redesign — active hero + enriched cards                    */
/* =============================================================== */

.forum-active {
  margin-bottom: 22px;
}
.forum-active-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.forum-active-head .eyebrow { margin-bottom: 0; }
.forum-active-head small {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

.forum-active-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.forum-active-card {
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, var(--accent-soft), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.forum-active-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.forum-active-card-link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
  text-indent: -9999px;
  overflow: hidden;
}
.forum-active-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.forum-active-card > header,
.forum-active-card > h3,
.forum-active-card > p,
.forum-active-card > footer {
  position: relative;
  z-index: 2;
}
.forum-active-card > footer .user-chip,
.forum-active-card > footer .forum-active-meta {
  position: relative;
  z-index: 3;
}
.forum-active-card > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.forum-active-card time {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.forum-active-card h3 {
  font-size: 14.5px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.forum-active-card p {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-2);
  flex: 1;
}
.forum-active-card > footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.forum-active-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  font-feature-settings: "tnum";
}

/* Enriched category cards */
.forum-cat-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  border: 0;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  margin-bottom: 22px;
}
.forum-cat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out);
}
.forum-cat:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.forum-cat-link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
  text-indent: -9999px;
  overflow: hidden;
}
.forum-cat-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.forum-cat > .forum-cat-head,
.forum-cat > strong,
.forum-cat > p,
.forum-cat > .forum-cat-foot {
  position: relative;
  z-index: 2;
}
.forum-cat .user-chip {
  position: relative;
  z-index: 3;
}
.forum-cat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.forum-cat-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.forum-cat-icon svg { width: 16px; height: 16px; }
.forum-cat-count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-feature-settings: "tnum";
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-2);
}
.forum-cat strong {
  font-size: 14.5px;
  letter-spacing: -0.005em;
}
.forum-cat p {
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg-2);
  flex: 1;
}
.forum-cat-foot {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.forum-cat-last {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.forum-cat-last small {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.forum-cat-last > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--fg-2);
}
.forum-cat-empty {
  font-size: 11px;
  color: var(--fg-4);
  font-style: italic;
}

/* =============================================================== */
/* Articles — 2-col layout with sidebar of categories               */
/* =============================================================== */

.articles-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  align-items: start;
}

.articles-side {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  align-self: start;
}
.articles-side-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 8px;
}
.articles-side-block .eyebrow {
  padding: 4px 8px 6px;
  margin: 0;
  display: block;
}

/* Sidebar tag cloud (replaces vertical cat-list) */
.cat-cloud-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 8px 8px;
  gap: 8px;
}
.cat-cloud-head .eyebrow { padding: 0; margin: 0; }
.cat-cloud-head small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 11px;
  color: var(--fg-3);
}
.cat-cloud-search {
  display: block;
  padding: 0 6px 8px;
}
.cat-cloud-search input {
  width: 100%;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  padding: 0 10px;
  font-size: 12.5px;
  outline: none;
  transition: border-color var(--motion-fast) var(--ease-out);
}
.cat-cloud-search input:focus {
  border-color: var(--accent);
}
.cat-cloud {
  list-style: none;
  margin: 0;
  padding: 4px 6px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 56vh;
  overflow-y: auto;
}
.cat-cloud > li { display: contents; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.cat-chip:hover {
  background: var(--hover);
  color: var(--fg);
  border-color: var(--border-strong);
}
.cat-chip small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 10.5px;
  color: var(--fg-3);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.cat-chip.active {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
.cat-chip.active small {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.cat-cloud-empty {
  padding: 6px 10px 10px;
  font-size: 11px;
  color: var(--fg-3);
  margin: 0;
}

/* Article create / edit form */
.article-form { gap: 14px; }
.article-form-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
}
.article-form .field input,
.article-form .field textarea,
.article-form .field select {
  font-family: var(--font-sans);
  font-size: 13px;
}
.article-sections-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}
.article-sections-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.article-sections-head small {
  font-size: 11px;
  color: var(--fg-3);
}
#article-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.article-section-block {
  margin: 0;
  padding: 12px 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.article-section-block legend {
  padding: 0 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.article-section-block legend .article-section-num {
  color: var(--accent);
  font-weight: 600;
}
.article-section-actions {
  display: flex;
  justify-content: flex-end;
}
.article-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.article-form-actions .btn { align-self: auto; }

/* Article card extras */
.article-card-user {
  border-left: 2px solid color-mix(in srgb, var(--accent) 60%, var(--border));
}
.article-card-author {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}
.article-card-author .user-chip {
  font-size: 11px;
  padding: 2px 6px;
}
.article-badge-user {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}
.article-author-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 14px;
  font-size: 12px;
  color: var(--fg-3);
}
.article-author-line small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 11px;
}

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

/* Legacy vertical list (kept for any other usage) */
.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 60vh;
  overflow-y: auto;
}
.cat-list-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.cat-list-item:hover {
  background: var(--hover);
  color: var(--fg);
}
.cat-list-item.active {
  background: var(--surface-3);
  color: var(--fg);
  font-weight: 500;
}
.cat-list-item small {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 11px;
  color: var(--fg-3);
}
.cat-list-item.active small { color: var(--accent); }

.articles-main { min-width: 0; }

.article-featured {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  background:
    radial-gradient(ellipse 60% 80% at 0% 100%, var(--accent-soft), transparent 60%),
    var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  margin-bottom: 18px;
  overflow: hidden;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.article-featured:hover { transform: translateY(-1px); border-color: var(--accent); }

.article-featured-side {
  padding: 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 6%, transparent));
}
.featured-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.article-featured-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.article-featured-body h2 {
  font-size: 18px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.article-featured-body p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--fg-2);
}
.article-featured-body footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.article-featured-meta {
  font-size: 11.5px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  margin-left: auto;
}

/* Toolbar (info + sort) */
.articles-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.articles-toolbar-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.articles-toolbar-info .mini-label { margin-bottom: 0; }
.articles-toolbar-info strong {
  font-size: 13px;
  font-weight: 600;
  font-feature-settings: "tnum";
}

@media (max-width: 960px) {
  .topbar-trail { max-width: 200px; }
  .articles-layout { grid-template-columns: 1fr; }
  .articles-side { position: static; }
  .cat-list { max-height: 200px; }
  .cat-cloud { max-height: 220px; }
  .forum-active-grid { grid-template-columns: 1fr; }
  .article-featured { grid-template-columns: 1fr; }
  .article-featured-side { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .topbar-trail { display: none; }
  .articles-toolbar { flex-direction: column; align-items: flex-start; }
  .articles-toolbar .segmented { width: 100%; }
}
