:root {
  color-scheme: light;
  --canvas: #ffffff;
  --surface: #ffffff;
  --soft: #ffffff;
  --soft-strong: #ffffff;
  --ink: #181818;
  --ink-soft: #343434;
  --muted: #626262;
  --faint: #737373;
  --line: #dedede;
  --line-strong: #b8b8b8;
  --accent: #176b55;
  --accent-strong: #105744;
  --accent-soft: #ffffff;
  --accent-line: #176b55;
  --danger: #ae3542;
  --danger-soft: #ffffff;
  --focus: #176b55;
  --sidebar-width: 268px;
  --page-width: 920px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 7%);
  --shadow-dialog: 0 24px 72px rgb(0 0 0 / 20%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  background: #ffffff;
  color: var(--ink);
}

body {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 16px;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 1;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[contenteditable]:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

kbd {
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font: 600 14px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

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

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  background: #ffffff;
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-width: 0;
  height: 100dvh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.sidebar-brand {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 15px 10px 18px;
}

.brand-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-button:hover {
  color: var(--accent);
}

.brand-mark,
.public-brand > span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 11px 11px 11px 4px;
  background: var(--ink);
  color: #ffffff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.icon-button,
.mini-icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  line-height: 1;
}

.icon-button:hover,
.mini-icon-button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.sidebar-close {
  display: none;
  font-size: 25px;
}

.capture-button {
  display: grid;
  min-height: 48px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin: 0 14px 14px;
  padding: 9px 10px 9px 13px;
  border: 1px solid var(--ink);
  border-radius: 12px 12px 12px 5px;
  background: var(--ink);
  color: #ffffff;
  text-align: left;
  font-weight: 680;
  box-shadow: 0 6px 14px rgb(0 0 0 / 14%);
}

.capture-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.capture-button > span:first-child {
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
}

.capture-button kbd {
  padding: 4px 6px;
  border-color: rgb(255 255 255 / 20%);
  background: rgb(255 255 255 / 10%);
  color: rgb(255 255 255 / 78%);
}

.sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 10px 16px;
  scrollbar-width: thin;
}

.sidebar-group + .sidebar-group {
  margin-top: 20px;
}

.sidebar-heading-row {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
}

.sidebar-heading-row h2 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
  letter-spacing: 0.04em;
}

.mini-icon-button {
  width: 38px;
  height: 38px;
  font-size: 20px;
}

.quiet-link {
  min-height: 38px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
}

.quiet-link:hover {
  color: var(--accent);
}

.sidebar-list {
  display: grid;
  gap: 3px;
}

.static-sidebar-item,
.sidebar-item {
  display: grid;
  width: 100%;
  min-height: 43px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  text-align: left;
}

.static-sidebar-item:hover,
.sidebar-item:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.static-sidebar-item[aria-current="page"],
.sidebar-item[aria-current="page"] {
  border-color: var(--accent-line);
  background: var(--accent);
  color: #ffffff;
  font-weight: 680;
}

.static-sidebar-item kbd {
  padding: 3px 5px;
  font-size: 14px;
}

.area-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px 8px 8px 3px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
}

[aria-current="page"] .area-icon {
  background: #ffffff;
  color: var(--accent-strong);
}

[aria-current="page"] .nav-count {
  color: #ffffff;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  min-width: 24px;
  color: var(--faint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tag-sidebar-list .sidebar-item {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-left: 14px;
}

.tag-sidebar-list .nav-label::before {
  content: "#";
  margin-right: 4px;
  color: var(--accent);
}

.sidebar-empty {
  margin: 3px 8px 0;
  color: var(--faint);
  font-size: 14px;
}

.sidebar-bottom {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 11px 10px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.storage-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 10px 0;
  color: var(--faint);
  font-size: 14px;
}

.storage-note span {
  color: var(--accent);
  font-size: 8px;
}

.data-menu-wrap {
  position: relative;
}

.small-menu,
.floating-menu {
  z-index: 100;
  min-width: 210px;
  max-height: min(440px, calc(100dvh - 32px));
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-dialog);
}

.data-menu {
  position: absolute;
  right: 0;
  bottom: 45px;
}

.small-menu button,
.floating-menu button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
}

