:root {
  color-scheme: light;
  --surface-bg: #f7f6f1;
  --surface-panel: #fffefb;
  --text: #172033;
  --muted: #7b8496;
  --line: #dcd4c5;
  --line-strong: #c8bda9;
  --primary: #6256e8;
  --primary-hover: #5448d8;
  --primary-disabled: #a79cef;
  --primary-shadow: rgba(98, 86, 232, 0.22);
  --primary-focus-ring: rgba(98, 86, 232, 0.16);
  --copy-bg: #fff4d8;
  --copy-bg-hover: #ffedc0;
  --copy-line: #d9b456;
  --copy-text: #4f370d;
  --warning-bg: #ffe27a;
  --warning-line: #ff8a00;
  --warning-text: #261600;
  --success: #16865e;
  --success-bg: #e5f7ec;
  --success-line: #b8e6cd;
  --danger: #d94a65;
  --danger-bg: #fff1f4;
  --danger-line: #f3bbc6;
  --shadow: 0 24px 58px rgba(88, 79, 59, 0.13);
  --toast-active: 1.4s;
  --toast-enter: 180ms;
  --toast-exit: 400ms;
  --toast-ring: 620ms;
  --toast-fill: 100ms;
  --toast-check: 280ms;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background-color: var(--surface-bg);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 216, 112, 0.44), transparent 30%),
    radial-gradient(circle at 86% 8%, rgba(196, 187, 255, 0.48), transparent 34%),
    linear-gradient(135deg, #fff4cf 0%, #f8f6ee 50%, #eef1ff 100%);
  overflow-x: hidden;
}

[v-cloak] {
  display: none;
}

.page {
  width: min(100% - 28px, 982px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-panel);
  box-shadow: var(--shadow);
}

.login {
  width: min(100%, 420px);
  padding: 32px 30px;
}

.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 156px;
  height: 156px;
  overflow: visible;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #ffd98f 0%, #bcb1ff 100%);
  padding: 5px;
  box-shadow: none;
}

.login-logo img {
  width: 146px;
  height: 146px;
  border: 3px solid var(--surface-panel);
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* 密码输入框:左锁图标 + 右显隐切换 */
.field {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: #8b83e0;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login .field input {
  min-height: 52px;
  padding: 0 46px 0 44px;
}

.field-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease-out, background 160ms ease-out;
}

.field-toggle:hover {
  color: var(--text);
  background: rgba(23, 32, 51, 0.06);
}

.field-toggle:focus-visible {
  outline: none;
  color: var(--text);
  box-shadow: 0 0 0 3px var(--primary-focus-ring);
}

.field-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 登录面板入场(prefers-reduced-motion 全局收敛) */
.login {
  animation: login-rise 420ms ease-out both;
}

@keyframes login-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font: inherit;
  outline: none;
}

input::placeholder {
  color: var(--muted);
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus-ring);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 180ms ease-out, border-color 180ms ease-out, box-shadow 180ms ease-out, color 180ms ease-out;
}

/* 按钮内联图标(导入/复制),随文字色 */
.btn-ico {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button.primary {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 8px 16px var(--primary-shadow);
}

.button.primary:hover,
.button.primary:focus {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  box-shadow: 0 10px 20px rgba(108, 92, 231, 0.28);
}

.button.secondary {
  color: var(--copy-text);
  border-color: var(--copy-line);
  background: var(--copy-bg);
  box-shadow: 0 7px 15px rgba(95, 69, 19, 0.09);
}

.button.secondary:hover,
.button.secondary:focus {
  color: var(--text);
  border-color: #d9a940;
  background: var(--copy-bg-hover);
  box-shadow: 0 9px 18px rgba(95, 69, 19, 0.13);
}

.button:disabled {
  cursor: not-allowed;
  color: #fff;
  border-color: var(--primary-disabled);
  background: var(--primary-disabled);
  box-shadow: none;
}

/* 统一键盘聚焦环(无障碍) */
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-focus-ring);
}

.button.secondary:focus-visible {
  box-shadow: 0 0 0 3px rgba(217, 160, 60, 0.28);
}

