:root {
  --bg: #0e0f12;
  --panel: #17191d;
  --line: #24272d;
  --text: #e6e7ea;
  --muted: #8b8f98;
  --accent: #5b8def;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.brand { font-weight: 600; letter-spacing: 0.02em; }

.path {
  color: var(--muted);
  font: 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.spacer { flex: 1; }

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

.btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn:disabled { opacity: 0.6; cursor: default; }

.btn.tiny {
  padding: 4px 10px;
  font-size: 12px;
  background: #2a2e36;
}

.grid {
  display: grid;
  grid-template-columns: 28% 1fr;
  gap: 16px;
  align-items: start;
}

aside {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 10px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.card.empty { color: var(--muted); font-size: 14px; }

.label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.value { word-break: break-word; font-size: 14px; }

.card .btn { margin-top: 8px; }

.note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
}

.note-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.note-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 5px 12px;
  font-size: 13px;
}

.btn.ghost:hover { color: var(--text); border-color: var(--muted); }

.tools { position: relative; }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  min-width: 140px;
  padding: 4px;
  background: #1d2026;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
}

.menu-item:hover { background: #2a2e36; }

#md {
  flex: 1;
  width: 100%;
  min-height: 60vh;
  resize: vertical;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 16px;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
}

.note-view {
  flex: 1;
  padding: 16px;
  overflow: auto;
}

.note-view > :first-child { margin-top: 0; }

.note-view .empty { color: var(--muted); }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  aside { position: static; }
  .note { min-height: 50vh; }
  #md { min-height: 40vh; }
}
