:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-soft: #eef6f1;
  --text: #18201d;
  --muted: #66736e;
  --line: #d9e3dd;
  --accent: #137a69;
  --accent-strong: #0f5f53;
  --danger: #b4234b;
  --shadow: 0 20px 55px rgba(21, 42, 35, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(19, 122, 105, 0.08), transparent 34%),
    linear-gradient(280deg, rgba(180, 35, 75, 0.06), transparent 30%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.account {
  max-width: 48vw;
  overflow: hidden;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  min-height: calc(100vh - 136px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
}

.memo-list-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(250, 252, 250, 0.94);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  padding: 16px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

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

.search-field input:focus,
.title-input:focus,
.content-input:focus {
  border-color: rgba(19, 122, 105, 0.7);
  box-shadow: 0 0 0 3px rgba(19, 122, 105, 0.14);
}

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

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover,
.icon-button.is-active {
  border-color: rgba(19, 122, 105, 0.35);
  background: var(--panel-soft);
  color: var(--accent-strong);
}

.icon-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.icon-button.danger:hover {
  border-color: rgba(180, 35, 75, 0.4);
  background: #fff1f4;
  color: var(--danger);
}

.archive-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.archive-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.status-line {
  min-height: 30px;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.memo-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 16px;
}

.memo-card {
  border-radius: var(--radius);
}

.memo-card-button {
  display: block;
  width: 100%;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--memo-color, var(--accent));
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  text-align: left;
}

.memo-card-button:hover,
.memo-card.is-selected .memo-card-button {
  border-color: rgba(19, 122, 105, 0.45);
  box-shadow: 0 10px 22px rgba(21, 42, 35, 0.08);
}

.memo-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.memo-card h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pin-mark {
  display: none;
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 800;
}

.memo-card.is-pinned .pin-mark {
  display: inline;
}

.memo-card p {
  display: -webkit-box;
  overflow: hidden;
  min-height: 43px;
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.memo-card time {
  color: #7d8984;
  font-size: 0.78rem;
}

.editor-panel {
  min-width: 0;
  padding: 18px;
}

.editor {
  display: flex;
  height: 100%;
  min-height: 480px;
  flex-direction: column;
  gap: 14px;
}

.editor-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.title-input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--panel);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 760;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.swatch {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(24, 32, 29, 0.14);
}

.swatch.is-selected {
  border-color: var(--text);
}

.mint {
  --memo-color: #45a873;
  background: #dff4e8;
}

.sky {
  --memo-color: #3e8ed0;
  background: #dceefe;
}

.lemon {
  --memo-color: #c58a13;
  background: #fff1b8;
}

.rose {
  --memo-color: #c44a6c;
  background: #ffe3eb;
}

.ink {
  --memo-color: #4d5966;
  background: #e7ebef;
}

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

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  color: var(--muted);
  font-size: 0.92rem;
}

.save-button {
  min-width: 92px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

.save-button:hover {
  background: var(--accent-strong);
}

.empty-state {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding: 14px 0;
  }

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

  .account {
    max-width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .memo-list-panel {
    max-height: 44vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .editor-panel {
    padding: 14px;
  }

  .editor {
    min-height: 520px;
  }

  .editor-head {
    grid-template-columns: 1fr;
  }

  .editor-actions {
    justify-content: flex-end;
  }
}
