:root {
  --page: #f4f7fa;
  --surface: #ffffff;
  --surface-soft: #edf2f7;
  --surface-strong: #e3eaf2;
  --text: #14253a;
  --muted: #506278;
  --line: #c7d1dd;
  --line-strong: #aab8c8;
  --navy: #071a34;
  --navy-raised: #0b294b;
  --accent: #b98d18;
  --accent-text: #174b72;
  --accent-hover: #98700d;
  --accent-soft: #f5ecd3;
  --danger: #a9343a;
  --success: #24775a;
  --focus: #2d74bb;
  --shadow: 0 18px 50px rgba(7, 26, 52, 0.12);
  color-scheme: light;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --page: #051222;
  --surface: #0b213c;
  --surface-soft: #102a49;
  --surface-strong: #173657;
  --text: #f5f8fc;
  --muted: #c1cddd;
  --line: #294463;
  --line-strong: #3b5b7d;
  --navy: #04101f;
  --navy-raised: #12345a;
  --accent: #d4ad4f;
  --accent-text: #f0cd76;
  --accent-hover: #e4c16e;
  --accent-soft: #3c321b;
  --danger: #ef8d92;
  --success: #74d1ad;
  --focus: #75b7f2;
  --shadow: 0 22px 56px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--page);
  font-size: 16px;
  line-height: 1.6;
  transition: color 180ms ease, background-color 180ms ease;
  touch-action: auto;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  background: color-mix(in srgb, var(--page) 91%, transparent);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  min-height: 44px;
  padding: 0.6rem 1rem;
  color: #fff;
  background: var(--navy);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  padding-top: env(safe-area-inset-top, 0);
  color: #fff;
  background: rgba(7, 26, 52, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px) saturate(140%);
}

.header-inner {
  width: min(1180px, calc(100% - 2.5rem));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: clamp(174px, 20vw, 220px);
  height: auto;
  flex: 0 0 auto;
  display: block;
}

.brand-division {
  padding-left: 0.85rem;
  color: #d5dfeb;
  border-left: 1px solid rgba(255, 255, 255, 0.26);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  line-height: 1.45;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.icon-button,
.utility-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.icon-button {
  padding: 0;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

:root[data-theme="light"] .sun-icon,
:root[data-theme="dark"] .moon-icon {
  display: none;
}

.utility-button {
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 750;
}

.icon-button:hover,
.utility-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.workspace-heading .utility-button,
.security-dialog .utility-button {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.workspace-heading .utility-button:hover:not(:disabled),
.security-dialog .utility-button:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--accent-text);
}

.workspace-heading .utility-button:disabled,
.security-dialog .utility-button:disabled {
  color: var(--muted);
  background: var(--surface-soft);
  border-color: var(--line);
  opacity: 1;
  cursor: not-allowed;
}

.account-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-right: 0.25rem;
}

.account-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
}

.account-chip strong,
.account-chip small {
  display: block;
  white-space: nowrap;
}

.account-chip strong {
  max-width: 10rem;
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
}

.account-chip small {
  color: #b9c7d8;
  font-size: 0.72rem;
}

.connection-notice,
.update-notice {
  z-index: 40;
  min-height: 44px;
  padding: 0.55rem max(1.25rem, calc((100% - 1180px) / 2));
  color: #fff;
  background: #7b2429;
  font-size: 0.88rem;
  text-align: center;
}

.update-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--navy-raised);
}

.update-notice button {
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  border: 0;
  border-radius: 7px;
  color: #071a34;
  background: #e0bb60;
  font-weight: 800;
  cursor: pointer;
}

.portal-main {
  width: 100%;
  flex: 1;
}

.security-dialog {
  width: min(36rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}
.security-dialog::backdrop { background: rgba(3, 14, 28, 0.65); }
.security-dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.security-dialog h2 { margin: 0; font-size: 1.4rem; }
.security-dialog p { color: var(--muted); line-height: 1.7; }
.security-factor-list { display: grid; gap: 0.75rem; margin: 1.25rem 0; padding: 0; list-style: none; }
.security-factor-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 0.5rem; }
.security-factor-list small { display: block; color: var(--muted); }
.security-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.security-actions button { flex: 1 1 12rem; }
.security-confirmation { margin: 1rem 0; padding: 1rem; border: 1px solid var(--danger); border-radius: 0.5rem; }
.security-confirmation h3 { margin: 0; font-size: 1rem; }

.auth-shell {
  min-height: calc(100vh - 72px - 68px);
  padding: clamp(2rem, 7vh, 5.5rem) 1.25rem 3rem;
  display: grid;
  place-items: start center;
}

