:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #fbfbfd;
  --panel-strong: #ffffff;
  --line: #d7d7dc;
  --line-soft: #ebebef;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #006edb;
  --accent-soft: #dcecff;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.88);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.account {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 12px 18px;
}

.view-tab {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.view-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.search-wrap {
  padding: 0 18px 12px;
}

.search {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 0 12px;
  color: var(--text);
  outline: none;
}

.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 110, 219, 0.14);
}

.list {
  min-height: 0;
  overflow: auto;
  padding: 4px 10px 18px;
}

.note-row {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 11px 12px;
  color: inherit;
  text-align: left;
}

.note-row:hover {
  background: rgba(0, 0, 0, 0.045);
}

.note-row.active {
  background: var(--accent-soft);
}

.note-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-meta,
.note-snippet {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--panel);
}

.document {
  width: min(840px, 100%);
  min-height: 100%;
  padding: 52px 56px 72px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.document h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f7f7f9;
}

.body {
  margin-top: 34px;
  color: #242426;
  font-size: 16px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

.details {
  margin-top: 34px;
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}

.details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.details pre {
  overflow: auto;
  margin: 14px 0 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fafafa;
  padding: 14px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.empty,
.auth {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--panel);
}

.empty-card,
.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 24px;
  box-shadow: var(--shadow);
}

.empty-card h2,
.auth-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: 0;
}

.empty-card p,
.auth-card p,
.error {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.primary {
  width: 100%;
  height: 40px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 650;
}

.error {
  margin-top: 14px;
  color: #b42318;
}

.hidden {
  display: none;
}

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

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

  .document {
    min-height: 58vh;
    padding: 32px 24px 56px;
    box-shadow: none;
  }

  .document h2 {
    font-size: 25px;
  }
}
