:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #17191f;
  --surface-2: #20232b;
  --line: #303541;
  --text: #f4f1ea;
  --muted: #a5acb8;
  --accent: #60d6be;
  --accent-2: #f2b84b;
  --danger: #ef6f6c;
  --shadow: 0 24px 70px rgb(0 0 0 / 35%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgb(96 214 190 / 16%), transparent 28rem),
    linear-gradient(135deg, #101114 0%, #151820 48%, #111318 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: rgb(16 17 20 / 84%);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .65rem;
  margin-bottom: 1.5rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border: 1px solid rgb(96 214 190 / 46%);
  border-radius: .65rem;
  background: linear-gradient(145deg, rgb(96 214 190 / 24%), rgb(242 184 75 / 12%));
  color: var(--accent);
  font-weight: 800;
}

.brand small,
.panel-title,
.eyebrow,
.stats span {
  color: var(--muted);
}

.brand strong,
.brand small {
  display: block;
}

.panel {
  margin: 0 0 1.25rem;
}

.panel-title {
  margin: 0 0 .65rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.filter-stack {
  display: grid;
  gap: .45rem;
}

.category-node {
  display: grid;
  gap: .45rem;
}

.category-children {
  display: grid;
  gap: .45rem;
  margin-left: .8rem;
  padding-left: .7rem;
  border-left: 1px solid rgb(255 255 255 / 12%);
}

.filter-button,
.tag-button,
#clearFilters {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgb(255 255 255 / 4%);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.filter-button:hover,
.tag-button:hover,
#clearFilters:hover {
  border-color: rgb(96 214 190 / 58%);
  background: rgb(96 214 190 / 10%);
}

.filter-button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: .72rem .8rem;
  border-radius: .65rem;
  text-align: left;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag-button {
  padding: .42rem .62rem;
  border-radius: 999px;
  color: var(--muted);
}

.filter-button.active,
.tag-button.active {
  border-color: rgb(96 214 190 / 70%);
  background: rgb(96 214 190 / 14%);
  color: var(--accent);
}

.workspace {
  width: min(100%, 78rem);
  padding: 2rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 .35rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.repo-link,
#clearFilters {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: .65rem .9rem;
  border-radius: .65rem;
  white-space: nowrap;
}

.repo-link {
  border: 1px solid rgb(242 184 75 / 42%);
  color: var(--accent-2);
  background: rgb(242 184 75 / 10%);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .8rem;
  align-items: end;
  margin-bottom: 1rem;
}

.search {
  display: grid;
  gap: .4rem;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

.search input {
  width: 100%;
  height: 3rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 0 .95rem;
  color: var(--text);
  background: rgb(255 255 255 / 6%);
  outline: none;
}

.search input:focus {
  border-color: rgb(96 214 190 / 72%);
  box-shadow: 0 0 0 3px rgb(96 214 190 / 12%);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: .9rem;
}

.stats div {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: rgb(255 255 255 / 4%);
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 1.5rem;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  min-height: 2rem;
  margin-bottom: 1rem;
}

.filter-pill {
  padding: .42rem .62rem;
  border: 1px solid rgb(96 214 190 / 42%);
  border-radius: 999px;
  color: var(--accent);
  background: rgb(96 214 190 / 10%);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: .9rem;
}

.note-card {
  display: flex;
  min-height: 16rem;
  flex-direction: column;
  gap: .8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: linear-gradient(180deg, rgb(255 255 255 / 7%), rgb(255 255 255 / 3%));
  box-shadow: var(--shadow);
}

.note-card:hover {
  border-color: rgb(96 214 190 / 48%);
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  color: var(--muted);
  font-size: .78rem;
}

.note-card h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.note-tags span {
  padding: .28rem .5rem;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  color: var(--muted);
  font-size: .78rem;
}

.headings {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.6;
}

.open-note {
  margin-top: auto;
  color: var(--accent);
  font-weight: 800;
}

.empty-state {
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  color: var(--muted);
  text-align: center;
  background: rgb(255 255 255 / 4%);
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 1rem;
  }

  .topbar,
  .toolbar {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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