.originotes-account-logout,
.originotes-account-primary {
  width: 100%;
  min-height: 2.5rem;
  margin-top: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  background: #fff;
  color: #1e293b;
  font: inherit;
  cursor: pointer;
}

.originotes-account-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.originotes-account-logout:disabled,
.originotes-account-primary:disabled {
  cursor: wait;
  opacity: 0.55;
}

.originotes-password-form {
  display: grid;
  gap: 0.8rem;
  margin: 0.85rem 0 1.25rem;
  padding: 1rem 0 1.15rem;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.originotes-password-form h4,
.originotes-password-form p {
  margin: 0;
}

.originotes-password-form label.originotes-account-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  align-items: stretch;
  justify-content: initial;
  gap: 0.4rem;
  width: 100%;
  color: #475569;
  font-size: 0.875rem;
}

.originotes-account-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  background: #fff;
  color: #0f172a;
  padding: 0 0.7rem;
  font: inherit;
}

.originotes-account-status {
  min-height: 1.25rem;
  margin: 0.5rem 0 0;
  color: #b91c1c;
  font-size: 0.875rem;
}

.originotes-account-status.is-success {
  color: #166534;
}

html[data-theme='light'] .originotes-password-form label.originotes-account-field {
  color: #475569;
}

html[data-theme='light'] .originotes-account-field input,
html[data-theme='light'] .originotes-account-logout {
  border-color: #cbd5e1;
  background: #fff;
  color: #0f172a;
}

html[data-theme='dark'] .originotes-password-form label.originotes-account-field {
  color: #cbd5e1;
}

html[data-theme='dark'] .originotes-account-field input,
html[data-theme='dark'] .originotes-account-logout {
  border-color: #475569;
  background: #20211f;
  color: #f8fafc;
}

html[data-theme='dark'] .originotes-password-form {
  border-color: #3f4140;
}

html[data-theme='dark'] .originotes-account-status {
  color: #fca5a5;
}

html[data-theme='dark'] .originotes-account-status.is-success {
  color: #86efac;
}

body:has(main[aria-labelledby='login-heading']) {
  box-sizing: border-box;
  display: flow-root;
  min-height: 100vh;
  margin: 0;
  padding: 10vh 1rem 2rem;
  background: #f4f5f7;
  color: #1f2937;
}

