:root {
  --bg: #131314;
  --card-bg: #1e1f20;
  --border-color: rgba(255,255,255,0.12);
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --google-blue: #8ab4f8;
  --google-blue-solid: #a8c7fa;
  --btn-blue: #a8c7fa;
  --btn-blue-hover: #8ab4f8;
}

* { box-sizing: border-box; }

body.dark {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-family: 'Roboto', Arial, sans-serif;
  color: var(--text-primary);
}

/* ---- Card semplice (password / add-account / success) ---- */
.card {
  width: 450px;
  max-width: 90vw;
  padding: 40px 36px 32px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card-header { margin-bottom: 12px; }

.title {
  font-family: 'Google Sans', 'Roboto', sans-serif;
  font-size: 24px;
  font-weight: 400;
  margin: 8px 0 8px;
  color: var(--text-primary);
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 28px;
}

.input-group {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  text-align: left;
}

.input-group input {
  width: 100%;
  padding: 13px 15px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
  color: var(--text-primary);
  background: transparent;
}

.input-group input:focus {
  border: 2px solid var(--google-blue);
  padding: 12px 14px;
}

.input-group label {
  position: absolute;
  left: 16px;
  top: 13px;
  font-size: 16px;
  color: var(--text-secondary);
  background: var(--card-bg);
  padding: 0 4px;
  pointer-events: none;
  transition: 0.15s ease all;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: -9px;
  left: 12px;
  font-size: 12px;
  color: var(--google-blue);
}

.toggle-visibility {
  position: absolute;
  right: 12px;
  top: 14px;
  background: none;
  border: none;
  color: var(--google-blue);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.link { color: var(--google-blue); font-size: 14px; font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link.inline { font-size: 13px; }

.error-text { color: #f28b82; font-size: 13px; margin-top: 8px; align-self: flex-start; }

.actions {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 36px;
}

.btn-text {
  color: var(--google-blue);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 4px;
}
.btn-text:hover { background: rgba(138,180,248,0.08); }

.btn-primary {
  background: var(--btn-blue);
  color: #062e6f;
  border: none;
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { background: var(--btn-blue-hover); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px 6px 6px;
  background: none;
  cursor: pointer;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--text-primary);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C4DFF, #448AFF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

/* ---- OAuth consent screen (index.html) ---- */
.oauth-card {
  width: 780px;
  max-width: 92vw;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  overflow: hidden;
}

.oauth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-color);
  font-size: 16px;
  font-weight: 500;
}

.oauth-body {
  display: flex;
  padding: 40px 32px;
  gap: 40px;
}

.oauth-left { flex: 1; }
.app-logo { margin-bottom: 16px; }

.oauth-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 26px;
  font-weight: 400;
  margin: 0 0 12px;
}

.oauth-subtitle { font-size: 15px; color: var(--text-secondary); margin: 0; }

.oauth-right {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
}
.account-item:hover { background: rgba(255,255,255,0.04); }

.account-item .avatar { width: 36px; height: 36px; font-size: 15px; flex-shrink: 0; }
.account-item .account-name { font-size: 15px; font-weight: 500; margin: 0; }
.account-item .account-email { font-size: 13px; color: var(--text-secondary); margin: 0; }

.use-another {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 8px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  font-family: inherit;
}
.use-another:hover { background: rgba(255,255,255,0.04); }
.use-another svg { flex-shrink: 0; }

.oauth-consent {
  padding: 0 32px 28px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- Footer ---- */
.oauth-footer, .footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 16px 32px;
  font-size: 12px;
  color: var(--text-secondary);
}

.lang-select { border: none; background: none; font-size: 12px; color: var(--text-secondary); }
.footer-links a { color: var(--text-secondary); text-decoration: none; margin-left: 24px; }

.success-card { padding-top: 48px; }
.check-icon { margin-bottom: 16px; }

@media (max-width: 700px) {
  .oauth-body { flex-direction: column; }
}

/* ---- Form email nella oauth-card (add-account.html) ---- */
.oauth-form { width: 100%; }

.input-group--floating-top {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
  border: 1px solid var(--google-blue);
  border-radius: 4px;
  padding: 8px 14px 10px;
}

.input-group--floating-top label {
  position: absolute;
  top: -9px;
  left: 12px;
  font-size: 12px;
  color: var(--google-blue);
  background: var(--card-bg);
  padding: 0 4px;
}

.input-group--floating-top input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  padding: 4px 0 0;
}

/* ---- Barra azioni in basso nella oauth-card ---- */
.oauth-bottom-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 32px;
  padding: 0 32px 32px;
}

/* ---- password.html: identità utente + verifica ---- */
.identity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.verify-text {
  font-size: 16px;
  color: var(--text-primary);
  margin: 0 0 20px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--google-blue);
  cursor: pointer;
}
/* Account chooser: dimensions follow the supplied desktop reference. */
body.account-picker {
  --bg: #1f1f1f;
  --card-bg: #0e0e0e;
  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --border-color: #444746;
  --google-blue: #a8c7fa;
  font-family: 'Google Sans', 'Roboto', Arial, sans-serif;
}

