.haidox_memo-page {
  --haidox-side-page-bg: var(--bg);
  --haidox-side-panel-width: clamp(240px, 18vw, 340px);
  --haidox_memo-fixed-edit-top-space: calc(var(--haidox-fixed-header-space, 58px) + var(--haidox_memo-toolbar-height, 44px) + 16px);
}

.haidox_memo-toolbar-panel {
  margin-bottom: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.haidox_memo-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 8px 10px;
  margin-bottom: 12px;
}

.haidox_memo-mode-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.haidox_memo-brand-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.haidox_memo-brand-actions .haidox_memo-button,
.haidox_memo-brand-actions .haidox_memo-state-link,
.haidox_memo-brand-actions .haidox-app-help-link {
  justify-content: flex-start;
  width: 100%;
}

.haidox_memo-quick-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.haidox_memo-entry-stamp {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 6px 0 6px 4px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.haidox_memo-entry-stamp:hover strong,
.haidox_memo-entry-stamp:focus-visible strong {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.haidox_memo-entry-stamp:focus-visible {
  outline: 2px solid rgba(29, 78, 216, .18);
  outline-offset: 4px;
}

.haidox_memo-entry-stamp span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.haidox_memo-entry-stamp strong {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.haidox_memo-list-header h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.haidox_memo-state-panel[hidden] {
  display: none;
}

.haidox_memo-state-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-top: 10px;
  padding: 10px;
}

.haidox_memo-button,
.haidox_memo-icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

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

.haidox_memo-button-danger {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.haidox_memo-button-secondary:hover,
.haidox_memo-icon-button:hover {
  border-color: #94a3b8;
}

.haidox_memo-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.haidox_memo-state-link {
  border: 0;
  min-height: 38px;
  padding: 8px 4px;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.haidox_memo-state-link:hover,
.haidox_memo-state-link:focus-visible {
  color: #1e40af;
}

.haidox_memo-file-input {
  display: none;
}

.haidox_memo-choice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
}

.haidox_memo-choice-dialog {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 20px 55px rgba(15, 23, 42, .22);
}

.haidox_memo-choice-dialog h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.haidox_memo-choice-dialog p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.haidox_memo-save-format-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.haidox_memo-save-format-button {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  text-align: left;
}

.haidox_memo-save-format-button strong,
.haidox_memo-save-format-button span {
  display: block;
}

.haidox_memo-save-format-button strong {
  font-size: 14px;
}

.haidox_memo-save-format-button span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.haidox_memo-save-format-button:disabled {
  background: #f8fafc;
}



.haidox_memo-choice-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.haidox_memo-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.haidox_memo-meta.is-state-details-hidden {
  grid-template-columns: minmax(220px, 1fr);
}

.haidox_memo-state-fields {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(120px, 170px) max-content;
  align-items: end;
  justify-content: start;
  gap: 10px;
  min-width: 0;
}

.haidox_memo-state-fields[hidden] {
  display: none;
}

.haidox_memo-meta label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.haidox_memo-meta input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.haidox_memo-title-input[hidden] {
  display: none;
}

.haidox_memo-now-button {
  align-self: end;
  min-height: 40px;
  white-space: nowrap;
}

.haidox_memo-title-input {
  min-width: 0;
}

.haidox_memo-editor-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin: -2px 0 8px;
  min-width: max-content;
}

.haidox_memo-editor-tool {
  flex: 0 0 auto;
  width: 38px;
  min-height: 34px;
  font-size: 20px;
  line-height: 1;
}

.haidox_memo-toolbar-action,
.haidox_memo-toolbar-panel .haidox_memo-mode-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.haidox_memo-editor {
  width: 100%;
  min-height: clamp(360px, 58vh, 720px);
  resize: vertical;
  overflow-y: auto;
  scrollbar-color: #2563eb #dbeafe;
  scrollbar-width: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: var(--text);
  font: 18px/1.7 Arial, sans-serif;
}

.haidox_memo-editor::-webkit-scrollbar {
  width: 18px;
}

.haidox_memo-editor::-webkit-scrollbar-track {
  background: #dbeafe;
  border-radius: 999px;
}

.haidox_memo-editor::-webkit-scrollbar-thumb {
  min-height: 64px;
  border: 4px solid #dbeafe;
  border-radius: 999px;
  background: #2563eb;
}

.haidox_memo-editor::-webkit-scrollbar-thumb:hover {
  background: #1d4ed8;
}

.haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-editor {
  scrollbar-gutter: stable;
}

@media (hover: none), (pointer: coarse) {
  .haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-editor {
    scrollbar-width: none;
  }

  .haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-editor::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-scroll-region::before,
  .haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-scroll-region::after {
    content: "";
    position: fixed;
    right: var(--haidox_memo-editor-scrollbar-right, 10px);
    border-radius: 999px;
    pointer-events: none;
    z-index: 940;
  }

  .haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-scroll-region::before {
    top: var(--haidox_memo-editor-indicator-top, 96px);
    bottom: var(--haidox_memo-editor-indicator-bottom, 18px);
    width: 8px;
    background: #dbeafe;
  }

  .haidox_memo-shell.has-haidox_memo-editor-overflow .haidox_memo-scroll-region::after {
    top: calc(var(--haidox_memo-editor-indicator-top, 96px) + var(--haidox_memo-editor-scroll-thumb-top, 0px));
    width: 8px;
    height: var(--haidox_memo-editor-scroll-thumb-height, 64px);
    background: #2563eb;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .72);
  }
}

.haidox_memo-editor:focus,
.haidox_memo-meta input:focus {
  outline: 2px solid rgba(29, 78, 216, .22);
  border-color: var(--brand);
}

.haidox_memo-edge-navigation {
  pointer-events: none;
}

.haidox_memo-edge-navigation-button {
  position: fixed;
  left: 50%;
  z-index: 960;
  width: 46px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .6);
  border-radius: 999px;
  background: rgba(255, 255, 255, .34);
  color: #334155;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .13);
  font: 700 20px/1 Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(.96);
  transition: opacity .16s ease, transform .16s ease, border-color .16s ease;
}

.haidox_memo-edge-navigation-button-top {
  top: var(--haidox_memo-editor-top, calc(var(--haidox_memo-visual-offset-top, 0px) + var(--haidox-fixed-header-space, 58px) + var(--haidox_memo-toolbar-height, 44px) + 10px));
}

.haidox_memo-edge-navigation-button-bottom {
  bottom: calc(var(--haidox_memo-editor-bottom-gap, 16px) + env(safe-area-inset-bottom, 0px));
}

.haidox_memo-shell.is-edge-navigation-visible .haidox_memo-edge-navigation-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

.haidox_memo-edge-navigation-button:hover,
.haidox_memo-edge-navigation-button:focus-visible {
  border-color: var(--brand);
  outline: 2px solid rgba(29, 78, 216, .2);
  outline-offset: 2px;
}

.haidox_memo-selection-indicator[hidden] {
  display: none;
}

.haidox_memo-selection-indicator {
  position: fixed;
  top: var(--haidox_memo-editor-top, calc(var(--haidox_memo-visual-offset-top, 0px) + var(--haidox-fixed-header-space, 58px) + var(--haidox_memo-toolbar-height, 44px) + 10px));
  left: 12px;
  z-index: 970;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(260px, calc(100vw - 24px));
  border: 1px solid rgba(29, 78, 216, .35);
  border-radius: 999px;
  background: rgba(239, 246, 255, .92);
  color: #1e3a8a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
  padding: 7px 11px;
  pointer-events: none;
}

.haidox_memo-selection-indicator strong,
.haidox_memo-selection-indicator span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.haidox_memo-selection-indicator strong {
  font-size: 12px;
}

.haidox_memo-selection-indicator span {
  font-size: 12px;
  color: #334155;
}

.is-haidox_memo-read-mode .haidox_memo-editor,
.is-haidox_memo-read-mode .haidox_memo-meta input {
  background: #f8fafc;
  color: #334155;
}

.haidox_memo-state-grid[hidden] {
  display: none;
}

.haidox_memo-state-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.haidox_memo-state-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.haidox_memo-state-grid dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.haidox_memo-state-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.haidox_memo-list-panel {
  padding: 14px;
  background: #fff;
}

.haidox_memo-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}

