/* Scoped to the account dialog — Storybook Gift Edition
 * (Side-by-Side Google + Email Sign-In & Rich Personal Center) */
dialog:has(.account-ui--split) {
  width: min(690px, 94vw);
  max-width: 94vw;
}
dialog:has(.account-ui--member) {
  width: min(520px, 94vw);
  max-width: 94vw;
}
.account-ui {
  color: #2a2132;
  width: 100%;
  min-width: 0;
  font-family: inherit;
}
.account-ui *, .account-ui *::before, .account-ui *::after { box-sizing: border-box; }

.account-heading {
  margin: 0 0 8px;
}
.account-heading .dlg-title {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 31px);
  line-height: 1.18;
  color: #2a2132;
}
.account-note, .account-hint, .auth-pane-hint {
  line-height: 1.55;
  color: #665c6d;
  overflow-wrap: anywhere;
}
.account-intro {
  margin: 0 0 18px;
  font-size: 14.5px;
}
.account-loading {
  padding: 20px 0;
  text-align: center;
}

/* Side-by-Side Two-Option Grid (Google Default Left + Email Code Right) */
.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
.auth-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #9b8d75;
  font-size: 12px;
  font-weight: 700;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  width: 1px;
  background: #e4d4b7;
}
.auth-divider span {
  padding: 6px 2px;
}

.auth-pane {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1.5px solid #e6d6b8;
  background: linear-gradient(180deg, #fffefb, #fbf3e4);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #e6d6b8, 0 8px 20px rgba(72, 44, 18, 0.06);
  min-width: 0;
}
.auth-pane.is-primary {
  border-color: #e2b566;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 58%, #f8ebd0 100%);
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(242, 196, 90, 0.32), 0 3px 0 #dfc288, 0 12px 26px rgba(168, 118, 28, 0.12);
}

.auth-pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.auth-pane-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #e6d8be;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.auth-pane-icon--mail {
  color: #c52642;
  background: #fff5f7;
  border-color: #f3cdd5;
}
.auth-pane-titles {
  flex: 1;
  min-width: 0;
}
.auth-pane-titles strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #2a2132;
  line-height: 1.25;
}
.auth-default-pill {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffeab0, #f4c862);
  color: #593b08;
  font-size: 11px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

/* Google Button Area */
.auth-google-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 62px;
  margin: 4px 0 10px;
}
.account-google {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 44px;
}
.google-placeholder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid #dadce0;
  background: #fff;
  color: #3c4043;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.google-placeholder-btn:hover {
  border-color: #c4c7cc;
  background: #fcfcfc;
  color: #202124;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.09);
}
.account-google-retry {
  appearance: none;
  background: none;
  border: 0;
  color: #9b1c32;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 6px;
}
.account-google-retry[hidden] { display: none !important; }
.auth-pane-hint {
  margin: 0 0 8px;
  font-size: 12px;
  text-align: center;
  color: #74697b;
}
.account-google-redirect {
  margin-top: auto;
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #9b1c32;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.account-google-redirect:hover { color: #e23d58; }

/* Email Form Area */
.account-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.account-form label {
  font-weight: 700;
  font-size: 12.5px;
  color: #665c6d;
}
.account-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1.5px solid #dfd1b6;
  border-radius: 12px;
  padding: 10px 13px;
  background: #fff;
  color: #2a2132;
  font: inherit;
  font-size: 15.5px;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.05);
}
.account-form input:focus {
  outline: none;
  border-color: #a8761c;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(242, 196, 90, 0.35);
}
.account-form input[name="email"] { direction: ltr; text-align: start; }
.account-form input[name="code"] {
  direction: ltr;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .32em;
  padding-inline-start: 16px;
}
.account-sent-banner {
  margin: 0 0 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff6df;
  border: 1px solid #ead39c;
  color: #5c3e0c;
  font-size: 12.5px;
  line-height: 1.45;
}
.account-hint { margin: 0; font-size: 12px; }
.account-submit {
  margin-top: auto;
  min-height: 45px;
  font-size: 14.5px;
}

