:root {
  color-scheme: dark;
  --bg: #05070d;
  --bg-soft: #07111f;
  --fg: #f4f7fb;
  --muted: #aab6c8;
  --dim: #728197;
  --line: rgba(255,255,255,.13);
  --glass: rgba(255,255,255,.075);
  --glass-strong: rgba(255,255,255,.12);
  --accent: #79ffd0;
  --accent-2: #7aa7ff;
  --accent-3: #d98cff;
  --shadow: 0 30px 100px rgba(0,0,0,.45);
  --radius-xl: 22px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fg);
  background:
    radial-gradient(circle at 12% 12%, rgba(121,255,208,.22), transparent 28rem),
    radial-gradient(circle at 86% 4%, rgba(122,167,255,.20), transparent 30rem),
    radial-gradient(circle at 70% 86%, rgba(217,140,255,.12), transparent 26rem),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-soft) 48%, #03040a 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 72%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }
.shell { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }

.nav {
  position: sticky;
  top: 14px;
  z-index: 10;
  width: min(1120px, calc(100% - 40px));
  margin: 14px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5,7,13,.62);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
}

.brand, .nav nav { display: flex; align-items: center; gap: 10px; }
.brand { text-decoration: none; font-weight: 850; letter-spacing: -.02em; }
.nav-dashboard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(121,255,208,.36);
  border-radius: 12px;
  color: var(--accent);
  background: rgba(121,255,208,.08);
  font-size: .92rem;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 0 24px rgba(121,255,208,.10);
}
.nav-dashboard:hover { background: rgba(121,255,208,.14); color: var(--fg); }
.nav .brand-avatar {
  display: block;
  flex: 0 0 36px;
  width: 36px !important;
  max-width: 36px;
  height: 36px !important;
  max-height: 36px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(121,255,208,.42);
  box-shadow: 0 0 28px rgba(121,255,208,.24);
}
.nav nav a {
  padding: 8px 12px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
  transition: color .2s ease, background .2s ease;
}
.nav nav a:hover { color: var(--fg); background: rgba(255,255,255,.08); }

.hero {
  min-height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(310px, .72fr);
  align-items: center;
  gap: clamp(22px, 5vw, 58px);
  padding: clamp(56px, 9vw, 120px) 0 64px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.7rem, 6.4vw, 5.45rem);
  line-height: .96;
  letter-spacing: -.055em;
}
h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: .95;
  letter-spacing: -.055em;
}
h3 { margin: 18px 0 8px; font-size: 1.2rem; line-height: 1.15; }
.lead {
  max-width: 720px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
}

.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 850;
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.button:hover { transform: translateY(-2px); }
.primary { color: #04100c; background: linear-gradient(135deg, var(--accent), #b8ffe8); }
.ghost { color: var(--fg); border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.ghost:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); }

.terminal {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.045));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overflow: hidden;
  transform: rotate(1.5deg);
}
.terminal::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: radial-gradient(circle at 20% 0%, rgba(121,255,208,.28), transparent 38%), radial-gradient(circle at 100% 40%, rgba(122,167,255,.24), transparent 34%);
  pointer-events: none;
}
.terminal-bar { position: relative; display: flex; gap: 8px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.terminal-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--dim); }
.terminal-bar span:nth-child(1) { background: #ff6b6b; }
.terminal-bar span:nth-child(2) { background: #ffd166; }
.terminal-bar span:nth-child(3) { background: #79ffd0; }
pre {
  position: relative;
  margin: 0;
  padding: clamp(22px, 4vw, 36px);
  color: #d7ffeF;
  white-space: pre-wrap;
  font: 700 clamp(.92rem, 1.5vw, 1.04rem)/1.9 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.section { padding: 76px 0; }
.section-head { max-width: 760px; margin-bottom: 24px; }
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.card, .cta, .split, .agent-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: blur(18px);
}
.card {
  min-height: 250px;
  padding: 24px;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); background: var(--glass-strong); border-color: rgba(121,255,208,.32); }
.card p, .principles p, .cta p { color: var(--muted); margin: 0; }
.icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(121,255,208,.30);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(121,255,208,.08);
  font-weight: 900;
}

.split {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 28px;
  padding: clamp(28px, 6vw, 54px);
}
.principles { display: grid; gap: 18px; }
.principles strong { color: var(--fg); }

.cta {
  margin-top: 30px;
  margin-bottom: 30px;
  padding: clamp(30px, 7vw, 70px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(121,255,208,.16), transparent 32rem),
    rgba(255,255,255,.075);
}
.cta p { max-width: 560px; margin: 18px auto 26px; }

.agent-panel {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: clamp(22px, 5vw, 46px);
  margin-top: 30px;
  margin-bottom: 30px;
  padding: clamp(24px, 6vw, 54px);
  background:
    radial-gradient(circle at 12% 50%, rgba(121,255,208,.16), transparent 22rem),
    rgba(255,255,255,.075);
}
.agent-panel p:not(.eyebrow) { max-width: 680px; color: var(--muted); margin: 18px 0 0; }
.agent-avatar-wrap {
  position: relative;
  width: 190px;
  aspect-ratio: 1;
  border-radius: 20px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(121,255,208,.72), rgba(122,167,255,.55));
  box-shadow: 0 22px 70px rgba(0,0,0,.34), 0 0 42px rgba(121,255,208,.16);
}
.agent-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.16);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 0 34px;
  color: var(--dim);
  font-size: .95rem;
}

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .terminal { transform: none; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .agent-panel { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell, .nav { width: min(100% - 28px, 1120px); }
  .nav { align-items: center; border-radius: 16px; gap: 12px; }
  .nav nav { display: none; }
  .nav-dashboard { min-height: 34px; padding: 0 12px; font-size: .88rem; }
  .hero { padding-top: 44px; }
  h1 { font-size: clamp(2.45rem, 13vw, 3.75rem); }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: auto; }
  .agent-avatar-wrap { width: min(170px, 68vw); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
/* Dashboard / auth extras — appended to main style.css */

.dashboard-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.auth-shell {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
}
.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 20% 0%, rgba(121,255,208,.14), transparent 18rem),
    var(--glass);
  backdrop-filter: blur(18px);
  padding: clamp(28px, 6vw, 48px);
  box-shadow: var(--shadow);
}
.auth-lead { color: var(--muted); margin: 14px 0 24px; }
.auth-error {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255,120,80,.45);
  border-radius: 10px;
  background: rgba(255,80,50,.08);
  color: #ffb3a0;
}
.auth-form { display: grid; gap: 10px; }
.auth-form label { color: var(--muted); font-size: .9rem; font-weight: 700; }
.auth-form input[type="text"], .auth-form input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: var(--fg);
  font: inherit;
  outline: none;
}
.auth-form input:focus { border-color: rgba(121,255,208,.55); }
.remember-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; }