.small-menu button:hover,
.small-menu button:focus-visible,
.floating-menu button:hover,
.floating-menu button:focus-visible,
.floating-menu button[aria-selected="true"] {
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.floating-menu {
  position: fixed;
}

.floating-menu button > span:first-child {
  display: inline-grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink-soft);
  font: 700 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.block-type-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.block-type-copy strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-type-copy small,
.attachment-limit {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.block-menu-actions {
  display: grid;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.block-menu-actions button:last-child {
  color: var(--danger);
}

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

.menu-divider {
  height: 1px;
  margin: 6px 3px;
  background: var(--line);
}

.workspace {
  display: grid;
  min-width: 0;
  height: 100dvh;
  grid-template-rows: 58px minmax(0, 1fr);
  background: #ffffff;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}

.mobile-menu-button {
  display: none;
}

.breadcrumbs {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: var(--faint);
  font-size: 14px;
  white-space: nowrap;
}

.breadcrumbs span {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs .crumb-current {
  color: var(--ink-soft);
  font-weight: 650;
}

.save-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.save-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.main-content {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  background: #ffffff;
}

.page-view {
  width: min(calc(100% - 48px), var(--page-width));
  margin: 0 auto;
  padding: 58px 0 96px;
}

.collection-header h1,
.tag-index-view h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 790;
  letter-spacing: -0.045em;
  line-height: 1.28;
}

.collection-header > div > p:last-child {
  max-width: 640px;
  margin: 16px 0 0;
  color: var(--muted);
}

.quick-capture-card {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 0;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 17px 17px 17px 7px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.quick-capture-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
}

.quick-title-input {
  min-height: 58px;
  padding: 15px 17px 8px;
  font-size: 19px;
  font-weight: 720;
}

.quick-title-input::placeholder {
  color: var(--muted);
}

.quick-capture-card textarea {
  min-height: 106px;
  padding: 6px 17px 14px;
  border: 0;
  outline: 0;
  line-height: 1.7;
}

.quick-capture-card input:focus {
  outline: 0;
}

.quick-capture-footer {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 7px 8px 7px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.primary-button,
.secondary-button,
.text-danger-button,
.restore-button,
.delete-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 10px;
  font-weight: 690;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.primary-button kbd {
  padding: 3px 5px;
  border-color: rgb(255 255 255 / 25%);
  background: rgb(255 255 255 / 10%);
  color: rgb(255 255 255 / 82%);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink-soft);
}

.secondary-button:hover {
  border-color: var(--accent-line);
  background: #ffffff;
  color: var(--accent-strong);
}

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

.text-danger-button:hover {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--danger);
}

.primary-button:disabled {
  border-color: var(--faint);
  background: var(--faint);
  color: #ffffff;
}

.secondary-button:disabled {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--faint);
}

.content-section {
  margin-top: 57px;
}

.section-heading-row,
.collection-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-heading-row h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.view-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.view-switch button {
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 16px;
}

.view-switch button:hover {
  color: var(--ink);
}

.view-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  font-weight: 680;
}

.note-list {
  display: grid;
  min-width: 0;
}

.note-list.is-list-mode {
  gap: 0;
}

.note-list.is-card-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
}

.note-item {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.is-list-mode .note-item {
  display: flex;
  align-items: stretch;
}

.note-open {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 18px 7px;
  border-radius: 10px;
  text-align: left;
}

.note-open:hover {
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.note-title {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.012em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-snippet {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.note-meta {
  color: var(--faint);
  font-size: 14px;
  line-height: 1.45;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
}

.tag-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1.35;
}

.tag-chip button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.tag-chip button:hover {
  background: #ffffff;
  color: var(--danger);
}

.note-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
}

.restore-button {
  color: var(--accent);
}

.restore-button:hover {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--accent);
}

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

.delete-button:hover {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--danger);
}

.is-card-mode .note-item {
  display: flex;
  min-height: 208px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 6px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgb(0 0 0 / 5%);
}

.is-card-mode .note-item:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.is-card-mode .note-open {
  flex: 1;
  padding: 18px;
}

.is-card-mode .note-snippet {
  -webkit-line-clamp: 4;
}

.is-card-mode .note-actions {
  flex-wrap: wrap;
  padding: 0 9px 9px;
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  align-content: center;
  padding: 36px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--accent-line);
  border-radius: 18px 18px 18px 6px;
  background: #ffffff;
  color: var(--accent);
  font-size: 24px;
}

.empty-state h2,
.empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
}

.empty-state p {
  margin: 8px 0 0;
}

.collection-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.collection-header h1,
.tag-index-view h1 {
  font-size: clamp(34px, 4vw, 44px);
}

.collection-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.collection-toolbar {
  align-items: center;
  margin-top: 35px;
}

