:root {
  --sidebar-width: 240px;
  --header-h: 56px;
}

html, body { height: 100%; }
body { background: var(--bs-body-bg); }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }
.app-shell.no-sidebar { grid-template-columns: 1fr; }

.app-sidebar {
  background: var(--bs-tertiary-bg);
  border-right: 1px solid var(--bs-border-color);
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-brand a { color: var(--bs-body-color); font-weight: 600; font-size: 1.1rem; padding: 0 .5rem; display: inline-block; margin-bottom: .75rem; }
.app-brand-mobile { color: var(--bs-body-color); font-weight: 600; text-decoration: none; display: none; }

.app-nav .nav-link {
  color: var(--bs-body-color);
  border-radius: .375rem;
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.app-nav .nav-link:hover { background: var(--bs-secondary-bg); }
.app-nav .nav-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }

.app-header {
  height: var(--header-h);
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-content { padding: 1.25rem; }

.note-card { transition: transform .08s ease, box-shadow .08s ease; }
.note-card:hover { transform: translateY(-1px); box-shadow: 0 .25rem .5rem rgba(0,0,0,.06); }
.note-thumb { object-fit: cover; aspect-ratio: 1 / 1; width: 100%; }
.note-excerpt { color: var(--bs-secondary-color); font-size: .9rem; line-height: 1.35; max-height: 5.5em; overflow: hidden; }
.note-body img { max-width: 100%; height: auto; }

.stat-card .card-body { padding: 1rem; }

#editor { min-height: 280px; background: var(--bs-body-bg); }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--bs-border-color); }
.ql-editor { min-height: 240px; font-size: 1rem; }

@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,.1);
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-brand-mobile { display: inline-flex; align-items: center; gap: .5rem; }
}

[data-bs-theme="dark"] .app-sidebar { background: #181a1d; }
[data-bs-theme="dark"] .app-header { background: var(--bs-body-bg); }