.originotes-users {
  border-top: 1px solid var(--border, #d9d9d6);
  margin-top: 2rem;
  padding-top: 1.75rem;
}

.originotes-user-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.originotes-users-list {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
}

.originotes-user-card {
  align-items: center;
  background: color-mix(in srgb, currentColor 4%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  border-radius: .65rem;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: .9rem 1rem;
}

.originotes-user-card > div:first-child {
  display: grid;
  gap: .2rem;
}

.originotes-user-card span {
  color: color-mix(in srgb, currentColor 68%, transparent);
  font-size: .875rem;
}

.originotes-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.originotes-account-field select {
  background: var(--background, Canvas);
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: .35rem;
  color: inherit;
  font: inherit;
  min-height: 2.8rem;
  padding: .55rem .7rem;
}

.originotes-owner-protected {
  font-weight: 600;
}

.originotes-forced-password {
  display: grid;
  gap: .25rem;
  margin-bottom: .35rem;
  padding: .85rem 1rem;
  border: 1px solid #d97706;
  border-radius: .5rem;
  background: color-mix(in srgb, #f59e0b 12%, transparent);
}

.originotes-forced-password span {
  font-size: .9rem;
}

html[data-originotes-password-required='true'] [role='dialog'][data-originotes-forced-password='true'] {
  border-color: #d97706;
}

@media (max-width: 640px) {
  .originotes-user-card {
    align-items: stretch;
    flex-direction: column;
  }
}

.originotes-note-row-meta {
  display: block;
  margin-top: .15rem;
  overflow: hidden;
  color: var(--muted, #73736f);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.originotes-note-access {
  display: flex;
  min-height: 2.25rem;
  align-items: center;
  gap: .75rem;
  margin: 0 0 1rem;
  padding: .55rem .7rem;
  border: 1px solid var(--border, #deded9);
  border-radius: 2px;
  background: var(--surface, #f7f7f5);
  color: var(--muted, #73736f);
  font-size: .78rem;
}

.originotes-note-author {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.originotes-note-visibility {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
}

.originotes-note-visibility select {
  min-height: 2rem;
  padding: .25rem 1.8rem .25rem .55rem;
}

.originotes-note-visibility-badge {
  padding: .25rem .5rem;
  border: 1px solid var(--border, #deded9);
  border-radius: 999px;
  color: var(--text, #242424);
  font-weight: 600;
}

.originotes-note-access .originotes-account-status {
  margin: 0;
  font-size: .75rem;
}

.originotes-note-readonly .note-title,
.originotes-note-readonly textarea {
  cursor: default;
}

.originotes-note-readonly .note-title {
  color: var(--text, #242424);
}

.modal.originotes-settings-dialog {
  width: min(900px, calc(100vw - 2rem));
  max-height: min(760px, calc(100vh - 2rem));
}

.originotes-settings-dialog > .modal-body {
  padding: 0;
  overflow: hidden;
}

.originotes-settings-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: min(580px, calc(100vh - 8rem));
}

.originotes-settings-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: 1.25rem .75rem;
  border-right: 1px solid var(--border, #deded9);
  background: var(--surface, #f7f7f5);
}

.originotes-settings-tab {
  width: 100%;
  min-height: 2.5rem;
  padding: .55rem .75rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted, #73736f);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.originotes-settings-tab:hover {
  background: var(--surface-2, #efefec);
  color: var(--text, #242424);
}

.originotes-settings-tab.is-active {
  background: var(--surface-2, #efefec);
  color: var(--text, #242424);
}

.originotes-settings-content {
  min-width: 0;
  overflow: auto;
  padding: 1.75rem 2rem 2.25rem;
}

.originotes-settings-content > section {
  margin: 0;
  padding: 0;
  border: 0;
}

.originotes-settings-content > section > h3 {
  margin-top: 0;
  font-size: 1.3rem;
}

.originotes-settings-content .originotes-password-form,
.originotes-settings-content .originotes-user-form {
  max-width: 620px;
}

.originotes-settings-content .originotes-users-list {
  max-width: 680px;
}

@media (max-width: 640px) {
  .originotes-note-access {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .originotes-note-author {
    width: 100%;
  }

  .originotes-settings-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .originotes-settings-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: .65rem;
    border-right: 0;
    border-bottom: 1px solid var(--border, #deded9);
  }

  .originotes-settings-tab {
    width: auto;
    white-space: nowrap;
  }

  .originotes-settings-content {
    padding: 1.25rem;
  }
}

body:has(main[aria-labelledby='login-heading']) #originotes-app {
  box-sizing: border-box;
  min-height: calc(100vh - 10vh - 2rem);
  background: transparent;
  color: #1f2937;
}

main[aria-labelledby='login-heading'] {
  box-sizing: border-box;
  width: min(420px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem;
  border: 1px solid #d8dde5;
  border-radius: 2px;
  background: #fff;
}

main[aria-labelledby='login-heading'] h1 {
  margin: 0 0 1.75rem;
  font-size: clamp(1.75rem, 5vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: inherit;
}

main[aria-labelledby='login-heading'] form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
}

main[aria-labelledby='login-heading'] label {
  margin-top: 0.45rem;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 600;
}

main[aria-labelledby='login-heading'] input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  background: #fff;
  color: #0f172a;
  padding: 0 0.75rem;
  font: inherit;
}

main[aria-labelledby='login-heading'] input:focus {
  border-color: #2563eb;
  outline: 2px solid rgb(37 99 235 / 18%);
  outline-offset: 1px;
}

main[aria-labelledby='login-heading'] button[type='submit'] {
  min-height: 2.75rem;
  margin-top: 1rem;
  border: 1px solid #2563eb;
  border-radius: 2px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
