/* ================================================
   KOBOLD PWA — Dashboard Design System
   Ported from kobold-dash.pancake3d.com
   ================================================ */

:root {
  /* Palette — Gremlin DNA */
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-card-hover: #16161f;
  --bg-overlay: rgba(10, 10, 15, 0.92);

  --border: rgba(200, 255, 0, 0.08);
  --border-hover: rgba(200, 255, 0, 0.2);

  --text: #c8c8d0;
  --text-dim: #888899;
  --text-bright: #eeeef4;
  --text-muted: #50506a;

  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.15);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.15);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.15);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.15);
  --lime: #a3ff3c;
  --lime-dim: rgba(163, 255, 60, 0.1);
  --teal: #2ed8a3;
  --teal-dim: rgba(46, 216, 163, 0.12);

  /* Typography */
  --font: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
  --text-xs: clamp(0.65rem, 0.62rem + 0.15vw, 0.72rem);
  --text-sm: clamp(0.75rem, 0.72rem + 0.15vw, 0.82rem);
  --text-base: clamp(0.82rem, 0.78rem + 0.2vw, 0.9rem);
  --text-lg: clamp(0.95rem, 0.88rem + 0.35vw, 1.1rem);
  --text-xl: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --text-2xl: clamp(1.6rem, 1.2rem + 2vw, 2.5rem);
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3.2rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(163, 255, 60, 0.08);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 200ms;

  /* Layout */
  --sidebar-w: 220px;
  --bottom-nav-h: 58px;
}

/* ================================================
   RESET
   ================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  height: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

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

/* ================================================
   A11Y
   ================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100%; left: var(--space-md);
  z-index: 9999; background: var(--lime); color: var(--bg);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: var(--text-sm);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-md); }

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* ================================================
   APP SHELL
   ================================================ */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ================================================
   SIDEBAR — desktop
   ================================================ */
.sidebar {
  display: none;
  flex-direction: column;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: var(--space-lg) var(--space-sm);
  overflow-y: auto;
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm);
  margin-bottom: var(--space-xl);
}

.sidebar-logo-mark {
  font-size: var(--text-2xl);
  font-weight: 900;
  background: linear-gradient(135deg, var(--lime), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  letter-spacing: -0.04em;
}

.sidebar-logo-sub {
  font-size: var(--text-xs);
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.55rem 0.6rem;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-dim);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-link:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-bright);
}

.nav-link.active {
  background: var(--lime-dim);
  color: var(--lime);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; height: 60%; width: 2px;
  background: var(--lime);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-icon {
  width: 16px; height: 16px;
  opacity: 0.5; flex-shrink: 0;
  transition: opacity var(--dur) var(--ease);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-spacer { flex: 1; min-height: var(--space-lg); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

/* ================================================
   BOTTOM NAV — mobile
   ================================================ */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0;
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

.bottom-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  padding: var(--space-xs);
  min-height: 44px; min-width: 44px;
  transition: color var(--dur) var(--ease);
  position: relative;
}

.bottom-btn.active { color: var(--lime); }
.bottom-btn svg { width: 20px; height: 20px; }

.bottom-btn::after {
  content: '';
  position: absolute; top: 0; left: 25%; right: 25%;
  height: 2px; border-radius: 0 0 2px 2px;
  background: var(--lime); opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.bottom-btn.active::after { opacity: 1; }

/* ================================================
   MAIN CONTENT
   ================================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.view-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--bottom-nav-h));
  position: relative;
}

@media (min-width: 768px) {
  .view-container {
    padding: var(--space-xl) var(--space-xl);
    padding-bottom: var(--space-xl);
  }
}

.view { display: none; max-width: 1000px; }
.view.active { display: block; }

/* Slide transitions */
.view.sliding {
  display: block;
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: inherit;
  will-change: transform, opacity;
}

.view.slide-out-left  { animation: slideOutLeft 0.3s var(--ease) forwards; }
.view.slide-out-right { animation: slideOutRight 0.3s var(--ease) forwards; }
.view.slide-in-left   { animation: slideInLeft 0.3s var(--ease) forwards; }
.view.slide-in-right  { animation: slideInRight 0.3s var(--ease) forwards; }

/* Live drag tracking */
.view.dragging {
  display: block;
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: inherit;
  transition: none;
}

@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(-30%); opacity: 0; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(30%); opacity: 0; }
}
@keyframes slideInLeft {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .view.slide-out-left,
  .view.slide-out-right,
  .view.slide-in-left,
  .view.slide-in-right { animation-duration: 0s; }
}

/* ================================================
   VIEW HEADERS
   ================================================ */
.view-header {
  margin-bottom: var(--space-xl);
}

.view-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}

.view-desc {
  font-size: var(--text-sm);
  color: var(--text-dim);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-bright);
  margin: var(--space-xl) 0 var(--space-md);
  letter-spacing: -0.01em;
}