.auth-card {
  width: min(100%, 440px);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.auth-heading {
  text-align: left;
}

.auth-heading p,
.enrollment-guide,
.auth-help {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

.auth-heading p { margin: 0.65rem 0 0; }
.enrollment-guide { margin-bottom: 1.25rem; }
.enrollment-guide p { margin: 0; }
.enrollment-guide ol { margin: 0.65rem 0 0; padding-left: 1.4rem; }
.enrollment-guide li + li { margin-top: 0.3rem; }
.auth-help { margin-top: 1rem; border-top: 1px solid var(--line); }
.auth-help summary { min-height: 44px; padding-top: 0.8rem; color: var(--accent-text); cursor: pointer; }
.auth-help p { margin: 0.6rem 0 0; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.auth-heading h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.auth-tabs {
  margin: 1.6rem 0 1.35rem;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.auth-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button[aria-selected="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(7, 26, 52, 0.09);
}

.auth-panel {
  animation: panel-in 180ms ease-out;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  border-radius: 8px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 100ms ease-out, background-color 160ms ease, border-color 160ms ease;
}

.primary-action {
  border: 1px solid var(--navy-raised);
  color: #fff;
  background: var(--navy-raised);
}

.primary-action:hover {
  background: #16426f;
  border-color: #16426f;
}

.secondary-action {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--surface);
}

.secondary-action:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.primary-action:active,
.secondary-action:active {
  transform: scale(0.985);
}

.primary-action:disabled,
.secondary-action:disabled {
  opacity: 0.6;
  cursor: wait;
}

.biometric-action svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cross-device-action {
  margin-top: 0.8rem;
}

.auth-divider {
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.alternate-login {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.alternate-login summary {
  min-height: 48px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.alternate-login summary::-webkit-details-marker {
  display: none;
}

.alternate-login[open] summary {
  border-bottom: 1px solid var(--line);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.compact-form {
  padding: 1rem;
}

.auth-form label,
.verify-code-form label {
  display: grid;
  gap: 0.4rem;
}

.auth-form label > span,
.verify-code-form label > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.auth-form input,
.verify-code-form input {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.auth-form input:focus,
.verify-code-form input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}

.code-input {
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem !important;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-align: center;
}

.enrollment-panel {
  display: grid;
  gap: 0.8rem;
}

.verified-account {
  min-height: 44px;
  margin-bottom: 0.2rem;
  padding: 0.6rem 0.8rem;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
}

.verified-account strong {
  overflow: hidden;
  color: var(--text);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.success-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.qr-panel {
  margin-top: 0.3rem;
  padding: 1rem;
  display: grid;
  gap: 1rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-code {
  width: min(100%, 248px);
  margin: 0 auto;
  padding: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d5dde7;
  border-radius: 8px;
}

.qr-code svg {
  width: 100%;
  height: auto;
}

.verify-code-form {
  display: grid;
  gap: 0.8rem;
}

.form-status {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.form-status.is-error {
  color: var(--danger);
}

.form-status.is-success {
  color: var(--success);
}

.workspace {
  width: 100%;
  padding: 0 0 4.5rem;
}

.workspace-hero {
  padding: 1.25rem max(1.25rem, calc((100% - 1240px) / 2));
  color: #fff;
  background: var(--navy);
  border-bottom: 1px solid color-mix(in srgb, var(--navy-raised) 70%, #fff);
}

.workspace-hero-inner {
  width: min(1240px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.workspace-hero h1 {
  margin: 0.45rem 0 0;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.workspace-summary {
  max-width: 44rem;
  margin: 0.85rem 0 0;
  color: #c7d4e3;
  font-size: 0.98rem;
}

.workspace-index {
  min-width: 210px;
  padding: 0.25rem 0 0.25rem 2rem;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.tool-count {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  color: #c9d7e7;
}

.tool-count strong {
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 3.65rem;
  line-height: 1;
}

.tool-count span {
  font-size: 0.88rem;
  font-weight: 700;
}

.permission-state {
  margin: 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #b6c6d9;
  font-size: 0.78rem;
  font-weight: 700;
}

.permission-state svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.workspace-tools {
  width: min(1240px, calc(100% - 3rem));
  margin: 0 auto;
  padding-top: 1.5rem;
}

.workspace-status {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-radius: 8px;
}

.workspace-heading {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.workspace-heading h2 {
  margin: 0.28rem 0 0;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: 1.125rem;
  line-height: 1.25;
}

.access-note {
  margin: 0 0 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.access-note svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--accent-text);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.tool-card {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(7, 26, 52, 0.075);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tool-card::before {
  content: "";
  display: block;
  width: 100%;
  height: 3px;
  background: color-mix(in srgb, var(--accent) 72%, var(--navy));
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.tool-card-link {
  min-height: 190px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.tool-card-link[aria-disabled="true"] {
  opacity: 0.56;
  cursor: not-allowed;
}

.tool-card-link[aria-busy="true"] {
  opacity: 0.68;
  pointer-events: none;
}

.tool-main {
  margin-top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
}

.tool-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--navy-raised);
  border-radius: 9px;
}

.tool-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.tool-card h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.25;
}

.tool-purpose {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.tool-link {
  min-height: 44px;
  margin-top: auto;
  padding-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--accent-text);
  font-size: 0.86rem;
  font-weight: 850;
}

.tool-link svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.site-footer {
  min-height: 68px;
  padding: 1rem max(1.25rem, calc((100% - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #9eafc4;
  background: var(--navy);
  border-top: 3px solid #b2292e;
  font-size: 0.8rem;
}

.site-footer strong {
  color: #fff;
}

.install-dialog {
  width: min(420px, calc(100% - 2rem));
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 28px 78px rgba(0, 0, 0, 0.38);
}

.install-dialog::backdrop {
  background: rgba(3, 12, 24, 0.75);
  backdrop-filter: blur(4px);
}

.install-dialog > div {
  padding: 1.5rem;
}

.install-dialog h2 {
  margin: 0;
}

.install-dialog ol {
  margin: 1rem 0;
  padding-left: 1.35rem;
}

.install-dialog button {
  min-height: 44px;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 8px;
  color: #071a34;
  background: #d4ad4f;
  font-weight: 800;
  cursor: pointer;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .header-inner,
  .workspace-tools {
    width: min(100% - 2rem, 1240px);
  }

  .account-chip span:not(.account-avatar) {
    display: none;
  }

  .workspace-hero {
    min-height: 0;
    padding: 1.25rem 1rem;
  }

  .workspace-hero-inner {
    min-height: 0;
    gap: 2rem;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .header-inner {
    min-height: 66px;
    gap: 0.65rem;
  }

  .brand-lockup {
    gap: 0;
  }

  .brand-logo {
    width: 174px;
  }

  .brand-division {
    display: none;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .account-chip {
    display: none;
  }

  .utility-button[data-install-app] {
    display: none !important;
  }

  .auth-shell {
    min-height: calc(100vh - 66px - 68px);
    padding: 1.25rem 0.75rem 2rem;
  }

  .auth-card {
    padding: 1.25rem;
    border-radius: 10px;
  }

  .workspace {
    padding: 0 0 2.5rem;
  }

  .workspace-hero-inner {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 1.35rem;
  }

  .workspace-hero h1 {
    font-size: 1.65rem;
  }

  .workspace-summary {
    margin-top: 0.65rem;
    font-size: 0.9rem;
  }

  .workspace-index {
    width: 100%;
    min-width: 0;
    padding: 1rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 0;
  }

  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .tool-count strong {
    font-size: 2.25rem;
  }

  .tool-card-link {
    min-height: 0;
    padding: 1.2rem;
  }

  .tool-main {
    margin-top: 0;
  }

  .tool-icon {
    width: 52px;
    height: 52px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }
}

@media (max-width: 360px) {
  .workspace-tools {
    width: min(100% - 1.25rem, 1180px);
  }
}

@media (display-mode: standalone) {
  [data-install-app] {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .auth-card {
    backdrop-filter: none;
  }

  .auth-card {
    background: var(--surface);
  }
}

@media (prefers-contrast: more) {
  .auth-card,
  .tool-card,
  .alternate-login,
  input {
    border-color: currentColor;
  }
}

/* Installed-app login uses the available viewport, not estimated header heights. */
html[data-app-login],
html[data-app-login] body {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--navy);
}
/* iOS may paint outside the DOM viewport using the page's background. */
html[data-app-login] body::before { display: none; }
html[data-app-login] body {
  height: 100vh;
  height: 100dvh;
}
[data-app-login] .site-header { flex: 0 0 auto; }
[data-app-login] .site-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 0;
  padding: .35rem 1rem;
  gap: .5rem;
  border-top-width: 2px;
  font-size: .7rem;
  line-height: 1.4;
  white-space: nowrap;
}
[data-app-login] .portal-main {
  min-height: 0;
  background: var(--page);
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
[data-app-login] .auth-shell {
  min-height: 100%;
  padding: 1rem max(.75rem, env(safe-area-inset-right)) 0 max(.75rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}
[data-app-login] .auth-card { flex: 0 0 auto; margin: auto; }
