/* Optional WordCraft account UI. It extends the site paper/ink tokens and never covers the editor. */
#account-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.account-trigger,
.account-cloud-save,
.account-dialog button,
.account-file-open {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.account-trigger {
  min-height: 34px;
  border: 1px solid var(--line, #ddddd6);
  border-radius: 3px;
  background: transparent;
  color: var(--ink, #242438);
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.account-trigger:hover,
.account-trigger[aria-expanded="true"] {
  background: #eeeeea;
  border-color: #c9c9c6;
}
.account-trigger:focus-visible,
.account-cloud-save:focus-visible,
.account-dialog button:focus-visible,
.account-file-open:focus-visible,
.account-dialog input:focus-visible {
  outline: 3px solid #888bc7;
  outline-offset: 3px;
}
.account-cloud-save {
  min-height: 32px;
  border-radius: 3px;
  background: #5d4a7c;
  color: #fff;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.account-cloud-save:hover { background: #48365f; }
.account-cloud-save[aria-busy="true"] { cursor: progress; opacity: .72; }

.account-dialog {
  width: min(94vw, 560px);
  max-height: min(82dvh, 700px);
  margin: auto;
  padding: 0;
  border: 1px solid #d4d4d1;
  border-radius: 6px;
  color: var(--ink, #242438);
  background: #fafaf7;
  box-shadow: 0 18px 55px #2424383a;
}
.account-dialog::backdrop { background: #22223273; backdrop-filter: blur(2px); }
.account-dialog[open] { display: flex; flex-direction: column; }
.account-dialog-inner { padding: 25px; overflow: auto; }
.account-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.account-dialog-title { margin: 0; font: 600 22px/1.25 var(--serif, Georgia, serif); letter-spacing: -.35px; }
.account-dialog-close {
  width: 30px;
  height: 30px;
  margin: -6px -6px 0 0;
  border-radius: 50% !important;
  background: transparent;
  color: #5e5e68;
  font-size: 20px !important;
  line-height: 1;
}
.account-dialog-close:hover { background: #eeeeea; color: #242438; }
.account-dialog-copy { margin: 0 0 19px; color: #686872; font-size: 13px; line-height: 1.65; }
.account-dialog-status {
  min-height: 20px;
  margin: 0 0 14px;
  color: #5e5e68;
  font-size: 12px;
  line-height: 1.5;
}
.account-dialog-status[data-kind="error"] { color: #9b3333; }
.account-dialog-status[data-kind="success"] { color: #356441; }
.account-dialog-status:empty { display: none; }
.account-login-panel[hidden],
.account-verify-panel[hidden],
.account-conflict-panel[hidden] { display: none; }
.account-login-panel { display: grid; gap: 14px; }
.account-field { display: grid; gap: 6px; }
.account-field label { color: #4d4d58; font-size: 11px; font-weight: 650; letter-spacing: .15px; }
.account-field input {
  width: 100%;
  border: 1px solid #cfcfcb;
  border-radius: 3px;
  background: #fff;
  color: var(--ink, #242438);
  padding: 10px 11px;
  font: 14px var(--sans, system-ui, sans-serif);
}
.account-code-input { letter-spacing: .25em; font-weight: 700 !important; }
.account-primary,
.account-secondary,
.account-text-button {
  min-height: 38px;
  border-radius: 3px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 650;
}
.account-primary { background: var(--accent, #393a70); color: #fff; }
.account-primary:hover { background: #292a58; }
.account-secondary { border: 1px solid #cfcfcb !important; background: #fff; color: var(--ink, #242438); }
.account-secondary:hover { background: #eeeeea; }
.account-text-button { min-height: 28px; padding: 3px 0; background: transparent; color: var(--accent, #393a70); text-align: left; }
.account-text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.account-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.account-buttons--split { justify-content: space-between; flex-wrap: wrap; }
.account-google { width: 100%; }
.account-divider { display: flex; align-items: center; gap: 11px; color: #86868d; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.account-divider::before,.account-divider::after { content: ''; height: 1px; flex: 1; background: #deded9; }
.account-email-unavailable { margin: 0; color: #797983; font-size: 11px; line-height: 1.5; }

.account-file-dialog { width: min(94vw, 760px); }
.account-file-dialog .account-dialog-inner { padding-bottom: 20px; }
.account-file-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.account-file-user { margin: 4px 0 0; color: #6a6a73; font-size: 11px; }
.account-limits { margin: 0 0 13px; color: #777781; font-size: 11px; }
.account-file-list { display: grid; border-top: 1px solid #deded9; }
.account-file-row { display: grid; grid-template-columns: minmax(120px, 1.7fr) minmax(88px, .8fr) minmax(58px, .45fr) auto; gap: 12px; align-items: center; min-height: 58px; border-bottom: 1px solid #e4e4df; }
.account-file-row--header { min-height: 30px; color: #777781; font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.account-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.account-file-meta { color: #74747d; font-size: 11px; }
.account-file-open { justify-self: end; border: 1px solid #cfcfcb; border-radius: 3px; background: #fff; color: var(--accent, #393a70); padding: 6px 10px; font-size: 11px; font-weight: 650; }
.account-file-open:hover { background: #eeeeea; }
.account-files-empty { padding: 20px 0; color: #777781; font-size: 12px; }
.account-file-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }

.account-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  max-width: min(390px, calc(100vw - 40px));
  border: 1px solid #d3d3cf;
  border-left: 4px solid #5d4a7c;
  border-radius: 4px;
  background: #fbfbf8;
  color: #30303f;
  padding: 11px 14px;
  box-shadow: 0 10px 24px #24243824;
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(7px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.account-toast.is-visible { opacity: 1; transform: translateY(0); }
.account-toast[data-kind="error"] { border-left-color: #9b3333; }
.account-toast[data-kind="success"] { border-left-color: #356441; }

@media (max-width: 1120px) {
  .app-header #account-actions { order: 2; }
}
@media (max-width: 760px) {
  #account-actions { gap: 5px; }
  .account-trigger { min-height: 31px; padding: 6px 8px; font-size: 10px; }
  .account-cloud-save { min-height: 30px; padding: 7px 9px; font-size: 10px; }
  .account-dialog-inner { padding: 19px; }
  .account-dialog-title { font-size: 20px; }
  .account-file-row { grid-template-columns: minmax(105px, 1fr) auto; gap: 4px 10px; min-height: 68px; padding: 7px 0; }
  .account-file-row--header { display: none; }
  .account-file-name { grid-column: 1; }
  .account-file-meta { grid-column: 1; font-size: 10px; }
  .account-file-row .account-file-meta:nth-of-type(2) { display: none; }
  .account-file-open { grid-column: 2; grid-row: 1 / span 2; }
  .account-file-footer { align-items: flex-start; flex-direction: column; gap: 10px; }
  .account-toast { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .account-toast { transition: none; }
}

.account-google-native { min-height:32px; display:flex; align-items:center; }
.account-google-dialog { padding:12px 0; justify-content:center; }
.account-email-trigger { font-size:10px; border:0; padding:5px; }
#account-actions { flex-wrap:wrap; justify-content:flex-end; }
@media(max-width:600px) { #account-actions { gap:4px; } .account-google-native { max-width:160px; } .account-email-trigger { font-size:10px; } }
