:root {
  color-scheme: light dark;
  --bg: #f6f7f2;
  --panel: #ffffff;
  --panel-muted: #eef1ea;
  --text: #161a16;
  --muted: #687060;
  --line: #dfe4d8;
  --accent: #256f5b;
  --accent-soft: #dff0e9;
  --danger: #b3261e;
  --shadow: 0 16px 44px rgb(22 26 22 / 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11140f;
    --panel: #181d16;
    --panel-muted: #20271d;
    --text: #eff4ec;
    --muted: #a8b3a1;
    --line: #2b3528;
    --accent: #7ad0ae;
    --accent-soft: #17372b;
    --danger: #ffb4ab;
    --shadow: 0 16px 44px rgb(0 0 0 / 0.28);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 20px;
}

.brand-row,
.editor-toolbar,
.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.icon-button,
.danger-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  font-size: 24px;
  line-height: 1;
}

.danger-button {
  padding: 9px 12px;
  color: var(--danger);
}

.search,
.title-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
  color: var(--text);
  outline: none;
}

.search {
  padding: 11px 12px;
}

.status,
.save-state {
  color: var(--muted);
  font-size: 13px;
}

.notes-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.note-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.note-item:hover,
.note-item.active {
  border-color: var(--line);
  background: var(--accent-soft);
}

.note-title {
  display: block;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
}

.editor-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
}

.title-input {
  border: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 750;
  min-width: 0;
  padding: 8px 0;
}

.content-input {
  flex: 1;
  width: 100%;
  min-height: 70vh;
  resize: none;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--panel);
  color: var(--text);
  line-height: 1.65;
  outline: none;
  padding: 22px;
}

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

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    max-height: 42vh;
  }

  .editor-panel {
    padding: 12px;
  }

  .editor-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }
}
