/* ── Layout ── */
.app {
  display: flex;
  height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #faf7f2;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 0 12px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header h2 {
  font-size: 1.15rem;
  margin: 0;
}

.btn-sm {
  padding: 6px 12px;
  font-size: .82rem;
  border-radius: 8px;
}

.category-list {
  list-style: none;
  padding: 8px 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.category-list li {
  margin: 0;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .15s;
  border-left: 3px solid transparent;
  font-weight: 500;
}

.category-list li:hover {
  background: #f0ebe0;
}

.category-list li.active {
  background: #f0ebe0;
  border-left-color: var(--accent);
  color: var(--accent);
}

.category-list li .cat-icon {
  font-size: 1.2rem;
}

.category-list li .cat-count {
  margin-left: auto;
  font-size: .78rem;
  color: var(--soft);
  background: var(--line);
  border-radius: 20px;
  padding: 2px 8px;
}

.sidebar-footer {
  padding: 10px 16px 0;
  border-top: 1px solid var(--line);
}

/* ── Note area ── */
.note-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
}

.note-placeholder {
  margin: auto;
}

.note-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.note-header {
  flex-wrap: wrap;
}

.note-header h2 {
  margin: 0;
}

.note-title-input {
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  padding: 8px 0;
  background: transparent;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  margin-bottom: 8px;
}

.note-title-input:focus {
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.note-body-input {
  border: none;
  padding: 8px 0;
  background: transparent;
  resize: vertical;
  min-height: 120px;
  border-radius: 0;
}

.note-body-input:focus {
  box-shadow: none;
}

/* ── Notes list ── */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}

.note-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  border-color: var(--accent);
}

.note-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.note-card .note-preview {
  color: var(--soft);
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-card .note-meta {
  font-size: .75rem;
  color: var(--soft);
  margin-top: 6px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  min-width: 360px;
  max-width: 480px;
}

.modal h3 {
  margin-top: 0;
}

.modal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    border-radius: 0;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-header {
    border-bottom: none;
    padding: 0;
    gap: 8px;
  }

  .category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0;
    overflow-y: visible;
    flex: none;
    width: 100%;
  }

  .category-list li {
    padding: 6px 12px;
    border-left: none;
    border-radius: 20px;
    font-size: .85rem;
    border: 1px solid var(--line);
  }

  .category-list li.active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
  }

  .category-list li .cat-count {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .note-area {
    padding: 16px;
  }
}