.login .button {
  width: 100%;
  min-height: 52px;
  margin-top: 22px;
  border-radius: 14px;
}

.error-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--danger-line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-bg);
  box-shadow: 0 10px 22px rgba(217, 74, 101, 0.1);
  font-size: 14px;
  font-weight: 700;
}

.error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: 14px;
  font-weight: 900;
}

.client-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 52px;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 38px;
}

.page-warning {
  grid-column: 1 / -1;
  justify-self: center;
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  color: var(--warning-text);
  background: var(--surface-panel);
  box-shadow: 0 14px 30px rgba(88, 79, 59, 0.1);
}

.page-warning-badge {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--warning-text);
  background: linear-gradient(135deg, var(--warning-bg), var(--warning-line));
  box-shadow: 0 6px 14px rgba(255, 138, 0, 0.3);
}

.page-warning-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-warning-text {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--warning-text);
}

.logout {
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  padding: 0 14px;
  color: var(--danger);
  background: var(--danger-bg);
  box-shadow: 0 8px 20px rgba(229, 72, 98, 0.08);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.logout:hover,
.logout:focus {
  background: #ffe6ec;
  box-shadow: 0 10px 24px rgba(244, 63, 94, 0.14);
}

.logout:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 74, 101, 0.22);
}

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: min(100% - 48px, 360px);
  overflow: hidden;
  transform: translate(-50%, 0);
  border: 1px solid var(--success-line);
  border-radius: 15px;
  color: var(--success);
  background: var(--surface-panel);
  box-shadow: 0 16px 34px rgba(22, 134, 94, 0.18);
  animation: toast-enter var(--toast-enter) ease-out both;
}

.toast.is-leaving {
  animation: toast-exit var(--toast-exit) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  background: var(--success-bg);
  transform: scaleX(0);
  transform-origin: left center;
  animation: toast-progress var(--toast-active) linear forwards;
}

.toast-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 900;
}

.toast-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: #fff;
}

.toast-svg {
  width: 32px;
  height: 32px;
  overflow: visible;
  display: block;
}

.toast-ring {
  fill: transparent;
  stroke: var(--success);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform: rotate(-90deg);
  transform-origin: 16px 16px;
  animation: toast-ring-draw var(--toast-ring) linear 80ms forwards;
}

.toast-fill-circle {
  fill: var(--success);
  opacity: 0;
  transform: scale(0.55);
  transform-origin: 16px 16px;
  animation: toast-circle-fill var(--toast-fill) ease-out 760ms forwards;
}

.toast-check-path {
  fill: none;
  opacity: 0;
  stroke: #fff;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: toast-check-draw var(--toast-check) cubic-bezier(0.45, 0, 0.2, 1) 840ms forwards;
}

