:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8f8f8;
  --surface-active: #fff0df;
  --border: rgba(19, 33, 68, 0.07);
  --text: #12264b;
  --muted: #6e7f9e;
  --muted-soft: #9aa7bf;
  --accent: #ff9f1a;
  --accent-deep: #f28c00;
  --danger: #de6b5c;
  --shadow-soft: 0 8px 24px rgba(30, 55, 90, 0.06);
  --radius-xl: 30px;
  --radius-lg: 26px;
  --radius-md: 22px;
  --radius-sm: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 16px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-top {
  display: grid;
  gap: 18px;
  min-height: 0;
}

.brand-block {
  display: inline-block;
  text-decoration: none;
  font-size: 1.03rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.search-icon {
  color: var(--muted-soft);
  font-size: 1.05rem;
}

.search-shell input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.search-shell input:focus {
  outline: none;
}

.note-card p,
.empty-list p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.98rem;
}

.notes-panel {
  display: grid;
  min-height: 0;
  gap: 12px;
}

.note-card-top,
.editor-header,
.editor-footer,
.button-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.note-card {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: #fffdfb;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.note-card strong {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.note-meta {
  color: var(--muted-soft);
  font-size: 0.88rem;
  white-space: nowrap;
}

.note-card:hover,
.note-card:focus-visible,
.note-card.active {
  transform: translateY(-1px);
  background: var(--surface-active);
  box-shadow: 0 10px 24px rgba(80, 92, 110, 0.12);
}

.main-stage {
  min-width: 0;
  padding: 34px 64px;
}

.editor-panel {
  min-width: 0;
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
}

.empty-state h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.9rem);
  font-weight: 300;
  letter-spacing: -0.04em;
}

.meta-pills {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.meta-pills span {
  color: var(--muted-soft);
  font-size: 0.88rem;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field span {
  display: none;
}

input[type="text"],
textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  transition: color 180ms ease;
}

input[type="text"] {
  min-height: auto;
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: -0.04em;
}

textarea {
  min-height: 520px;
  resize: vertical;
  line-height: 1.95;
  font-size: 0.98rem;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
}

.editor-footer {
  align-items: stretch;
  justify-content: flex-end;
  flex-direction: column;
  margin-top: auto;
  padding-top: 32px;
  gap: 18px;
}

.button-row {
  width: 100%;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.meta-pills-bottom {
  display: flex;
  width: 100%;
  justify-content: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.button-row .primary-button,
.button-row .danger-button {
  min-width: 120px;
}

.primary-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
  font-size: 0.95rem;
}

.primary-button {
  background: linear-gradient(180deg, #ffac31, var(--accent-deep));
  color: #fff;
  box-shadow: 0 14px 24px rgba(255, 159, 26, 0.24);
}

.danger-button {
  background: #fff3f0;
  color: var(--danger);
}

.primary-button:hover,
.primary-button:focus-visible,
.danger-button:hover,
.danger-button:focus-visible {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.danger-button:focus-visible,
.note-card:focus-visible {
  outline: none;
}

.empty-state,
.empty-list {
  align-content: start;
  gap: 14px;
}

.empty-state {
  min-height: 420px;
  max-width: 520px;
  padding-top: 40px;
}

.empty-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.delete-form {
  display: none;
}

.new-note-form {
  margin-top: auto;
  padding-top: 16px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .editor-header,
  .editor-footer {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .meta-pills {
    align-items: flex-end;
    max-width: none;
  }

  .main-stage {
    padding: 26px 20px 40px;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .editor-panel {
    padding: 18px;
  }

  .editor-heading h2,
  .empty-state h2 {
    font-size: 1.8rem;
  }

  .note-card-top,
  .editor-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .primary-button,
  .danger-button {
    width: 100%;
    justify-content: center;
  }

  .button-row,
  .delete-form {
    width: 100%;
  }

  .button-row {
    margin-left: 0;
  }

  .meta-pills {
    align-items: flex-start;
  }

  .main-stage {
    padding: 20px 16px 32px;
  }

  textarea {
    min-height: 360px;
  }
}