.account-picker .picker-layout {
  width: 73.6%;
  max-width: 1600px;
  margin: 32px auto;
  transform: translateY(-1.4vh);
  /* Scale the reference consistently on desktop, including its type. */
  font-size: clamp(14px, 1.058vw, 23px);
}

.account-picker .oauth-card {
  width: 100%;
  max-width: none;
  min-height: 24em;
  border: 0;
  border-radius: 1.85em;
}

.account-picker .oauth-header {
  height: 3.4667em;
  padding: 0 1em;
  gap: .75em;
  font-size: .9375em;
  font-weight: 500;
}

.account-picker .google-g { width: 1.5em; height: 1.5em; }
.account-picker .oauth-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3em;
  padding: 2.4em 2.25em 4.5em;
}
.account-picker .oauth-left { min-width: 0; }
.account-picker .app-logo {
  display: block;
  object-fit: contain;
  object-position: left center;
  width: 3em;
  height: 2.5em;
  margin: 0 0 1.65em;
}
.account-picker .oauth-title {
  font-size: 2.25em;
  line-height: 1.22;
  font-weight: 400;
  letter-spacing: -.035em;
  margin: 0 0 .55em;
}
.account-picker .oauth-subtitle {
  font-size: 1em;
  line-height: 1.5;
  color: var(--text-primary);
}
.account-picker .link { font-size: inherit; }
.account-picker .oauth-right { min-width: 0; padding-top: 1.2em; }
.account-picker .account-item {
  position: relative;
  isolation: isolate;
  gap: .75em;
  padding: .75em 0 .85em;
  font-size: inherit;
  min-height: 4.2em;
}
.account-picker .account-item::before,
.account-picker .use-another::before {
  content: '';
  position: absolute;
  inset: 0 -1em;
  z-index: -1;
  border-radius: 1em;
  background: transparent;
}
.account-picker .account-item:hover,
.account-picker .use-another:hover { background: transparent; }
.account-picker .account-item:is(:hover, :focus-visible)::before,
.account-picker .use-another:is(:hover, :focus-visible)::before {
  background: #1f1f1f;
}
.account-picker .account-item .avatar {
  object-fit: cover;
  width: 1.75em;
  height: 1.75em;
  font-size: 1em;
  background: #67503c;
}
.account-picker .account-name { font-size: 1em; line-height: 1.4; font-weight: 500; }
.account-picker .account-email { font-size: .875em; line-height: 1.4; overflow-wrap: anywhere; }
.account-picker .use-another {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 3.35em;
  padding: .85em .3em;
  gap: 1.05em;
  font-size: 1em;
  border-bottom: 1px solid var(--border-color);
}
.account-picker .use-another svg { width: 1.125em; height: 1.125em; }
.account-picker .use-another svg * { stroke: var(--text-secondary); }
.account-picker .oauth-consent {
  padding: 0;
  margin: 2.7em 0 0;
  font-size: .875em;
  line-height: 1.4;
  color: var(--text-secondary);
}
.account-picker .oauth-footer {
  position: static;
  align-items: center;
  padding: 1.5em 1.25em 0;
  font-size: .75em;
  min-height: 3.8em;
}
.account-picker .lang-select {
  font: inherit;
  color: var(--text-secondary);
  width: 12.5em;
  cursor: pointer;
  color-scheme: dark;
}
.account-picker .footer-links { display: flex; gap: 2.7em; }
.account-picker .footer-links a { margin: 0; }
.account-picker :is(button, a, select):focus-visible { outline: 2px solid var(--google-blue); outline-offset: 4px; }

@media (max-width: 900px) {
  .account-picker .picker-layout { width: calc(100% - 48px); font-size: 16px; transform: none; }
  .account-picker .oauth-body { gap: 2em; padding: 2em; }
  .account-picker .oauth-title { font-size: 2em; }
}
@media (max-width: 600px) {
  body.account-picker { justify-content: flex-start; }
  .account-picker .picker-layout { width: calc(100% - 32px); margin: 24px auto; }
  .account-picker .oauth-body { grid-template-columns: 1fr; padding: 1.75em 1.5em 2.5em; gap: 1.5em; }
  .account-picker .oauth-right { padding-top: 0; }
  .account-picker .oauth-title { font-size: 2em; }
  .account-picker .app-logo { margin-bottom: 1.25em; }
  .account-picker .oauth-consent { margin-top: 2em; }
  .account-picker .oauth-footer { flex-wrap: wrap; gap: 24px; padding: 24px 8px; }
  .account-picker .footer-links { gap: 24px; }
}

