/* The default gate prevents a pre-authentication flash of workspace content. */
html:not([data-notes-access='unlocked']) .notes-hero,
html:not([data-notes-access='unlocked']) .notes-main,
html:not([data-notes-access='unlocked']) .notes-workspace-rail,
html:not([data-notes-access='unlocked']) .notes-workspace-dashboard,
html:not([data-notes-access='unlocked']) .notes-workspace-resizer {
  display: none !important;
}

html:not([data-notes-access='unlocked']) .notes-vault-menu {
  visibility: hidden;
  pointer-events: none;
}

.notes-access-gate {
  width: min(100% - 2rem, 540px);
  margin: 4rem auto;
  padding: 2rem;
  border: 1px solid var(--border, #ccd4e0);
  border-radius: 16px;
  background: var(--surface, #fff);
  color: var(--text, #172033);
}

.notes-access-gate[hidden],
.notes-logout-panel[hidden],
.notes-access-gate [hidden] {
  display: none;
}

.notes-access-gate form,
.notes-vault-dialog form {
  display: grid;
  gap: 1rem;
}

.notes-access-gate label,
.notes-vault-dialog label {
  display: grid;
  gap: 0.4rem;
}

.notes-access-gate .notes-btn {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.notes-access-gate input:not([type='checkbox']),
.notes-access-gate select,
.notes-vault-dialog input,
.notes-vault-dialog select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem;
  border: 1px solid #9aa6b8;
  border-radius: 6px;
  background: inherit;
  color: inherit;
  font: inherit;
}

.notes-access-actions,
.notes-access-consent {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.site-header .notes-drive-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0 auto;
  padding: 0;
  font-size: 0.75rem;
}

#driveSyncStatus {
  max-width: 180px;
  overflow-wrap: anywhere;
}

#driveSyncStatus[data-sync-state='conflict'],
#driveSyncStatus[data-sync-state='sync-failed'] {
  color: #b04b18;
}

.notes-vault-menu {
  position: relative;
}

.notes-vault-actions {
  position: absolute;
  right: 0;
  z-index: 1200;
  display: grid;
  gap: 0.5rem;
  width: min(300px, 85vw);
  padding: 1rem;
  border: 1px solid #bcc6d4;
  border-radius: 8px;
  background: var(--surface, #fff);
  box-shadow: 0 10px 35px #0002;
}

.notes-vault-actions p {
  white-space: normal;
}

.notes-logout-panel {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  z-index: 3000;
  width: min(540px, calc(100% - 2rem));
  transform: translateX(-50%);
  padding: 1rem;
  border: 1px solid #9aa6b8;
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--text, #172033);
  box-shadow: 0 8px 35px #0003;
}

.notes-vault-dialog {
  width: min(900px, calc(100% - 2rem));
  max-height: 85vh;
  padding: 1.5rem;
  overflow: auto;
  border: 1px solid #9aa6b8;
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text, #172033);
}

.notes-vault-dialog::backdrop {
  background: #10182788;
}

.notes-conflict-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.notes-conflict-compare pre,
.notes-vault-dialog details pre {
  max-height: 320px;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #869ab51a;
}

.notes-workspace-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

@media (max-width: 767px) {
  .site-header .tagline {
    display: none;
  }

  .site-header .notes-drive-controls {
    gap: 0.3rem;
  }

  #driveSyncStatus {
    max-width: 65px;
    font-size: 0.65rem;
  }

  #driveSyncBtn {
    min-width: 36px;
    font-size: 0;
  }

  #driveSyncBtn::before {
    content: '↻';
    font-size: 1.3rem;
  }

  .notes-conflict-compare {
    grid-template-columns: 1fr;
  }

  .notes-access-gate {
    margin-top: 2rem;
    padding: 1.2rem;
  }
}

@media (max-width: 767px) {
  .notes-vault-menu > summary {
    font-size: 0;
  }

  .notes-vault-menu > summary::before {
    content: '⋯';
    font-size: 1.2rem;
  }
}

html[data-theme='dark'] .notes-access-gate,
body[data-notes-theme='dark'] .notes-access-gate,
body[data-notes-theme='dark'] .notes-vault-dialog,
body[data-notes-theme='dark'] .notes-vault-actions,
body[data-notes-theme='dark'] .notes-logout-panel {
  background: #172033;
  color: #e8edf5;
}

html[data-notes-network] .notes-workspace-create-button,
html[data-notes-network] [data-workspace-create-type],
html[data-notes-network] .notes-workspace-card-menu {
  pointer-events: none;
  opacity: 0.5;
}

.notes-entry-landing[hidden],
.notes-entry-workspace[hidden] {
  display: none !important;
}

.landing-page .google-account-controls .notes-access-gate {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