.collection-count {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.tag-cloud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 38px;
}

.tag-cloud > button {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px 13px 13px 5px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.tag-cloud > button:hover {
  border-color: var(--accent-line);
  background: #ffffff;
  color: var(--accent-strong);
}

.tag-cloud > button > span:first-child::before {
  content: "#";
  margin-right: 4px;
  color: var(--accent);
}

.tag-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.editor-view {
  --editor-indent: 40px;
  width: min(calc(100% - 48px), 860px);
  padding-top: 48px;
}

.editor-header {
  padding-left: var(--editor-indent);
}

.editor-meta-row {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 9px;
}

.editor-meta,
.sample-label {
  color: var(--faint);
  font-size: 14px;
}

.sample-label {
  padding: 2px 7px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 700;
}

.page-title-input {
  display: block;
  width: 100%;
  min-height: 62px;
  margin: 13px 0 20px;
  padding: 0;
  overflow: hidden;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 790;
  letter-spacing: -0.045em;
  line-height: 1.28;
}

.page-title-input::placeholder {
  color: #737373;
}

.editor-properties {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(240px, 1.6fr) auto;
  align-items: start;
  gap: 14px;
  padding: 13px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.editor-properties > label,
.tag-property {
  display: grid;
  gap: 6px;
}

.editor-properties > label > span,
.tag-property > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.editor-properties select,
.tag-entry,
.dialog-panel input,
.dialog-panel textarea,
.dialog-panel select,
.search-filters select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #ffffff;
}

.tag-entry {
  display: flex;
  min-height: 44px;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
}

.tag-entry:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.note-tag-list {
  display: contents;
}

.tag-entry input {
  width: 110px;
  min-height: 32px;
  flex: 1 1 110px;
  padding: 2px 5px;
  border: 0;
  outline: 0;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 25px;
}

.block-editor {
  display: grid;
  gap: 2px;
  margin-top: 28px;
}

.block-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
}

.block-handle {
  display: grid;
  width: 32px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: transparent;
  font-size: 20px;
  line-height: 1;
}

