:root {
  --bg: 246 247 251;
  --surface: 255 255 255;
  --surface-2: 240 242 248;
  --line: 225 229 238;
  --text: 16 20 33;
  --muted: 100 108 130;
  --brand: 91 75 225;
  --brand-soft: 237 235 254;
  --accent: 13 148 136;
  --accent-soft: 220 245 241;
  --danger: 209 61 61;
  --warn: 199 129 20;
  --ok: 34 145 92;
  --shadow: 15 23 42;
}

html.dark {
  --bg: 12 14 20;
  --surface: 20 23 32;
  --surface-2: 29 33 45;
  --line: 43 48 63;
  --text: 232 235 244;
  --muted: 145 154 175;
  --brand: 138 126 255;
  --brand-soft: 39 36 74;
  --accent: 45 212 191;
  --accent-soft: 11 51 48;
  --danger: 241 116 116;
  --warn: 226 168 62;
  --ok: 74 196 138;
  --shadow: 0 0 0;
}

* { -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }

::selection { background: rgb(var(--brand) / 0.22); }

.scroll-thin { scrollbar-width: thin; scrollbar-color: rgb(var(--muted) / 0.35) transparent; }
.scroll-thin::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
.scroll-thin::-webkit-scrollbar-thumb { background: rgb(var(--muted) / 0.3); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
.scroll-thin::-webkit-scrollbar-thumb:hover { background: rgb(var(--muted) / 0.5); background-clip: content-box; }

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid rgb(var(--brand));
  outline-offset: 2px;
  border-radius: 6px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 2.25rem; padding: 0 0.75rem; border-radius: 0.5rem;
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .06s ease;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-brand { background: rgb(var(--brand)); color: #fff; }
.btn-brand:hover:not(:disabled) { background: rgb(var(--brand) / 0.88); }
.btn-accent { background: rgb(var(--accent)); color: #fff; }
.btn-accent:hover:not(:disabled) { background: rgb(var(--accent) / 0.88); }
.btn-default { background: rgb(var(--surface)); color: rgb(var(--text)); border-color: rgb(var(--line)); }
.btn-default:hover:not(:disabled) { background: rgb(var(--surface-2)); }
.btn-ghost { background: transparent; color: rgb(var(--muted)); }
.btn-ghost:hover:not(:disabled) { background: rgb(var(--surface-2)); color: rgb(var(--text)); }
.btn-danger { background: rgb(var(--danger)); color: #fff; }
.btn-danger:hover:not(:disabled) { background: rgb(var(--danger) / 0.88); }
.btn-sm { height: 1.75rem; padding: 0 0.5rem; font-size: 0.75rem; border-radius: 0.4rem; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-icon.btn-sm { width: 1.75rem; }

.input, .select, .textarea {
  width: 100%; background: rgb(var(--surface)); color: rgb(var(--text));
  border: 1px solid rgb(var(--line)); border-radius: 0.5rem;
  padding: 0.45rem 0.6rem; font-size: 0.8125rem; line-height: 1.35;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder, .textarea::placeholder { color: rgb(var(--muted) / 0.8); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: rgb(var(--brand)); box-shadow: 0 0 0 3px rgb(var(--brand) / 0.16);
}
.select { appearance: none; padding-right: 1.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23838ba0'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5' stroke='%23838ba0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1rem;
}
.textarea { resize: vertical; min-height: 5rem; }

.card { background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 0.75rem; }

.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.45rem; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.chip-muted { background: rgb(var(--surface-2)); color: rgb(var(--muted)); border-color: rgb(var(--line)); }
.chip-brand { background: rgb(var(--brand-soft)); color: rgb(var(--brand)); }
.chip-accent { background: rgb(var(--accent-soft)); color: rgb(var(--accent)); }
.chip-danger { background: rgb(var(--danger) / 0.12); color: rgb(var(--danger)); }
.chip-warn { background: rgb(var(--warn) / 0.14); color: rgb(var(--warn)); }
.chip-ok { background: rgb(var(--ok) / 0.14); color: rgb(var(--ok)); }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem;
  border: 1px solid rgb(var(--line)); border-bottom-width: 2px; border-radius: 0.3rem;
  background: rgb(var(--surface-2)); color: rgb(var(--muted));
  font-size: 0.6875rem; font-weight: 600; font-family: inherit;
}

.nav-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.6rem; border-radius: 0.5rem;
  font-size: 0.8125rem; font-weight: 500; color: rgb(var(--muted));
  cursor: pointer; transition: background-color .12s ease, color .12s ease;
}
.nav-link:hover { background: rgb(var(--surface-2)); color: rgb(var(--text)); }
.nav-link.active { background: rgb(var(--brand-soft)); color: rgb(var(--brand)); font-weight: 600; }
.nav-link.active svg { color: rgb(var(--brand)); }

.tab {
  padding: 0.5rem 0.15rem; margin-right: 1.1rem;
  font-size: 0.8125rem; font-weight: 600; color: rgb(var(--muted));
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: rgb(var(--text)); }
.tab.active { color: rgb(var(--brand)); border-bottom-color: rgb(var(--brand)); }

.task-card { transition: box-shadow .12s ease, border-color .12s ease, transform .06s ease; }
.task-card:hover { border-color: rgb(var(--brand) / 0.45); box-shadow: 0 2px 8px -2px rgb(var(--shadow) / 0.12); }
.task-card.dragging { opacity: .45; }
.drop-target { background: rgb(var(--brand) / 0.06); box-shadow: inset 0 0 0 2px rgb(var(--brand) / 0.35); }

.pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgb(var(--accent) / 0.55); animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(var(--accent) / 0); } 100% { box-shadow: 0 0 0 0 rgb(var(--accent) / 0); } }

.fade-in { animation: fade-in .16s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pop-in { animation: pop-in .16s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.sheet-cell {
  width: 100%; height: 2.25rem; text-align: center; background: transparent;
  border: 1px solid transparent; border-radius: 0.4rem; color: rgb(var(--text));
  font-size: 0.8125rem; font-variant-numeric: tabular-nums;
}
.sheet-cell:hover { border-color: rgb(var(--line)); }
.sheet-cell:focus { outline: none; border-color: rgb(var(--brand)); box-shadow: 0 0 0 3px rgb(var(--brand) / 0.16); background: rgb(var(--surface)); }
.sheet-cell.weekend { background: rgb(var(--surface-2) / 0.7); }
.sheet-cell.filled { font-weight: 600; }

.prose-mini p { margin: 0 0 0.6rem; }
.prose-mini p:last-child { margin-bottom: 0; }
.prose-mini ul { margin: 0 0 0.6rem 1.1rem; list-style: disc; }
.prose-mini code { font-family: ui-monospace, monospace; font-size: .8em; background: rgb(var(--surface-2)); padding: 0.05rem 0.3rem; border-radius: 0.25rem; }
.mention { color: rgb(var(--brand)); background: rgb(var(--brand-soft)); padding: 0 0.25rem; border-radius: 0.25rem; font-weight: 600; }

.stripe { background-image: repeating-linear-gradient(45deg, rgb(var(--muted) / .14) 0 6px, transparent 6px 12px); }

@media (max-width: 767px) {
  #sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    transform: translateX(-101%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px rgb(15 23 42 / .2);
  }
  #app[data-nav="open"] #sidebar { transform: none; }
  #app[data-nav="open"]::before {
    content: ''; position: fixed; inset: 0; z-index: 55;
    background: rgb(15 23 42 / .45);
  }
}

/* Documentation pages rendered from Markdown */
.prose-doc { font-size: 14px; line-height: 1.65; color: rgb(var(--text)); overflow-wrap: anywhere; }
.prose-doc > :first-child { margin-top: 0; }
.prose-doc h1, .prose-doc h2, .prose-doc h3, .prose-doc h4 { font-weight: 650; line-height: 1.3; margin: 1.6em 0 0.6em; scroll-margin-top: 1rem; }
.prose-doc h1 { font-size: 1.6rem; }
.prose-doc h2 { font-size: 1.25rem; padding-bottom: 0.3em; border-bottom: 1px solid rgb(var(--line)); }
.prose-doc h3 { font-size: 1.05rem; }
.prose-doc h4 { font-size: 0.95rem; }
.prose-doc p, .prose-doc ul, .prose-doc ol, .prose-doc pre, .prose-doc table, .prose-doc blockquote { margin: 0 0 1em; }
.prose-doc ul { list-style: disc; padding-left: 1.4em; }
.prose-doc ol { list-style: decimal; padding-left: 1.4em; }
.prose-doc li { margin: 0.2em 0; }
.prose-doc li > ul, .prose-doc li > ol { margin: 0.2em 0 0; }
.prose-doc a { color: rgb(var(--brand)); font-weight: 500; }
.prose-doc a:hover { text-decoration: underline; }
.prose-doc code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: rgb(var(--surface-2)); padding: 0.1rem 0.35rem; border-radius: 0.3rem; }
.prose-doc pre { background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line)); border-radius: 0.5rem; padding: 0.8rem 1rem; overflow-x: auto; }
.prose-doc pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.55; }
.prose-doc blockquote { border-left: 3px solid rgb(var(--line)); padding-left: 1em; color: rgb(var(--muted)); }
.prose-doc table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 13px; }
.prose-doc th, .prose-doc td { border: 1px solid rgb(var(--line)); padding: 0.4rem 0.7rem; text-align: left; vertical-align: top; }
.prose-doc th { background: rgb(var(--surface-2)); font-weight: 600; }
.prose-doc hr { border: 0; border-top: 1px solid rgb(var(--line)); margin: 1.5em 0; }
.prose-doc img { max-width: 100%; border-radius: 0.4rem; }
.prose-doc input[type="checkbox"] { margin-right: 0.4em; }