.db-warn {
  margin: 0 0 20px;
  padding: 14px 20px;
  border: 1px solid rgba(255,120,80,.45);
  border-radius: 10px;
  background: rgba(255,80,50,.08);
  color: #ffb3a0;
  font-size: .95rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, .6fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.055);
  padding: 16px 18px;
}
.metric-card span { display: block; color: var(--muted); font-size: .82rem; font-weight: 750; }
.metric-card strong { display: block; margin-top: 6px; font-size: 1.65rem; line-height: 1; }
.metric-danger strong { color: #ff9d8f; }

.dash-todo, .dash-status { min-width: 0; padding: 24px 28px; overflow: hidden; }

.todo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.todo-head h3 { margin: 0; }
.todo-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.todo-filters a {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: .83rem;
  font-weight: 800;
}
.todo-filters a.active,
.todo-filters a:hover { color: var(--accent); background: rgba(121,255,208,.10); border-color: rgba(121,255,208,.32); }

.todo-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.todo-form-extended {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 150px 56px;
  align-items: stretch;
}
.todo-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: var(--fg);
  font: inherit;
  font-size: .97rem;
  outline: none;
  transition: border-color .2s;
}
.todo-input:focus {
  border-color: rgba(121,255,208,.55);
  background:
    linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.055)),
    radial-gradient(circle at 0 0, rgba(121,255,208,.13), transparent 16rem);
  box-shadow: 0 0 0 3px rgba(121,255,208,.07);
}
.todo-input::placeholder { color: var(--dim); }
.todo-form-extended > .todo-input,
.todo-form-extended > .todo-textarea,
.todo-form-extended > .token-field,
.todo-edit-form > .todo-input,
.todo-edit-form > .todo-textarea,
.todo-edit-form > .token-field {
  grid-column: 1 / -1;
}
.todo-textarea {
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.045)),
    radial-gradient(circle at 0 0, rgba(121,255,208,.10), transparent 18rem);
  color: var(--fg);
  font: inherit;
  font-size: .94rem;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.todo-textarea:focus {
  border-color: rgba(121,255,208,.58);
  background:
    linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.055)),
    radial-gradient(circle at 0 0, rgba(121,255,208,.16), transparent 18rem);
  box-shadow: 0 0 0 3px rgba(121,255,208,.08), inset 0 1px 0 rgba(255,255,255,.05);
}
.todo-textarea::placeholder { color: var(--dim); }

.token-field {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.045)),
    radial-gradient(circle at 0 0, rgba(122,167,255,.08), transparent 16rem);
  color: var(--fg);
  position: relative;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.token-field:focus-within {
  border-color: rgba(121,255,208,.55);
  background: rgba(255,255,255,.075);
  box-shadow: 0 0 0 3px rgba(121,255,208,.07);
}
.token-list {
  display: contents;
}
.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 4px 0 9px;
  border-radius: 7px;
  color: #eaf4ff;
  background: linear-gradient(135deg, #1976d2, #0d5fb4);
  border: 1px solid rgba(255,255,255,.14);
  font-size: .76rem;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}
