:root {
  --account-blue: #2869d8;
  --account-border: #d7e0ec;
}
.mtg-brand-block { min-width: 0; }
.mtg-brand-block .mtg-account-tools { margin: 5px 0 0 52px; }
.mtg-brand-block .mtg-account-link { border: 0; padding: 0; font-size: 11px; color: #64748b; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.mtg-account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: 600 13px system-ui;
  text-decoration: none;
  border: 1px solid #8998ad66;
  border-radius: 20px;
  padding: 8px 14px;
  white-space: nowrap;
}
.mtg-account-link:hover {
  background: #7aa6ed22;
}
.mtg-account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mtg-account-icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mtg-account-link[aria-expanded="true"] { background: #7aa6ed22; }
.mtg-account-menu {
  position: fixed;
  z-index: 100001;
  box-sizing: border-box;
  width: 218px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  color: #172b48;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  box-shadow: 0 12px 32px #172b4824, 0 2px 6px #172b4808;
  font: 13px/1.5 "Segoe UI", system-ui, sans-serif;
  text-align: left;
  user-select: none;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity .16s ease, transform .2s cubic-bezier(.22, 1, .36, 1);
}
.mtg-account-menu[hidden] { display: none; }
.mtg-account-menu.is-open { opacity: 1; transform: none; }
.mtg-account-menu .mtg-account-menu-item {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.mtg-account-menu .mtg-account-menu-item:not(:disabled):is(:hover, :focus-visible) { outline: none; background: #edf3fd; color: #2869d8; }
.mtg-account-menu .mtg-account-menu-item:disabled { opacity: .5; cursor: default; }
.mtg-account-menu .mtg-account-menu-logout { border-top: 1px solid #e8edf4; border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 4px; }
.mtg-account-menu-error { margin: 6px 12px 8px; color: #9d291e; font-size: 12px; }
.mtg-account-menu-error[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .mtg-account-menu, .mtg-account-menu-item { transition: none !important; }
}
.mtg-account-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}
.mtg-sync {
  position: fixed;
  z-index: 100000;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 680px);
  padding: 10px 16px;
  background: #182535;
  color: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px #0004;
  display: flex;
  gap: 12px;
  align-items: center;
  font: 14px system-ui;
}
.mtg-sync[hidden] {
  display: none;
}
.mtg-sync button,
.mtg-sync a {
  border: 0;
  border-radius: 7px;
  background: #eaf0fa;
  color: #15396e;
  padding: 6px 10px;
  white-space: nowrap;
}
.account-page {
  margin: 0;
  background: #f1f5fa;
  color: #1c2a3d;
  font: 16px/1.5 system-ui;
  min-height: 100vh;
}
.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 5vw;
  background: white;
  border-bottom: 1px solid var(--account-border);
}
.account-brand {
  text-decoration: none;
  color: #20314a;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.account-main {
  max-width: 960px;
  margin: 48px auto;
  padding: 0 24px;
}
.account-main.auth {
  max-width: 440px;
}
.account-card {
  border: 1px solid var(--account-border);
  background: white;
  border-radius: 18px;
  padding: 28px;
  margin: 20px 0;
  box-shadow: 0 8px 30px #20457808;
}
.account-card h1,
.account-card h2 {
  margin: 0 0 12px;
  line-height: 1.2;
}
.account-card h1 {
  font-size: 30px;
}
.account-card h2 {
  font-size: 21px;
}
.account-card p {
  color: #526179;
}
.account-form {
  display: grid;
  gap: 18px;
}
.account-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.account-form input:not([type="checkbox"]),
.account-form select {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #bfcbdc;
  border-radius: 9px;
  padding: 12px;
  font: inherit;
  color: inherit;
  background: #fff;
}
.account-form input:focus {
  outline: 2px solid #759fe8;
  outline-offset: 2px;
}
.account-form .check {
  display: flex;
  gap: 9px;
  align-items: center;
}
.account-form button,
.account-button {
  cursor: pointer;
  background: var(--account-blue);
  color: white;
  border: 0;
  border-radius: 9px;
  padding: 12px 18px;
  font: 600 14px system-ui;
}
.account-button.secondary {
  background: #e8eef8;
  color: #224d84;
}
.account-button.danger {
  background: #fff0ef;
  color: #a21c18;
}
.account-button:disabled,
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.account-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.account-tabs button {
  border: 0;
  padding: 10px 14px;
  background: #e6edf8;
  color: #27466e;
  border-radius: 8px;
  cursor: pointer;
}
.account-tabs [aria-selected="true"] {
  background: #2869d8;
  color: white;
}
.account-status {
  min-height: 24px;
  white-space: pre-wrap;
  color: #9d291e !important;
}
.account-status.success {
  color: #24663c !important;
}
.account-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.account-table td,
.account-table th {
  border-bottom: 1px solid #e1e7f0;
  padding: 12px 8px;
  overflow-wrap: anywhere;
}
.account-table .account-button {
  padding: 7px 10px;
  margin: 2px;
}
.account-scroll {
  overflow: auto;
}
.mtg-image-url-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin: 8px 0;
  background: #eef3fa;
  border-radius: 10px;
  color: #172a44;
}
.mtg-image-url-form label {
  display: grid;
  gap: 5px;
  font: 14px system-ui;
}
.mtg-image-url-form input {
  padding: 9px;
  border: 1px solid #bccce3;
  border-radius: 6px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.mtg-image-url-form button {
  padding: 10px;
  border: 0;
  background: #2b69d8;
  color: white;
  border-radius: 8px;
  cursor: pointer;
}
.mtg-image-url-form p {
  margin: 0;
  font: 13px system-ui;
}
.mtg-image-url-form[hidden] {
  display: none;
}
.mtg-account-tools [hidden] {
  display: none;
}
@media (max-width: 650px) {
  .account-main {
    margin-top: 24px;
    padding: 0 14px;
  }
  .account-card {
    padding: 20px;
  }
  .account-header {
    padding: 16px;
  }
  .masthead-note {
    display: none;
  }
  .mtg-account-link {
    font-size: 12px;
    padding: 7px 10px;
  }
}

.account-form[hidden],
.account-page [hidden] {
  display: none !important;
}
