:root {
  --bg: #ffffff;
  --sidebar: #f7f7f7;
  --text: #1f1f1f;
  --muted: #747474;
  --line: #d9d9d9;
  --line-soft: #e8e8e8;
  --button: #f3f3f3;
  --button-active: #dedede;
  --selected: #dfdfdf;
  --danger: #7d1f1f;
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --note-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --note-size: 15.5px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

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

body.list-hidden .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.note-list-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

body.list-hidden .note-list-pane {
  display: none;
}

.list-header,
.topbar {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.list-header {
  gap: 8px;
  padding: 0 10px;
}

.list-header h1 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  line-height: 1;
  font-weight: 700;
}

.button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--button);
  padding: 0 8px;
  font-size: 12.5px;
}

.button:hover {
  background: #ececec;
}

.button.is-active {
  background: var(--button-active);
  border-color: #bdbdbd;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08);
}

.icon-button {
  width: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.list-action-button {
  padding: 0 7px;
  font-size: 12px;
}

.danger-button {
  color: var(--danger);
}

.search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.sort-row {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}

.sort-select {
  width: 100%;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  outline: 0;
  padding: 0 7px;
  color: #666;
  font-size: 12.5px;
}

.search-input {
  width: 100%;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  outline: 0;
  padding: 0 8px;
  font-size: 13px;
}

.notes {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.note-row {
  width: 100%;
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  padding: 10px 11px 9px;
  text-align: left;
}

.note-row:hover {
  background: #efefef;
}

.note-row.active {
  background: var(--selected);
}

.note-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.2;
}

.note-date,
.empty-state {
  color: #858585;
  font-size: 11px;
}

.empty-state {
  padding: 14px;
  line-height: 1.35;
}

.editor-pane {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: 50px minmax(0, 1fr) auto;
  background: #fff;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  gap: 8px;
  padding: 0 12px;
  background: #fbfbfb;
}

.save-state {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-scroll {
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.paper {
  width: min(940px, 100%);
  min-height: 100%;
  margin: 0;
  padding: 44px 62px 86px;
}

.title-input {
  width: 100%;
  display: block;
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  font-family: var(--font);
}

.editor {
  min-height: 420px;
  outline: none;
  color: var(--text);
  font-family: var(--note-font);
  font-size: var(--note-size);
  line-height: 1.55;
}

.editor:empty::before {
  content: "Skriv her...";
  color: #aaa;
}

.editor p {
  margin: 0 0 12px;
}

.editor h1,
.editor h2 {
  margin: 26px 0 10px;
  line-height: 1.15;
}

.editor h1 {
  font-size: 24px;
}

.editor h2 {
  font-size: 20px;
}

.editor ul,
.editor ol {
  margin: 0 0 14px;
  padding-left: 25px;
}

.editor a {
  color: #0645ad;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.editor img {
  display: block;
  max-width: 100%;
  margin: 14px 0;
  border: 1px solid var(--line);
}

.toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  background: linear-gradient(#fbfbfb, #f4f4f4);
  box-shadow: 0 -1px 4px rgba(0, 0, 0, .04);
  padding: 9px 12px;
}

body.toolbar-hidden .toolbar {
  display: none;
}

.toolbar-group {
  display: flex;
  gap: 3px;
  align-items: center;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid #dddddd;
  background: rgba(255, 255, 255, .72);
}

.toolbar-fill {
  flex: 1;
}

.select {
  height: 32px;
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--button);
  outline: 0;
  padding: 0 7px;
  font-size: 12.5px;
}

.size-select {
  max-width: 96px;
}

.highlight-select {
  max-width: 122px;
}

.tool-button {
  min-width: 34px;
  min-height: 32px;
}

.strike-icon {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.text-tool {
  min-width: 78px;
}

.hidden-file,
.floating-toolbar-button {
  display: none;
}

body.toolbar-hidden .floating-toolbar-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: block;
  background: #fbfbfb;
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .note-list-pane {
    position: fixed;
    inset: 0 24% 0 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .15s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, .16);
  }

  body.mobile-list-open .note-list-pane {
    transform: translateX(0);
  }

  body.mobile-list-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(0, 0, 0, .15);
  }

  body.list-hidden .note-list-pane {
    display: flex;
  }

  .topbar {
    height: 46px;
  }

  .paper {
    padding: 28px 20px 78px;
  }

  .title-input {
    font-size: 25px;
  }

  .editor {
    font-size: 16px;
  }
}