/* ================================================
   CARDS
   ================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color var(--dur) var(--ease);
}

.card:hover { border-color: var(--border-hover); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.card-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* ================================================
   TAGS & BADGES
   ================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.tag-green  { background: var(--green-dim); color: var(--green); }
.tag-purple { background: var(--purple-dim); color: var(--purple); }
.tag-amber  { background: var(--amber-dim); color: var(--amber); }
.tag-red    { background: var(--red-dim); color: var(--red); }
.tag-blue   { background: var(--blue-dim); color: var(--blue); }
.tag-lime   { background: var(--lime-dim); color: var(--lime); }
.tag-teal   { background: var(--teal-dim); color: var(--teal); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ================================================
   DASHBOARD GRID
   ================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 540px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .dash-grid { grid-template-columns: repeat(3, 1fr); }
}

.dash-grid .card-wide {
  grid-column: 1 / -1;
}

@media (min-width: 540px) {
  .dash-grid .card-span-2 { grid-column: span 2; }
}

/* ================================================
   STAT CARDS (dashboard hero row)
   ================================================ */
.stat-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  min-width: 0;
  flex: 1 1 100px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: border-color var(--dur);
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-value {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 800;
  color: var(--green);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.stat-card.accent { border-color: var(--lime-dim); }
.stat-card.accent .stat-value { color: var(--lime); }

/* ================================================
   PROGRESS BARS
   ================================================ */
.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-full);
  overflow: visible;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--lime));
  border-radius: var(--radius-full);
  position: relative;
  transition: width 0.8s var(--ease-out);
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: -1px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--lime), 0 0 14px var(--lime-dim);
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  min-height: 36px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--lime);
  color: var(--bg);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-bright);
  border-color: var(--border-hover);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: var(--text-xs);
  min-height: 28px;
}

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: none; border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
}

.btn-icon:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--border-hover);
  color: var(--text-bright);
}

/* ================================================
   CHAT
   ================================================ */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--bottom-nav-h) - var(--space-lg) * 2 - 4px);
}

@media (min-width: 768px) {
  .chat-wrap { height: calc(100dvh - var(--space-xl) * 2 - 4px); }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: var(--space-sm) 0 var(--space-md);
}

.msg {
  max-width: min(78%, 420px);
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msgIn 0.15s var(--ease-out);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-user {
  align-self: flex-end;
  background: var(--blue-dim);
  color: var(--text-bright);
  border-bottom-right-radius: 3px;
}

.msg-assistant {
  align-self: flex-start;
  background: rgba(163, 255, 60, 0.06);
  color: var(--text);
  border: 1px solid rgba(163, 255, 60, 0.1);
  border-bottom-left-radius: 3px;
}

.msg-system {
  align-self: center;
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  font-size: var(--text-xs);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  max-width: 90%;
  text-align: center;
}


.chat-typing {
  font-size: var(--text-xs);
  color: var(--text-dim);
  padding: var(--space-xs) 0;
  min-height: 1.4em;
}

.chat-form {
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
}

.chat-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem var(--space-md);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  min-height: 40px;
}

.chat-input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-dim);
}

.chat-input::placeholder { color: var(--text-muted); }

/* ================================================
   ENTITY GRID — Home Assistant
   ================================================ */
.ha-summary {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.ha-summary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  transition: border-color var(--dur);
}

.ha-summary-item:hover { border-color: var(--border-hover); }

.entity-section { margin-bottom: var(--space-lg); }

.entity-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-dim);
}

.entity-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.entity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  background: var(--bg-card);
  font-size: var(--text-sm);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background var(--dur);
  gap: var(--space-sm);
}

.entity-row:last-child { border-bottom: none; }
.entity-row:hover { background: var(--bg-card-hover); }

.entity-name { color: var(--text); flex: 1; min-width: 0; }

.entity-state {
  font-size: var(--text-xs);
  font-weight: 600;
  flex-shrink: 0;
}

.entity-state.on   { color: var(--lime); }
.entity-state.off  { color: var(--text-muted); }
.entity-state.unavailable { color: var(--red); }

.entity-toggle {
  width: 36px; height: 20px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.08);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--dur);
  flex-shrink: 0;
}

.entity-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all var(--dur);
}

.entity-toggle.on { background: var(--lime-dim); }
.entity-toggle.on::after {
  left: 18px;
  background: var(--lime);
  box-shadow: 0 0 6px var(--lime-dim);
}

/* ================================================
   INVENTORY
   ================================================ */
.inv-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.inv-tab {
  padding: 0.6rem 1rem;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur);
}

.inv-tab:hover { color: var(--text-bright); }
.inv-tab.active {
  color: var(--lime);
  border-bottom-color: var(--lime);
}

.inv-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: var(--text-sm);
  transition: border-color var(--dur);
}

.inv-item:hover { border-color: var(--border-hover); }

.inv-item-name { flex: 1; color: var(--text); }

