@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  font-family: 'DM Sans', sans-serif;
  color: #282923;
  background: #f4f3ef;
  --sidebar: #191a18;
  --muted: #85867d;
  --accent: #c7ef82;
  --paper: #fffefa;
  --line: #e4e6df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid #a5c96d;
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 255px;
  padding: 27px 16px 18px;
  background: var(--sidebar);
  color: #f2f2eb;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: width .2s ease, transform .25s ease;
}

.brand {
  color: #f7f7f0;
  font: 800 30px Manrope, sans-serif;
  letter-spacing: -1.8px;
  text-decoration: none;
  padding: 0 9px;
  margin-bottom: 35px;
}

.brand span {
  color: var(--accent);
}

.new-project {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: #292a26;
  color: #f1f1e9;
  border: 1px solid #3c3d36;
  border-radius: 9px;
  padding: 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
}

.new-project > span {
  color: var(--accent);
  font-size: 18px;
}

.new-project kbd {
  margin-left: auto;
  color: #999b91;
  font: 9px 'DM Mono', monospace;
  border: 1px solid #4a4b43;
  padding: 3px 5px;
  border-radius: 4px;
}

.new-project:hover {
  background: #35362f;
}

.section-label {
  color: #777970;
  font: 10px 'DM Mono', monospace;
  letter-spacing: 1px;
  margin: 32px 10px 12px;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.project-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  background: transparent;
  color: #aaa99f;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
  font-size: 12px;
  transition: background .15s, color .15s;
}

.project-item:hover {
  background: #252622;
  color: white;
}

.project-item.active {
  background: #2b2d27;
  color: #fff;
  border-color: #3a3c33;
}

.project-item .glyph {
  color: #a7d56c;
  font-size: 14px;
}

.project-item .label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item .archived {
  font-size: 9px;
  color: #85867d;
}

.sidebar-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  border-top: 1px solid #33342e;
  padding: 18px 8px 5px;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a8d46a;
  flex-shrink: 0;
}

.sidebar-bottom strong,
.sidebar-bottom small {
  display: block;
}

.sidebar-bottom strong {
  font-size: 11px;
  font-weight: 600;
}

.sidebar-bottom small {
  margin-top: 4px;
  color: #85867d;
  font-size: 10px;
}

.main {
  min-height: 100vh;
  margin-left: 255px;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 35px;
  border-bottom: 1px solid #e8e7e1;
  background: #f7f6f2;
  position: relative;
  z-index: 2;
}

.breadcrumb {
  font-size: 11px;
  color: #8b8b81;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.breadcrumb span {
  margin: 0 10px;
  color: #c0bfb6;
}

.breadcrumb strong {
  color: #3c3d36;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #88897f;
  font-size: 10px;
  flex-shrink: 0;
}

.icon-button {
  border: 1px solid transparent;
  background: transparent;
  color: #67685f;
  border-radius: 7px;
  width: 34px;
  height: 34px;
  font-size: 19px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.icon-button:hover {
  background: #ecebe5;
  border-color: #e1e0d8;
}

#mobileMenu {
  display: none;
}

.page {
  width: min(850px, calc(100% - 70px));
  margin: 52px auto 35px;
  padding: 0 0 20px;
  flex: 1;
}

.page-meta {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: #99998e;
  font: 9px 'DM Mono', monospace;
  letter-spacing: 1.1px;
}

.title {
  display: block;
  width: 100%;
  margin: 23px 0 25px;
  padding: 0;
  color: #252720;
  background: transparent;
  border: 0;
  outline: 0;
  font: 700 clamp(30px, 4vw, 43px) Manrope, sans-serif;
  letter-spacing: -1.7px;
}

.title:focus {
  outline: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 47px;
  padding: 5px 0;
  border-top: 1px solid #e1e0d9;
  border-bottom: 1px solid #e1e0d9;
}

.toolbar button {
  border: 1px solid transparent;
  background: transparent;
  color: #65665d;
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 11px;
}

.toolbar button:hover {
  background: #e9e8e1;
}

.separator {
  height: 20px;
  border-left: 1px solid #deddd5;
  margin: 0 6px;
}

.word-count {
  margin-left: auto;
  color: #96968c;
  font-size: 10px;
  white-space: nowrap;
}

.paper {
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    var(--line) 32px
  );
  background-position: 0 0;
  border: 1px solid #ebe9e1;
  border-top: 0;
  box-shadow: 0 12px 35px #34332208;
  min-height: 420px;
  padding: 0 28px;
}

#editor {
  min-height: 420px;
  padding: 0;
  outline: none;
  color: #36372f;
  font-size: 13px;
  line-height: 32px;
  overflow-wrap: anywhere;
}

#editor:empty::before {
  content: "Start writing...";
  color: #b0afa5;
  pointer-events: none;
}

#editor div,
#editor p {
  min-height: 32px;
  margin: 0;
}

#editor ul,
#editor ol {
  margin: 0;
  padding-left: 25px;
}