.block-row:hover .block-handle,
.block-handle:focus-visible {
  background: #ffffff;
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.block-body {
  min-width: 0;
}

.block-editable {
  min-height: 36px;
  padding: 4px 6px;
  border-radius: 6px;
  outline: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
}

.block-editable:hover {
  background: #ffffff;
  box-shadow: inset 2px 0 0 var(--line-strong);
}

.block-editable:focus {
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.block-editable:empty::before {
  content: attr(data-placeholder);
  color: #737373;
  pointer-events: none;
}

.heading-block .block-editable {
  min-height: 48px;
  padding-top: 9px;
  padding-bottom: 5px;
  font-size: 25px;
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.4;
}

.list-block {
  position: relative;
  padding-left: 24px;
}

.list-block::before {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 19px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.75;
}

.list-block.is-bullet::before {
  content: "•";
}

.list-block.is-number::before {
  content: attr(data-number) ".";
  font-size: 14px;
}

.quote-block {
  margin: 4px 0;
  padding: 5px 5px 5px 14px;
  border-left: 3px solid var(--ink-soft);
  color: var(--ink-soft);
}

.callout-block {
  position: relative;
  margin: 5px 0;
  padding: 10px 11px 10px 42px;
  border: 1px solid var(--accent-line);
  border-radius: 11px 11px 11px 4px;
  background: #ffffff;
  border-left-width: 4px;
}

.callout-block::before {
  content: "✦";
  position: absolute;
  margin-left: -28px;
  color: var(--accent);
}

.code-block {
  overflow: hidden;
  margin: 6px 0;
  border: 1px solid #25342f;
  border-radius: 11px;
  background: #17201d;
}

.code-block textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  padding: 16px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: #ffffff;
  font: 15px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.attachment-block {
  display: grid;
  gap: 11px;
  margin: 6px 0;
  padding: 14px;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
}

.attachment-block img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border-radius: 9px;
  object-fit: contain;
}

.attachment-block input[type="file"] {
  max-width: 100%;
}

.attachment-chooser {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-weight: 680;
}

.attachment-empty {
  margin: 0;
  color: var(--muted);
}

.attachment-block .attachment-caption {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-block > button,
.attachment-block > a {
  justify-self: start;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-block {
  max-width: 100%;
  overflow-x: auto;
  margin: 7px 0;
  scrollbar-width: thin;
}

.table-block table {
  width: 100%;
  min-width: 520px;
  border-spacing: 0;
  border-collapse: separate;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.table-block caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.table-block th,
.table-block td {
  min-width: 150px;
  padding: 0;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: #ffffff;
  text-align: left;
}

.table-block th {
  background: #ffffff;
}

.table-block input {
  width: 100%;
  min-height: 45px;
  padding: 9px 11px;
  outline: 0;
}

.table-block input:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.table-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
}

.table-actions button {
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-actions button:hover {
  border-color: var(--accent-line);
  background: #ffffff;
  color: var(--accent-strong);
}

.add-block-button {
  min-height: 44px;
  margin: 10px 0 0 var(--editor-indent);
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  text-align: left;
}

.add-block-button:hover {
  background: #ffffff;
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.app-dialog {
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  max-height: min(780px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px 18px 18px 7px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
}

.app-dialog::backdrop {
  background: rgb(0 0 0 / 38%);
  backdrop-filter: blur(2px);
}

.compact-dialog {
  width: min(560px, calc(100vw - 32px));
}

.dialog-panel {
  display: grid;
  max-height: min(780px, calc(100dvh - 32px));
  gap: 9px;
  overflow-y: auto;
  padding: 24px;
  background: #ffffff;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.025em;
}

.dialog-panel > label,
.search-filters label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.dialog-panel textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.7;
}

.dialog-title-input {
  font-weight: 680;
}

.dialog-panel input:focus,
.dialog-panel textarea:focus,
.dialog-panel select:focus,
.search-filters select:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 2px var(--accent);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 9px;
}

.split-actions {
  justify-content: space-between;
}

.dialog-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.search-box {
  display: grid;
  min-height: 54px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.search-box input {
  width: 100%;
  height: 52px;
  border: 0;
  outline: 0;
  font-size: 17px;
}

.search-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 5px 0;
}

.search-filters label {
  display: grid;
  gap: 4px;
}

.search-results {
  min-height: 220px;
  max-height: min(430px, 50dvh);
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.search-result {
  display: grid;
  width: 100%;
  min-height: 78px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.search-result:hover {
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.search-result > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.search-result-title {
  overflow: hidden;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-snippet {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-empty {
  min-height: 220px;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.share-illustration {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 4px 0 4px;
  border: 1px solid var(--accent-line);
  border-radius: 19px 19px 19px 6px;
  background: #ffffff;
  color: var(--accent);
  font-size: 27px;
}

.share-status-text {
  margin: 0 0 5px;
  color: var(--ink-soft);
}

.danger-share {
  border-color: var(--danger);
  color: var(--danger);
}

.danger-share:hover {
  border-color: var(--danger);
  background: #ffffff;
  color: var(--danger);
}

.toast {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: flex;
  max-width: min(440px, calc(100vw - 32px));
  min-height: 48px;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid #283a34;
  border-radius: 12px 12px 12px 4px;
  background: #17201d;
  color: #ffffff;
  box-shadow: var(--shadow-dialog);
}

.toast button {
  min-height: 38px;
  margin-left: auto;
  padding: 5px 8px;
  border-radius: 7px;
  color: #ffffff;
  font-weight: 700;
}

.toast button:hover {
  background: rgb(255 255 255 / 10%);
}

.public-view {
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  background: #ffffff;
}

.public-topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
}

.public-brand > span {
  width: 30px;
  height: 30px;
  font-size: 19px;
}

.public-document {
  width: min(calc(100% - 40px), 760px);
  margin: 0 auto;
  padding: 74px 0 110px;
}

.public-document > h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  letter-spacing: -0.045em;
  line-height: 1.25;
}

.public-meta {
  margin: 13px 0 38px;
  color: var(--muted);
  font-size: 14px;
}

.public-blocks {
  display: grid;
  gap: 9px;
}

.public-block {
  margin: 0;
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.public-block.is-heading {
  margin: 24px 0 4px;
  font-size: 26px;
  letter-spacing: -0.025em;
  line-height: 1.4;
}

.public-list {
  padding-left: 28px;
}

.public-list li + li {
  margin-top: 4px;
}

.public-block.is-quote {
  padding: 5px 0 5px 16px;
  border-left: 3px solid var(--ink-soft);
  color: var(--ink-soft);
}

.public-block.is-callout {
  position: relative;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--accent-line);
  border-radius: 12px 12px 12px 5px;
  background: #ffffff;
  border-left-width: 4px;
}

.public-callout {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 4px;
}

.public-callout > p {
  margin: 0;
}

.public-callout-icon {
  color: var(--accent);
}

.public-block.is-callout::before {
  content: "✦";
  position: absolute;
  margin-left: -28px;
  color: var(--accent);
}

.public-block pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 5px 0;
  padding: 17px;
  border-radius: 11px;
  background: #17201d;
  color: #ffffff;
}

.public-block code {
  font: 15px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.public-block figure,
figure.public-block {
  margin: 8px 0;
}

.public-block img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.public-block figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.public-block a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.public-unavailable {
  display: grid;
  min-height: calc(100dvh - 64px);
  place-items: center;
  align-content: center;
  padding: 32px;
  text-align: center;
}

.public-unavailable > span {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 20px 20px 20px 7px;
  color: var(--accent);
  font-size: 26px;
}

.public-unavailable h1 {
  margin: 17px 0 0;
  font-size: 26px;
}

.public-unavailable p {
  margin: 7px 0 0;
  color: var(--muted);
}

.mobile-scrim {
  display: none;
}

@media (min-width: 769px) {
  .sidebar-close {
    display: inline-grid;
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.is-sidebar-collapsed .sidebar {
    display: none;
  }

  .app-shell.is-sidebar-collapsed .mobile-menu-button {
    display: inline-grid;
  }
}

@media (max-width: 1040px) {
  .note-list.is-card-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-properties {
    grid-template-columns: minmax(140px, 0.75fr) minmax(220px, 1.25fr);
  }

  .editor-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(292px, calc(100vw - 42px));
    transform: translateX(-102%);
    box-shadow: 18px 0 48px rgb(0 0 0 / 18%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-grid;
  }

  .mobile-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 36%);
  }

  .mobile-scrim.is-visible {
    display: block;
  }

  .workspace {
    width: 100%;
    height: 100dvh;
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .topbar {
    padding: 0 12px;
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .breadcrumbs span:not(.crumb-current) {
    display: none;
  }

  .breadcrumbs {
    gap: 0;
  }

  .save-status {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-view,
  .editor-view {
    width: min(calc(100% - 32px), var(--page-width));
    padding-top: 34px;
    padding-bottom: 72px;
  }

  .collection-header h1,
  .tag-index-view h1 {
    font-size: clamp(30px, 10vw, 38px);
  }

  .content-section {
    margin-top: 43px;
  }

  .collection-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .collection-actions {
    justify-content: flex-start;
  }

  .collection-toolbar {
    margin-top: 26px;
  }

  .note-list.is-card-mode,
  .tag-cloud {
    grid-template-columns: 1fr;
  }

  .is-card-mode .note-item {
    min-height: 178px;
  }

  .editor-view {
    --editor-indent: 0px;
  }

  .editor-header {
    padding-left: 0;
  }

  .page-title-input {
    font-size: clamp(32px, 11vw, 42px);
  }

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

  .editor-actions {
    grid-column: auto;
  }

  .block-row {
    grid-template-columns: 31px minmax(0, 1fr);
  }

  .block-handle {
    width: 29px;
    color: var(--faint);
  }

  .add-block-button {
    margin-left: 31px;
  }

  .dialog-panel {
    padding: 20px;
  }

  .search-filters {
    grid-template-columns: 1fr;
  }

  .search-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }

  .search-dialog .dialog-panel {
    max-height: calc(100dvh - 18px);
  }

  .search-results {
    max-height: 42dvh;
  }

  .public-document {
    padding-top: 48px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 520px) {
  .quick-capture-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 11px;
  }

  .quick-capture-footer .primary-button {
    width: 100%;
  }

  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-switch {
    align-self: stretch;
  }

  .view-switch button {
    flex: 1;
  }

  .is-list-mode .note-item {
    flex-direction: column;
  }

  .note-actions {
    justify-content: flex-start;
    padding: 0 0 10px;
  }

  .dialog-actions,
  .split-actions,
  .copy-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .dialog-actions > button,
  .copy-row > button {
    width: 100%;
  }

  .copy-row {
    display: grid;
  }

  .public-topbar {
    padding: 8px 12px;
  }

  .public-topbar .secondary-button {
    padding-inline: 10px;
  }
}

@media (max-width: 360px) {
  .page-view,
  .editor-view {
    width: calc(100% - 24px);
  }

  .collection-header h1,
  .tag-index-view h1,
  .page-title-input {
    font-size: 30px;
  }

  .view-switch button span {
    display: none;
  }

  .save-status {
    max-width: 74px;
  }

  .dialog-panel {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