/* Shared Account Buttons */
.account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  padding: 9px 14px;
  border: 1px solid #9b1c32;
  background: linear-gradient(180deg, #f66b82, #e23d58 55%, #c52642);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 3px 0 #9b1c32;
}
.account-secondary {
  color: #2a2132;
  background: linear-gradient(180deg, #fff, #f2e8d5);
  border-color: #dfd1b6;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #dfd1b6;
}
.account-secondary:hover:not(:disabled) { background: linear-gradient(180deg, #fff, #f8eedb); }
.account-ui button:disabled { cursor: not-allowed; opacity: .55; }
.account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.account-actions > * { flex: 1 1 110px; }

.account-status {
  margin: 12px 0 0;
  color: #1f6d48;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}
.account-status:empty { display: none; }
.account-status.account-error {
  padding: 8px 12px;
  border-radius: 10px;
  background: #ffe8ec;
  border: 1px solid #f3bac5;
  color: #9b1c32;
}

/* Personal Center (Member View) — Storybook Member Card & Rich Tree Cards */
.account-profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  margin-top: 10px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1b2c58 0%, #132146 100%);
  border: 1px solid rgba(242, 196, 90, 0.35);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 27, 56, 0.18);
}
.account-avatar-badge {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 18px/1 var(--display, Georgia, serif);
  color: #3d280a;
  background: linear-gradient(180deg, #ffeab2, #efb948);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.online-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4cd98a;
  border: 2px solid #172750;
}
.account-profile-info {
  flex: 1;
  min-width: 0;
}
.account-profile-info small {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 2px;
}
.account-profile-info strong {
  display: block;
  font-size: 15.5px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-signout-pill {
  flex: none;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.account-signout-pill:hover {
  background: rgba(226, 61, 88, 0.85);
  border-color: #f66b82;
  color: #fff;
}

.account-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 0 11px;
}
.account-section-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #2a2132;
}
.tree-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f2e4c8;
  color: #7a5416;
  font-size: 12px;
  font-weight: 800;
}
.account-new-tree-btn {
  min-height: 36px !important;
  padding: 6px 13px !important;
  font-size: 12.5px !important;
  border-radius: 999px !important;
}

.account-trees {
  display: grid;
  gap: 9px;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding: 2px 1px 4px;
}
.account-tree-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1.5px solid #e6d6b8;
  background: linear-gradient(180deg, #fffefb, #faf1e0);
  color: #2a2132;
  text-decoration: none;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #e6d6b8, 0 6px 14px rgba(72, 44, 18, 0.05);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.account-tree-card:hover {
  transform: translateY(-1.5px);
  border-color: #d8ac62;
  background: linear-gradient(180deg, #fff, #fdf4e3);
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #dfc288, 0 10px 20px rgba(72, 44, 18, 0.09);
}
.account-tree-card.is-current-tree {
  border-color: #e23d58;
  background: linear-gradient(180deg, #fff, #fff0f3);
}
.tree-card-emblem {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #1f6d48, #144930);
  color: #ffe49c;
  box-shadow: 0 3px 8px rgba(20, 73, 48, 0.22);
}
.tree-card-emblem.is-frost {
  background: linear-gradient(145deg, #2b5c84, #173654);
  color: #d8f0ff;
}
.tree-card-emblem.is-gala {
  background: linear-gradient(145deg, #b56572, #7c3b47);
  color: #ffece6;
}
.tree-card-main {
  flex: 1;
  min-width: 0;
}
.tree-card-main strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #2a2132;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-card-main small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: #776b7e;
}
.tree-card-arrow {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3e7d0;
  color: #8c5c10;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.account-tree-card:hover .tree-card-arrow {
  background: #e23d58;
  color: #fff;
}
.account-empty-trees {
  text-align: center;
  padding: 24px 16px;
  border-radius: 16px;
  border: 1.5px dashed #dfd1b6;
  background: rgba(255, 255, 255, 0.55);
}
.account-empty-trees span { font-size: 28px; display: block; margin-bottom: 6px; }
.account-empty-trees p { margin: 0; font-size: 14px; color: #665c6d; }

/* Stack cleanly on phones while keeping Google first & prominent */
@media (max-width: 620px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .auth-divider {
    flex-direction: row;
    padding: 2px 0;
  }
  .auth-divider::before,
  .auth-divider::after {
    width: auto;
    height: 1px;
  }
  .auth-divider span { padding: 0 10px; }
  .auth-pane { padding: 15px 15px 14px; }
  .account-profile-card { flex-wrap: wrap; }
}