.toast-message {
  min-width: 0;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

@keyframes toast-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes toast-ring-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes toast-circle-fill {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toast-check-draw {
  0%,
  6% {
    opacity: 0;
    stroke-dashoffset: 1;
  }
  7% {
    opacity: 1;
    stroke-dashoffset: 0.93;
  }
  to {
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

.client {
  position: relative;
  isolation: isolate;
  min-height: 268px;
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  contain: layout;
  will-change: transform;
  transition: transform 180ms ease-out, border-color 180ms ease-out;
  animation: card-rise 480ms ease-out backwards;
}

.client::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 30px 70px rgba(88, 79, 59, 0.18);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
  transition: opacity 180ms ease-out;
}

/* 卡片错落入场(受全局 prefers-reduced-motion 收敛) */
.client:nth-of-type(1) { animation-delay: 0ms; }
.client:nth-of-type(2) { animation-delay: 70ms; }
.client:nth-of-type(3) { animation-delay: 140ms; }
.client:nth-of-type(4) { animation-delay: 210ms; }

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.client:hover,
.client:focus-within {
  transform: translateY(-3px);
  border-color: #c3b9f2;
}

.client:hover::after,
.client:focus-within::after {
  opacity: 1;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 174px;
  min-height: 204px;
}

.icon-wrap {
  width: 174px;
  height: 174px;
  will-change: transform;
  transition: transform 220ms ease-out;
}

/* 实心图标用贴合形状的 box-shadow 替代 iOS 滚动时不稳的 filter: drop-shadow;
   投影按 border-radius 勾勒 border-box,与图标自身 alpha 形状对齐 */
.icon-wrap.shape-square,
.icon-wrap.shape-circle {
  box-shadow:
    0 15px 24px rgba(87, 74, 52, 0.2),
    0 3px 8px rgba(87, 74, 52, 0.14),
    0 0 1px rgba(88, 79, 59, 0.42);
}

.icon-wrap.shape-square {
  border-radius: 18%;
}

.icon-wrap.shape-circle {
  border-radius: 50%;
}

.client:hover .icon-wrap {
  transform: translateY(-2px) scale(1.03);
}

.icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.client-content {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 24px;
  align-items: stretch;
  justify-items: center;
}

.client-title {
  min-width: 0;
  width: min(100%, 400px);
  display: flex;
  align-items: flex-start;
}

.client h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.24;
  letter-spacing: 0;
  color: var(--text);
}

.actions {
  width: min(100%, 400px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.actions .button {
  min-height: 54px;
  border-radius: 15px;
}

.shadowrocket-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shadowrocket-secondary-actions .button.secondary {
  min-width: 0;
  gap: 5px;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.shadowrocket-secondary-actions .button.secondary .btn-ico {
  width: 16px;
  height: 16px;
}

@media (max-width: 599px) {
  .page {
    width: min(100% - 24px, 520px);
    padding: 24px 0;
  }

  .login {
    padding: 32px 30px;
  }

  .login-logo {
    width: 150px;
    height: 150px;
  }

  .login-logo img {
    width: 140px;
    height: 140px;
  }

  .client-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .topbar {
    justify-content: flex-end;
    min-height: 34px;
  }

  .page-warning {
    justify-self: stretch;
    width: auto;
    gap: 12px;
    padding: 12px 16px;
  }

  .page-warning-badge {
    width: 40px;
    height: 40px;
  }

  .page-warning-icon {
    width: 22px;
    height: 22px;
  }

  .client {
    --client-logo-size: clamp(112px, 36vw, 160px);
    min-height: auto;
    grid-template-columns: var(--client-logo-size) minmax(0, 1fr);
    gap: 16px;
    padding: 24px 18px;
  }

  .brand-icon {
    width: var(--client-logo-size);
    min-height: auto;
    align-items: flex-end;
  }

  .icon-wrap {
    width: var(--client-logo-size);
    height: var(--client-logo-size);
  }

  .client-content {
    justify-items: stretch;
    align-content: end;
    gap: 16px;
  }

  .client h2 {
    font-size: 20px;
  }

  .client-title {
    width: 100%;
  }

  .actions {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .button {
    min-height: 48px;
    padding: 0 12px;
    font-size: 13px;
  }

  .actions .button {
    min-height: 48px;
  }

  .shadowrocket-secondary-actions {
    gap: 11px;
  }

  .shadowrocket-secondary-actions .button.secondary {
    gap: 2px;
    padding: 0 4px;
    font-size: 13px;
  }

  .shadowrocket-secondary-actions .button.secondary .btn-ico {
    width: 13px;
    height: 13px;
  }
}

@media (min-width: 600px) and (max-width: 959px) {
  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
  }

  .client {
    --client-logo-size: clamp(118px, 16vw, 156px);
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 26px 22px;
    justify-items: center;
  }

  .brand-icon {
    width: 100%;
    min-height: auto;
    align-items: center;
  }

  .icon-wrap {
    width: var(--client-logo-size);
    height: var(--client-logo-size);
  }

  .client-content {
    width: 100%;
    justify-items: stretch;
    align-content: start;
    gap: 18px;
  }

  .client-title {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .actions {
    width: 100%;
  }
}

@media (max-width: 389px) {
  .shadowrocket-secondary-actions .button.secondary {
    padding: 0 4px;
  }

  .shadowrocket-secondary-actions .button.secondary .btn-ico {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .toast {
    transform: translateX(-50%);
  }
}