.inv-item-expiry {
  font-size: var(--text-xs);
  font-weight: 600;
}

.inv-item-expiry.ok { color: var(--green); }
.inv-item-expiry.warn { color: var(--amber); }
.inv-item-expiry.urgent { color: var(--red); }

.inv-item-location {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

/* ================================================
   SHOPPING LISTS
   ================================================ */
.shop-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-md);
  overflow: hidden;
  transition: border-color var(--dur);
}

.shop-list-card:hover { border-color: var(--border-hover); }

.shop-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  cursor: pointer;
  user-select: none;
}

.shop-list-header:hover { background: var(--bg-card-hover); }

.shop-list-name {
  font-weight: 600;
  color: var(--text-bright);
  font-size: var(--text-sm);
}

.shop-list-count {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.shop-list-body { display: none; padding: 0 1rem 0.8rem; }
.shop-list-card.open .shop-list-body { display: block; }

.shop-list-chevron {
  color: var(--text-dim);
  transition: transform 0.3s;
  font-size: 0.7rem;
}
.shop-list-card.open .shop-list-chevron { transform: rotate(180deg); }

.shop-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.35rem 0;
  font-size: var(--text-sm);
}

.shop-check {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 2px solid var(--border-hover);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: transparent;
  transition: all var(--dur);
}

.shop-check.done {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}

.shop-item-text { color: var(--text); }
.shop-item.done .shop-item-text {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.15);
}

/* ================================================
   RECIPES
   ================================================ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color var(--dur);
}

.recipe-card:hover { border-color: var(--border-hover); }

.recipe-name {
  font-weight: 600;
  color: var(--text-bright);
  font-size: var(--text-sm);
  margin-bottom: 0.4rem;
}

.recipe-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.recipe-ingredients {
  font-size: var(--text-xs);
  color: var(--text);
  line-height: 1.5;
}

.recipe-match {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.recipe-match.high { background: var(--green-dim); color: var(--green); }
.recipe-match.medium { background: var(--amber-dim); color: var(--amber); }
.recipe-match.low { background: var(--red-dim); color: var(--red); }

/* ================================================
   VAULT / KNOWLEDGE BASE
   ================================================ */
.vault-search {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.vault-search-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem var(--space-md);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.vault-search-input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-dim);
}

.vault-search-input::placeholder { color: var(--text-muted); }

.vault-note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color var(--dur);
}

.vault-note:hover { border-color: var(--border-hover); }

.vault-note-title {
  font-weight: 600;
  color: var(--text-bright);
  font-size: var(--text-sm);
  margin-bottom: 0.2rem;
}

.vault-note-excerpt {
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vault-note-meta {
  display: flex;
  gap: var(--space-sm);
  margin-top: 0.4rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.vault-note-links {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

.vault-link {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--purple-dim);
  color: var(--purple);
}

/* ================================================
   PROFILE
   ================================================ */
.profile-hero {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.profile-avatar {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--lime), var(--green));
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--bg);
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--lime-dim);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

@media (min-width: 480px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: center;
  transition: border-color var(--dur);
}

.stat-box:hover { border-color: var(--border-hover); }

.stat-box .stat-value {
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.achievement-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: all var(--dur);
}

.achievement-chip.unlocked {
  background: var(--lime-dim);
  border-color: rgba(163, 255, 60, 0.2);
  color: var(--lime);
}

/* ================================================
   ACTIVITY FEED
   ================================================ */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: var(--text-sm);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.45rem;
}

.activity-dot.xp { background: var(--lime); }
.activity-dot.chat { background: var(--blue); }
.activity-dot.home { background: var(--teal); }
.activity-dot.alert { background: var(--amber); }

.activity-text { color: var(--text); flex: 1; }
.activity-time { font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0; }

/* ================================================
   BRIEFING CARD
   ================================================ */
.briefing-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 0;
  font-size: var(--text-sm);
  color: var(--text);
}

.briefing-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

/* ================================================
   ADD FORMS (inline)
   ================================================ */
.inline-form {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.inline-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--dur);
}

.inline-input:focus {
  border-color: var(--lime);
}

.inline-input::placeholder { color: var(--text-muted); }

/* ================================================
   EMPTY / LOADING STATES
   ================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  opacity: 0.3;
  display: block;
}

.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 25%,
    rgba(255,255,255,0.06) 50%,
    rgba(255,255,255,0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

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

/* ================================================
   SETTINGS
   ================================================ */
.settings-group {
  margin-bottom: var(--space-xl);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: var(--text-sm);
}

.settings-row:last-child { border-bottom: none; }

.settings-label { color: var(--text); }
.settings-detail { font-size: var(--text-xs); color: var(--text-dim); }

/* ================================================
   ANIMATIONS
   ================================================ */
@media (prefers-reduced-motion: no-preference) {
  .card { animation: fadeUp 0.3s var(--ease-out) backwards; }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
