:root {
  color-scheme: light;
  --bg: #f5efe5;
  --bg-alt: #e4edf5;
  --paper: rgba(255, 251, 245, 0.82);
  --ink: #172033;
  --muted: #64748b;
  --line: rgba(23, 32, 51, 0.12);
  --accent: #c2410c;
  --accent-soft: rgba(194, 65, 12, 0.12);
  --sidebar: #162033;
  --sidebar-soft: rgba(255, 255, 255, 0.08);
  --danger: #be123c;
  --success: #047857;
  --shadow: 0 25px 70px rgba(23, 32, 51, 0.14);
  font-family: "Instrument Serif", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(194, 65, 12, 0.24), transparent 28%),
    radial-gradient(circle at bottom right, rgba(14, 116, 144, 0.2), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-alt));
  color: var(--ink);
  font-family: "Georgia", serif;
}

button,
input,
textarea {
  font: inherit;
}

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

.sidebar {
  background: linear-gradient(180deg, rgba(22, 32, 51, 0.98), rgba(15, 23, 42, 0.98));
  color: white;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand,
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fb923c, #facc15);
  color: #111827;
  font-weight: 700;
  font-size: 1.35rem;
  box-shadow: 0 14px 30px rgba(251, 146, 60, 0.26);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-family: Arial, sans-serif;
  opacity: 0.7;
}

.title,
.workspace-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.ghost-button,
.danger-button,
.import-label {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
}

.button:hover,
.ghost-button:hover,
.danger-button:hover,
.import-label:hover {
  transform: translateY(-1px);
}

.button {
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: white;
}

.ghost-button,
.import-label {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.danger-button {
  background: rgba(190, 18, 60, 0.16);
  color: #ffe4e6;
}

.workspace .ghost-button {
  background: rgba(23, 32, 51, 0.08);
  color: var(--ink);
}

.workspace .danger-button {
  background: rgba(190, 18, 60, 0.12);
  color: var(--danger);
}

.search-wrap {
  display: grid;
  gap: 8px;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
}

.search-wrap input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

.search-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.52);
}

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

.note-card {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 13px 14px;
  background: var(--sidebar-soft);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.note-card.active {
  background: rgba(251, 146, 60, 0.16);
  border-color: rgba(251, 146, 60, 0.36);
}

.note-name {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.note-meta {
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.62);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: Arial, sans-serif;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.88rem;
}

.hidden-input {
  display: none;
}

.workspace {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.workspace-header,
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
  backdrop-filter: blur(16px);
}

.workspace-header {
  padding: 20px 24px;
}

.status {
  font-family: Arial, sans-serif;
  font-size: 0.86rem;
  color: var(--muted);
}

.status.good {
  color: var(--success);
}

.panes {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  min-height: 72vh;
}

.panel {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
}

.editor-input,
.preview {
  min-height: 0;
}

.editor-input {
  width: 100%;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  padding: 22px;
  outline: none;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.98rem;
  line-height: 1.7;
}

.preview {
  overflow: auto;
  padding: 22px 26px 34px;
  line-height: 1.75;
}

.preview h1,
.preview h2,
.preview h3 {
  line-height: 1.25;
  margin-top: 1.7em;
}

.preview h1:first-child,
.preview h2:first-child,
.preview h3:first-child {
  margin-top: 0;
}

.preview pre {
  background: #111827;
  color: #f9fafb;
  border-radius: 16px;
  padding: 16px;
  overflow: auto;
}

.preview code {
  background: rgba(23, 32, 51, 0.08);
  border-radius: 6px;
  padding: 0.12em 0.35em;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.preview pre code {
  background: transparent;
  padding: 0;
}

.preview blockquote {
  border-left: 4px solid rgba(194, 65, 12, 0.35);
  padding-left: 14px;
  color: #475569;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

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

  .panes {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel {
    min-height: 48vh;
  }
}