/* Password screen shares the chooser shell; overrides stay on this page. */
.password-page .picker-layout { transform: translateY(-1.15vh); }
.password-page .oauth-card { min-height: 29.25em; }
.password-page .oauth-title { letter-spacing: -.015em; }
.password-page .oauth-body { padding-bottom: 2.25em; }
.password-page .identity-row {
  margin-top: 1.35em;
  gap: .6em;
  font-size: .9375em;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.password-page .identity-row svg {
  width: 1.5em;
  height: 1.5em;
  flex-shrink: 0;
}
.password-page .identity-row svg * { stroke: var(--text-secondary); }
.password-page .verify-text {
  font-size: .9375em;
  line-height: 1.4;
  margin: 0 0 3.25em;
}
.password-page .input-group--floating-top {
  height: 3.5em;
  border: 2px solid var(--google-blue);
  border-radius: 4px;
  padding: .65em .75em;
  margin: 0;
}
.password-page .input-group--floating-top label {
  top: -.65em;
  left: .6em;
  padding: 0 .5em;
  font-size: .75em;
  line-height: 1.3;
}
.password-page .input-group--floating-top input {
  height: 100%;
  padding: 0;
  font: inherit;
}
.password-page .checkbox-row {
  margin-top: .7em;
  gap: 1.2em;
  font-size: .9375em;
  line-height: 1.4;
}
.password-page .checkbox-row input {
  appearance: none;
  display: grid;
  place-content: center;
  width: 1.2em;
  height: 1.2em;
  margin: 0 0 0 .2em;
  border: 2px solid var(--text-secondary);
  border-radius: 2px;
  font: inherit;
  flex-shrink: 0;
}
.password-page .checkbox-row input:checked { background: var(--google-blue); border-color: var(--google-blue); }
.password-page .checkbox-row input:checked::after {
  content: '';
  width: .6em;
  height: .3em;
  border-left: 2px solid #062e6f;
  border-bottom: 2px solid #062e6f;
  transform: translateY(-.1em) rotate(-45deg);
}
.password-page .checkbox-row input:focus-visible { outline: 2px solid var(--google-blue); outline-offset: 4px; }
.password-page .oauth-consent { margin-top: 3em; font-size: .9375em; }
.password-page .oauth-bottom-actions {
  padding: 0;
  margin-top: 2.65em;
  gap: 2.5em;
  font-size: .9375em;
}
.password-page .btn-primary {
  min-width: 5.25em;
  min-height: 2.65em;
  padding: .65em 1.5em;
  border-radius: 2em;
  background: #aec6f5;
  font: inherit;
  font-weight: 500;
}
.password-page .btn-primary:hover { background: #bfd3fa; }
.password-page .error-text { font-size: .8125em; }
@media (max-width: 600px) {
  .password-page .picker-layout { transform: none; }
  .password-page .oauth-card { min-height: 0; }
  .password-page .verify-text { margin-bottom: 2.5em; }
  .password-page .oauth-consent { margin-top: 2.5em; }
  .password-page .oauth-bottom-actions { justify-content: space-between; gap: 1em; }
}

/* Add-account reference: Canva identity and email form. */
.add-account-page .picker-layout { transform: translateY(-1.1vh); }
.add-account-page .oauth-card { min-height: 25em; }
.add-account-page .oauth-body { padding-bottom: 2.25em; }
.add-account-page .canva-logo {
  height: 2.7em;
  margin-bottom: 1.62em;
}
.add-account-page .oauth-title { letter-spacing: 0; margin-bottom: .4em; }
.add-account-page .lang-select { width: 14em; }
.add-account-page .oauth-right { padding-top: 1.6em; }
.add-account-page .input-group--floating-top {
  height: 3.5em;
  padding: .65em .75em;
  margin: 0 0 .55em;
  border: 2px solid var(--google-blue);
  border-radius: 4px;
}
.add-account-page .input-group--floating-top label {
  top: -.65em;
  left: .6em;
  padding: 0 .5em;
  font-size: .75em;
  line-height: 1.3;
}
.add-account-page .input-group--floating-top input {
  height: 100%;
  padding: 0;
  font: inherit;
}
.add-account-page .oauth-form > .link { font-size: .9375em; line-height: 1.4; }
.add-account-page .oauth-consent { margin-top: 2.85em; font-size: .9375em; }
.add-account-page .oauth-bottom-actions {
  padding: 0;
  margin-top: 2.65em;
  gap: 2.65em;
  font-size: .9375em;
}
.add-account-page .btn-primary {
  min-width: 5.25em;
  min-height: 2.65em;
  padding: .65em 1.5em;
  border-radius: 2em;
  background: #aec6f5;
  font: inherit;
  font-weight: 500;
}
.add-account-page .btn-primary:hover { background: #bfd3fa; }
@media (max-width: 900px) {
  .add-account-page .picker-layout { transform: none; }
}
@media (max-width: 600px) {
  .add-account-page .oauth-card { min-height: 0; }
  .add-account-page .oauth-right { padding-top: .5em; }
  .add-account-page .oauth-consent { margin-top: 2.5em; }
  .add-account-page .oauth-bottom-actions { justify-content: space-between; gap: 1em; }
}