.topic-token-field .token-pill {
  background: linear-gradient(135deg, #5b65d8, #3647b5);
}
.token-remove {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 50%;
  color: #eaf4ff;
  background: rgba(0,0,0,.22);
  cursor: pointer;
  font: 900 .82rem/1 inherit;
  padding: 0;
}
.token-remove:hover {
  background: rgba(0,0,0,.38);
}
.token-input {
  flex: 1 1 180px;
  min-width: 160px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: .94rem;
  outline: none;
  padding: 6px 2px;
}
.token-input::placeholder { color: var(--dim); }


.token-suggestions {
  position: absolute;
  z-index: 20;
  left: 8px;
  right: 8px;
  top: calc(100% + 6px);
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: rgba(12,18,30,.96);
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  backdrop-filter: blur(16px);
}
.token-suggestions[hidden] { display: none; }
.token-suggestion {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: #dce8ff;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: .86rem;
  font-weight: 750;
  text-align: left;
}
.token-suggestion:hover,
.token-suggestion:focus {
  color: #07120f;
  background: linear-gradient(135deg, var(--accent), #5ee6ff);
  outline: none;
}

.todo-select, .todo-date {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: var(--fg);
  font: inherit;
  outline: none;
}
.todo-select:focus, .todo-date:focus { border-color: rgba(121,255,208,.55); }

.todo-empty { color: var(--muted); font-style: italic; margin: 0; }

.todo-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.todo-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  transition: background .2s;
}
.todo-item:hover { background: rgba(255,255,255,.07); }
.todo-overdue { border-color: rgba(255,120,80,.38); background: rgba(255,80,50,.055); }
.todo-done .todo-title { color: var(--dim); text-decoration: line-through; }
.todo-main { min-width: 0; display: grid; gap: 6px; }
.todo-title { font-size: .97rem; overflow-wrap: anywhere; }
.todo-description { color: var(--muted); font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.todo-meta { font-size: .76rem; color: var(--dim); white-space: nowrap; }
.todo-actions {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: end;
  gap: 6px;
}
.todo-actions form { display: contents; }
.todo-edit-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 150px auto;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}
.todo-edit-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.todo-edit-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255,255,255,.055);
  font: 900 1rem/1 inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.todo-edit-icon:hover {
  transform: translateY(-1px);
  text-decoration: none;
}
.todo-edit-cancel:hover {
  color: #ff9d8f;
  border-color: rgba(255,120,80,.45);
  background: rgba(255,80,50,.12);
}
.todo-edit-save {
  color: #07120f;
  border-color: rgba(121,255,208,.58);
  background: linear-gradient(135deg, var(--accent), #5ee6ff);
}
.todo-edit-save:hover {
  color: #07120f;
  border-color: rgba(121,255,208,.8);
  background: linear-gradient(135deg, #9effdd, #8cf0ff);
}
.todo-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.priority-badge, .due-badge, .tag-badge, .topic-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: .72rem;
  font-weight: 850;
  color: var(--muted);
  background: rgba(255,255,255,.06);
}
.priority-high { color: #ffb2a4; background: rgba(255,80,50,.12); }
.priority-normal { color: var(--accent); background: rgba(121,255,208,.10); }
.priority-low { color: #b8c6e6; }
.due-overdue { color: #ff9d8f; background: rgba(255,80,50,.12); }
.topic-badge { color: #d7e1ff; background: rgba(122,167,255,.12); }
.tag-badge { color: #79ffd0; background: rgba(121,255,208,.08); }

.btn-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  transition: background .2s, color .2s;
}
.btn-icon:hover { background: rgba(121,255,208,.14); color: var(--accent); }
.btn-danger:hover { background: rgba(255,80,50,.14); color: #ff9080; border-color: rgba(255,80,50,.35); }
.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: .78rem;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}
.btn-text:hover { background: rgba(121,255,208,.14); color: var(--accent); }
.btn-text.btn-danger { color: #ffb0a4; border-color: rgba(255,80,50,.28); }

.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.status-list li { font-size: .95rem; color: var(--muted); }
.status-list strong { color: var(--fg); display: inline-block; min-width: 110px; }
.status-note {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}
.error-page { min-height: calc(100vh - 180px); display: grid; align-items: center; }
.error-card { min-height: auto; padding: clamp(28px, 6vw, 54px); }
.error-card .lead { margin-top: 18px; }

@media (max-width: 780px) {
  .section { padding-top: 44px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .todo-head { align-items: flex-start; flex-direction: column; }
  .todo-form-extended { grid-template-columns: 1fr 1fr; }
  .todo-form-extended .todo-input,
  .todo-form-extended .token-field { grid-column: 1 / -1; }
  .todo-form-extended .button { grid-column: 1 / -1; width: 100%; border-radius: 10px; }
  .todo-edit-form { grid-template-columns: 1fr 1fr; }
  .todo-edit-form .todo-input,
  .todo-edit-form .token-field { grid-column: 1 / -1; }
  .todo-edit-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .todo-actions { grid-template-columns: repeat(3, 1fr); justify-content: stretch; }
  .todo-item { grid-template-columns: minmax(0, 1fr); }
  .todo-meta { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .dashboard-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .dashboard-actions,
  .dashboard-actions .button {
    width: 100%;
  }
  .dashboard-actions .button { justify-content: center; }

  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { padding: 14px 16px; }

  .dash-todo, .dash-status {
    padding: 18px 16px;
    border-radius: 14px;
  }

  .todo-filters { width: 100%; }
  .todo-filters a {
    flex: 1 1 auto;
    text-align: center;
  }

  .todo-form-extended {
    display: grid;
    grid-template-columns: 1fr;
  }
  .todo-edit-form { grid-template-columns: 1fr; }
  .todo-input,
  .todo-textarea,
  .todo-select,
  .todo-date,
  .token-field,
  .todo-form-extended .button {
    width: 100%;
    border-radius: 10px;
  }
  .todo-edit-actions { justify-content: flex-end; }

  .todo-textarea { min-height: 86px; }

  .todo-item {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }
  .todo-main { gap: 8px; }
  .todo-title { font-size: 1rem; line-height: 1.35; }
  .todo-meta {
    grid-column: auto;
    white-space: normal;
  }
  .todo-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .todo-actions form { display: contents !important; }
  .btn-text { width: 100%; min-height: 40px; border-radius: 8px; }
  .btn-icon {
    width: 100%;
    height: 38px;
    border-radius: 8px;
  }
}

@media (max-width: 380px) {
  .dash-todo, .dash-status { padding: 16px 12px; }
  .priority-badge, .due-badge { font-size: .68rem; }
}

/* Project management */
.project-grid,
.project-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}
.project-form,
.project-task-form {
  display: grid;
  gap: 10px;
}
.project-task-form {
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(110px, .35fr));
  margin-bottom: 18px;
}
.project-task-form .todo-input:first-child,
.project-task-form .todo-textarea {
  grid-column: 1 / -1;
}
.project-list { display: grid; gap: 12px; }
.project-card {
  min-height: auto;
  display: grid;
  gap: 14px;
}
.project-card h3 { margin: 6px 0 8px; }
.project-card h3 a { color: var(--fg); text-decoration: none; }
.project-card h3 a:hover { color: var(--accent); }
.project-card p { color: var(--muted); margin: 0; }
.project-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #dce8ff;
  background: rgba(122,167,255,.13);
}
.project-status-active,
.project-status-in_progress { color: var(--accent); background: rgba(121,255,208,.11); }
.project-status-planned,
.project-status-open { color: #dce8ff; background: rgba(122,167,255,.13); }
.project-status-paused,
.project-status-blocked { color: #ffdca4; background: rgba(255,209,102,.13); }
.project-status-done { color: #b9f8cb; background: rgba(70,220,120,.12); }
.project-status-archived { color: var(--dim); background: rgba(255,255,255,.06); }
.project-progress { display: grid; gap: 6px; }
.project-progress span { color: var(--muted); font-size: .82rem; font-weight: 850; }
.project-progress div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.project-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #5ee6ff);
}
.project-card-meta,
.project-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.project-card-meta span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}
.project-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-task-item { grid-template-columns: minmax(0, 1fr) minmax(130px, auto); }
.task-status-form { min-width: 130px; }
.time-entry-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.time-entry-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.time-entry-list strong { color: var(--fg); }
.gantt-card { min-height: auto; padding: 18px; }
.gantt-row {
  display: grid;
  grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.gantt-row:last-child { border-bottom: 0; }
.gantt-label { color: var(--muted); font-weight: 800; overflow-wrap: anywhere; }
.gantt-track {
  min-height: 34px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  overflow: hidden;
}
.gantt-bar {
  min-width: 46px;
  height: 24px;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
}
@media (max-width: 780px) {
  .project-grid,
  .project-detail-grid,
  .project-task-form,
  .gantt-row { grid-template-columns: 1fr; }
  .project-task-item { grid-template-columns: 1fr; }
}

.api-key-panel { margin-bottom: 16px; }
.api-key-secret {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(121,255,208,.35);
  border-radius: 10px;
  background: rgba(121,255,208,.08);
  color: var(--fg);
}
.api-key-secret code {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0,0,0,.25);
  overflow-wrap: anywhere;
}
.api-key-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.api-key-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
}
.api-key-list span { color: var(--muted); font-size: .82rem; }
.api-key-revoked { opacity: .62; }
@media (max-width: 560px) { .api-key-list li { align-items: stretch; flex-direction: column; } }

/* Mobile usability polish */
.section { padding-bottom: clamp(42px, 8vw, 84px); }
.button,
.btn-text,
.todo-select,
.todo-date,
.todo-input,
.todo-textarea {
  -webkit-tap-highlight-color: rgba(121,255,208,.16);
}
.button,
.btn-text,
.todo-select,
.todo-date,
.todo-input { min-height: 44px; }
.card {
  overflow-wrap: anywhere;
}
.project-card {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.088), rgba(255,255,255,.052)),
    radial-gradient(circle at 0 0, rgba(121,255,208,.09), transparent 18rem);
}
.project-card h3 { font-size: clamp(1.12rem, 3.5vw, 1.35rem); line-height: 1.2; }
.project-card-actions .button { min-height: 42px; }
.project-card-meta span,
.todo-badges span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
}
.project-progress div { height: 11px; }
.project-task-item .task-status-form { width: 100%; }
.project-task-item .task-status-form .todo-select { width: 100%; }
.time-entry-list li { line-height: 1.35; }
.gantt-card { overflow-x: auto; }

@media (max-width: 700px) {
  html { scroll-padding-top: 84px; }
  body { font-size: 15px; }
  .shell,
  .nav { width: min(100% - 24px, 1120px); }
  .nav {
    top: 8px;
    margin-top: 8px;
    border-radius: 16px;
    gap: 10px;
  }
  .nav nav { gap: 4px; overflow-x: auto; padding-bottom: 1px; }
  .nav nav a,
  .nav-dashboard { white-space: nowrap; }
  .section { padding-top: 32px; }
  .section-head h2,
  .dashboard-head h2 { margin-bottom: 8px; line-height: 1.08; }
  .dashboard-head { gap: 14px; }
  .dashboard-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .dashboard-actions .button { min-height: 44px; padding-inline: 10px; }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric-card {
    padding: 13px 14px;
    border-radius: 14px;
  }
  .metric-card span { font-size: .75rem; }
  .metric-card strong { font-size: 1.35rem; }
  .project-grid,
  .project-detail-grid { gap: 12px; margin-bottom: 14px; }
  .project-create-card,
  .project-summary-card,
  .project-card,
  .dash-todo,
  .dash-status,
  .gantt-card {
    padding: 16px;
    border-radius: 16px;
  }
  .project-form,
  .project-task-form { gap: 9px; }
  .project-task-form { margin-bottom: 14px; }
  .project-card { gap: 12px; }
  .project-card-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .project-card-meta span {
    justify-content: center;
    padding: 6px 7px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    background: rgba(255,255,255,.045);
    text-align: center;
    font-size: .76rem;
  }
  .project-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .project-card-actions .button { width: 100%; justify-content: center; }
  .todo-list { gap: 10px; }
  .todo-item,
  .project-task-item {
    padding: 13px;
    border-radius: 14px;
  }
  .todo-badges { gap: 5px; }
  .priority-badge,
  .due-badge,
  .tag-badge,
  .topic-badge,
  .project-status {
    font-size: .68rem;
    padding-inline: 7px;
  }
  .api-key-secret code { font-size: .78rem; line-height: 1.45; }
  .api-key-list li { padding: 12px; border-radius: 14px; }
}

@media (max-width: 430px) {
  .shell,
  .nav { width: min(100% - 18px, 1120px); }
  .brand span { display: none; }
  .dashboard-actions { grid-template-columns: 1fr; }
  .metric-grid,
  .project-metrics { grid-template-columns: 1fr 1fr; }
  .project-card-meta { grid-template-columns: 1fr; }
  .project-card-actions { grid-template-columns: 1fr; }
  .project-create-card,
  .project-summary-card,
  .project-card,
  .dash-todo,
  .dash-status,
  .gantt-card { padding: 14px; }
  .todo-input,
  .todo-select,
  .todo-date { padding-inline: 12px; }
  .todo-textarea { min-height: 92px; }
  .gantt-row { gap: 7px; padding: 12px 0; }
  .gantt-track { min-width: 260px; }
}

/* Velzon-inspired dark application shell (custom, not a template copy) */
body.app-mode {
  --bg: #0b0f19;
  --bg-soft: #111827;
  --fg: #e5ecf6;
  --muted: #9aa7b8;
  --dim: #6b7788;
  --line: #263241;
  --glass: #151c2b;
  --glass-strong: #192335;
  --accent: #3ddc97;
  --accent-2: #3577f1;
  --accent-3: #a855f7;
  --shadow: 0 12px 34px rgba(0,0,0,.32);
  background: #0f1724;
  color: var(--fg);
}
body.app-mode::before {
  background-image: none;
  mask-image: none;
}
body.app-mode .noise { display: none; }
body.app-mode .nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 248px;
  height: 100vh;
  margin: 0;
  padding: 18px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
  justify-content: stretch;
  gap: 20px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #111827;
  box-shadow: 10px 0 30px rgba(0,0,0,.24);
  backdrop-filter: none;
}
body.app-mode .brand {
  min-height: 48px;
  padding: 0 8px;
  color: #f8fafc;
  font-size: 1.05rem;
}
body.app-mode .nav .brand-avatar {
  width: 34px !important;
  height: 34px !important;
  border-color: rgba(61,220,151,.32);
  box-shadow: 0 0 0 4px rgba(61,220,151,.08);
}
body.app-mode .nav nav {
  display: grid;
  align-content: start;
  gap: 6px;
}
body.app-mode .nav nav a,
body.app-mode .nav-dashboard {
  min-height: 42px;
  justify-content: flex-start;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #aeb9c8;
  background: transparent;
  box-shadow: none;
  font-size: .92rem;
  font-weight: 700;
}
body.app-mode .nav nav a:hover,
body.app-mode .nav-dashboard:hover {
  color: #fff;
  background: rgba(53,119,241,.14);
}
body.app-mode .nav nav a[href="/projects"],
body.app-mode .nav-dashboard {
  color: #fff;
  background: linear-gradient(90deg, rgba(53,119,241,.26), rgba(53,119,241,.08));
}
body.app-mode .nav-dashboard::before { content: "↳"; margin-right: 8px; color: var(--accent); }
body.app-mode .shell {
  width: min(100% - 48px, 1440px);
  margin-left: calc(248px + 24px);
  margin-right: 24px;
}
body.app-mode .section {
  padding: 28px 0 46px;
}
body.app-mode .section::before {
  content: "Datryx Workspace";
  display: flex;
  align-items: center;
  min-height: 56px;
  margin: -28px 0 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #0f1724;
  color: #dbe4f0;
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: .02em;
}
body.app-mode .dashboard-head,
body.app-mode .section-head {
  max-width: none;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #151c2b;
  box-shadow: 0 1px 0 rgba(255,255,255,.03);
}
body.app-mode .eyebrow {
  margin-bottom: 8px;
  color: var(--accent-2);
  font-size: .72rem;
  letter-spacing: .12em;
}
body.app-mode h2 {
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  letter-spacing: -.03em;
  line-height: 1.12;
}
body.app-mode h3 { font-size: 1.04rem; letter-spacing: -.01em; }
body.app-mode .muted,
body.app-mode .project-card p,
body.app-mode .todo-description,
body.app-mode .status-note { color: var(--muted); }
body.app-mode .card,
body.app-mode .dash-todo,
body.app-mode .dash-status,
body.app-mode .project-card,
body.app-mode .project-create-card,
body.app-mode .project-summary-card,
body.app-mode .metric-card,
body.app-mode .gantt-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #151c2b;
  box-shadow: 0 1px 0 rgba(255,255,255,.025), var(--shadow);
  backdrop-filter: none;
}
body.app-mode .card:hover,
body.app-mode .project-card:hover {
  transform: none;
  border-color: #334155;
  background: #182132;
}
body.app-mode .metric-grid { gap: 14px; }
body.app-mode .metric-card { min-height: auto; padding: 16px; }
body.app-mode .metric-card span { color: #8f9bad; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
body.app-mode .metric-card strong { color: #f8fafc; font-size: 1.55rem; }
body.app-mode .button,
body.app-mode .btn-text {
  border-radius: 7px;
  font-weight: 750;
}
body.app-mode .primary {
  color: #fff;
  background: #3577f1;
  box-shadow: 0 8px 18px rgba(53,119,241,.22);
}
body.app-mode .primary:hover { background: #2f6fe2; }
body.app-mode .ghost,
body.app-mode .btn-text {
  color: #c6d0df;
  border-color: #334155;
  background: #1b2535;
}
body.app-mode .ghost:hover,
body.app-mode .btn-text:hover {
  color: #fff;
  border-color: #3d4a5d;
  background: #233047;
}
body.app-mode .todo-input,
body.app-mode .todo-textarea,
body.app-mode .todo-select,
body.app-mode .todo-date,
body.app-mode .token-field {
  border-color: #303c4d;
  border-radius: 7px;
  background: #111827;
  color: #e5ecf6;
  box-shadow: none;
}
body.app-mode .todo-input:focus,
body.app-mode .todo-textarea:focus,
body.app-mode .todo-select:focus,
body.app-mode .todo-date:focus,
body.app-mode .token-field:focus-within {
  border-color: #3577f1;
  background: #101725;
  box-shadow: 0 0 0 3px rgba(53,119,241,.18);
}
body.app-mode .todo-item,
body.app-mode .time-entry-list li,
body.app-mode .api-key-list li {
  border-color: #293548;
  border-radius: 8px;
  background: #111827;
}
body.app-mode .todo-item:hover { background: #162033; }
body.app-mode .todo-title { color: #f1f5f9; font-weight: 750; }
body.app-mode .project-status {
  border-radius: 4px;
  min-height: 22px;
  padding: 0 7px;
  font-size: .68rem;
  letter-spacing: .035em;
}
body.app-mode .project-status-active,
body.app-mode .project-status-in_progress,
body.app-mode .priority-normal {
  color: #3ddc97;
  background: rgba(61,220,151,.12);
}
body.app-mode .project-status-planned,
body.app-mode .project-status-open { color: #74a7ff; background: rgba(53,119,241,.14); }
body.app-mode .project-status-paused,
body.app-mode .project-status-blocked { color: #f7b84b; background: rgba(247,184,75,.14); }
body.app-mode .project-status-done { color: #45cb85; background: rgba(69,203,133,.14); }
body.app-mode .priority-high { color: #f06548; background: rgba(240,101,72,.14); }
body.app-mode .priority-badge,
body.app-mode .due-badge,
body.app-mode .tag-badge,
body.app-mode .topic-badge {
  border-radius: 4px;
  background: #202b3d;
}
body.app-mode .project-progress div { background: #253247; }
body.app-mode .project-progress i { background: linear-gradient(90deg, #3577f1, #3ddc97); }
body.app-mode .api-key-secret {
  border-color: rgba(61,220,151,.26);
  background: rgba(61,220,151,.08);
}
body.app-mode .footer {
  margin-left: calc(248px + 24px);
  margin-right: 24px;
  color: #7f8da1;
}

@media (max-width: 920px) {
  body.app-mode .nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 10px 12px;
    display: flex;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  body.app-mode .brand { min-height: 40px; flex: 0 0 auto; }
  body.app-mode .nav nav { display: flex; gap: 4px; flex: 1 0 auto; }
  body.app-mode .nav nav a,
  body.app-mode .nav-dashboard { min-height: 38px; white-space: nowrap; }
  body.app-mode .shell,
  body.app-mode .footer {
    width: min(100% - 24px, 1120px);
    margin-left: auto;
    margin-right: auto;
  }
  body.app-mode .section { padding-top: 18px; }
  body.app-mode .section::before { display: none; }
}

@media (max-width: 560px) {
  body.app-mode .dashboard-head,
  body.app-mode .section-head { padding: 15px; }
  body.app-mode .project-grid,
  body.app-mode .project-detail-grid { gap: 12px; }
  body.app-mode .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.app-mode .dash-todo,
  body.app-mode .dash-status,
  body.app-mode .project-card,
  body.app-mode .project-create-card,
  body.app-mode .project-summary-card { padding: 14px; }
}

/* App navigation cleanup */
body.app-mode .nav nav a[href="/projects"] { color: #aeb9c8; background: transparent; }
body.app-mode .nav nav a[href="/projects"]:hover { color: #fff; background: rgba(53,119,241,.14); }
body.app-mode .nav nav a.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(53,119,241,.34), rgba(53,119,241,.10));
  box-shadow: inset 3px 0 0 #3577f1;
}
body.app-mode .nav nav a span { display: inline-flex; align-items: center; gap: 8px; }
body.app-mode .nav nav a[href="/dashboard"] span::before { content: "▦"; color: #74a7ff; width: 16px; }
body.app-mode .nav nav a[href="/projects"] span::before { content: "▣"; color: #3ddc97; width: 16px; }
body.app-mode .nav nav a[href="/control"] span::before { content: "⚙"; color: #f7b84b; width: 16px; }
body.app-mode .nav nav a[href*="api-key"] span::before { content: "◆"; color: #a855f7; width: 16px; }
body.app-mode .nav nav a[href="/"] span::before { content: "↩"; color: #8f9bad; width: 16px; }
body.app-mode .nav-dashboard {
  align-self: end;
  justify-content: center;
  min-height: 42px;
  color: #f7b84b;
  border: 1px solid rgba(247,184,75,.28);
  background: rgba(247,184,75,.08);
}
body.app-mode .nav-dashboard::before { content: none; }
body.app-mode .nav-dashboard:hover {
  color: #fff;
  border-color: rgba(247,184,75,.42);
  background: rgba(247,184,75,.14);
}
body.app-mode .footer { padding-bottom: 20px; }

@media (max-width: 920px) {
  body.app-mode .nav nav a.is-active { box-shadow: inset 0 -2px 0 #3577f1; }
  body.app-mode .nav nav a span::before { display: none; }
  body.app-mode .nav-dashboard {
    align-self: center;
    flex: 0 0 auto;
    padding-inline: 12px;
  }
}

@media (max-width: 560px) {
  body.app-mode .nav {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }
  body.app-mode .nav nav {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body.app-mode .nav nav::-webkit-scrollbar { display: none; }
  body.app-mode .nav nav a { padding-inline: 10px; }
  body.app-mode .nav-dashboard { min-width: 0; padding-inline: 10px; }
}

/* Velzon-style component pass: cards, widgets, forms, tables, badges */
body.app-mode .dashboard-grid,
body.app-mode .project-grid,
body.app-mode .project-detail-grid { gap: 18px; }
body.app-mode .card,
body.app-mode .dash-todo,
body.app-mode .dash-status,
body.app-mode .project-card,
body.app-mode .project-create-card,
body.app-mode .project-summary-card,
body.app-mode .gantt-card {
  padding: 0;
  overflow: hidden;
}
body.app-mode .card > h3,
body.app-mode .dash-status > h3,
body.app-mode .dash-todo > .todo-head,
body.app-mode .project-create-card > h3,
body.app-mode .project-summary-card > h3 {
  min-height: 54px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: #dfe7f3;
  background: rgba(255,255,255,.018);
  font-size: .98rem;
  font-weight: 800;
}
body.app-mode .dash-todo > .todo-head { justify-content: space-between; gap: 12px; }
body.app-mode .dash-todo > form,
body.app-mode .dash-todo > .todo-list,
body.app-mode .dash-todo > .todo-empty,
body.app-mode .dash-status > form,
body.app-mode .dash-status > ul,
body.app-mode .dash-status > .status-note,
body.app-mode .dash-status > .api-key-secret,
body.app-mode .project-create-card > form,
body.app-mode .project-summary-card > .metric-grid,
body.app-mode .gantt-card > * {
  margin: 18px 20px;
}
body.app-mode .project-card { padding: 18px 20px; }
body.app-mode .project-card h3 { margin-top: 8px; }
body.app-mode .project-card-meta {
  padding-top: 12px;
  border-top: 1px dashed #2d3a4d;
}
body.app-mode .metric-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
body.app-mode .metric-card::after {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(53,119,241,.15);
  box-shadow: inset 0 0 0 1px rgba(53,119,241,.18);
}
body.app-mode .metric-card:nth-child(1)::after { background: rgba(53,119,241,.16); }
body.app-mode .metric-card:nth-child(2)::after { background: rgba(61,220,151,.14); }
body.app-mode .metric-card:nth-child(3)::after { background: rgba(240,101,72,.14); }
body.app-mode .metric-card:nth-child(4)::after { background: rgba(168,85,247,.14); }
body.app-mode .metric-card span,
body.app-mode .metric-card strong { grid-column: 1; }
body.app-mode .metric-card strong { margin-top: -3px; }
body.app-mode .todo-form,
body.app-mode .project-form,
body.app-mode .project-task-form,
body.app-mode .todo-edit-form {
  gap: 12px;
}
body.app-mode .todo-input,
body.app-mode .todo-textarea,
body.app-mode .todo-select,
body.app-mode .todo-date,
body.app-mode .token-field {
  min-height: 40px;
  padding: 9px 12px;
  border-color: #2b3647;
  font-size: .91rem;
}
body.app-mode .todo-textarea { min-height: 84px; }
body.app-mode .token-field { padding: 7px 9px; }
body.app-mode .todo-input::placeholder,
body.app-mode .todo-textarea::placeholder,
body.app-mode .token-input::placeholder { color: #667386; }
body.app-mode .button { min-height: 40px; padding: 0 14px; font-size: .9rem; }
body.app-mode .btn-text { min-height: 32px; padding: 0 10px; font-size: .75rem; }
body.app-mode .todo-filters {
  padding: 4px;
  border: 1px solid #2b3647;
  border-radius: 8px;
  background: #111827;
}
body.app-mode .todo-filters a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
}
body.app-mode .todo-filters a.active {
  color: #fff;
  background: #3577f1;
}
body.app-mode .todo-list,
body.app-mode .api-key-list,
body.app-mode .time-entry-list { gap: 0; }
body.app-mode .todo-item,
body.app-mode .api-key-list li,
body.app-mode .time-entry-list li {
  border-width: 0 0 1px;
  border-radius: 0;
  margin: 0;
  background: transparent;
}
body.app-mode .todo-list .todo-item:last-child,
body.app-mode .api-key-list li:last-child,
body.app-mode .time-entry-list li:last-child { border-bottom: 0; }
body.app-mode .todo-actions { gap: 5px; }
body.app-mode .priority-badge,
body.app-mode .due-badge,
body.app-mode .tag-badge,
body.app-mode .topic-badge,
body.app-mode .project-status {
  min-height: 21px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .01em;
}
body.app-mode .tag-badge,
body.app-mode .project-status-active,
body.app-mode .project-status-in_progress,
body.app-mode .priority-normal {
  border-color: rgba(61,220,151,.22);
  color: #3ddc97;
  background: rgba(61,220,151,.10);
}
body.app-mode .topic-badge,
body.app-mode .project-status-planned,
body.app-mode .project-status-open {
  border-color: rgba(53,119,241,.24);
  color: #74a7ff;
  background: rgba(53,119,241,.12);
}
body.app-mode .project-status-paused,
body.app-mode .project-status-blocked {
  border-color: rgba(247,184,75,.24);
  color: #f7b84b;
  background: rgba(247,184,75,.12);
}
body.app-mode .project-status-done {
  border-color: rgba(69,203,133,.24);
  color: #45cb85;
  background: rgba(69,203,133,.12);
}
body.app-mode .priority-high,
body.app-mode .due-overdue {
  border-color: rgba(240,101,72,.26);
  color: #f06548;
  background: rgba(240,101,72,.12);
}
body.app-mode .priority-low,
body.app-mode .project-status-archived {
  border-color: rgba(148,163,184,.20);
  color: #94a3b8;
  background: rgba(148,163,184,.10);
}
.app-table-wrap {
  margin: 18px 20px;
  overflow-x: auto;
  border: 1px solid #2b3647;
  border-radius: 8px;
}
.app-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.app-table th,
.app-table td {
  padding: 11px 13px;
  border-bottom: 1px solid #263241;
  text-align: left;
  vertical-align: top;
}
.app-table th {
  color: #8f9bad;
  background: #111827;
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.app-table td { color: #dfe7f3; font-size: .9rem; }
.app-table tbody tr:hover { background: rgba(53,119,241,.07); }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table .muted-cell { color: #8f9bad; font-size: .82rem; }
body.app-mode .status-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #2d3a4d;
}
body.app-mode .status-list li:last-child { border-bottom: 0; }
body.app-mode .status-list strong { min-width: auto; }

@media (max-width: 700px) {
  body.app-mode .card > h3,
  body.app-mode .dash-status > h3,
  body.app-mode .dash-todo > .todo-head,
  body.app-mode .project-create-card > h3,
  body.app-mode .project-summary-card > h3 { padding-inline: 14px; }
  body.app-mode .dash-todo > form,
  body.app-mode .dash-todo > .todo-list,
  body.app-mode .dash-todo > .todo-empty,
  body.app-mode .dash-status > form,
  body.app-mode .dash-status > ul,
  body.app-mode .dash-status > .status-note,
  body.app-mode .dash-status > .api-key-secret,
  body.app-mode .project-create-card > form,
  body.app-mode .project-summary-card > .metric-grid,
  body.app-mode .gantt-card > *,
  .app-table-wrap { margin: 14px; }
  body.app-mode .metric-card { grid-template-columns: minmax(0,1fr) 36px; }
  body.app-mode .metric-card::after { width: 36px; height: 36px; }
}

/* Dashboard-specific Velzon alignment */
body.app-mode .dashboard-head .muted {
  margin: 8px 0 0;
  max-width: 680px;
  font-size: .94rem;
}
body.app-mode .dashboard-widgets .dashboard-widget {
  grid-template-columns: minmax(0, 1fr) 46px;
  min-height: 116px;
}
body.app-mode .dashboard-widget small {
  grid-column: 1;
  color: #7f8da1;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.25;
}
body.app-mode .dashboard-widget::after {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
}
body.app-mode .widget-open::after { content: "↗"; }
body.app-mode .widget-today::after { content: "⏱"; }
body.app-mode .widget-danger::after { content: "!"; }
body.app-mode .widget-done::after { content: "✓"; }
body.app-mode .dashboard-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 125px 250px;
  gap: 10px;
  margin: 0 20px;
  padding: 11px 13px;
  border: 1px solid #2b3647;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #111827;
  color: #8f9bad;
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .055em;
}
body.app-mode .dashboard-list-head + .dashboard-todo-list {
  margin-top: 0;
  border: 1px solid #2b3647;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
body.app-mode .dashboard-todo-list .todo-item {
  grid-template-columns: minmax(0, 1fr) 125px 250px;
  padding: 13px;
}
body.app-mode .dashboard-todo-list .todo-meta {
  color: #8f9bad;
  font-size: .78rem;
}
body.app-mode .dashboard-todo-list .todo-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
body.app-mode .dashboard-todo-list .todo-actions .btn-text {
  width: 100%;
}
body.app-mode .dash-status.api-key-panel .project-form {
  grid-template-columns: minmax(0, 1fr);
}
body.app-mode .api-key-list strong { color: #e8eef8; }
body.app-mode .api-key-list span { color: #8f9bad; }
body.app-mode .status-list {
  border: 1px solid #2b3647;
  border-radius: 8px;
  overflow: hidden;
}
body.app-mode .status-list li {
  padding: 10px 12px;
  background: #111827;
}
body.app-mode .status-list li:nth-child(even) { background: rgba(17,24,39,.62); }

@media (max-width: 980px) {
  body.app-mode .dashboard-list-head { display: none; }
  body.app-mode .dashboard-list-head + .dashboard-todo-list {
    margin-top: 14px;
    border-radius: 8px;
  }
  body.app-mode .dashboard-todo-list .todo-item {
    grid-template-columns: minmax(0, 1fr);
  }
  body.app-mode .dashboard-todo-list .todo-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  body.app-mode .dashboard-widgets .dashboard-widget {
    min-height: 96px;
    grid-template-columns: minmax(0, 1fr) 36px;
  }
  body.app-mode .dashboard-widget small { font-size: .7rem; }
  body.app-mode .dashboard-todo-list .todo-actions { grid-template-columns: 1fr; }
}

/* App navbar aligned with Control navigation */
body.app-mode .nav nav .nav-section {
  display: block;
  margin: 12px 10px 5px;
  color: #6f7d91;
  font-size: .70rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
body.app-mode .nav nav .nav-section:first-child { margin-top: 2px; }
body.app-mode .nav nav a[href="/control/todo"] span::before { content: "☑"; color: #3ddc97; width: 16px; }
body.app-mode .nav nav a[href="/control/time-entry"] span::before { content: "◷"; color: #f7b84b; width: 16px; }
body.app-mode .nav nav a[href="/control/todo"]:hover,
body.app-mode .nav nav a[href="/control/time-entry"]:hover {
  color: #fff;
  background: rgba(53,119,241,.14);
}
@media (max-width: 920px) {
  body.app-mode .nav {
    background: #111827;
    border-bottom: 1px solid #263241;
    box-shadow: 0 8px 26px rgba(0,0,0,.22);
  }
  body.app-mode .nav .brand { color: #f8fafc; }
  body.app-mode .nav .brand-avatar {
    border-color: rgba(61,220,151,.32);
    box-shadow: 0 0 0 4px rgba(61,220,151,.08);
  }
  body.app-mode .nav nav .nav-section { display: none; }
  body.app-mode .nav nav a {
    color: #aeb9c8;
    background: transparent;
  }
  body.app-mode .nav nav a.is-active {
    color: #fff;
    background: rgba(53,119,241,.18);
    box-shadow: inset 0 -2px 0 #3ddc97;
  }
  body.app-mode .nav-dashboard {
    color: #3ddc97;
    border-color: rgba(61,220,151,.26);
    background: rgba(61,220,151,.08);
  }
}


/* Protected notes */
.notes-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}
.note-form {
  grid-template-columns: minmax(220px, 1fr) auto;
}
.note-form > .todo-input:first-of-type,
.note-form > .note-textarea { grid-column: 1 / -1; }
.note-pin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  color: var(--muted);
  font-weight: 800;
}
.notes-board {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(18px);
  padding: 24px 28px;
}
.note-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.note-card {
  min-height: 0;
  padding: 20px;
  background:
    radial-gradient(circle at 0 0, rgba(121,255,208,.10), transparent 16rem),
    rgba(255,255,255,.055);
}
.note-pinned {
  border-color: rgba(121,255,208,.36);
  box-shadow: 0 0 0 1px rgba(121,255,208,.08), 0 22px 70px rgba(0,0,0,.24);
}
.note-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 10px;
}
.note-card h3 { margin: 10px 0 0; }
.note-content {
  color: #dbe6f5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.note-meta {
  margin: 16px 0 0;
  color: var(--dim);
  font-size: .82rem;
}
@media (max-width: 860px) {
  .notes-grid, .note-list { grid-template-columns: 1fr; }
}


/* App nav vertical centering follow-up */
body.app-mode .nav nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  line-height: 1.2;
}
body.app-mode .nav nav a span {
  min-height: 20px;
  line-height: 1.2;
}
body.app-mode .nav nav a span::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  line-height: 1;
}
body.app-mode .nav nav a[href="/notes"] span::before {
  content: "◫";
  color: #a855f7;
  width: 16px;
}


/* Markdown rendering */
.markdown-body {
  color: inherit;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body p { margin: .35rem 0 .65rem; }
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: .75rem 0 .4rem;
  color: var(--fg);
  line-height: 1.2;
}
.markdown-body ul,
.markdown-body ol { margin: .4rem 0 .75rem; padding-left: 1.25rem; }
.markdown-body li + li { margin-top: .2rem; }
.markdown-body blockquote {
  margin: .65rem 0;
  padding: .45rem .75rem;
  border-left: 3px solid var(--accent-2);
  background: rgba(122,167,255,.08);
  color: var(--muted);
  border-radius: 0 8px 8px 0;
}
.markdown-body code {
  padding: .08rem .32rem;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 5px;
  background: rgba(0,0,0,.22);
  color: #d7ffef;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: .88em;
}
.markdown-body pre {
  margin: .7rem 0;
  padding: .85rem;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  background: rgba(0,0,0,.24);
  overflow: auto;
}
.markdown-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
}
.markdown-body a { color: var(--accent-2); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.todo-textarea {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.note-textarea { min-height: 190px; }
.time-note { min-width: 180px; color: var(--muted); font-size: .9rem; }


/* Workspace visible restructure */
.workspace-section { margin-top: 18px; }
.dashboard-link-card { display: block; text-decoration: none; color: inherit; min-height: 118px; }
.dashboard-link-card:hover { border-color: rgba(121,255,208,.34); background: rgba(255,255,255,.08); }
.dashboard-grid-overview { grid-template-columns: minmax(0, 1fr) minmax(260px, .55fr); }
body.app-mode .nav nav a[href="/todos"] span::before { content: "☑"; color: #45cb85; width: 16px; }
.project-status-overdue { color: #f06548; background: rgba(240,101,72,.14); }
.project-status-in_progress { color: #f7b84b; background: rgba(247,184,75,.14); }
@media (max-width: 920px) { .dashboard-grid-overview { grid-template-columns: 1fr; } }
