/* Evernote workbench - Codex platform dark green theme */
:root {
  --bg: #090f0c;
  --surface: #0e1912;
  --surface-2: #142219;
  --line: #263d2e;
  --line-strong: #2c4936;
  --text: #e8edf4;
  --text-soft: #a7b5c7;
  --muted: #7c8ea4;
  --accent: #4ade80;
  --accent-strong: #22c55e;
  --chip-bg: #173c26;
  --chip-fg: #bbf7d0;
  --danger: #fca5a5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; min-width: 120px; color: var(--text); }
.topbar .back { color: var(--accent); text-decoration: none; font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar button {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.topbar button:hover { background: #1b3525; }
.topbar button:disabled { color: var(--muted); cursor: default; }
.pill { font-size: 12px; color: var(--muted); }
.card {
  max-width: 640px;
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.card button {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #052e16;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}
.card button:disabled { background: #31523e; color: #9db8ab; cursor: default; }
.hint { color: var(--muted); font-size: 13px; }
.workbench {
  display: grid;
  grid-template-columns: minmax(0, var(--notebooks, .22fr)) 8px minmax(0, var(--notes, .28fr)) 8px minmax(0, var(--detail, .5fr));
  gap: 0;
  padding: 12px;
  align-items: stretch;
}
.pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 0;
  height: calc(100vh - 82px);
  overflow: auto;
}
/* Keep scrolling but hide the visible scrollbar in the notebook and note panes. */
.pane-notebooks, .pane-notes {
  scrollbar-width: none;
}
.pane-notebooks::-webkit-scrollbar, .pane-notes::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.pane-detail { scrollbar-width: thin; scrollbar-color: #31523e transparent; }
.pane-detail::-webkit-scrollbar { width: 8px; }
.pane-detail::-webkit-scrollbar-track { background: transparent; }
.pane-detail::-webkit-scrollbar-thumb { background: #31523e; border-radius: 4px; }
.pane-detail { display: flex; flex-direction: column; overflow: hidden; }
.pane-head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  flex-wrap: wrap;
}
.pane-head h2 {
  font-size: 14px;
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 60px;
  color: var(--text);
}
/* Search layout: input owns the whole first row; both buttons share the second row. */
.pane-notebooks .pane-head { flex-direction: column; align-items: stretch; }
.search-box { display: flex; width: 100%; min-width: 0; }
.search-box input[type="search"] {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101c15;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.search-box input[type="search"]::placeholder { color: #6d8294; }
.search-box input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.search-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.search-actions button {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
}
.search-actions button:hover { background: #1b3525; }
#search-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #052e16;
  font-weight: 600;
}
#search-button:hover { filter: brightness(1.07); }
.notebook-shortcut { display: flex; gap: 6px; align-items: center; }
#notebook-shortcut {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#notebook-shortcut:hover { background: #1b3525; }
#notebook-shortcut:disabled { opacity: .6; cursor: default; }
#notebook-shortcut-change { flex: none; font-size: 12px; }
.notebook-shortcut-picker { display: flex; gap: 6px; align-items: center; }
.notebook-shortcut-picker select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.note-title { cursor: text; }
.note-title:hover { text-decoration: underline dotted; }
.title-input {
  flex: 1;
  min-width: 60px;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.list { list-style: none; margin: 0; padding: 6px; }
.list-item {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  font: inherit;
  color: var(--text);
}
.list-item:hover { background: #14281c; }
.list-item.selected { background: #173c26; }
.list-item.selected:hover { background: #19452b; }
/* Faint separator between notes; the selected card keeps its highlight. */
.pane-notes .list > li:not(:last-child) { border-bottom: 1px solid var(--line); }
.pane-notes .list > li:has(.list-item.selected) { border-bottom-color: transparent; }
.item-label { display: block; font-size: 14px; overflow-wrap: anywhere; }
.item-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-empty { padding: 16px; color: var(--muted); font-size: 13px; }
.list-foot {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.link-button {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 4px;
}
.link-button:disabled { color: #54706a; cursor: default; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.chip {
  font-size: 12px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-radius: 999px;
  padding: 2px 8px;
}
.note-body {
  line-height: 1.65;
  font-size: 15px;
  overflow-wrap: anywhere;
  color: var(--text);
}
.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #31523e transparent;
}
.detail-scroll::-webkit-scrollbar { width: 8px; }
.detail-scroll::-webkit-scrollbar-track { background: transparent; }
.detail-scroll::-webkit-scrollbar-thumb { background: #31523e; border-radius: 4px; }
.note-body.editor {
  flex: 1 0 auto;
  display: block;
  padding: 12px 16px 24px;
}
.format-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.format-tools select {
  background: #101c15;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 3px 6px;
  font: inherit;
  font-size: 13px;
}
.color-row { display: flex; align-items: center; gap: 5px; }
.color-chip {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(232, 237, 244, 0.3);
  cursor: pointer;
  padding: 0;
}
.color-chip.color-default {
  width: auto;
  height: auto;
  border-radius: 8px;
  padding: 3px 7px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.save-state { font-size: 12px; color: var(--muted); }
.save-state.save-ok { color: var(--accent); }
.save-state.save-busy { color: var(--text-soft); }
.save-state.save-unsynced { color: var(--text-soft); }
.save-state.save-failed { color: var(--danger); }
.note-body img.en-img { max-width: 100%; height: auto; border-radius: 6px; margin: 6px 0; }
.note-body table { border-collapse: collapse; max-width: 100%; }
.note-body td, .note-body th { border: 1px solid var(--line-strong); padding: 4px 8px; }
.note-body pre { background: var(--surface-2); padding: 8px; border-radius: 6px; overflow: auto; }
.note-body blockquote { border-left: 3px solid var(--line-strong); margin: 8px 0; padding-left: 10px; color: var(--text-soft); }
.note-body a { color: #6ee7b7; }
.en-todo { margin-right: 4px; }
.en-crypt { color: #fbbf24; }
.en-missing { color: var(--muted); }
/* Attachments are ordinary blocks in the document flow: never positioned, so
   they cannot cover the text before or after them, and long names wrap or get
   truncated instead of pushing the editor wider than its pane. */
.en-media {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  margin: 6px 0;
  padding: 2px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.en-media-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}
.en-media-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 12px; margin-top: 2px; }
.en-media-actions a { color: #6ee7b7; }
.en-rename, .attachment-name-editor button { min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2);
  color: var(--accent); font: inherit; cursor: pointer; }
.attachment-name-editor { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.attachment-name-editor > span { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.attachment-name-editor input { min-width: 0; flex: 1 1 220px; max-width: 100%; box-sizing: border-box;
  min-height: 40px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px; font: inherit; }
.en-media-actions .en-remove { padding: 1px 8px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer;
  font: inherit; font-size: 12px; }
.note-body.read-only .en-media-actions .en-remove { display: none; }
.en-pdf { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 8px; margin: 4px 0;
  max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
.en-open { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.en-pdf-view {
  width: 100%;
  height: 70vh;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
.en-file { display: inline-block; margin: 4px 0; color: #6ee7b7; }
.attachments { padding: 0 16px 16px; }
.attachments h3, .edit h3 { font-size: 13px; margin: 8px 0; color: var(--muted); }
.attachments ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.attachments a { color: #6ee7b7; }
.edit {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edit textarea, .edit input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101c15;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.edit-actions { display: flex; gap: 8px; align-items: center; }
.edit button, .detail-actions button {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.edit button:hover, .detail-actions button:hover { background: #1b3525; }
.edit button:disabled { color: var(--muted); cursor: default; }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .workbench { display: block; padding: 8px; }
  .pane { min-height: 0; max-height: none; height: auto; margin: 0 0 10px; }
  .pane-notebooks, .pane-notes, .pane-detail { display: none; }
  .stage-notebooks .pane-notebooks { display: block; }
  .stage-notes .pane-notes { display: block; }
  .stage-detail .pane-detail { display: block; }
  .mobile-only { display: inline-block; }
  .note-body { padding: 10px 12px 20px; }
  .en-pdf-view { height: 60vh; }
  .topbar h1 { font-size: 16px; }
  .search-actions button { flex: 1; }
}

.pane { min-width: 0; }
.resizer { align-self: stretch; cursor: col-resize; touch-action: none; border-radius: 4px; }
.resizer:hover, .resizer:focus { background: #19452b; outline: 2px solid var(--accent); }
.stack-children { padding-left: 14px; }
summary { padding: 8px; cursor: pointer; overflow-wrap: anywhere; color: var(--text); }
/* One document surface; media remains atomic inside it. */
.note-body[contenteditable="true"] { outline: none; white-space: pre-wrap; min-height: 300px; cursor: text; }
.note-body [data-opaque] { display: inline-block; max-width: 100%; vertical-align: middle; }
.note-body [data-opaque][data-media] { display: block; }
.note-body [data-opaque] .en-pdf { white-space: normal; }
.en-media-failed { display: block; margin-top: 2px; font-size: 12px; color: var(--danger); }
/* Colour chips stay visible on the dark theme, and the active one is obvious. */
.color-chip { box-shadow: 0 0 0 1px rgba(9, 15, 12, 0.6); }
.color-chip[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.color-chip.color-default[aria-pressed="true"] { background: #1b3525; }
.format-tools button[aria-pressed="true"] { background: var(--line-strong); border-color: var(--text); }
.format-tools button { padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.attachments .attachment-remove { margin-left: 10px; }
.attachments .attachment-note { margin-left: 8px; font-size: 12px; color: var(--muted); }

/* Status is a normal-flow sibling of the scroll area, never painted on text. */
.pane-detail > .pane-head, .pane-detail > .meta { flex-shrink: 0; }
#detail-state { flex: 0 0 auto; margin: 0; padding: 10px 16px;
  border-top: 1px solid var(--line); white-space: pre-line; overflow-wrap: anywhere; }
#detail-state:empty { display: none; }
.detail-scroll > .attachments { flex-shrink: 0; }