#editor li {
  min-height: 32px;
}

#editor input[type="checkbox"] {
  accent-color: #829f50;
  margin-right: 8px;
}

#editor h2 {
  font-size: 17px;
  line-height: 32px;
  margin: 0;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 2px;
  color: #93948a;
  font-size: 10px;
}

.page-footer span:first-child {
  color: #85877b;
}

.bottom-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 16px 35px;
  border-top: 1px solid #e8e7e1;
  color: #8d8e83;
  font-size: 10px;
}

.bottom-bar > span:first-child {
  color: #35362f;
  font-weight: 700;
}

.shortcut {
  margin-left: auto;
}

kbd {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
}

.project-menu {
  position: fixed;
  top: 57px;
  right: 25px;
  width: 185px;
  padding: 5px;
  background: #fffefa;
  border: 1px solid #e3e2da;
  border-radius: 10px;
  box-shadow: 0 12px 35px #00000012;
  z-index: 30;
}

.project-menu button {
  display: block;
  width: 100%;
  padding: 10px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4b4c43;
  font-size: 11px;
}

.project-menu button:hover {
  background: #f0efe9;
}

.project-menu .danger {
  color: #b84b42;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: transparent;
}

dialog {
  border: 1px solid #e6e5de;
  border-radius: 15px;
  width: min(420px, calc(100% - 30px));
  padding: 27px;
  background: #fffefa;
  color: #282923;
  box-shadow: 0 25px 90px #1114;
}

dialog::backdrop {
  background: #16171280;
  backdrop-filter: blur(4px);
}

.eyebrow {
  color: #929387;
  font: 10px 'DM Mono', monospace;
  letter-spacing: 1.3px;
}

dialog h2 {
  font: 700 24px Manrope, sans-serif;
  letter-spacing: -.7px;
  margin: 10px 0 25px;
}

dialog label:not(.setting-row) {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}

dialog input:not([type="checkbox"]) {
  width: 100%;
  padding: 12px;
  border: 1px solid #deddd4;
  border-radius: 8px;
  background: #fbfaf6;
  font-size: 13px;
}

dialog input:focus {
  outline: 2px solid #b3d781;
  border-color: transparent;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.primary,
.secondary,
.backup-button {
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.primary {
  background: #252720;
  color: #fff;
  border: 1px solid #252720;
}

.primary:hover {
  background: #414239;
}

.secondary,
.backup-button {
  background: #fff;
  border: 1px solid #e1e0d8;
  color: #56574e;
}

.secondary:hover,
.backup-button:hover {
  background: #f1f0e9;
}

.search-dialog {
  padding: 0;
  overflow: hidden;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid #e6e5de;
  font-size: 20px;
}

.search-box input {
  flex: 1;
  width: 100%;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
}

.search-results {
  max-height: 340px;
  overflow: auto;
  padding: 8px;
}

.search-result {
  width: 100%;
  display: block;
  padding: 12px;
  text-align: left;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.search-result:hover {
  background: #f1f0e9;
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result strong {
  font-size: 12px;
  color: #303129;
}

.search-result small {
  margin-top: 5px;
  font-size: 10px;
  color: #898a80;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-modal {
  padding-bottom: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid #e9e8e1;
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  font-size: 12px;
}

.setting-row small {
  margin-top: 5px;
  font-size: 10px;
  color: #8a8b81;
}

.setting-row input {
  accent-color: #555e40;
}

.backup-button {
  width: 100%;
  margin-top: 15px;
}

.privacy-note {
  color: #898a80;
  font-size: 10px;
  line-height: 1.7;
  margin: 17px 0 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 15px);
  opacity: 0;
  pointer-events: none;
  background: #252720;
  color: white;
  padding: 11px 16px;
  border-radius: 9px;
  box-shadow: 0 8px 30px #0002;
  font-size: 12px;
  transition: .2s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.hide-lines .paper {
  background-image: none;
}

body.compact-sidebar .sidebar {
  width: 220px;
}

body.compact-sidebar .main {
  margin-left: 220px;
}

@media (max-width: 800px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 15px 0 45px #0002;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main,
  body.compact-sidebar .main {
    margin-left: 0;
  }

  #mobileMenu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    padding: 0 16px;
    gap: 10px;
  }

  .breadcrumb {
    flex: 1;
  }

  .top-actions {
    gap: 4px;
  }

  #saveStatus {
    display: none;
  }

  .page {
    width: calc(100% - 32px);
    margin-top: 35px;
  }

  .paper {
    padding: 0 16px;
  }

  .bottom-bar {
    padding: 15px 16px;
  }

  body.compact-sidebar .sidebar {
    width: 255px;
  }
}

@media (max-width: 450px) {
  .page-meta {
    font-size: 8px;
  }

  .title {
    font-size: 32px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .word-count {
    width: 100%;
    margin: 0 8px 3px;
  }

  .paper,
  #editor {
    min-height: 360px;
  }

  .shortcut {
    display: none;
  }
}