.haidox_memo-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-start;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.haidox_memo-list-actions .haidox_memo-button,
.haidox_memo-list-actions .haidox_memo-icon-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.haidox_memo-list-actions .haidox_memo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.haidox_memo-icon-button {
  width: 38px;
  padding: 0;
  font-size: 18px;
}

.haidox_memo-current-document {
  display: block;
  width: 100%;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px 12px;
  margin-bottom: 12px;
  text-align: left;
  cursor: pointer;
}

.haidox_memo-current-document:hover,
.haidox_memo-current-document:focus-visible {
  border-color: var(--brand);
  outline: 2px solid rgba(29, 78, 216, .22);
}

.haidox_memo-current-document span {
  display: block;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.haidox_memo-current-document strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.haidox_memo-selected-panel[hidden] {
  display: none;
}

.haidox_memo-selected-panel {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  margin-bottom: 12px;
  padding: 10px;
}

.haidox_memo-selected-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.haidox_memo-selected-header h3 {
  margin: 0;
  color: #1d4ed8;
  font-size: 14px;
  line-height: 1.25;
}

.haidox_memo-selected-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.haidox_memo-selected-list {
  gap: 6px;
}

.haidox_memo-list-sort {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.haidox_memo-list-sort select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.haidox_memo-list-sort select:focus {
  border-color: var(--brand);
  outline: 2px solid rgba(29, 78, 216, .18);
}

.haidox_memo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.haidox_memo-list-load-state {
  text-align: center;
}

.haidox_memo-list-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.haidox_memo-entry-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: stretch;
  gap: 6px;
}

.haidox_memo-entry-check {
  width: 18px;
  height: 18px;
  margin: 13px 0 0 4px;
}

.haidox_memo-entry-button {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.haidox_memo-entry-button:hover {
  border-color: #94a3b8;
}

.haidox_memo-entry-row.is-current .haidox_memo-entry-button,
.haidox_memo-entry-row.is-current.is-scroll-target .haidox_memo-entry-button {
  border-color: var(--brand);
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.haidox_memo-entry-row.is-current.is-scroll-target .haidox_memo-entry-button {
  outline: 2px solid rgba(29, 78, 216, .28);
  outline-offset: 2px;
}

.haidox_memo-entry-row.is-current .haidox_memo-entry-title::before {
  content: "현재 ";
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.haidox_memo-entry-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.haidox_memo-entry-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .haidox_memo-state-fields {
    grid-template-columns: 1fr;
  }

  .haidox_memo-now-button {
    width: 100%;
  }
}

@media (max-width: 640px) {

  .top-bar {
    top: var(--haidox_memo-visual-offset-top, 0px);
  }

  html,
  body {
    overflow: hidden;
  }

  .haidox_memo-workspace {
    position: fixed;
    top: calc(var(--haidox_memo-visual-offset-top, 0px) + var(--haidox-fixed-header-space, 58px));
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    height: calc(var(--haidox_memo-visual-viewport-height, 100dvh) - var(--haidox-fixed-header-space, 58px));
    max-height: calc(var(--haidox_memo-visual-viewport-height, 100dvh) - var(--haidox-fixed-header-space, 58px));
    overflow: hidden;
    background: var(--bg);
    padding: 0;
  }

  .haidox_memo-toolbar-panel {
    flex: 0 0 auto;
    z-index: 2;
    margin: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px 10px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
  }

  .haidox_memo-scroll-region {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px calc(28px + env(safe-area-inset-bottom, 0px));
    scroll-padding-top: 16px;
    scroll-padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .haidox_memo-header,
  .haidox_memo-meta,
  .haidox_memo-editor {
    scroll-margin-top: 16px;
  }

  .haidox_memo-brand-actions {
    gap: 5px;
  }

  .haidox_memo-brand-actions .haidox_memo-button,
  .haidox_memo-brand-actions .haidox_memo-state-link,
  .haidox_memo-brand-actions .haidox-app-help-link {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .haidox_memo-quick-button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .haidox_memo-entry-stamp strong {
    font-size: 20px;
  }

  .haidox_memo-meta,
  .haidox_memo-state-fields,
  .haidox_memo-state-grid {
    grid-template-columns: 1fr;
  }

  .haidox_memo-editor-toolbar {
    justify-content: flex-start;
    margin: 0;
  }

  .haidox_memo-editor {
    min-height: clamp(180px, calc(var(--haidox_memo-visual-viewport-height, 100dvh) - var(--haidox-fixed-header-space, 58px) - var(--haidox_memo-toolbar-height, 44px) - 128px), 52vh);
    font-size: 17px;
  }

  html.is-haidox_memo-list-popup .haidox_memo-list-panel.is-open,
  .haidox_memo-shell.is-haidox-side-popup .haidox_memo-list-panel.is-open {
    position: fixed;
    top: calc(var(--haidox_memo-visual-offset-top, 0px) + var(--haidox-fixed-header-space, 58px));
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 1200;
    width: 100vw;
    max-width: none;
    height: calc(var(--haidox_memo-visual-viewport-height, var(--haidox-side-popup-viewport-height, 100dvh)) - var(--haidox-fixed-header-space, 58px));
    max-height: calc(var(--haidox_memo-visual-viewport-height, var(--haidox-side-popup-viewport-height, 100dvh)) - var(--haidox-fixed-header-space, 58px));
    overflow: auto;
    border-radius: 0;
  }

  html.is-haidox_memo-list-popup .haidox_memo-list,
  .haidox_memo-shell.is-haidox-side-popup .haidox_memo-list {
    padding-bottom: 24px;
  }
}
